[FFmpeg-cvslog] r20853 - in trunk/libavformat: flvdec.c flvenc.c

daniel subversion
Mon Dec 14 04:30:25 CET 2009


Author: daniel
Date: Mon Dec 14 04:30:25 2009
New Revision: 20853

Log:
FLV 8-bit PCM is unsigned, not signed

Fixes issue #1569

Modified:
   trunk/libavformat/flvdec.c
   trunk/libavformat/flvenc.c

Modified: trunk/libavformat/flvdec.c
==============================================================================
--- trunk/libavformat/flvdec.c	Mon Dec 14 04:23:45 2009	(r20852)
+++ trunk/libavformat/flvdec.c	Mon Dec 14 04:30:25 2009	(r20853)
@@ -50,7 +50,7 @@ static void flv_set_audio_codec(AVFormat
     switch(flv_codecid) {
         //no distinction between S16 and S8 PCM codec flags
         case FLV_CODECID_PCM:
-            acodec->codec_id = acodec->bits_per_coded_sample == 8 ? CODEC_ID_PCM_S8 :
+            acodec->codec_id = acodec->bits_per_coded_sample == 8 ? CODEC_ID_PCM_U8 :
 #if HAVE_BIGENDIAN
                                 CODEC_ID_PCM_S16BE;
 #else
@@ -58,7 +58,7 @@ static void flv_set_audio_codec(AVFormat
 #endif
             break;
         case FLV_CODECID_PCM_LE:
-            acodec->codec_id = acodec->bits_per_coded_sample == 8 ? CODEC_ID_PCM_S8 : CODEC_ID_PCM_S16LE; break;
+            acodec->codec_id = acodec->bits_per_coded_sample == 8 ? CODEC_ID_PCM_U8 : CODEC_ID_PCM_S16LE; break;
         case FLV_CODECID_AAC  : acodec->codec_id = CODEC_ID_AAC;                                    break;
         case FLV_CODECID_ADPCM: acodec->codec_id = CODEC_ID_ADPCM_SWF;                              break;
         case FLV_CODECID_SPEEX:

Modified: trunk/libavformat/flvenc.c
==============================================================================
--- trunk/libavformat/flvenc.c	Mon Dec 14 04:23:45 2009	(r20852)
+++ trunk/libavformat/flvenc.c	Mon Dec 14 04:30:25 2009	(r20853)
@@ -38,7 +38,7 @@ static const AVCodecTag flv_video_codec_
 
 static const AVCodecTag flv_audio_codec_ids[] = {
     {CODEC_ID_MP3,       FLV_CODECID_MP3    >> FLV_AUDIO_CODECID_OFFSET},
-    {CODEC_ID_PCM_S8,    FLV_CODECID_PCM    >> FLV_AUDIO_CODECID_OFFSET},
+    {CODEC_ID_PCM_U8,    FLV_CODECID_PCM    >> FLV_AUDIO_CODECID_OFFSET},
     {CODEC_ID_PCM_S16BE, FLV_CODECID_PCM    >> FLV_AUDIO_CODECID_OFFSET},
     {CODEC_ID_PCM_S16LE, FLV_CODECID_PCM_LE >> FLV_AUDIO_CODECID_OFFSET},
     {CODEC_ID_ADPCM_SWF, FLV_CODECID_ADPCM  >> FLV_AUDIO_CODECID_OFFSET},
@@ -107,7 +107,7 @@ static int get_audio_flags(AVCodecContex
     case CODEC_ID_MP3:
         flags |= FLV_CODECID_MP3    | FLV_SAMPLESSIZE_16BIT;
         break;
-    case CODEC_ID_PCM_S8:
+    case CODEC_ID_PCM_U8:
         flags |= FLV_CODECID_PCM    | FLV_SAMPLESSIZE_8BIT;
         break;
     case CODEC_ID_PCM_S16BE:
@@ -248,7 +248,7 @@ static int flv_write_header(AVFormatCont
         put_amf_double(pb, audio_enc->sample_rate);
 
         put_amf_string(pb, "audiosamplesize");
-        put_amf_double(pb, audio_enc->codec_id == CODEC_ID_PCM_S8 ? 8 : 16);
+        put_amf_double(pb, audio_enc->codec_id == CODEC_ID_PCM_U8 ? 8 : 16);
 
         put_amf_string(pb, "stereo");
         put_amf_bool(pb, audio_enc->channels == 2);



More information about the ffmpeg-cvslog mailing list