avfvideosrc: add device-name property
This property is readonly and should show the name of selected capture device.
This commit is contained in:
parent
52e4a20b4e
commit
9f03ade11f
@ -159,6 +159,7 @@ gst_avf_video_source_device_type_get_type (void)
|
|||||||
GstPushSrc *pushSrc;
|
GstPushSrc *pushSrc;
|
||||||
|
|
||||||
gint deviceIndex;
|
gint deviceIndex;
|
||||||
|
const gchar *deviceName;
|
||||||
GstAVFVideoSourcePosition position;
|
GstAVFVideoSourcePosition position;
|
||||||
GstAVFVideoSourceOrientation orientation;
|
GstAVFVideoSourceOrientation orientation;
|
||||||
GstAVFVideoSourceDeviceType deviceType;
|
GstAVFVideoSourceDeviceType deviceType;
|
||||||
@ -200,6 +201,7 @@ gst_avf_video_source_device_type_get_type (void)
|
|||||||
- (void)finalize;
|
- (void)finalize;
|
||||||
|
|
||||||
@property int deviceIndex;
|
@property int deviceIndex;
|
||||||
|
@property const gchar *deviceName;
|
||||||
@property GstAVFVideoSourcePosition position;
|
@property GstAVFVideoSourcePosition position;
|
||||||
@property GstAVFVideoSourceOrientation orientation;
|
@property GstAVFVideoSourceOrientation orientation;
|
||||||
@property GstAVFVideoSourceDeviceType deviceType;
|
@property GstAVFVideoSourceDeviceType deviceType;
|
||||||
@ -287,7 +289,7 @@ static AVCaptureVideoOrientation GstAVFVideoSourceOrientation2AVCaptureVideoOrie
|
|||||||
|
|
||||||
@implementation GstAVFVideoSrcImpl
|
@implementation GstAVFVideoSrcImpl
|
||||||
|
|
||||||
@synthesize deviceIndex, position, orientation, deviceType, doStats,
|
@synthesize deviceIndex, deviceName, position, orientation, deviceType, doStats,
|
||||||
fps, captureScreen, captureScreenCursor, captureScreenMouseClicks;
|
fps, captureScreen, captureScreenCursor, captureScreenMouseClicks;
|
||||||
|
|
||||||
- (id)init
|
- (id)init
|
||||||
@ -303,6 +305,7 @@ static AVCaptureVideoOrientation GstAVFVideoSourceOrientation2AVCaptureVideoOrie
|
|||||||
pushSrc = src;
|
pushSrc = src;
|
||||||
|
|
||||||
deviceIndex = DEFAULT_DEVICE_INDEX;
|
deviceIndex = DEFAULT_DEVICE_INDEX;
|
||||||
|
deviceName = NULL;
|
||||||
position = DEFAULT_POSITION;
|
position = DEFAULT_POSITION;
|
||||||
orientation = DEFAULT_ORIENTATION;
|
orientation = DEFAULT_ORIENTATION;
|
||||||
deviceType = DEFAULT_DEVICE_TYPE;
|
deviceType = DEFAULT_DEVICE_TYPE;
|
||||||
@ -364,7 +367,8 @@ static AVCaptureVideoOrientation GstAVFVideoSourceOrientation2AVCaptureVideoOrie
|
|||||||
}
|
}
|
||||||
g_assert (device != nil);
|
g_assert (device != nil);
|
||||||
|
|
||||||
GST_INFO ("Opening '%s'", [[device localizedName] UTF8String]);
|
deviceName = [[device localizedName] UTF8String];
|
||||||
|
GST_INFO ("Opening '%s'", deviceName);
|
||||||
|
|
||||||
input = [AVCaptureDeviceInput deviceInputWithDevice:device
|
input = [AVCaptureDeviceInput deviceInputWithDevice:device
|
||||||
error:&err];
|
error:&err];
|
||||||
@ -1259,6 +1263,7 @@ enum
|
|||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_DEVICE_INDEX,
|
PROP_DEVICE_INDEX,
|
||||||
|
PROP_DEVICE_NAME,
|
||||||
PROP_POSITION,
|
PROP_POSITION,
|
||||||
PROP_ORIENTATION,
|
PROP_ORIENTATION,
|
||||||
PROP_DEVICE_TYPE,
|
PROP_DEVICE_TYPE,
|
||||||
@ -1337,6 +1342,10 @@ gst_avf_video_src_class_init (GstAVFVideoSrcClass * klass)
|
|||||||
"The zero-based device index",
|
"The zero-based device index",
|
||||||
-1, G_MAXINT, DEFAULT_DEVICE_INDEX,
|
-1, G_MAXINT, DEFAULT_DEVICE_INDEX,
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
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_object_class_install_property (gobject_class, PROP_POSITION,
|
||||||
g_param_spec_enum ("position", "Position",
|
g_param_spec_enum ("position", "Position",
|
||||||
"The position of the capture device (front or back-facing)",
|
"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:
|
case PROP_DEVICE_INDEX:
|
||||||
g_value_set_int (value, impl.deviceIndex);
|
g_value_set_int (value, impl.deviceIndex);
|
||||||
break;
|
break;
|
||||||
|
case PROP_DEVICE_NAME:
|
||||||
|
g_value_set_string (value, impl.deviceName);
|
||||||
|
break;
|
||||||
case PROP_POSITION:
|
case PROP_POSITION:
|
||||||
g_value_set_enum(value, impl.position);
|
g_value_set_enum(value, impl.position);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user