gst/realmedia/rmdemux.c: Add suport for mpeg4 and aac audio. See #556714.

Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_add_stream),
(gst_rmdemux_descramble_mp4a_audio),
(gst_rmdemux_handle_scrambled_packet):
Add suport for mpeg4 and aac audio. See #556714.
This commit is contained in:
Wim Taymans 2008-10-24 12:47:05 +00:00
parent 46c5294930
commit 5aa3023505
3 changed files with 69 additions and 9 deletions

View file

@ -1,3 +1,10 @@
2008-10-24 Wim Taymans <wim.taymans@collabora.co.uk>
* gst/realmedia/rmdemux.c: (gst_rmdemux_add_stream),
(gst_rmdemux_descramble_mp4a_audio),
(gst_rmdemux_handle_scrambled_packet):
Add suport for mpeg4 and aac audio. See #556714.
2008-10-14 Michael Smith <msmith@songbirdnest.com>
* gst/mpegaudioparse/gstmpegaudioparse.c:

2
common

@ -1 +1 @@
Subproject commit 46eefd2f8474ee748864c59635be87b5a29317d1
Subproject commit 2802bb17517a6cfbbb1be6da61ec19151be0750b

View file

@ -1375,18 +1375,21 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
stream->subpackets = NULL;
break;
/* RealAudio 10 (AAC) */
case GST_RM_AUD_RAAC:
codec_name = "Real Audio 10 (AAC)";
version = 10;
break;
/* MPEG-4 based */
case GST_RM_AUD_RAAC:
case GST_RM_AUD_RACP:
/* FIXME: codec_name = */
codec_name = "MPEG4 audio";
stream_caps =
gst_caps_new_simple ("audio/mpeg", "mpegversion", G_TYPE_INT,
(int) 4, NULL);
(int) 4, "framed", G_TYPE_BOOLEAN, TRUE, NULL);
if (stream->extra_data_size > 0) {
/* strip off an unknown byte in the extra data */
stream->extra_data_size--;
stream->extra_data++;
}
stream->needs_descrambling = TRUE;
stream->subpackets_needed = 1;
stream->subpackets = NULL;
break;
/* Sony ATRAC3 */
@ -1978,6 +1981,52 @@ gst_rmdemux_descramble_dnet_audio (GstRMDemux * rmdemux,
return gst_pad_push (stream->pad, buf);
}
static GstFlowReturn
gst_rmdemux_descramble_mp4a_audio (GstRMDemux * rmdemux,
GstRMDemuxStream * stream)
{
GstFlowReturn res;
GstBuffer *buf, *outbuf;
guint frames, index, i;
guint8 *data;
guint size;
GstClockTime timestamp;
res = GST_FLOW_OK;
buf = g_ptr_array_index (stream->subpackets, 0);
g_ptr_array_index (stream->subpackets, 0) = NULL;
g_ptr_array_set_size (stream->subpackets, 0);
data = GST_BUFFER_DATA (buf);
size = GST_BUFFER_SIZE (buf);
timestamp = GST_BUFFER_TIMESTAMP (buf);
frames = (data[1] & 0xf0) >> 4;
index = 2 * frames + 2;
for (i = 0; i < frames; i++) {
guint len = (data[i * 2 + 2] << 8) | data[i * 2 + 3];
outbuf = gst_buffer_create_sub (buf, index, len);
if (i == 0)
GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (stream->pad));
index += len;
if (stream->discont) {
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
stream->discont = FALSE;
}
res = gst_pad_push (stream->pad, outbuf);
if (res != GST_FLOW_OK)
break;
}
gst_buffer_unref (buf);
return res;
}
static GstFlowReturn
gst_rmdemux_handle_scrambled_packet (GstRMDemux * rmdemux,
GstRMDemuxStream * stream, GstBuffer * buf, gboolean keyframe)
@ -2008,6 +2057,10 @@ gst_rmdemux_handle_scrambled_packet (GstRMDemux * rmdemux,
case GST_RM_AUD_COOK:
ret = gst_rmdemux_descramble_cook_audio (rmdemux, stream);
break;
case GST_RM_AUD_RAAC:
case GST_RM_AUD_RACP:
ret = gst_rmdemux_descramble_mp4a_audio (rmdemux, stream);
break;
default:
g_assert_not_reached ();
}