Mercurial > libavformat.hg
changeset 145:4f3960430e54 libavformat
4xm adpcm
author | michaelni |
---|---|
date | Tue, 03 Jun 2003 13:58:44 +0000 |
parents | 9e73bf732800 |
children | b9703b3c10b6 |
files | 4xm.c |
diffstat | 1 files changed, 12 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/4xm.c Wed May 28 23:50:00 2003 +0000 +++ b/4xm.c Tue Jun 03 13:58:44 2003 +0000 @@ -71,6 +71,7 @@ int bits; int channels; int stream_index; + int adpcm; } AudioTrack; typedef struct FourxmDemuxContext { @@ -172,9 +173,11 @@ return AVERROR_NOMEM; } } + fourxm->tracks[current_track].adpcm = LE_32(&header[i + 12]); fourxm->tracks[current_track].channels = LE_32(&header[i + 36]); fourxm->tracks[current_track].sample_rate = LE_32(&header[i + 40]); fourxm->tracks[current_track].bits = LE_32(&header[i + 44]); + printf("bps:%d\n", fourxm->tracks[current_track].bits); i += 8 + size; /* allocate a new AVStream */ @@ -192,7 +195,9 @@ st->codec.bit_rate = st->codec.channels * st->codec.sample_rate * st->codec.bits_per_sample; st->codec.block_align = st->codec.channels * st->codec.bits_per_sample; - if (st->codec.bits_per_sample == 8) + if (fourxm->tracks[current_track].adpcm) + st->codec.codec_id = CODEC_ID_ADPCM_4XM; + else if (st->codec.bits_per_sample == 8) st->codec.codec_id = CODEC_ID_PCM_U8; else st->codec.codec_id = CODEC_ID_PCM_S16LE; @@ -224,7 +229,7 @@ FourxmDemuxContext *fourxm = s->priv_data; ByteIOContext *pb = &s->pb; unsigned int fourcc_tag; - unsigned int size; + unsigned int size, out_size; int ret = 0; int track_number; int packet_read = 0; @@ -237,10 +242,9 @@ return ret; fourcc_tag = LE_32(&header[0]); size = LE_32(&header[4]); - +//printf(" %8X %c%c%c%c %d\n", fourcc_tag, fourcc_tag, fourcc_tag>>8, fourcc_tag>>16, fourcc_tag>>24, size); if (url_feof(pb)) return -EIO; - switch (fourcc_tag) { case LIST_TAG: @@ -277,7 +281,7 @@ id = LE_32(&pkt->data[12]); whole = LE_32(&pkt->data[16]); stats[id] += size - 12; -printf(" cfrm chunk id:%d size:%d whole:%d until now:%d\n", id, size, whole, stats[id]); +//printf(" cfrm chunk id:%d size:%d whole:%d until now:%d\n", id, size, whole, stats[id]); } if (ret < 0) @@ -290,7 +294,9 @@ case snd__TAG: printf (" snd_ chunk, "); track_number = get_le32(pb); - size = get_le32(pb); + out_size= get_le32(pb); + size-=8; + if (track_number == fourxm->selected_track) { printf ("correct track, dispatching...\n"); if (av_new_packet(pkt, size)) @@ -321,7 +327,6 @@ break; } } - return ret; }