mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 04:45:36 +00:00
dvdlpcmdec: rewrite to use GstAudioDecoder
https://bugzilla.gnome.org/show_bug.cgi?id=765807
This commit is contained in:
parent
9b6b6d1fd5
commit
35dc8d0f68
2 changed files with 189 additions and 335 deletions
|
@ -56,65 +56,31 @@ GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
"channels = (int) [ 1, 8 ]")
|
"channels = (int) [ 1, 8 ]")
|
||||||
);
|
);
|
||||||
|
|
||||||
/* DvdLpcmDec signals and args */
|
#define gst_dvdlpcmdec_parent_class parent_class
|
||||||
enum
|
G_DEFINE_TYPE (GstDvdLpcmDec, gst_dvdlpcmdec, GST_TYPE_AUDIO_DECODER);
|
||||||
{
|
|
||||||
/* FILL ME */
|
|
||||||
LAST_SIGNAL
|
|
||||||
};
|
|
||||||
|
|
||||||
enum
|
static gboolean gst_dvdlpcmdec_set_format (GstAudioDecoder * bdec,
|
||||||
{
|
GstCaps * caps);
|
||||||
PROP_0
|
static GstFlowReturn gst_dvdlpcmdec_parse (GstAudioDecoder * bdec,
|
||||||
/* FILL ME */
|
GstAdapter * adapter, gint * offset, gint * len);
|
||||||
};
|
static GstFlowReturn gst_dvdlpcmdec_handle_frame (GstAudioDecoder * bdec,
|
||||||
|
|
||||||
static void gst_dvdlpcmdec_base_init (gpointer g_class);
|
|
||||||
static void gst_dvdlpcmdec_class_init (GstDvdLpcmDecClass * klass);
|
|
||||||
static void gst_dvdlpcmdec_init (GstDvdLpcmDec * dvdlpcmdec);
|
|
||||||
|
|
||||||
static GstFlowReturn gst_dvdlpcmdec_chain_raw (GstPad * pad, GstObject * parent,
|
|
||||||
GstBuffer * buffer);
|
GstBuffer * buffer);
|
||||||
static GstFlowReturn gst_dvdlpcmdec_chain_dvd (GstPad * pad, GstObject * parent,
|
static GstFlowReturn gst_dvdlpcmdec_chain (GstPad * pad, GstObject * parent,
|
||||||
GstBuffer * buffer);
|
GstBuffer * buffer);
|
||||||
static gboolean gst_dvdlpcmdec_setcaps (GstPad * pad, GstCaps * caps);
|
|
||||||
static gboolean dvdlpcmdec_sink_event (GstPad * pad, GstObject * parent,
|
|
||||||
GstEvent * event);
|
|
||||||
|
|
||||||
static GstStateChangeReturn gst_dvdlpcmdec_change_state (GstElement * element,
|
|
||||||
GstStateChange transition);
|
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
|
||||||
|
|
||||||
GType
|
|
||||||
gst_dvdlpcmdec_get_type (void)
|
|
||||||
{
|
|
||||||
static GType dvdlpcmdec_type = 0;
|
|
||||||
|
|
||||||
if (!dvdlpcmdec_type) {
|
|
||||||
static const GTypeInfo dvdlpcmdec_info = {
|
|
||||||
sizeof (GstDvdLpcmDecClass),
|
|
||||||
gst_dvdlpcmdec_base_init,
|
|
||||||
NULL,
|
|
||||||
(GClassInitFunc) gst_dvdlpcmdec_class_init,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
sizeof (GstDvdLpcmDec),
|
|
||||||
0,
|
|
||||||
(GInstanceInitFunc) gst_dvdlpcmdec_init,
|
|
||||||
};
|
|
||||||
|
|
||||||
dvdlpcmdec_type =
|
|
||||||
g_type_register_static (GST_TYPE_ELEMENT, "GstDvdLpcmDec",
|
|
||||||
&dvdlpcmdec_info, 0);
|
|
||||||
}
|
|
||||||
return dvdlpcmdec_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_dvdlpcmdec_base_init (gpointer g_class)
|
gst_dvdlpcmdec_class_init (GstDvdLpcmDecClass * klass)
|
||||||
{
|
{
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
GstElementClass *element_class;
|
||||||
|
GstAudioDecoderClass *gstbase_class;
|
||||||
|
|
||||||
|
element_class = (GstElementClass *) klass;
|
||||||
|
gstbase_class = (GstAudioDecoderClass *) klass;
|
||||||
|
|
||||||
|
gstbase_class->set_format = GST_DEBUG_FUNCPTR (gst_dvdlpcmdec_set_format);
|
||||||
|
gstbase_class->parse = GST_DEBUG_FUNCPTR (gst_dvdlpcmdec_parse);
|
||||||
|
gstbase_class->handle_frame = GST_DEBUG_FUNCPTR (gst_dvdlpcmdec_handle_frame);
|
||||||
|
|
||||||
gst_element_class_add_static_pad_template (element_class,
|
gst_element_class_add_static_pad_template (element_class,
|
||||||
&gst_dvdlpcmdec_sink_template);
|
&gst_dvdlpcmdec_sink_template);
|
||||||
|
@ -124,18 +90,8 @@ gst_dvdlpcmdec_base_init (gpointer g_class)
|
||||||
"DVD LPCM Audio decoder", "Codec/Decoder/Audio",
|
"DVD LPCM Audio decoder", "Codec/Decoder/Audio",
|
||||||
"Decode DVD LPCM frames into standard PCM audio",
|
"Decode DVD LPCM frames into standard PCM audio",
|
||||||
"Jan Schmidt <jan@noraisin.net>, Michael Smith <msmith@fluendo.com>");
|
"Jan Schmidt <jan@noraisin.net>, Michael Smith <msmith@fluendo.com>");
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
GST_DEBUG_CATEGORY_INIT (dvdlpcm_debug, "dvdlpcmdec", 0, "DVD LPCM Decoder");
|
||||||
gst_dvdlpcmdec_class_init (GstDvdLpcmDecClass * klass)
|
|
||||||
{
|
|
||||||
GstElementClass *gstelement_class;
|
|
||||||
|
|
||||||
gstelement_class = (GstElementClass *) klass;
|
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
|
||||||
|
|
||||||
gstelement_class->change_state = gst_dvdlpcmdec_change_state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -145,27 +101,28 @@ gst_dvdlpcm_reset (GstDvdLpcmDec * dvdlpcmdec)
|
||||||
dvdlpcmdec->dynamic_range = 0;
|
dvdlpcmdec->dynamic_range = 0;
|
||||||
dvdlpcmdec->emphasis = FALSE;
|
dvdlpcmdec->emphasis = FALSE;
|
||||||
dvdlpcmdec->mute = FALSE;
|
dvdlpcmdec->mute = FALSE;
|
||||||
dvdlpcmdec->timestamp = GST_CLOCK_TIME_NONE;
|
|
||||||
|
|
||||||
dvdlpcmdec->header = 0;
|
dvdlpcmdec->header = 0;
|
||||||
|
|
||||||
gst_segment_init (&dvdlpcmdec->segment, GST_FORMAT_UNDEFINED);
|
dvdlpcmdec->mode = GST_LPCM_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_dvdlpcmdec_init (GstDvdLpcmDec * dvdlpcmdec)
|
gst_dvdlpcmdec_init (GstDvdLpcmDec * dvdlpcmdec)
|
||||||
{
|
{
|
||||||
dvdlpcmdec->sinkpad =
|
|
||||||
gst_pad_new_from_static_template (&gst_dvdlpcmdec_sink_template, "sink");
|
|
||||||
gst_pad_set_event_function (dvdlpcmdec->sinkpad, dvdlpcmdec_sink_event);
|
|
||||||
gst_element_add_pad (GST_ELEMENT (dvdlpcmdec), dvdlpcmdec->sinkpad);
|
|
||||||
|
|
||||||
dvdlpcmdec->srcpad =
|
|
||||||
gst_pad_new_from_static_template (&gst_dvdlpcmdec_src_template, "src");
|
|
||||||
gst_pad_use_fixed_caps (dvdlpcmdec->srcpad);
|
|
||||||
gst_element_add_pad (GST_ELEMENT (dvdlpcmdec), dvdlpcmdec->srcpad);
|
|
||||||
|
|
||||||
gst_dvdlpcm_reset (dvdlpcmdec);
|
gst_dvdlpcm_reset (dvdlpcmdec);
|
||||||
|
|
||||||
|
gst_audio_decoder_set_use_default_pad_acceptcaps (GST_AUDIO_DECODER_CAST
|
||||||
|
(dvdlpcmdec), TRUE);
|
||||||
|
GST_PAD_SET_ACCEPT_TEMPLATE (GST_AUDIO_DECODER_SINK_PAD (dvdlpcmdec));
|
||||||
|
|
||||||
|
/* retrieve and intercept base class chain.
|
||||||
|
* Quite HACKish, but that's dvd specs/caps for you,
|
||||||
|
* since one buffer needs to be split into 2 frames */
|
||||||
|
dvdlpcmdec->base_chain =
|
||||||
|
GST_PAD_CHAINFUNC (GST_AUDIO_DECODER_SINK_PAD (dvdlpcmdec));
|
||||||
|
gst_pad_set_chain_function (GST_AUDIO_DECODER_SINK_PAD (dvdlpcmdec),
|
||||||
|
GST_DEBUG_FUNCPTR (gst_dvdlpcmdec_chain));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const GstAudioChannelPosition channel_positions[][8] = {
|
static const GstAudioChannelPosition channel_positions[][8] = {
|
||||||
|
@ -209,31 +166,26 @@ gst_dvdlpcmdec_send_tags (GstDvdLpcmDec * dvdlpcmdec)
|
||||||
taglist = gst_tag_list_new (GST_TAG_AUDIO_CODEC, "LPCM Audio",
|
taglist = gst_tag_list_new (GST_TAG_AUDIO_CODEC, "LPCM Audio",
|
||||||
GST_TAG_BITRATE, bitrate, NULL);
|
GST_TAG_BITRATE, bitrate, NULL);
|
||||||
|
|
||||||
gst_pad_push_event (dvdlpcmdec->srcpad, gst_event_new_tag (taglist));
|
gst_audio_decoder_merge_tags (GST_AUDIO_DECODER (dvdlpcmdec), taglist,
|
||||||
|
GST_TAG_MERGE_REPLACE);
|
||||||
|
gst_tag_list_unref (taglist);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_dvdlpcmdec_set_outcaps (GstDvdLpcmDec * dvdlpcmdec)
|
gst_dvdlpcmdec_set_output_format (GstDvdLpcmDec * dvdlpcmdec)
|
||||||
{
|
{
|
||||||
gboolean res = TRUE;
|
gboolean res = TRUE;
|
||||||
GstCaps *src_caps;
|
|
||||||
|
|
||||||
/* Build caps to set on the src pad, which we know from the incoming caps */
|
res = gst_audio_decoder_set_output_format (GST_AUDIO_DECODER (dvdlpcmdec),
|
||||||
src_caps = gst_audio_info_to_caps (&dvdlpcmdec->info);
|
&dvdlpcmdec->info);
|
||||||
|
|
||||||
res = gst_pad_set_caps (dvdlpcmdec->srcpad, src_caps);
|
|
||||||
if (res) {
|
if (res) {
|
||||||
GST_DEBUG_OBJECT (dvdlpcmdec, "Successfully set output caps: %"
|
GST_DEBUG_OBJECT (dvdlpcmdec, "Successfully set output format");
|
||||||
GST_PTR_FORMAT, src_caps);
|
|
||||||
|
|
||||||
gst_dvdlpcmdec_send_tags (dvdlpcmdec);
|
gst_dvdlpcmdec_send_tags (dvdlpcmdec);
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (dvdlpcmdec, "Failed to set output caps: %"
|
GST_DEBUG_OBJECT (dvdlpcmdec, "Failed to set output format");
|
||||||
GST_PTR_FORMAT, src_caps);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_caps_unref (src_caps);
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,41 +205,42 @@ gst_dvdlpcmdec_update_audio_formats (GstDvdLpcmDec * dec, gint channels,
|
||||||
guint c;
|
guint c;
|
||||||
|
|
||||||
position = channel_positions[channels - 1];
|
position = channel_positions[channels - 1];
|
||||||
dec->lpcm_layout = position;
|
|
||||||
for (c = 0; c < channels; ++c)
|
for (c = 0; c < channels; ++c)
|
||||||
sorted_position[c] = position[c];
|
sorted_position[c] = position[c];
|
||||||
gst_audio_channel_positions_to_valid_order (sorted_position, channels);
|
gst_audio_channel_positions_to_valid_order (sorted_position, channels);
|
||||||
gst_audio_info_set_format (&dec->info, format, rate, channels,
|
gst_audio_info_set_format (&dec->info, format, rate, channels,
|
||||||
sorted_position);
|
sorted_position);
|
||||||
|
if (memcmp (position, sorted_position,
|
||||||
|
channels * sizeof (position[0])) != 0)
|
||||||
|
dec->lpcm_layout = position;
|
||||||
|
else
|
||||||
|
dec->lpcm_layout = NULL;
|
||||||
} else {
|
} else {
|
||||||
gst_audio_info_set_format (&dec->info, format, rate, channels, NULL);
|
gst_audio_info_set_format (&dec->info, format, rate, channels, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_dvdlpcmdec_setcaps (GstPad * pad, GstCaps * caps)
|
gst_dvdlpcmdec_set_format (GstAudioDecoder * bdec, GstCaps * caps)
|
||||||
{
|
{
|
||||||
|
GstDvdLpcmDec *dvdlpcmdec = GST_DVDLPCMDEC (bdec);
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
gboolean res = TRUE;
|
gboolean res = TRUE;
|
||||||
GstDvdLpcmDec *dvdlpcmdec;
|
|
||||||
GstAudioFormat format;
|
GstAudioFormat format;
|
||||||
gint rate, channels, width;
|
gint rate, channels, width;
|
||||||
|
|
||||||
g_return_val_if_fail (caps != NULL, FALSE);
|
gst_dvdlpcm_reset (dvdlpcmdec);
|
||||||
g_return_val_if_fail (pad != NULL, FALSE);
|
|
||||||
|
|
||||||
dvdlpcmdec = GST_DVDLPCMDEC (gst_pad_get_parent (pad));
|
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
|
|
||||||
/* If we have the DVD structured LPCM (including header) then we wait
|
/* If we have the DVD structured LPCM (including header) then we wait
|
||||||
* for incoming data before creating the output pad caps */
|
* for incoming data before creating the output pad caps */
|
||||||
if (gst_structure_has_name (structure, "audio/x-private1-lpcm")) {
|
if (gst_structure_has_name (structure, "audio/x-private1-lpcm")) {
|
||||||
gst_pad_set_chain_function (dvdlpcmdec->sinkpad, gst_dvdlpcmdec_chain_dvd);
|
dvdlpcmdec->mode = GST_LPCM_DVD;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_pad_set_chain_function (dvdlpcmdec->sinkpad, gst_dvdlpcmdec_chain_raw);
|
dvdlpcmdec->mode = GST_LPCM_RAW;
|
||||||
|
|
||||||
res &= gst_structure_get_int (structure, "rate", &rate);
|
res &= gst_structure_get_int (structure, "rate", &rate);
|
||||||
res &= gst_structure_get_int (structure, "channels", &channels);
|
res &= gst_structure_get_int (structure, "channels", &channels);
|
||||||
|
@ -318,59 +271,19 @@ gst_dvdlpcmdec_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
|
|
||||||
dvdlpcmdec->width = width;
|
dvdlpcmdec->width = width;
|
||||||
|
|
||||||
res = gst_dvdlpcmdec_set_outcaps (dvdlpcmdec);
|
res = gst_dvdlpcmdec_set_output_format (dvdlpcmdec);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
gst_object_unref (dvdlpcmdec);
|
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
caps_parse_error:
|
caps_parse_error:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (dvdlpcmdec, "Couldn't get parameters; missing caps?");
|
GST_DEBUG_OBJECT (dvdlpcmdec, "Couldn't get parameters; missing caps?");
|
||||||
gst_object_unref (dvdlpcmdec);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
update_timestamps (GstDvdLpcmDec * dvdlpcmdec, GstBuffer * buf, int samples)
|
|
||||||
{
|
|
||||||
gboolean take_buf_ts = FALSE;
|
|
||||||
gint rate;
|
|
||||||
|
|
||||||
rate = GST_AUDIO_INFO_RATE (&dvdlpcmdec->info);
|
|
||||||
|
|
||||||
GST_BUFFER_DURATION (buf) = gst_util_uint64_scale (samples, GST_SECOND, rate);
|
|
||||||
|
|
||||||
if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
|
|
||||||
if (GST_CLOCK_TIME_IS_VALID (dvdlpcmdec->timestamp)) {
|
|
||||||
GstClockTimeDiff one_sample = GST_SECOND / rate;
|
|
||||||
GstClockTimeDiff diff = GST_CLOCK_DIFF (GST_BUFFER_TIMESTAMP (buf),
|
|
||||||
dvdlpcmdec->timestamp);
|
|
||||||
|
|
||||||
if (diff > one_sample || diff < -one_sample)
|
|
||||||
take_buf_ts = TRUE;
|
|
||||||
} else {
|
|
||||||
take_buf_ts = TRUE;
|
|
||||||
}
|
|
||||||
} else if (!GST_CLOCK_TIME_IS_VALID (dvdlpcmdec->timestamp)) {
|
|
||||||
dvdlpcmdec->timestamp = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (take_buf_ts) {
|
|
||||||
/* Take buffer timestamp */
|
|
||||||
dvdlpcmdec->timestamp = GST_BUFFER_TIMESTAMP (buf);
|
|
||||||
} else {
|
|
||||||
GST_BUFFER_TIMESTAMP (buf) = dvdlpcmdec->timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
dvdlpcmdec->timestamp += GST_BUFFER_DURATION (buf);
|
|
||||||
|
|
||||||
GST_LOG_OBJECT (dvdlpcmdec, "Updated timestamp to %" GST_TIME_FORMAT,
|
|
||||||
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parse_header (GstDvdLpcmDec * dec, guint32 header)
|
parse_header (GstDvdLpcmDec * dec, guint32 header)
|
||||||
{
|
{
|
||||||
|
@ -430,73 +343,40 @@ parse_header (GstDvdLpcmDec * dec, guint32 header)
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_dvdlpcmdec_chain_dvd (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
gst_dvdlpcmdec_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstDvdLpcmDec *dvdlpcmdec;
|
GstDvdLpcmDec *dvdlpcmdec = GST_DVDLPCMDEC (parent);
|
||||||
GstMapInfo map;
|
guint8 data[2];
|
||||||
guint8 *data;
|
|
||||||
gsize size;
|
gsize size;
|
||||||
guint first_access;
|
guint first_access;
|
||||||
guint32 header;
|
|
||||||
GstBuffer *subbuf;
|
GstBuffer *subbuf;
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
gint off, len;
|
gint off, len;
|
||||||
gint rate, channels;
|
|
||||||
|
|
||||||
dvdlpcmdec = GST_DVDLPCMDEC (parent);
|
if (dvdlpcmdec->mode != GST_LPCM_DVD)
|
||||||
|
return dvdlpcmdec->base_chain (pad, parent, buf);
|
||||||
gst_buffer_map (buf, &map, GST_MAP_READ);
|
|
||||||
data = map.data;
|
|
||||||
size = map.size;
|
|
||||||
|
|
||||||
|
size = gst_buffer_get_size (buf);
|
||||||
if (size < 5)
|
if (size < 5)
|
||||||
goto too_small;
|
goto too_small;
|
||||||
|
|
||||||
/* We have a 5 byte header, now.
|
gst_buffer_extract (buf, 0, data, 2);
|
||||||
* The first two bytes are a (big endian) 16 bit offset into our buffer.
|
|
||||||
* The buffer timestamp refers to this offset.
|
|
||||||
*
|
|
||||||
* The other three bytes are a (big endian) number in which the header is
|
|
||||||
* encoded.
|
|
||||||
*/
|
|
||||||
first_access = (data[0] << 8) | data[1];
|
first_access = (data[0] << 8) | data[1];
|
||||||
if (first_access > size)
|
if (first_access > size)
|
||||||
goto invalid_data;
|
goto invalid_data;
|
||||||
|
|
||||||
/* Don't keep the 'frame number' low 5 bits of the first byte */
|
/* After first_access, we have an additional 3 bytes of header data; this
|
||||||
header = ((data[2] & 0xC0) << 16) | (data[3] << 8) | data[4];
|
* is included within the value of first_access.
|
||||||
|
|
||||||
/* see if we have a new header */
|
|
||||||
if (header != dvdlpcmdec->header) {
|
|
||||||
parse_header (dvdlpcmdec, header);
|
|
||||||
|
|
||||||
if (!gst_dvdlpcmdec_set_outcaps (dvdlpcmdec))
|
|
||||||
goto negotiation_failed;
|
|
||||||
|
|
||||||
dvdlpcmdec->header = header;
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_LOG_OBJECT (dvdlpcmdec, "first_access %d, buffer length %" G_GSIZE_FORMAT,
|
|
||||||
first_access, size);
|
|
||||||
|
|
||||||
rate = GST_AUDIO_INFO_RATE (&dvdlpcmdec->info);
|
|
||||||
channels = GST_AUDIO_INFO_CHANNELS (&dvdlpcmdec->info);
|
|
||||||
|
|
||||||
/* After first_access, we have an additional 3 bytes of data we've parsed and
|
|
||||||
* don't want to handle; this is included within the value of first_access.
|
|
||||||
* So a first_access value of between 1 and 3 is just broken, we treat that
|
* So a first_access value of between 1 and 3 is just broken, we treat that
|
||||||
* the same as zero. first_access == 4 means we only need to create a single
|
* the same as zero. first_access == 4 means we only need to create a single
|
||||||
* sub-buffer, greater than that we need to create two. */
|
* sub-buffer, greater than that we need to create two. */
|
||||||
|
|
||||||
/* skip access unit bytes and info */
|
/* skip access unit bytes */
|
||||||
off = 5;
|
off = 2;
|
||||||
|
|
||||||
if (first_access > 4) {
|
if (first_access > 4) {
|
||||||
guint samples = 0;
|
|
||||||
GstClockTime ts;
|
|
||||||
|
|
||||||
/* length of first buffer */
|
/* length of first buffer */
|
||||||
len = first_access - 4;
|
len = first_access - 1;
|
||||||
|
|
||||||
GST_LOG_OBJECT (dvdlpcmdec, "Creating first sub-buffer off %d, len %d",
|
GST_LOG_OBJECT (dvdlpcmdec, "Creating first sub-buffer off %d, len %d",
|
||||||
off, len);
|
off, len);
|
||||||
|
@ -506,36 +386,8 @@ gst_dvdlpcmdec_chain_dvd (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
||||||
goto bad_first_access;
|
goto bad_first_access;
|
||||||
|
|
||||||
subbuf = gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL, off, len);
|
subbuf = gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL, off, len);
|
||||||
|
GST_BUFFER_TIMESTAMP (subbuf) = GST_CLOCK_TIME_NONE;
|
||||||
/* If we don't have a stored timestamp from the last packet,
|
ret = dvdlpcmdec->base_chain (pad, parent, subbuf);
|
||||||
* (it's straight after a new-segment, but we have one on the
|
|
||||||
* first access buffer, then calculate the timestamp to align
|
|
||||||
* this buffer to just before the first_access buffer */
|
|
||||||
if (!GST_CLOCK_TIME_IS_VALID (dvdlpcmdec->timestamp) &&
|
|
||||||
GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
|
|
||||||
switch (dvdlpcmdec->width) {
|
|
||||||
case 16:
|
|
||||||
samples = len / channels / 2;
|
|
||||||
break;
|
|
||||||
case 20:
|
|
||||||
samples = (len / channels) * 2 / 5;
|
|
||||||
break;
|
|
||||||
case 24:
|
|
||||||
samples = len / channels / 3;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (samples != 0) {
|
|
||||||
ts = gst_util_uint64_scale (samples, GST_SECOND, rate);
|
|
||||||
if (ts < GST_BUFFER_TIMESTAMP (buf))
|
|
||||||
GST_BUFFER_TIMESTAMP (subbuf) = GST_BUFFER_TIMESTAMP (buf) - ts;
|
|
||||||
else
|
|
||||||
GST_BUFFER_TIMESTAMP (subbuf) = 0;
|
|
||||||
} else {
|
|
||||||
GST_BUFFER_TIMESTAMP (subbuf) = GST_CLOCK_TIME_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = gst_dvdlpcmdec_chain_raw (pad, parent, subbuf);
|
|
||||||
if (ret != GST_FLOW_OK)
|
if (ret != GST_FLOW_OK)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
|
@ -547,10 +399,14 @@ gst_dvdlpcmdec_chain_dvd (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
||||||
len);
|
len);
|
||||||
|
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
|
GstMemory *header, *tmp;
|
||||||
subbuf = gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL, off, len);
|
subbuf = gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL, off, len);
|
||||||
|
tmp = gst_buffer_peek_memory (buf, 0);
|
||||||
|
header = gst_memory_copy (tmp, 2, 3);
|
||||||
|
gst_buffer_prepend_memory (subbuf, header);
|
||||||
GST_BUFFER_TIMESTAMP (subbuf) = GST_BUFFER_TIMESTAMP (buf);
|
GST_BUFFER_TIMESTAMP (subbuf) = GST_BUFFER_TIMESTAMP (buf);
|
||||||
|
|
||||||
ret = gst_dvdlpcmdec_chain_raw (pad, parent, subbuf);
|
ret = dvdlpcmdec->base_chain (pad, parent, subbuf);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
GST_LOG_OBJECT (dvdlpcmdec,
|
GST_LOG_OBJECT (dvdlpcmdec,
|
||||||
|
@ -558,11 +414,10 @@ gst_dvdlpcmdec_chain_dvd (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
||||||
size - off);
|
size - off);
|
||||||
subbuf = gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL, off, size - off);
|
subbuf = gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL, off, size - off);
|
||||||
GST_BUFFER_TIMESTAMP (subbuf) = GST_BUFFER_TIMESTAMP (buf);
|
GST_BUFFER_TIMESTAMP (subbuf) = GST_BUFFER_TIMESTAMP (buf);
|
||||||
ret = gst_dvdlpcmdec_chain_raw (pad, parent, subbuf);
|
ret = dvdlpcmdec->base_chain (pad, parent, subbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
gst_buffer_unmap (buf, &map);
|
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -585,13 +440,6 @@ invalid_data:
|
||||||
ret = GST_FLOW_OK;
|
ret = GST_FLOW_OK;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
negotiation_failed:
|
|
||||||
{
|
|
||||||
GST_ELEMENT_ERROR (dvdlpcmdec, STREAM, FORMAT, (NULL),
|
|
||||||
("Failed to configure output format"));
|
|
||||||
ret = GST_FLOW_NOT_NEGOTIATED;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
bad_first_access:
|
bad_first_access:
|
||||||
{
|
{
|
||||||
GST_WARNING_OBJECT (pad, "Bad first_access parameter in buffer");
|
GST_WARNING_OBJECT (pad, "Bad first_access parameter in buffer");
|
||||||
|
@ -604,15 +452,87 @@ bad_first_access:
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_dvdlpcmdec_chain_raw (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
gst_dvdlpcmdec_parse_dvd (GstDvdLpcmDec * dvdlpcmdec, GstAdapter * adapter,
|
||||||
|
gint * offset, gint * len)
|
||||||
{
|
{
|
||||||
GstDvdLpcmDec *dvdlpcmdec;
|
guint32 header;
|
||||||
|
const guint8 *data;
|
||||||
|
|
||||||
|
data = (const guint8 *) gst_adapter_map (adapter, 3);
|
||||||
|
if (!data)
|
||||||
|
goto too_small;
|
||||||
|
|
||||||
|
/* Don't keep the 'frame number' low 5 bits of the first byte */
|
||||||
|
header = ((data[0] & 0xC0) << 16) | (data[1] << 8) | data[2];
|
||||||
|
|
||||||
|
gst_adapter_unmap (adapter);
|
||||||
|
|
||||||
|
/* see if we have a new header */
|
||||||
|
if (header != dvdlpcmdec->header) {
|
||||||
|
parse_header (dvdlpcmdec, header);
|
||||||
|
|
||||||
|
if (!gst_dvdlpcmdec_set_output_format (dvdlpcmdec))
|
||||||
|
goto negotiation_failed;
|
||||||
|
|
||||||
|
dvdlpcmdec->header = header;
|
||||||
|
}
|
||||||
|
|
||||||
|
*offset = 3;
|
||||||
|
*len = gst_adapter_available (adapter) - 3;
|
||||||
|
|
||||||
|
return GST_FLOW_OK;
|
||||||
|
|
||||||
|
/* ERRORS */
|
||||||
|
too_small:
|
||||||
|
{
|
||||||
|
/* Buffer is too small */
|
||||||
|
GST_ELEMENT_WARNING (dvdlpcmdec, STREAM, DECODE,
|
||||||
|
("Invalid data found parsing LPCM packet"),
|
||||||
|
("LPCM packet was too small. Dropping"));
|
||||||
|
*offset = gst_adapter_available (adapter);
|
||||||
|
return GST_FLOW_EOS;
|
||||||
|
}
|
||||||
|
negotiation_failed:
|
||||||
|
{
|
||||||
|
GST_ELEMENT_ERROR (dvdlpcmdec, STREAM, FORMAT, (NULL),
|
||||||
|
("Failed to configure output format"));
|
||||||
|
return GST_FLOW_NOT_NEGOTIATED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static GstFlowReturn
|
||||||
|
gst_dvdlpcmdec_parse (GstAudioDecoder * bdec, GstAdapter * adapter,
|
||||||
|
gint * offset, gint * len)
|
||||||
|
{
|
||||||
|
GstDvdLpcmDec *dvdlpcmdec = GST_DVDLPCMDEC (bdec);
|
||||||
|
|
||||||
|
switch (dvdlpcmdec->mode) {
|
||||||
|
case GST_LPCM_UNKNOWN:
|
||||||
|
return GST_FLOW_NOT_NEGOTIATED;
|
||||||
|
|
||||||
|
case GST_LPCM_RAW:
|
||||||
|
*offset = 0;
|
||||||
|
*len = gst_adapter_available (adapter);
|
||||||
|
return GST_FLOW_OK;
|
||||||
|
|
||||||
|
case GST_LPCM_DVD:
|
||||||
|
return gst_dvdlpcmdec_parse_dvd (dvdlpcmdec, adapter, offset, len);
|
||||||
|
}
|
||||||
|
return GST_FLOW_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GstFlowReturn
|
||||||
|
gst_dvdlpcmdec_handle_frame (GstAudioDecoder * bdec, GstBuffer * buf)
|
||||||
|
{
|
||||||
|
GstDvdLpcmDec *dvdlpcmdec = GST_DVDLPCMDEC (bdec);
|
||||||
gsize size;
|
gsize size;
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
guint samples = 0;
|
guint samples = 0;
|
||||||
gint rate, channels;
|
gint rate, channels;
|
||||||
|
|
||||||
dvdlpcmdec = GST_DVDLPCMDEC (parent);
|
/* no fancy draining */
|
||||||
|
if (G_UNLIKELY (!buf))
|
||||||
|
return GST_FLOW_OK;
|
||||||
|
|
||||||
size = gst_buffer_get_size (buf);
|
size = gst_buffer_get_size (buf);
|
||||||
|
|
||||||
|
@ -626,9 +546,6 @@ gst_dvdlpcmdec_chain_raw (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
||||||
if (rate == 0)
|
if (rate == 0)
|
||||||
goto not_negotiated;
|
goto not_negotiated;
|
||||||
|
|
||||||
if (GST_BUFFER_TIMESTAMP_IS_VALID (buf))
|
|
||||||
dvdlpcmdec->timestamp = GST_BUFFER_TIMESTAMP (buf);
|
|
||||||
|
|
||||||
/* We don't currently do anything at all regarding emphasis, mute or
|
/* We don't currently do anything at all regarding emphasis, mute or
|
||||||
* dynamic_range - I'm not sure what they're for */
|
* dynamic_range - I'm not sure what they're for */
|
||||||
switch (dvdlpcmdec->width) {
|
switch (dvdlpcmdec->width) {
|
||||||
|
@ -639,7 +556,8 @@ gst_dvdlpcmdec_chain_raw (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
||||||
samples = size / channels / 2;
|
samples = size / channels / 2;
|
||||||
if (samples < 1)
|
if (samples < 1)
|
||||||
goto drop;
|
goto drop;
|
||||||
buf = gst_buffer_make_writable (buf);
|
|
||||||
|
gst_buffer_ref (buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 20:
|
case 20:
|
||||||
|
@ -688,7 +606,6 @@ gst_dvdlpcmdec_chain_raw (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
||||||
}
|
}
|
||||||
gst_buffer_unmap (outbuf, &destmap);
|
gst_buffer_unmap (outbuf, &destmap);
|
||||||
gst_buffer_unmap (buf, &srcmap);
|
gst_buffer_unmap (buf, &srcmap);
|
||||||
gst_buffer_unref (buf);
|
|
||||||
buf = outbuf;
|
buf = outbuf;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -698,51 +615,57 @@ gst_dvdlpcmdec_chain_raw (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
||||||
* and last byte are already correct */
|
* and last byte are already correct */
|
||||||
guint count = size / 12;
|
guint count = size / 12;
|
||||||
gint i;
|
gint i;
|
||||||
GstMapInfo map;
|
GstMapInfo srcmap, destmap;
|
||||||
guint8 *ptr;
|
guint8 *src, *dest;
|
||||||
|
GstBuffer *outbuf;
|
||||||
|
|
||||||
samples = size / channels / 3;
|
samples = size / channels / 3;
|
||||||
|
|
||||||
if (samples < 1)
|
if (samples < 1)
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
/* Ensure our output buffer is writable */
|
outbuf = gst_buffer_new_allocate (NULL, size, NULL);
|
||||||
buf = gst_buffer_make_writable (buf);
|
gst_buffer_copy_into (outbuf, buf, GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
|
||||||
|
|
||||||
gst_buffer_map (buf, &map, GST_MAP_READWRITE);
|
gst_buffer_map (buf, &srcmap, GST_MAP_READ);
|
||||||
ptr = map.data;
|
gst_buffer_map (outbuf, &destmap, GST_MAP_READWRITE);
|
||||||
|
src = srcmap.data;
|
||||||
|
dest = destmap.data;
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
guint8 tmp;
|
dest[0] = src[0];
|
||||||
|
dest[1] = src[1];
|
||||||
|
dest[11] = src[11];
|
||||||
|
dest[10] = src[7];
|
||||||
|
dest[7] = src[5];
|
||||||
|
dest[5] = src[9];
|
||||||
|
dest[9] = src[6];
|
||||||
|
dest[6] = src[4];
|
||||||
|
dest[4] = src[3];
|
||||||
|
dest[3] = src[2];
|
||||||
|
dest[2] = src[8];
|
||||||
|
dest[8] = src[10];
|
||||||
|
|
||||||
tmp = ptr[10];
|
src += 12;
|
||||||
ptr[10] = ptr[7];
|
dest += 12;
|
||||||
ptr[7] = ptr[5];
|
|
||||||
ptr[5] = ptr[9];
|
|
||||||
ptr[9] = ptr[6];
|
|
||||||
ptr[6] = ptr[4];
|
|
||||||
ptr[4] = ptr[3];
|
|
||||||
ptr[3] = ptr[2];
|
|
||||||
ptr[2] = ptr[8];
|
|
||||||
ptr[8] = tmp;
|
|
||||||
|
|
||||||
ptr += 12;
|
|
||||||
}
|
}
|
||||||
gst_buffer_unmap (buf, &map);
|
gst_buffer_unmap (outbuf, &destmap);
|
||||||
|
gst_buffer_unmap (buf, &srcmap);
|
||||||
|
buf = outbuf;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
goto invalid_width;
|
goto invalid_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
update_timestamps (dvdlpcmdec, buf, samples);
|
if (dvdlpcmdec->lpcm_layout) {
|
||||||
|
buf = gst_buffer_make_writable (buf);
|
||||||
if (dvdlpcmdec->lpcm_layout)
|
|
||||||
gst_audio_buffer_reorder_channels (buf, dvdlpcmdec->info.finfo->format,
|
gst_audio_buffer_reorder_channels (buf, dvdlpcmdec->info.finfo->format,
|
||||||
dvdlpcmdec->info.channels, dvdlpcmdec->lpcm_layout,
|
dvdlpcmdec->info.channels, dvdlpcmdec->lpcm_layout,
|
||||||
dvdlpcmdec->info.position);
|
dvdlpcmdec->info.position);
|
||||||
|
}
|
||||||
|
|
||||||
ret = gst_pad_push (dvdlpcmdec->srcpad, buf);
|
ret = gst_audio_decoder_finish_frame (bdec, buf, 1);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -752,7 +675,6 @@ drop:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (dvdlpcmdec,
|
GST_DEBUG_OBJECT (dvdlpcmdec,
|
||||||
"Buffer of size %" G_GSIZE_FORMAT " is too small. Dropping", size);
|
"Buffer of size %" G_GSIZE_FORMAT " is too small. Dropping", size);
|
||||||
gst_buffer_unref (buf);
|
|
||||||
ret = GST_FLOW_OK;
|
ret = GST_FLOW_OK;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -760,7 +682,6 @@ not_negotiated:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (dvdlpcmdec, STREAM, FORMAT, (NULL),
|
GST_ELEMENT_ERROR (dvdlpcmdec, STREAM, FORMAT, (NULL),
|
||||||
("Buffer pushed before negotiation"));
|
("Buffer pushed before negotiation"));
|
||||||
gst_buffer_unref (buf);
|
|
||||||
ret = GST_FLOW_NOT_NEGOTIATED;
|
ret = GST_FLOW_NOT_NEGOTIATED;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -768,88 +689,14 @@ invalid_width:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (dvdlpcmdec, STREAM, WRONG_TYPE, (NULL),
|
GST_ELEMENT_ERROR (dvdlpcmdec, STREAM, WRONG_TYPE, (NULL),
|
||||||
("Invalid sample width configured"));
|
("Invalid sample width configured"));
|
||||||
gst_buffer_unref (buf);
|
|
||||||
ret = GST_FLOW_NOT_NEGOTIATED;
|
ret = GST_FLOW_NOT_NEGOTIATED;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
dvdlpcmdec_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
|
||||||
{
|
|
||||||
GstDvdLpcmDec *dvdlpcmdec;
|
|
||||||
gboolean res;
|
|
||||||
|
|
||||||
dvdlpcmdec = GST_DVDLPCMDEC (parent);
|
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
|
||||||
case GST_EVENT_CAPS:
|
|
||||||
{
|
|
||||||
GstCaps *caps;
|
|
||||||
|
|
||||||
gst_event_parse_caps (event, &caps);
|
|
||||||
res = gst_dvdlpcmdec_setcaps (pad, caps);
|
|
||||||
gst_event_unref (event);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GST_EVENT_SEGMENT:
|
|
||||||
{
|
|
||||||
GstSegment seg;
|
|
||||||
|
|
||||||
gst_event_copy_segment (event, &seg);
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (dvdlpcmdec, "segment %" GST_SEGMENT_FORMAT, &seg);
|
|
||||||
|
|
||||||
dvdlpcmdec->segment = seg;
|
|
||||||
|
|
||||||
if (seg.format == GST_FORMAT_TIME) {
|
|
||||||
dvdlpcmdec->timestamp = GST_CLOCK_TIME_NONE;
|
|
||||||
} else {
|
|
||||||
dvdlpcmdec->timestamp = 0;
|
|
||||||
}
|
|
||||||
res = gst_pad_push_event (dvdlpcmdec->srcpad, event);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GST_EVENT_FLUSH_STOP:
|
|
||||||
gst_segment_init (&dvdlpcmdec->segment, GST_FORMAT_UNDEFINED);
|
|
||||||
res = gst_pad_push_event (dvdlpcmdec->srcpad, event);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
res = gst_pad_push_event (dvdlpcmdec->srcpad, event);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstStateChangeReturn
|
|
||||||
gst_dvdlpcmdec_change_state (GstElement * element, GstStateChange transition)
|
|
||||||
{
|
|
||||||
GstDvdLpcmDec *dvdlpcmdec = GST_DVDLPCMDEC (element);
|
|
||||||
GstStateChangeReturn res;
|
|
||||||
|
|
||||||
switch (transition) {
|
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
|
||||||
gst_dvdlpcm_reset (dvdlpcmdec);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = parent_class->change_state (element, transition);
|
|
||||||
|
|
||||||
switch (transition) {
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
plugin_init (GstPlugin * plugin)
|
plugin_init (GstPlugin * plugin)
|
||||||
{
|
{
|
||||||
GST_DEBUG_CATEGORY_INIT (dvdlpcm_debug, "dvdlpcmdec", 0, "DVD LPCM Decoder");
|
|
||||||
|
|
||||||
if (!gst_element_register (plugin, "dvdlpcmdec", GST_RANK_PRIMARY,
|
if (!gst_element_register (plugin, "dvdlpcmdec", GST_RANK_PRIMARY,
|
||||||
GST_TYPE_DVDLPCMDEC)) {
|
GST_TYPE_DVDLPCMDEC)) {
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/audio/audio.h>
|
#include <gst/audio/audio.h>
|
||||||
|
#include <gst/audio/gstaudiodecoder.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -40,11 +41,18 @@ G_BEGIN_DECLS
|
||||||
typedef struct _GstDvdLpcmDec GstDvdLpcmDec;
|
typedef struct _GstDvdLpcmDec GstDvdLpcmDec;
|
||||||
typedef struct _GstDvdLpcmDecClass GstDvdLpcmDecClass;
|
typedef struct _GstDvdLpcmDecClass GstDvdLpcmDecClass;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
GST_LPCM_UNKNOWN,
|
||||||
|
GST_LPCM_RAW,
|
||||||
|
GST_LPCM_DVD,
|
||||||
|
} GstDvdLpcmMode;
|
||||||
|
|
||||||
struct _GstDvdLpcmDec {
|
struct _GstDvdLpcmDec {
|
||||||
GstElement element;
|
GstAudioDecoder element;
|
||||||
|
|
||||||
GstPad *sinkpad,*srcpad;
|
GstPadChainFunction base_chain;
|
||||||
|
|
||||||
|
GstDvdLpcmMode mode;
|
||||||
guint32 header;
|
guint32 header;
|
||||||
|
|
||||||
GstAudioInfo info;
|
GstAudioInfo info;
|
||||||
|
@ -55,11 +63,10 @@ struct _GstDvdLpcmDec {
|
||||||
gint mute;
|
gint mute;
|
||||||
|
|
||||||
GstClockTime timestamp;
|
GstClockTime timestamp;
|
||||||
GstSegment segment;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstDvdLpcmDecClass {
|
struct _GstDvdLpcmDecClass {
|
||||||
GstElementClass parent_class;
|
GstAudioDecoderClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gst_dvdlpcmdec_get_type (void);
|
GType gst_dvdlpcmdec_get_type (void);
|
||||||
|
|
Loading…
Reference in a new issue