From a4b140116c85da0eb9bd36eb0b512eeda8c502d4 Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Tue, 23 Mar 2004 16:59:59 +0000 Subject: [PATCH] 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. --- ChangeLog | 8 ++++++++ gst-libs/gst/play/play.c | 21 ++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8452c461c4..c794bd5fcf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-03-23 Johan Dahlin + + * 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. + 2004-03-22 David Schleef * sys/oss/Makefile.am: diff --git a/gst-libs/gst/play/play.c b/gst-libs/gst/play/play.c index 28acb075bf..7416234995 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; }