Commit 88084eec authored by Carl Eugen Hoyos's avatar Carl Eugen Hoyos

Use little endian for caf codec tags.

parent 9e4ed295
...@@ -32,34 +32,34 @@ ...@@ -32,34 +32,34 @@
* Known codec tags for CAF * Known codec tags for CAF
*/ */
const AVCodecTag ff_codec_caf_tags[] = { const AVCodecTag ff_codec_caf_tags[] = {
{ CODEC_ID_AAC, MKBETAG('a','a','c',' ') }, { CODEC_ID_AAC, MKTAG('a','a','c',' ') },
{ CODEC_ID_AC3, MKBETAG('a','c','-','3') }, { CODEC_ID_AC3, MKTAG('a','c','-','3') },
{ CODEC_ID_ALAC, MKBETAG('a','l','a','c') }, { CODEC_ID_ALAC, MKTAG('a','l','a','c') },
/* FIXME: use DV demuxer, as done in MOV */ /* FIXME: use DV demuxer, as done in MOV */
/*{ CODEC_ID_DVAUDIO, MKBETAG('v','d','v','a') },*/ /*{ CODEC_ID_DVAUDIO, MKTAG('v','d','v','a') },*/
/*{ CODEC_ID_DVAUDIO, MKBETAG('d','v','c','a') },*/ /*{ CODEC_ID_DVAUDIO, MKTAG('d','v','c','a') },*/
{ CODEC_ID_ADPCM_IMA_QT, MKBETAG('i','m','a','4') }, { CODEC_ID_ADPCM_IMA_QT, MKTAG('i','m','a','4') },
{ CODEC_ID_ADPCM_IMA_WAV, MKBETAG('m','s', 0, 17 ) }, { CODEC_ID_ADPCM_IMA_WAV, MKTAG('m','s', 0, 17 ) },
{ CODEC_ID_ADPCM_MS, MKBETAG('m','s', 0, 2 ) }, { CODEC_ID_ADPCM_MS, MKTAG('m','s', 0, 2 ) },
{ CODEC_ID_AMR_NB, MKBETAG('s','a','m','r') }, { CODEC_ID_AMR_NB, MKTAG('s','a','m','r') },
{ CODEC_ID_GSM, MKBETAG('a','g','s','m') }, { CODEC_ID_GSM, MKTAG('a','g','s','m') },
{ CODEC_ID_GSM_MS, MKBETAG('m','s', 0, '1') }, { CODEC_ID_GSM_MS, MKTAG('m','s', 0, '1') },
{ CODEC_ID_MACE3, MKBETAG('M','A','C','3') }, { CODEC_ID_MACE3, MKTAG('M','A','C','3') },
{ CODEC_ID_MACE6, MKBETAG('M','A','C','6') }, { CODEC_ID_MACE6, MKTAG('M','A','C','6') },
{ CODEC_ID_MP3, MKBETAG('.','m','p','3') }, { CODEC_ID_MP3, MKTAG('.','m','p','3') },
{ CODEC_ID_MP3, MKBETAG('m','s', 0 ,'U') }, { CODEC_ID_MP3, MKTAG('m','s', 0 ,'U') },
{ CODEC_ID_MP2, MKBETAG('.','m','p','2') }, { CODEC_ID_MP2, MKTAG('.','m','p','2') },
{ CODEC_ID_MP1, MKBETAG('.','m','p','1') }, { CODEC_ID_MP1, MKTAG('.','m','p','1') },
{ CODEC_ID_PCM_ALAW, MKBETAG('a','l','a','w') }, { CODEC_ID_PCM_ALAW, MKTAG('a','l','a','w') },
{ CODEC_ID_PCM_MULAW, MKBETAG('u','l','a','w') }, { CODEC_ID_PCM_MULAW, MKTAG('u','l','a','w') },
{ CODEC_ID_QCELP, MKBETAG('Q','c','l','p') }, { CODEC_ID_QCELP, MKTAG('Q','c','l','p') },
{ CODEC_ID_QDM2, MKBETAG('Q','D','M','2') }, { CODEC_ID_QDM2, MKTAG('Q','D','M','2') },
{ CODEC_ID_QDM2, MKBETAG('Q','D','M','C') }, { CODEC_ID_QDM2, MKTAG('Q','D','M','C') },
/* currently unsupported codecs */ /* currently unsupported codecs */
/*{ AC-3 over S/PDIF MKBETAG('c','a','c','3') },*/ /*{ AC-3 over S/PDIF MKTAG('c','a','c','3') },*/
/*{ MPEG4CELP MKBETAG('c','e','l','p') },*/ /*{ MPEG4CELP MKTAG('c','e','l','p') },*/
/*{ MPEG4HVXC MKBETAG('h','v','x','c') },*/ /*{ MPEG4HVXC MKTAG('h','v','x','c') },*/
/*{ MPEG4TwinVQ MKBETAG('t','w','v','q') },*/ /*{ MPEG4TwinVQ MKTAG('t','w','v','q') },*/
{ CODEC_ID_NONE, 0 }, { CODEC_ID_NONE, 0 },
}; };
...@@ -68,7 +68,7 @@ static int read_desc_chunk(AVFormatContext *s) ...@@ -68,7 +68,7 @@ static int read_desc_chunk(AVFormatContext *s)
/* parse format description */ /* parse format description */
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->sample_rate = av_int2dbl(avio_rb64(pb)); st->codec->sample_rate = av_int2dbl(avio_rb64(pb));
st->codec->codec_tag = avio_rb32(pb); st->codec->codec_tag = avio_rl32(pb);
flags = avio_rb32(pb); flags = avio_rb32(pb);
caf->bytes_per_packet = avio_rb32(pb); caf->bytes_per_packet = avio_rb32(pb);
st->codec->block_align = caf->bytes_per_packet; st->codec->block_align = caf->bytes_per_packet;
...@@ -85,7 +85,7 @@ static int read_desc_chunk(AVFormatContext *s) ...@@ -85,7 +85,7 @@ static int read_desc_chunk(AVFormatContext *s)
} }
/* determine codec */ /* determine codec */
if (st->codec->codec_tag == MKBETAG('l','p','c','m')) if (st->codec->codec_tag == MKTAG('l','p','c','m'))
st->codec->codec_id = ff_mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, (flags ^ 0x2) | 0x4); st->codec->codec_id = ff_mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, (flags ^ 0x2) | 0x4);
else else
st->codec->codec_id = ff_codec_get_id(ff_codec_caf_tags, st->codec->codec_tag); st->codec->codec_id = ff_codec_get_id(ff_codec_caf_tags, st->codec->codec_tag);
......
...@@ -114,7 +114,7 @@ static int caf_write_header(AVFormatContext *s) ...@@ -114,7 +114,7 @@ static int caf_write_header(AVFormatContext *s)
case CODEC_ID_PCM_F64BE: case CODEC_ID_PCM_F64BE:
case CODEC_ID_PCM_ALAW: case CODEC_ID_PCM_ALAW:
case CODEC_ID_PCM_MULAW: case CODEC_ID_PCM_MULAW:
codec_tag = MKBETAG('l','p','c','m'); codec_tag = MKTAG('l','p','c','m');
} }
if (!codec_tag) { if (!codec_tag) {
...@@ -134,7 +134,7 @@ static int caf_write_header(AVFormatContext *s) ...@@ -134,7 +134,7 @@ static int caf_write_header(AVFormatContext *s)
ffio_wfourcc(pb, "desc"); //< Audio Description chunk ffio_wfourcc(pb, "desc"); //< Audio Description chunk
avio_wb64(pb, 32); //< mChunkSize avio_wb64(pb, 32); //< mChunkSize
avio_wb64(pb, av_dbl2int(enc->sample_rate)); //< mSampleRate avio_wb64(pb, av_dbl2int(enc->sample_rate)); //< mSampleRate
avio_wb32(pb, codec_tag); //< mFormatID avio_wl32(pb, codec_tag); //< mFormatID
avio_wb32(pb, codec_flags(enc->codec_id)); //< mFormatFlags avio_wb32(pb, codec_flags(enc->codec_id)); //< mFormatFlags
avio_wb32(pb, enc->block_align); //< mBytesPerPacket avio_wb32(pb, enc->block_align); //< mBytesPerPacket
avio_wb32(pb, samples_per_packet(enc->codec_id, enc->channels)); //< mFramesPerPacket avio_wb32(pb, samples_per_packet(enc->codec_id, enc->channels)); //< mFramesPerPacket
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment