changeset 16134:a1fd1a7eeb35

lavf demuxer with raw PCM fix (and a related hang)
author reimar
date Thu, 28 Jul 2005 13:43:24 +0000
parents 2678255514cc
children 7457c791204e
files libmpcodecs/ad_pcm.c libmpdemux/demux_lavf.c
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_pcm.c	Thu Jul 28 13:08:03 2005 +0000
+++ b/libmpcodecs/ad_pcm.c	Thu Jul 28 13:43:24 2005 +0000
@@ -67,6 +67,8 @@
        break;
     default: if(sh_audio->samplesize!=2) sh_audio->sample_format=AF_FORMAT_U8;
   }
+  if (!sh_audio->samplesize) // this would cause MPlayer to hang later
+    sh_audio->samplesize = 2;
   return 1;
 }
 
--- a/libmpdemux/demux_lavf.c	Thu Jul 28 13:08:03 2005 +0000
+++ b/libmpdemux/demux_lavf.c	Thu Jul 28 13:43:24 2005 +0000
@@ -217,6 +217,16 @@
             sh_audio->channels= codec->channels;
             sh_audio->samplerate= codec->sample_rate;
             sh_audio->i_bps= codec->bit_rate/8;
+            switch (codec->codec_id) {
+              case CODEC_ID_PCM_S8:
+              case CODEC_ID_PCM_U8:
+                sh_audio->samplesize = 1;
+              case CODEC_ID_PCM_S16LE:
+              case CODEC_ID_PCM_S16BE:
+              case CODEC_ID_PCM_U16LE:
+              case CODEC_ID_PCM_U16BE:
+                sh_audio->samplesize = 2;
+            }
             if(verbose>=1) print_wave_header(sh_audio->wf);
             if(demuxer->audio->id != i && demuxer->audio->id != -1)
                 st->discard= AVDISCARD_ALL;