From 58719f492b13db9ea61a3bcbbc72be5e48d9ab53 Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Tue, 23 Mar 2004 16:59:59 +0000 Subject: gst-libs/gst/play/play.c (gst_play_audio_fixate) Original commit message from CVS: * gst-libs/gst/play/play.c (gst_play_audio_fixate) (gst_play_video_fixate): Check so the structure has the field before trying to fixate them, this makes it possible to have fakesinks for video and audio output without printing errors on the output console. --- gst-libs/gst/play/play.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'gst-libs') diff --git a/gst-libs/gst/play/play.c b/gst-libs/gst/play/play.c index 28acb075..74162349 100644 --- a/gst-libs/gst/play/play.c +++ b/gst-libs/gst/play/play.c @@ -480,13 +480,16 @@ gst_play_video_fixate (GstPad * pad, const GstCaps * caps, gpointer user_data) newcaps = gst_caps_copy (caps); structure = gst_caps_get_structure (newcaps, 0); - if (gst_caps_structure_fixate_field_nearest_int (structure, "width", 320)) { + if (gst_structure_has_field (structure, "width") && + gst_caps_structure_fixate_field_nearest_int (structure, "width", 320)) { return newcaps; } - if (gst_caps_structure_fixate_field_nearest_int (structure, "height", 240)) { + if (gst_structure_has_field (structure, "height") && + gst_caps_structure_fixate_field_nearest_int (structure, "height", 240)) { return newcaps; } - if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate", + if (gst_structure_has_field (structure, "framerate") && + gst_caps_structure_fixate_field_nearest_double (structure, "framerate", 30.0)) { return newcaps; } @@ -509,16 +512,20 @@ gst_play_audio_fixate (GstPad * pad, const GstCaps * caps, gpointer user_data) NULL); structure = gst_caps_get_structure (newcaps, 0); - if (gst_caps_structure_fixate_field_nearest_int (structure, "rate", 44100)) { + if (gst_structure_has_field (structure, "rate") && + gst_caps_structure_fixate_field_nearest_int (structure, "rate", 44100)) { return newcaps; } - if (gst_caps_structure_fixate_field_nearest_int (structure, "depth", 16)) { + if (gst_structure_has_field (structure, "depth") && + gst_caps_structure_fixate_field_nearest_int (structure, "depth", 16)) { return newcaps; } - if (gst_caps_structure_fixate_field_nearest_int (structure, "width", 16)) { + if (gst_structure_has_field (structure, "width") && + gst_caps_structure_fixate_field_nearest_int (structure, "width", 16)) { return newcaps; } - if (gst_caps_structure_fixate_field_nearest_int (structure, "channels", 2)) { + if (gst_structure_has_field (structure, "channels") && + gst_caps_structure_fixate_field_nearest_int (structure, "channels", 2)) { return newcaps; } -- cgit v1.2.1