[SCM] libav/experimental: Fix issue357 Do what the spec says, insane or not: " Format 0 (uncompressed) and Format 3 (uncompressed little-endian) are similar. Both encode uncompressed audio samples. For 8-bit samples, the two formats are identical. For 16-bit samples, the two formats differ in byte ordering. In Format 0, 16-bit samples are encoded and decoded according to the native byte ordering of the platform on which the encoder and Flash Player, respectively, are running. In Format 3, 16-bit samples are always encoded in little-endian order (least significant byte first), and are byte-swapped if necessary in Flash Player before playback. Format 0 is clearly disadvantageous because it introduces a playback platform dependency. For 16-bit samples, Format 3 is highly preferable to Format 0 for SWF version 4 or later. "

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:15:26 UTC 2013


The following commit has been merged in the experimental branch:
commit 58293e57e158cd18a522df42ebc56611f94cae5e
Author: Michael Niedermayer <michaelni at gmx.at>
Date:   Sun Feb 24 01:04:00 2008 +0000

    Fix issue357
    Do what the spec says, insane or not:
    "
    Format 0 (uncompressed) and Format 3 (uncompressed little-endian) are similar. Both encode
    uncompressed audio samples. For 8-bit samples, the two formats are identical. For 16-bit
    samples, the two formats differ in byte ordering. In Format 0, 16-bit samples are encoded and
    decoded according to the native byte ordering of the platform on which the encoder and Flash
    Player, respectively, are running. In Format 3, 16-bit samples are always encoded in little-endian
    order (least significant byte first), and are byte-swapped if necessary in Flash Player before
    playback. Format 0 is clearly disadvantageous because it introduces a playback platform
    dependency. For 16-bit samples, Format 3 is highly preferable to Format 0 for SWF version 4
    or later.
    "
    
    Originally committed as revision 12184 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 7cd9944..f21f352 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -42,7 +42,13 @@ static void flv_set_audio_codec(AVFormatContext *s, AVStream *astream, int flv_c
     switch(flv_codecid) {
         //no distinction between S16 and S8 PCM codec flags
         case FLV_CODECID_PCM:
-            acodec->codec_id = acodec->bits_per_sample == 8 ? CODEC_ID_PCM_S8 : CODEC_ID_PCM_S16BE; break;
+            acodec->codec_id = acodec->bits_per_sample == 8 ? CODEC_ID_PCM_S8 :
+#ifdef WORDS_BIGENDIAN
+                                CODEC_ID_PCM_S16BE;
+#else
+                                CODEC_ID_PCM_S16LE;
+#endif
+            break;
         case FLV_CODECID_PCM_LE:
             acodec->codec_id = acodec->bits_per_sample == 8 ? CODEC_ID_PCM_S8 : CODEC_ID_PCM_S16LE; break;
         case FLV_CODECID_ADPCM: acodec->codec_id = CODEC_ID_ADPCM_SWF;                              break;

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list