From: <so...@fr...> - 2005-12-26 17:49:45
|
CVS Root: /cvs/gstreamer Module: gst-plugins-ugly Changes by: soto Date: Mon Dec 26 2005 09:48:45 PST Log message: 2005-12-26 Martin Soto <mar...@us...> * gst/iec958/ac3iec.h: * gst/iec958/ac3iec.c: (NORMAL_CAPS_DEF, RAW_AUDIO_CAPS_DEF, ac3iec_class_init) (ac3iec_init, ac3iec_set_property, ac3iec_get_property): Add a raw-audio property to ac3iec958 that allows setting the source pad caps to raw audio instead of audio/x-iec958. This makes it possible to use ac3iec958 together with the normal alsasink element to drive an external receiver that autodetects AC3 content. Modified files: . : ChangeLog gst/iec958 : ac3iec.c ac3iec.h Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-ugly/ChangeLog.diff?r1=1.1925&r2=1.1926 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-ugly/gst/iec958/ac3iec.c.diff?r1=1.11&r2=1.12 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-ugly/gst/iec958/ac3iec.h.diff?r1=1.4&r2=1.5 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-ugly/ChangeLog,v retrieving revision 1.1925 retrieving revision 1.1926 diff -u -d -r1.1925 -r1.1926 --- ChangeLog 23 Dec 2005 15:48:04 -0000 1.1925 +++ ChangeLog 26 Dec 2005 17:48:32 -0000 1.1926 @@ -1,3 +1,15 @@ +2005-12-26 Martin Soto <mar...@us...> + + * gst/iec958/ac3iec.h: + * gst/iec958/ac3iec.c: + (NORMAL_CAPS_DEF, RAW_AUDIO_CAPS_DEF, ac3iec_class_init) + (ac3iec_init, ac3iec_set_property, ac3iec_get_property): Add a + raw-audio property to ac3iec958 that allows setting the source pad + caps to raw audio instead of audio/x-iec958. This makes it + possible to use ac3iec958 together with the normal alsasink + element to drive an external receiver that autodetects AC3 + content. 2005-12-23 Michael Smith <ms...@fl...> * gst/iec958/ac3iec.c: (ac3iec_init), (ac3iec_setcaps), Index: ac3iec.c RCS file: /cvs/gstreamer/gst-plugins-ugly/gst/iec958/ac3iec.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- ac3iec.c 23 Dec 2005 15:48:04 -0000 1.11 +++ ac3iec.c 26 Dec 2005 17:48:32 -0000 1.12 @@ -56,7 +56,8 @@ enum { - ARG_0, + PROP_0, + PROP_RAW_AUDIO, }; @@ -67,12 +68,24 @@ GST_STATIC_CAPS ("audio/x-private1-ac3; audio/x-ac3; audio/ac3") ); +/* Two different output caps are possible. */ +#define NORMAL_CAPS_DEF "audio/x-iec958" +#define RAW_AUDIO_CAPS_DEF "audio/x-raw-int, " \ + "endianness = (int) " G_STRINGIFY (G_BIG_ENDIAN) ", " \ + "signed = (boolean) true, " \ + "width = (int) 16, " \ + "depth = (int) 16, " \ + "rate = (int) 48000, " \ + "channels = (int) 2" +static GstStaticCaps normal_caps = GST_STATIC_CAPS (NORMAL_CAPS_DEF); +static GstStaticCaps raw_audio_caps = GST_STATIC_CAPS (RAW_AUDIO_CAPS_DEF); static GstStaticPadTemplate ac3iec_src_template = -GST_STATIC_PAD_TEMPLATE ("src", + GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-iec958") - ); + GST_STATIC_CAPS (NORMAL_CAPS_DEF ";" RAW_AUDIO_CAPS_DEF)); static void ac3iec_base_init (gpointer g_class); static void ac3iec_class_init (AC3IECClass * klass); @@ -151,6 +164,11 @@ gobject_class->get_property = ac3iec_get_property; gobject_class->finalize = ac3iec_finalize; + g_object_class_install_property (gobject_class, PROP_RAW_AUDIO, + g_param_spec_boolean ("raw-audio", "raw-audio", + "If true, source pad caps are set to raw audio.", + FALSE, G_PARAM_READWRITE)); gstelement_class->change_state = ac3iec_change_state; } @@ -158,6 +176,8 @@ static void ac3iec_init (AC3IEC * ac3iec) + GstCaps *src_caps; ac3iec->sink = gst_pad_new_from_template (gst_static_pad_template_get (&ac3iec_sink_template), "sink"); @@ -169,9 +189,11 @@ (&ac3iec_src_template), "src"); gst_pad_use_fixed_caps (ac3iec->src); + src_caps = gst_static_caps_get (&normal_caps); + gst_pad_set_caps (ac3iec->src, src_caps); + gst_caps_unref (src_caps); gst_element_add_pad (GST_ELEMENT (ac3iec), ac3iec->src); - ac3iec->cur_ts = GST_CLOCK_TIME_NONE; ac3iec->padder = g_malloc (sizeof (ac3_padder)); @@ -190,12 +212,23 @@ ac3iec_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) - AC3IEC *ac3iec; - /* it's not null if we got it, but it might not be ours */ - ac3iec = AC3IEC (object); + AC3IEC *ac3iec = AC3IEC (object); switch (prop_id) { + case PROP_RAW_AUDIO: + { + GstCaps *src_caps; + ac3iec->raw_audio = g_value_get_boolean (value); + if (ac3iec->raw_audio) { + src_caps = gst_static_caps_get (&raw_audio_caps); + } else { + src_caps = gst_static_caps_get (&normal_caps); + } + gst_pad_set_caps (ac3iec->src, src_caps); + gst_caps_unref (src_caps); + break; + } default: break; } @@ -221,14 +254,12 @@ ac3iec_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) - g_return_if_fail (GST_IS_AC3IEC (object)); + g_value_set_boolean (value, ac3iec->raw_audio); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); Index: ac3iec.h RCS file: /cvs/gstreamer/gst-plugins-ugly/gst/iec958/ac3iec.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ac3iec.h 23 Dec 2005 15:48:04 -0000 1.4 +++ ac3iec.h 26 Dec 2005 17:48:32 -0000 1.5 @@ -63,7 +63,12 @@ ac3_padder *padder; /* AC3 to SPDIF padder object. */ - gboolean dvdmode; + gboolean dvdmode; /* TRUE if DVD mode (input is + demultiplexed from a DVD) is + active. */ + gboolean raw_audio; /* TRUE if output pad should use raw + audio capabilities. */ |