################################################################################
# SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################

Prequisites:
- DeepStreamSDK 6.1.1
- Python 3.8
- Gst-python

To run the test app:
  $ python3 deepstream-test-rt-src-add-del.py <uri>
e.g.
  $ python3 deepstream_rt_src_add_del.py \
  file:///opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.mp4

This application demonstrates how to:
* Add and delete sources at runtime.
* Use a uridecodebin so that any type of input (e.g. RTSP/File), any GStreamer
  supported container format, and any codec can be used as input.
* Configure the stream-muxer to generate a batch of frames and infer on the
  batch for better resource utilization.
* Configure the tracker (referred to as nvtracker in this sample) using
  config file dstest_tracker_config.txt

Refer to the deepstream-nvdsanalytics sample documentation for a description
of stream-muxer configuration, tracker configuration, and multi-stream tiling.

The sample generates the following pipeline for single source <uri>

uridecodebin -> nvstreammux -> nvinfer -> nvtracker -> nvtiler -> nvvideoconvert
 -> nvdsosd -> displaysink

For reference, here are the config files used for this sample:
1. Primary inference engine: dstest_pgie_config.txt
2. First secondary inference engine: dstest_sgie1_config.txt
3. Second secondary inference engine: dstest_sgie2_config.txt
4. Third secondary inference engine: dstest_sgie3_config.txt

At runtime, after a timeout, a source will be added periodically. All the components 
are reconfigured during addition/deletion. After reaching of `MAX_NUM_SOURCES`, 
a random source is deleted periodically until a single source is present in the
pipeline. The app exits when End of Stream is reached for the final source or if
the last source is deleted.





