[FFmpeg-cvslog] r13206 - trunk/libavformat/mpeg.c

bcoudurier subversion
Wed May 21 04:26:43 CEST 2008


Author: bcoudurier
Date: Wed May 21 04:26:42 2008
New Revision: 13206

Log:
support dvd pcm 20/24 bits, patch by Lars T?uber, lars.taeuber gmx net

Modified:
   trunk/libavformat/mpeg.c

Modified: trunk/libavformat/mpeg.c
==============================================================================
--- trunk/libavformat/mpeg.c	(original)
+++ trunk/libavformat/mpeg.c	Wed May 21 04:26:42 2008
@@ -474,7 +474,8 @@ static int mpegps_read_packet(AVFormatCo
         codec_id = CODEC_ID_DTS;
     } else if (startcode >= 0xa0 && startcode <= 0xaf) {
         type = CODEC_TYPE_AUDIO;
-        codec_id = CODEC_ID_PCM_S16BE;
+        /* 16 bit form will be handled as CODEC_ID_PCM_S16BE */
+        codec_id = CODEC_ID_PCM_DVD;
     } else if (startcode >= 0xb0 && startcode <= 0xbf) {
         type = CODEC_TYPE_AUDIO;
         codec_id = CODEC_ID_MLP;
@@ -519,7 +520,14 @@ static int mpegps_read_packet(AVFormatCo
         freq = (b1 >> 4) & 3;
         st->codec->sample_rate = lpcm_freq_tab[freq];
         st->codec->channels = 1 + (b1 & 7);
-        st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * 2;
+        st->codec->bits_per_sample = 16 + ((b1 >> 6) & 3) * 4;
+        st->codec->bit_rate = st->codec->channels *
+                              st->codec->sample_rate *
+                              st->codec->bits_per_sample;
+        if (st->codec->bits_per_sample == 16)
+            st->codec->codec_id = CODEC_ID_PCM_S16BE;
+        else if (st->codec->bits_per_sample == 28)
+            return AVERROR(EINVAL);
     }
     av_new_packet(pkt, len);
     get_buffer(s->pb, pkt->data, pkt->size);




More information about the ffmpeg-cvslog mailing list