changeset 34884:57bb464310a7

Add ralf audio support
author rtogni
date Sun, 27 May 2012 18:12:42 +0000
parents 3efd3d87424b
children e8af23854aa1
files libmpdemux/demux_real.c
diffstat 1 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_real.c	Fri May 25 20:31:11 2012 +0000
+++ b/libmpdemux/demux_real.c	Sun May 27 18:12:42 2012 +0000
@@ -1493,7 +1493,26 @@
 
 		    ++a_streams;
 	  } else if (strstr(mimet,"x-ralf-mpeg4")) {
-		 mp_msg(MSGT_DEMUX,MSGL_ERR,"Real lossless audio not supported yet\n");
+		    sh_audio_t *sh = new_sh_audio(demuxer, stream_id, NULL);
+    		    mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "real", stream_id);
+
+		    // Check extradata len, we can't store bigger values in cbSize anyway
+		    if ((unsigned)codec_data_size > 0xffff) {
+		        mp_msg(MSGT_DEMUX,MSGL_ERR,"Extradata too big (%d)\n", codec_data_size);
+			goto skip_this_chunk;
+		    }
+		    /* Emulate WAVEFORMATEX struct: */
+		    sh->wf = calloc(1, sizeof(*sh->wf)+codec_data_size);
+		    sh->wf->nChannels = 0;
+		    sh->wf->wBitsPerSample = 16;
+		    sh->wf->nSamplesPerSec = 0;
+		    sh->wf->nAvgBytesPerSec = 0;
+		    sh->wf->nBlockAlign = 0;
+		    sh->wf->wFormatTag = sh->format = mmioFOURCC('L','S','D',':');
+		    sh->wf->cbSize = codec_data_size;
+		    stream_read(demuxer->stream, (char*)(sh->wf+1), codec_data_size);
+
+		    ++a_streams;
 	  } else if (strstr(mimet,"x-pn-encrypted-ra")) {
 		 mp_msg(MSGT_DEMUX,MSGL_ERR,"Encrypted audio is not supported\n");
 	  } else {