gst/iec958/ac3iec.*: Accept audio/x-ac3 and audio/ac3 to ac3iec958 element.

Original commit message from CVS:
* gst/iec958/ac3iec.c: (ac3iec_init), (ac3iec_setcaps),
(ac3iec_chain_dvd):
* gst/iec958/ac3iec.h:
Accept audio/x-ac3 and audio/ac3 to ac3iec958 element.
This commit is contained in:
Michael Smith 2005-12-23 15:48:04 +00:00
parent 9c580660a8
commit 96b959fc53
3 changed files with 70 additions and 36 deletions

View file

@ -1,3 +1,10 @@
2005-12-23 Michael Smith <msmith@fluendo.com>
* gst/iec958/ac3iec.c: (ac3iec_init), (ac3iec_setcaps),
(ac3iec_chain_dvd):
* gst/iec958/ac3iec.h:
Accept audio/x-ac3 and audio/ac3 to ac3iec958 element.
2005-12-21 Tim-Philipp Müller <tim at centricular dot net> 2005-12-21 Tim-Philipp Müller <tim at centricular dot net>
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_src_event): * ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_src_event):

View file

@ -64,7 +64,7 @@ static GstStaticPadTemplate ac3iec_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK, GST_PAD_SINK,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-private1-ac3") GST_STATIC_CAPS ("audio/x-private1-ac3; audio/x-ac3; audio/ac3")
); );
static GstStaticPadTemplate ac3iec_src_template = static GstStaticPadTemplate ac3iec_src_template =
@ -84,6 +84,7 @@ static void ac3iec_set_property (GObject * object,
static void ac3iec_get_property (GObject * object, static void ac3iec_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec); guint prop_id, GValue * value, GParamSpec * pspec);
static gboolean ac3iec_setcaps (GstPad * pad, GstCaps * caps);
static GstFlowReturn ac3iec_chain_dvd (GstPad * pad, GstBuffer * buf); static GstFlowReturn ac3iec_chain_dvd (GstPad * pad, GstBuffer * buf);
static GstFlowReturn ac3iec_chain_raw (GstPad * pad, GstBuffer * buf); static GstFlowReturn ac3iec_chain_raw (GstPad * pad, GstBuffer * buf);
@ -160,6 +161,7 @@ ac3iec_init (AC3IEC * ac3iec)
ac3iec->sink = ac3iec->sink =
gst_pad_new_from_template (gst_static_pad_template_get gst_pad_new_from_template (gst_static_pad_template_get
(&ac3iec_sink_template), "sink"); (&ac3iec_sink_template), "sink");
gst_pad_set_setcaps_function (ac3iec->sink, ac3iec_setcaps);
gst_pad_set_chain_function (ac3iec->sink, ac3iec_chain_dvd); gst_pad_set_chain_function (ac3iec->sink, ac3iec_chain_dvd);
gst_element_add_pad (GST_ELEMENT (ac3iec), ac3iec->sink); gst_element_add_pad (GST_ELEMENT (ac3iec), ac3iec->sink);
@ -199,6 +201,21 @@ ac3iec_set_property (GObject * object, guint prop_id,
} }
} }
static gboolean
ac3iec_setcaps (GstPad * pad, GstCaps * caps)
{
AC3IEC *ac3iec = AC3IEC (gst_pad_get_parent (pad));
GstStructure *structure = gst_caps_get_structure (caps, 0);
if (structure && gst_structure_has_name (structure, "audio/x-private1-ac3"))
ac3iec->dvdmode = TRUE;
else
ac3iec->dvdmode = FALSE;
gst_object_unref (ac3iec);
return TRUE;
}
static void static void
ac3iec_get_property (GObject * object, guint prop_id, ac3iec_get_property (GObject * object, guint prop_id,
@ -228,7 +245,9 @@ ac3iec_chain_dvd (GstPad * pad, GstBuffer * buf)
gint len; gint len;
GstBuffer *subbuf; GstBuffer *subbuf;
GstFlowReturn ret; GstFlowReturn ret;
AC3IEC *ac3iec = AC3IEC (gst_pad_get_parent (pad));
if (ac3iec->dvdmode) {
size = GST_BUFFER_SIZE (buf); size = GST_BUFFER_SIZE (buf);
data = GST_BUFFER_DATA (buf); data = GST_BUFFER_DATA (buf);
@ -274,8 +293,14 @@ ac3iec_chain_dvd (GstPad * pad, GstBuffer * buf)
GST_BUFFER_TIMESTAMP (subbuf) = GST_CLOCK_TIME_NONE; GST_BUFFER_TIMESTAMP (subbuf) = GST_CLOCK_TIME_NONE;
ret = ac3iec_chain_raw (pad, subbuf); ret = ac3iec_chain_raw (pad, subbuf);
} }
} else {
ret = ac3iec_chain_raw (pad, buf);
gst_object_unref (ac3iec);
return ret;
}
done: done:
gst_object_unref (ac3iec);
gst_buffer_unref (buf); gst_buffer_unref (buf);
return ret; return ret;

View file

@ -62,6 +62,8 @@ struct _AC3IEC {
GstClockTime next_ts; /* Time stamp for the next frame. */ GstClockTime next_ts; /* Time stamp for the next frame. */
ac3_padder *padder; /* AC3 to SPDIF padder object. */ ac3_padder *padder; /* AC3 to SPDIF padder object. */
gboolean dvdmode;
}; };