Revision 2288834f

View differences:

libavformat/mov.c
665 665
    return 0;
666 666
}
667 667

  
668
/**
669
 * Compute codec id for 'lpcm' tag.
670
 * See CoreAudioTypes and AudioStreamBasicDescription at Apple.
671
 */
672
static int mov_get_lpcm_codec_id(int bps, int flags)
673
{
674
    if (flags & 1) { // floating point
675
        if (flags & 2) { // big endian
676
            if      (bps == 32) return CODEC_ID_PCM_F32BE;
677
          //else if (bps == 64) return CODEC_ID_PCM_F64BE;
678
        } else {
679
          //if      (bps == 32) return CODEC_ID_PCM_F32LE;
680
          //else if (bps == 64) return CODEC_ID_PCM_F64LE;
681
        }
682
    } else {
683
        if (flags & 2) {
684
            if      (bps == 8)
685
                // signed integer
686
                if (flags & 4)  return CODEC_ID_PCM_S8;
687
                else            return CODEC_ID_PCM_U8;
688
            else if (bps == 16) return CODEC_ID_PCM_S16BE;
689
            else if (bps == 24) return CODEC_ID_PCM_S24BE;
690
            else if (bps == 32) return CODEC_ID_PCM_S32BE;
691
        } else {
692
            if      (bps == 8)
693
                if (flags & 4)  return CODEC_ID_PCM_S8;
694
                else            return CODEC_ID_PCM_U8;
695
            if      (bps == 16) return CODEC_ID_PCM_S16LE;
696
            else if (bps == 24) return CODEC_ID_PCM_S24LE;
697
            else if (bps == 32) return CODEC_ID_PCM_S32LE;
698
        }
699
    }
700
    return 0;
701
}
702

  
668 703
static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
669 704
{
670 705
    AVStream *st = c->fc->streams[c->fc->nb_streams-1];
......
865 900
                    flags = get_be32(pb); /* lcpm format specific flag */
866 901
                    sc->bytes_per_frame = get_be32(pb); /* bytes per audio packet if constant */
867 902
                    sc->samples_per_frame = get_be32(pb); /* lpcm frames per audio packet if constant */
868
                    if (flags & 2) // big endian
869
                        st->codec->codec_id = CODEC_ID_PCM_S16BE;
903
                    if (format == MKTAG('l','p','c','m'))
904
                        st->codec->codec_id = mov_get_lpcm_codec_id(st->codec->bits_per_sample, flags);
870 905
                }
871 906
            }
872 907

  

Also available in: Unified diff