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.
This commit is contained in:
Johan Dahlin 2004-03-23 16:59:59 +00:00
parent 6b102fdeb7
commit a4b140116c
2 changed files with 22 additions and 7 deletions

View file

@ -1,3 +1,11 @@
2004-03-23 Johan Dahlin <johan@gnome.org>
* 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 <ds@schleef.org>
* sys/oss/Makefile.am:

View file

@ -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;
}