2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using static Interop.MediaVision.Surveillance;
20 namespace Tizen.Multimedia.Vision
23 /// Provides the ability to push the source to surveillance engines.
25 /// <seealso cref="MovementDetector"/>
26 /// <seealso cref="PersonAppearanceDetector"/>
27 /// <seealso cref="PersonRecognizer"/>
28 /// <since_tizen> 3 </since_tizen>
29 public class SurveillanceSource
31 private static int _nextStreamId = int.MinValue;
33 private static int GetNextStreamId()
35 if (_nextStreamId == int.MaxValue)
37 return _nextStreamId = int.MinValue;
39 return _nextStreamId++;
43 /// Initializes a new instance of the <see cref="SurveillanceSource"/> class.
45 /// <since_tizen> 3 </since_tizen>
46 public SurveillanceSource()
48 StreamId = GetNextStreamId();
52 /// Pushes the source to the surveillance system to detect events.
54 /// <param name="source">The media source used for surveillance.</param>
55 /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception>
56 /// <exception cref="ObjectDisposedException"><paramref name="source"/> has already been disposed of.</exception>
57 /// <exception cref="InvalidOperationException">This <see cref="SurveillanceSource"/> has not been added yet.</exception>
58 /// <seealso cref="MovementDetector.AddSource(SurveillanceSource)"/>
59 /// <seealso cref="MovementDetector.AddSource(SurveillanceSource, MovementDetectionConfiguration)"/>
60 /// <seealso cref="PersonAppearanceDetector.AddSource(SurveillanceSource)"/>
61 /// <seealso cref="PersonAppearanceDetector.AddSource(SurveillanceSource, PersonAppearanceDetectionConfiguration)"/>
62 /// <seealso cref="PersonRecognizer.AddSource(SurveillanceSource, PersonRecognitionConfiguration)"/>
63 /// <since_tizen> 3</since_tizen>
64 public void Push(MediaVisionSource source)
68 throw new ArgumentNullException(nameof(source));
71 PushSource(source.Handle, StreamId).Validate("Failed to push source");
74 internal int StreamId { get; }