From d23d907a86d52ab2dd371ce55108a000dc46a303 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 31 Oct 2005 11:43:01 +0000 Subject: [PATCH] gst-libs/gst/audio/gstringbuffer.h: Don't break ABI. Original commit message from CVS: * gst-libs/gst/audio/gstringbuffer.h: Don't break ABI. * gst/ffmpegcolorspace/gstffmpegcodecmap.c: (gst_ffmpeg_caps_to_pixfmt): * gst/ffmpegcolorspace/gstffmpegcolorspace.c: (gst_ffmpegcsp_set_caps): Some more comments. Handle missing required caps fields better. --- ChangeLog | 12 +++++++++++ gst-libs/gst/audio/gstringbuffer.h | 10 ++++++--- gst/ffmpegcolorspace/gstffmpegcodecmap.c | 1 + gst/ffmpegcolorspace/gstffmpegcolorspace.c | 34 ++++++++++++++++++++++++------ 4 files changed, 48 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9960cce..5e8fac3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2005-10-31 Wim Taymans + * gst-libs/gst/audio/gstringbuffer.h: + Don't break ABI. + + * gst/ffmpegcolorspace/gstffmpegcodecmap.c: + (gst_ffmpeg_caps_to_pixfmt): + * gst/ffmpegcolorspace/gstffmpegcolorspace.c: + (gst_ffmpegcsp_set_caps): + Some more comments. + Handle missing required caps fields better. + +2005-10-31 Wim Taymans + * gst-libs/gst/audio/gstbaseaudiosink.c: (gst_base_audio_sink_event), (gst_base_audio_sink_get_offset), (gst_base_audio_sink_render): diff --git a/gst-libs/gst/audio/gstringbuffer.h b/gst-libs/gst/audio/gstringbuffer.h index bb03818..9e92110 100644 --- a/gst-libs/gst/audio/gstringbuffer.h +++ b/gst-libs/gst/audio/gstringbuffer.h @@ -172,10 +172,14 @@ struct _GstRingBuffer { GstRingBufferCallback callback; gpointer cb_data; - gboolean flushing; - /*< private >*/ - gpointer _gst_reserved[GST_PADDING]; + union { + struct { + gboolean flushing; + }; + /* adding + 0 to mark ABI change to be undone later */ + gpointer _gst_reserved[GST_PADDING + 0]; + }; }; struct _GstRingBufferClass { diff --git a/gst/ffmpegcolorspace/gstffmpegcodecmap.c b/gst/ffmpegcolorspace/gstffmpegcodecmap.c index e1e61fc..9e6943c 100644 --- a/gst/ffmpegcolorspace/gstffmpegcodecmap.c +++ b/gst/ffmpegcolorspace/gstffmpegcodecmap.c @@ -445,6 +445,7 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps, gst_structure_get_int (structure, "width", &context->width); gst_structure_get_int (structure, "height", &context->height); + /* framerate does not really matter */ if (gst_structure_get_double (structure, "framerate", &fps)) { context->frame_rate = fps * DEFAULT_FRAME_RATE_BASE; context->frame_rate_base = DEFAULT_FRAME_RATE_BASE; diff --git a/gst/ffmpegcolorspace/gstffmpegcolorspace.c b/gst/ffmpegcolorspace/gstffmpegcolorspace.c index 253d404..c170a72 100644 --- a/gst/ffmpegcolorspace/gstffmpegcolorspace.c +++ b/gst/ffmpegcolorspace/gstffmpegcolorspace.c @@ -148,26 +148,41 @@ gst_ffmpegcsp_set_caps (GstBaseTransform * btrans, GstCaps * incaps, const GValue *in_par = NULL; const GValue *out_par = NULL; AVCodecContext *ctx; + gboolean res; space = GST_FFMPEGCSP (btrans); /* parse in and output values */ structure = gst_caps_get_structure (incaps, 0); - gst_structure_get_int (structure, "width", &in_width); - gst_structure_get_int (structure, "height", &in_height); - gst_structure_get_double (structure, "framerate", &in_framerate); + + /* we have to have width and height */ + res = gst_structure_get_int (structure, "width", &in_width); + res &= gst_structure_get_int (structure, "height", &in_height); + res &= gst_structure_get_double (structure, "framerate", &in_framerate); + if (!res) + goto no_width_height; + + /* this is optional */ in_par = gst_structure_get_value (structure, "pixel-aspect-ratio"); structure = gst_caps_get_structure (outcaps, 0); - gst_structure_get_int (structure, "width", &out_width); - gst_structure_get_int (structure, "height", &out_height); - gst_structure_get_double (structure, "framerate", &out_framerate); + + /* we have to have width and height */ + res = gst_structure_get_int (structure, "width", &out_width); + res &= gst_structure_get_int (structure, "height", &out_height); + res &= gst_structure_get_double (structure, "framerate", &out_framerate); + if (!res) + goto no_width_height; + + /* this is optional */ out_par = gst_structure_get_value (structure, "pixel-aspect-ratio"); + /* these must match */ if (in_width != out_width || in_height != out_height || in_framerate != out_framerate) goto format_mismatch; + /* if present, these must match too */ if (in_par && out_par && gst_value_compare (in_par, out_par) != GST_VALUE_EQUAL) goto format_mismatch; @@ -203,6 +218,13 @@ gst_ffmpegcsp_set_caps (GstBaseTransform * btrans, GstCaps * incaps, return TRUE; /* ERRORS */ +no_width_height: + { + GST_DEBUG ("did not specify width or height"); + space->from_pixfmt = PIX_FMT_NB; + space->to_pixfmt = PIX_FMT_NB; + return FALSE; + } format_mismatch: { GST_DEBUG ("input and output formats do not match"); -- 2.7.4