mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +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
|
||||
return NO;
|
||||
#else
|
||||
GST_DEBUG_OBJECT (element, "Opening screen input");
|
||||
|
||||
AVCaptureScreenInput *screenInput =
|
||||
[[AVCaptureScreenInput alloc] initWithDisplayID:displayId];
|
||||
|
||||
|
@ -253,6 +255,8 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
|||
{
|
||||
BOOL success = NO, *successPtr = &success;
|
||||
|
||||
GST_DEBUG_OBJECT (element, "Opening device");
|
||||
|
||||
dispatch_sync (mainQueue, ^{
|
||||
BOOL ret;
|
||||
|
||||
|
@ -277,11 +281,15 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
|||
*successPtr = YES;
|
||||
});
|
||||
|
||||
GST_DEBUG_OBJECT (element, "Opening device %s", success ? "succeed" : "failed");
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
- (void)closeDevice
|
||||
{
|
||||
GST_DEBUG_OBJECT (element, "Closing device");
|
||||
|
||||
dispatch_sync (mainQueue, ^{
|
||||
g_assert (![session isRunning]);
|
||||
|
||||
|
@ -333,7 +341,8 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
|||
gst_format = GST_VIDEO_FORMAT_YUY2;
|
||||
break;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -345,6 +354,8 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
|||
NSArray *formats = [device valueForKey:@"formats"];
|
||||
NSArray *pixel_formats = output.availableVideoCVPixelFormatTypes;
|
||||
|
||||
GST_DEBUG_OBJECT (element, "Getting device caps");
|
||||
|
||||
for (AVCaptureDeviceFormat *f in [formats reverseObjectEnumerator]) {
|
||||
CMFormatDescriptionRef formatDescription = f.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;
|
||||
}
|
||||
|
||||
|
@ -371,6 +383,8 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
|||
NSArray *formats = [device valueForKey:@"formats"];
|
||||
gst_util_fraction_to_double (info->fps_n, info->fps_d, &framerate);
|
||||
|
||||
GST_DEBUG_OBJECT (element, "Setting device caps");
|
||||
|
||||
if ([device lockForConfiguration:NULL] == YES) {
|
||||
for (AVCaptureDeviceFormat *f in formats) {
|
||||
CMFormatDescriptionRef formatDescription = f.formatDescription;
|
||||
|
@ -437,11 +451,15 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
|||
if ([session canSetSessionPreset:AVCaptureSessionPresetLow])
|
||||
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;
|
||||
}
|
||||
|
||||
- (BOOL)setSessionPresetCaps:(GstVideoInfo *)info;
|
||||
{
|
||||
GST_DEBUG_OBJECT (element, "Setting session presset caps");
|
||||
|
||||
if ([device lockForConfiguration:NULL] != YES) {
|
||||
GST_WARNING ("Couldn't lock device for configuration");
|
||||
|
|
Loading…
Reference in a new issue