diff options
author | Edward Hervey <bilboed@bilboed.com> | 2008-08-25 14:15:43 +0000 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2008-08-25 14:15:43 +0000 |
commit | dbea08db341b91272d561b7b027e397aedea9503 (patch) | |
tree | 95a3e2592508ca6e92a196acef66f766ecb036eb /gst/matroska/matroska-mux.c | |
parent | c0826dc21d0ee5c7119354fe1da9a499cef44905 (diff) |
gst/matroska/: Add Real[Audio|Video] support to Matroska containers.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_send_event),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps),
(gst_matroska_mux_audio_pad_setcaps), (gst_matroska_mux_finish):
Add Real[Audio|Video] support to Matroska containers.
It works fine for:
* decoding real audio/video streams contained in mkv
* 'transmuxing' real (.rm) files into .mkv files
It will not work though for encoding real[audio/video] streams that
don't contain the 'mdpr_data' extra data on the caps.
The reason why this will not work is because I never intended to
duplicate virtually all the 'mdpr' block creation into mkvmux.
Fixes #536067
Diffstat (limited to 'gst/matroska/matroska-mux.c')
-rw-r--r-- | gst/matroska/matroska-mux.c | 84 |
1 files changed, 83 insertions, 1 deletions
diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c index 6138bcb4..dfe51a07 100644 --- a/gst/matroska/matroska-mux.c +++ b/gst/matroska/matroska-mux.c @@ -91,6 +91,9 @@ static GstStaticPadTemplate videosink_templ = "video/x-theora; " "video/x-dirac, " COMMON_VIDEO_CAPS "; " + "video/x-pn-realvideo, " + "rmversion = (int) [1, 4], " + COMMON_VIDEO_CAPS "; " "video/x-raw-yuv, " "format = (fourcc) { YUY2, I420, YV12, UYVY, AYUV }, " COMMON_VIDEO_CAPS) @@ -149,7 +152,9 @@ static GstStaticPadTemplate audiosink_templ = COMMON_AUDIO_CAPS ";" "audio/x-tta, " "width = (int) { 8, 16, 24 }, " - "channels = (int) { 1, 2 }, " "rate = (int) [ 8000, 96000 ]") + "channels = (int) { 1, 2 }, " "rate = (int) [ 8000, 96000 ]; " + "audio/x-pn-realaudio, " + "raversion = (int) { 1, 2, 8 }, " COMMON_AUDIO_CAPS ";") ); static GstStaticPadTemplate subtitlesink_templ = @@ -752,6 +757,45 @@ skip_details: context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3); return TRUE; + } else if (!strcmp (mimetype, "video/x-pn-realvideo")) { + gint rmversion; + const GValue *mdpr_data; + + gst_structure_get_int (structure, "rmversion", &rmversion); + switch (rmversion) { + case 1: + context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO1); + break; + case 2: + context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO2); + break; + case 3: + context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO3); + break; + case 4: + context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO4); + break; + default: + return FALSE; + } + + mdpr_data = gst_structure_get_value (structure, "mdpr_data"); + if (mdpr_data != NULL) { + guint8 *priv_data = NULL; + guint priv_data_size = 0; + + GstBuffer *codec_data_buf = g_value_peek_pointer (mdpr_data); + + priv_data_size = GST_BUFFER_SIZE (codec_data_buf); + priv_data = g_malloc0 (priv_data_size); + + memcpy (priv_data, GST_BUFFER_DATA (codec_data_buf), priv_data_size); + + context->codec_priv = priv_data; + context->codec_priv_size = priv_data_size; + } + + return TRUE; } return FALSE; @@ -1204,6 +1248,42 @@ gst_matroska_mux_audio_pad_setcaps (GstPad * pad, GstCaps * caps) context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_TTA); return TRUE; + } else if (!strcmp (mimetype, "audio/x-pn-realaudio")) { + gint raversion; + const GValue *mdpr_data; + + gst_structure_get_int (structure, "raversion", &raversion); + switch (raversion) { + case 1: + context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_REAL_14_4); + break; + case 2: + context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_REAL_28_8); + break; + case 8: + context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_REAL_COOK); + break; + default: + return FALSE; + } + + mdpr_data = gst_structure_get_value (structure, "mdpr_data"); + if (mdpr_data != NULL) { + guint8 *priv_data = NULL; + guint priv_data_size = 0; + + GstBuffer *codec_data_buf = g_value_peek_pointer (mdpr_data); + + priv_data_size = GST_BUFFER_SIZE (codec_data_buf); + priv_data = g_malloc0 (priv_data_size); + + memcpy (priv_data, GST_BUFFER_DATA (codec_data_buf), priv_data_size); + + context->codec_priv = priv_data; + context->codec_priv_size = priv_data_size; + } + + return TRUE; } return FALSE; @@ -1687,6 +1767,8 @@ gst_matroska_mux_finish (GstMatroskaMux * mux) if (tags != NULL) { guint64 master_tags, master_tag; + GST_DEBUG ("Writing tags"); + /* TODO: maybe limit via the TARGETS id by looking at the source pad */ mux->tags_pos = ebml->pos; master_tags = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TAGS); |