mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
gst/iec958/ac3iec.*: (NORMAL_CAPS_DEF, RAW_AUDIO_CAPS_DEF, ac3iec_class_init)
Original commit message from CVS: 2005-12-26 Martin Soto <martinsoto@users.sourceforge.net> * 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.
This commit is contained in:
parent
96b959fc53
commit
f2d10b0927
3 changed files with 64 additions and 16 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2005-12-26 Martin Soto <martinsoto@users.sourceforge.net>
|
||||
|
||||
* 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 <msmith@fluendo.com>
|
||||
|
||||
* gst/iec958/ac3iec.c: (ac3iec_init), (ac3iec_setcaps),
|
||||
|
|
|
@ -56,7 +56,8 @@ enum
|
|||
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
PROP_0,
|
||||
PROP_RAW_AUDIO,
|
||||
};
|
||||
|
||||
|
||||
|
@ -67,12 +68,24 @@ static GstStaticPadTemplate ac3iec_sink_template =
|
|||
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 @@ ac3iec_class_init (AC3IECClass * klass)
|
|||
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 @@ ac3iec_class_init (AC3IECClass * klass)
|
|||
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_init (AC3IEC * ac3iec)
|
|||
gst_pad_new_from_template (gst_static_pad_template_get
|
||||
(&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 @@ static void
|
|||
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 @@ static void
|
|||
ac3iec_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
AC3IEC *ac3iec;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_AC3IEC (object));
|
||||
|
||||
ac3iec = AC3IEC (object);
|
||||
AC3IEC *ac3iec = AC3IEC (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_RAW_AUDIO:
|
||||
g_value_set_boolean (value, ac3iec->raw_audio);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
|
|
@ -63,7 +63,12 @@ struct _AC3IEC {
|
|||
|
||||
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. */
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue