summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorVaL Doroshchuk <valentyn.doroshchuk@qt.io>2019-01-22 13:52:55 +0100
committerVaL Doroshchuk <valbok@gmail.com>2019-01-25 22:20:49 +0100
commit9f03ade11f2cef7d434a3e6aba77994a798b86fe (patch)
tree69fa5febb435cdb38b2e3ab66643cbc8afb61cbb /sys
parent52e4a20b4e9bfbe92390dcbb69cf124d2564f91e (diff)
downloadgstreamer-plugins-bad-9f03ade11f2cef7d434a3e6aba77994a798b86fe.tar.gz
avfvideosrc: add device-name property
This property is readonly and should show the name of selected capture device.
Diffstat (limited to 'sys')
-rw-r--r--sys/applemedia/avfvideosrc.m16
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/applemedia/avfvideosrc.m b/sys/applemedia/avfvideosrc.m
index 88b64acc5..349429131 100644
--- a/sys/applemedia/avfvideosrc.m
+++ b/sys/applemedia/avfvideosrc.m
@@ -159,6 +159,7 @@ gst_avf_video_source_device_type_get_type (void)
GstPushSrc *pushSrc;
gint deviceIndex;
+ const gchar *deviceName;
GstAVFVideoSourcePosition position;
GstAVFVideoSourceOrientation orientation;
GstAVFVideoSourceDeviceType deviceType;
@@ -200,6 +201,7 @@ gst_avf_video_source_device_type_get_type (void)
- (void)finalize;
@property int deviceIndex;
+@property const gchar *deviceName;
@property GstAVFVideoSourcePosition position;
@property GstAVFVideoSourceOrientation orientation;
@property GstAVFVideoSourceDeviceType deviceType;
@@ -287,7 +289,7 @@ static AVCaptureVideoOrientation GstAVFVideoSourceOrientation2AVCaptureVideoOrie
@implementation GstAVFVideoSrcImpl
-@synthesize deviceIndex, position, orientation, deviceType, doStats,
+@synthesize deviceIndex, deviceName, position, orientation, deviceType, doStats,
fps, captureScreen, captureScreenCursor, captureScreenMouseClicks;
- (id)init
@@ -303,6 +305,7 @@ static AVCaptureVideoOrientation GstAVFVideoSourceOrientation2AVCaptureVideoOrie
pushSrc = src;
deviceIndex = DEFAULT_DEVICE_INDEX;
+ deviceName = NULL;
position = DEFAULT_POSITION;
orientation = DEFAULT_ORIENTATION;
deviceType = DEFAULT_DEVICE_TYPE;
@@ -364,7 +367,8 @@ static AVCaptureVideoOrientation GstAVFVideoSourceOrientation2AVCaptureVideoOrie
}
g_assert (device != nil);
- GST_INFO ("Opening '%s'", [[device localizedName] UTF8String]);
+ deviceName = [[device localizedName] UTF8String];
+ GST_INFO ("Opening '%s'", deviceName);
input = [AVCaptureDeviceInput deviceInputWithDevice:device
error:&err];
@@ -1259,6 +1263,7 @@ enum
{
PROP_0,
PROP_DEVICE_INDEX,
+ PROP_DEVICE_NAME,
PROP_POSITION,
PROP_ORIENTATION,
PROP_DEVICE_TYPE,
@@ -1337,6 +1342,10 @@ gst_avf_video_src_class_init (GstAVFVideoSrcClass * klass)
"The zero-based device index",
-1, G_MAXINT, DEFAULT_DEVICE_INDEX,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class, PROP_DEVICE_NAME,
+ g_param_spec_string ("device-name", "Device Name",
+ "The name of the currently opened capture device",
+ NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_POSITION,
g_param_spec_enum ("position", "Position",
"The position of the capture device (front or back-facing)",
@@ -1414,6 +1423,9 @@ gst_avf_video_src_get_property (GObject * object, guint prop_id, GValue * value,
case PROP_DEVICE_INDEX:
g_value_set_int (value, impl.deviceIndex);
break;
+ case PROP_DEVICE_NAME:
+ g_value_set_string (value, impl.deviceName);
+ break;
case PROP_POSITION:
g_value_set_enum(value, impl.position);
break;