From 58fb0b6288e2e50740fd02165e97824975ca105e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Loeuillet?= Date: Mon, 4 Oct 2004 18:27:54 +0000 Subject: [PATCH] - better detection of audio/video stream for files not produced by real official codec Original commit message from CVS: - better detection of audio/video stream for files not produced by real official codec - enable parsing of CONT sections (a text field, sort of title for the file) - modify ac3 audio output a bit --- gst/realmedia/rmdemux.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/gst/realmedia/rmdemux.c b/gst/realmedia/rmdemux.c index 2109819a6d..f7b6141332 100644 --- a/gst/realmedia/rmdemux.c +++ b/gst/realmedia/rmdemux.c @@ -558,7 +558,9 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream) /* DolbyNet (Dolby AC3, low bitrate) */ case GST_RM_AUD_DNET: - stream->caps = gst_caps_new_simple ("audio/x-ac3", NULL); + stream->caps = + gst_caps_new_simple ("audio/x-ac3", "rate", G_TYPE_INT, + (int) stream->rate, NULL); break; /* MPEG-4 based */ @@ -759,11 +761,18 @@ gst_rmdemux_parse_mdpr (GstRMDemux * rmdemux, void *data, int length) offset += re_skip_pascal_string (data + offset); stream2_type_string = re_get_pascal_string (data + offset); offset += re_skip_pascal_string (data + offset); - /* It could either be "Video Stream" or "The Video Stream", - same thing for Audio */ - if (strstr (stream1_type_string, "Video Stream")) { + + /* stream1_type_string for audio and video stream is a "put_whatever_you_want" field : + observed values : + - "[The ]Video/Audio Stream" (File produced by an official Real encoder) + - "RealVideoPremierePlugIn-VIDEO/AUDIO" (File produced by Abobe Premiere) + + so, we should not rely on it to know which stream type it is + */ + + if (strcmp (stream2_type_string, "video/x-pn-realvideo") == 0) { stream_type = GST_RMDEMUX_STREAM_VIDEO; - } else if (strstr (stream1_type_string, "Audio Stream")) { + } else if (strcmp (stream2_type_string, "audio/x-pn-realaudio") == 0) { stream_type = GST_RMDEMUX_STREAM_AUDIO; } else if (strcmp (stream1_type_string, "") == 0 && strcmp (stream2_type_string, "logical-fileinfo") == 0) { @@ -1033,9 +1042,10 @@ gst_rmdemux_dump_data (GstRMDemux * rmdemux, void *data, int length) static void gst_rmdemux_parse_cont (GstRMDemux * rmdemux, void *data, int length) { -// int offset = 0; + int offset = 0; -// offset += re_dump_pascal_string ( data + offset + 3 ); + GST_DEBUG ("File Content : (CONT)"); + offset += re_dump_pascal_string (data + offset + 3); } static void