/* We have the whole packet now so we should push the packet to
* the src pad now. First though we should check if we need to do
* descrambling */
- if (G_UNLIKELY (demux->span > 1)) {
+ if (G_UNLIKELY (stream->span > 1)) {
gst_asf_demux_descramble_buffer (demux, stream, &payload->buf);
}
return NULL;
}
-static void
+static AsfStream *
gst_asf_demux_setup_pad (GstASFDemux * demux, GstPad * src_pad,
GstCaps * caps, guint16 id, gboolean is_video, GstTagList * tags)
{
++demux->num_streams;
stream->active = FALSE;
+
+ return stream;
}
-static void
+static AsfStream *
gst_asf_demux_add_audio_stream (GstASFDemux * demux,
asf_stream_audio * audio, guint16 id, guint8 ** p_data, guint64 * p_size)
{
++demux->num_audio_streams;
- gst_asf_demux_setup_pad (demux, src_pad, caps, id, FALSE, tags);
+ return gst_asf_demux_setup_pad (demux, src_pad, caps, id, FALSE, tags);
}
-static void
+static AsfStream *
gst_asf_demux_add_video_stream (GstASFDemux * demux,
asf_stream_video_format * video, guint16 id,
guint8 ** p_data, guint64 * p_size)
++demux->num_video_streams;
- gst_asf_demux_setup_pad (demux, src_pad, caps, id, TRUE, tags);
+ return gst_asf_demux_setup_pad (demux, src_pad, caps, id, TRUE, tags);
}
static void
guint type_specific_size G_GNUC_UNUSED;
guint unknown G_GNUC_UNUSED;
gboolean inspect_payload = FALSE;
- AsfStream *stream;
+ AsfStream *stream = NULL;
/* Get the rest of the header's header */
if (size < (16 + 16 + 8 + 4 + 4 + 2 + 4))
GST_INFO ("Object is an audio stream with %u bytes of additional data",
audio_object.size);
- gst_asf_demux_add_audio_stream (demux, &audio_object, stream_id,
+ stream = gst_asf_demux_add_audio_stream (demux, &audio_object, stream_id,
&data, &size);
switch (correction_type) {
data_size = gst_asf_demux_get_uint16 (&data, &size);
silence_data = gst_asf_demux_get_uint8 (&data, &size);
- /* FIXME: shouldn't this be per-stream? */
- demux->span = span;
+ stream->span = span;
GST_DEBUG_OBJECT (demux, "Descrambling ps:%u cs:%u ds:%u s:%u sd:%u",
packet_size, chunk_size, data_size, span, silence_data);
- if (demux->span > 1) {
+ if (stream->span > 1) {
if (chunk_size == 0 || ((packet_size / chunk_size) <= 1)) {
/* Disable descrambling */
- demux->span = 0;
+ stream->span = 0;
} else {
/* FIXME: this else branch was added for
* weird_al_yankovic - the saga begins.asf */
- demux->ds_packet_size = packet_size;
- demux->ds_chunk_size = chunk_size;
+ stream->ds_packet_size = packet_size;
+ stream->ds_chunk_size = chunk_size;
}
} else {
/* Descambling is enabled */
- demux->ds_packet_size = packet_size;
- demux->ds_chunk_size = chunk_size;
+ stream->ds_packet_size = packet_size;
+ stream->ds_chunk_size = chunk_size;
}
#if 0
/* Now skip the rest of the silence data */
goto not_enough_data;
}
- gst_asf_demux_add_video_stream (demux, &video_format_object, stream_id,
- &data, &size);
+ stream = gst_asf_demux_add_video_stream (demux, &video_format_object,
+ stream_id, &data, &size);
break;
}
break;
}
- stream = gst_asf_demux_get_stream (demux, stream_id);
if (stream)
stream->inspect_payload = inspect_payload;
return stream;
scrambled_buffer = *p_buffer;
if (gst_buffer_get_size (scrambled_buffer) <
- demux->ds_packet_size * demux->span)
+ stream->ds_packet_size * stream->span)
return;
for (offset = 0; offset < gst_buffer_get_size (scrambled_buffer);
- offset += demux->ds_chunk_size) {
- off = offset / demux->ds_chunk_size;
- row = off / demux->span;
- col = off % demux->span;
- idx = row + col * demux->ds_packet_size / demux->ds_chunk_size;
+ offset += stream->ds_chunk_size) {
+ off = offset / stream->ds_chunk_size;
+ row = off / stream->span;
+ col = off % stream->span;
+ idx = row + col * stream->ds_packet_size / stream->ds_chunk_size;
GST_DEBUG ("idx=%u, row=%u, col=%u, off=%u, ds_chunk_size=%u", idx, row,
- col, off, demux->ds_chunk_size);
+ col, off, stream->ds_chunk_size);
GST_DEBUG ("scrambled buffer size=%" G_GSIZE_FORMAT
", span=%u, packet_size=%u", gst_buffer_get_size (scrambled_buffer),
- demux->span, demux->ds_packet_size);
+ stream->span, stream->ds_packet_size);
GST_DEBUG ("gst_buffer_get_size (scrambled_buffer) = %" G_GSIZE_FORMAT,
gst_buffer_get_size (scrambled_buffer));
sub_buffer =
gst_buffer_copy_region (scrambled_buffer, GST_BUFFER_COPY_MEMORY,
- idx * demux->ds_chunk_size, demux->ds_chunk_size);
+ idx * stream->ds_chunk_size, stream->ds_chunk_size);
if (!offset) {
descrambled_buffer = sub_buffer;
} else {