mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
avfvideosrc: add more debug
This commit is contained in:
parent
606a50e550
commit
ef7f6e4654
1 changed files with 19 additions and 1 deletions
|
@ -228,6 +228,8 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
||||||
#if HAVE_IOS
|
#if HAVE_IOS
|
||||||
return NO;
|
return NO;
|
||||||
#else
|
#else
|
||||||
|
GST_DEBUG_OBJECT (element, "Opening screen input");
|
||||||
|
|
||||||
AVCaptureScreenInput *screenInput =
|
AVCaptureScreenInput *screenInput =
|
||||||
[[AVCaptureScreenInput alloc] initWithDisplayID:displayId];
|
[[AVCaptureScreenInput alloc] initWithDisplayID:displayId];
|
||||||
|
|
||||||
|
@ -253,6 +255,8 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
||||||
{
|
{
|
||||||
BOOL success = NO, *successPtr = &success;
|
BOOL success = NO, *successPtr = &success;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (element, "Opening device");
|
||||||
|
|
||||||
dispatch_sync (mainQueue, ^{
|
dispatch_sync (mainQueue, ^{
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
|
@ -277,11 +281,15 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
||||||
*successPtr = YES;
|
*successPtr = YES;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (element, "Opening device %s", success ? "succeed" : "failed");
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)closeDevice
|
- (void)closeDevice
|
||||||
{
|
{
|
||||||
|
GST_DEBUG_OBJECT (element, "Closing device");
|
||||||
|
|
||||||
dispatch_sync (mainQueue, ^{
|
dispatch_sync (mainQueue, ^{
|
||||||
g_assert (![session isRunning]);
|
g_assert (![session isRunning]);
|
||||||
|
|
||||||
|
@ -333,7 +341,8 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
||||||
gst_format = GST_VIDEO_FORMAT_YUY2;
|
gst_format = GST_VIDEO_FORMAT_YUY2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
GST_DEBUG ("Pixel format %s is not handled by avfvideosrc", [[pixel_format stringValue] UTF8String]);
|
GST_LOG_OBJECT (element, "Pixel format %s is not handled by avfvideosrc",
|
||||||
|
[[pixel_format stringValue] UTF8String]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,6 +354,8 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
||||||
NSArray *formats = [device valueForKey:@"formats"];
|
NSArray *formats = [device valueForKey:@"formats"];
|
||||||
NSArray *pixel_formats = output.availableVideoCVPixelFormatTypes;
|
NSArray *pixel_formats = output.availableVideoCVPixelFormatTypes;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (element, "Getting device caps");
|
||||||
|
|
||||||
for (AVCaptureDeviceFormat *f in [formats reverseObjectEnumerator]) {
|
for (AVCaptureDeviceFormat *f in [formats reverseObjectEnumerator]) {
|
||||||
CMFormatDescriptionRef formatDescription = f.formatDescription;
|
CMFormatDescriptionRef formatDescription = f.formatDescription;
|
||||||
CMVideoDimensions dimensions = CMVideoFormatDescriptionGetDimensions(formatDescription);
|
CMVideoDimensions dimensions = CMVideoFormatDescriptionGetDimensions(formatDescription);
|
||||||
|
@ -361,6 +372,7 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
GST_LOG_OBJECT (element, "Device returned the following caps %" GST_PTR_FORMAT, result);
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,6 +383,8 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
||||||
NSArray *formats = [device valueForKey:@"formats"];
|
NSArray *formats = [device valueForKey:@"formats"];
|
||||||
gst_util_fraction_to_double (info->fps_n, info->fps_d, &framerate);
|
gst_util_fraction_to_double (info->fps_n, info->fps_d, &framerate);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (element, "Setting device caps");
|
||||||
|
|
||||||
if ([device lockForConfiguration:NULL] == YES) {
|
if ([device lockForConfiguration:NULL] == YES) {
|
||||||
for (AVCaptureDeviceFormat *f in formats) {
|
for (AVCaptureDeviceFormat *f in formats) {
|
||||||
CMFormatDescriptionRef formatDescription = f.formatDescription;
|
CMFormatDescriptionRef formatDescription = f.formatDescription;
|
||||||
|
@ -437,11 +451,15 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
||||||
if ([session canSetSessionPreset:AVCaptureSessionPresetLow])
|
if ([session canSetSessionPreset:AVCaptureSessionPresetLow])
|
||||||
gst_caps_append (result, GST_AVF_CAPS_NEW (gst_format, 192, 144, DEVICE_FPS_N, DEVICE_FPS_D));
|
gst_caps_append (result, GST_AVF_CAPS_NEW (gst_format, 192, 144, DEVICE_FPS_N, DEVICE_FPS_D));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (element, "Session presets returned the following caps %" GST_PTR_FORMAT, result);
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)setSessionPresetCaps:(GstVideoInfo *)info;
|
- (BOOL)setSessionPresetCaps:(GstVideoInfo *)info;
|
||||||
{
|
{
|
||||||
|
GST_DEBUG_OBJECT (element, "Setting session presset caps");
|
||||||
|
|
||||||
if ([device lockForConfiguration:NULL] != YES) {
|
if ([device lockForConfiguration:NULL] != YES) {
|
||||||
GST_WARNING ("Couldn't lock device for configuration");
|
GST_WARNING ("Couldn't lock device for configuration");
|
||||||
|
|
Loading…
Reference in a new issue