# HG changeset patch # User michaelni # Date 1061198402 0 # Node ID 01bec1059bdfb48d810a27ff3e855a79eaf9841e # Parent 0edf7458da7b4b8b71ab0d421a56d95e5c6a20d1 use codec_tag for encoding too diff -r 0edf7458da7b -r 01bec1059bdf asf.c --- a/asf.c Tue Aug 12 18:20:29 2003 +0000 +++ b/asf.c Mon Aug 18 09:20:02 2003 +0000 @@ -411,13 +411,23 @@ put_le16(pb, asf->streams[n].num); put_str16(pb, p ? p->name : enc->codec_name); put_le16(pb, 0); /* no parameters */ + + /* id */ if (enc->codec_type == CODEC_TYPE_AUDIO) { put_le16(pb, 2); - put_le16(pb, codec_get_tag(codec_wav_tags, enc->codec_id)); + if(!enc->codec_tag) + enc->codec_tag = codec_get_tag(codec_wav_tags, enc->codec_id); + if(!enc->codec_tag) + return -1; + put_le16(pb, enc->codec_tag); } else { put_le16(pb, 4); - put_le32(pb, codec_get_tag(codec_bmp_tags, enc->codec_id)); + if(!enc->codec_tag) + enc->codec_tag = codec_get_tag(codec_bmp_tags, enc->codec_id); + if(!enc->codec_tag) + return -1; + put_le32(pb, enc->codec_tag); } } end_header(pb, hpos); diff -r 0edf7458da7b -r 01bec1059bdf au.c --- a/au.c Tue Aug 12 18:20:29 2003 +0000 +++ b/au.c Mon Aug 18 09:20:02 2003 +0000 @@ -42,15 +42,14 @@ /* AUDIO_FILE header */ static int put_au_header(ByteIOContext *pb, AVCodecContext *enc) { - int tag; - - tag = codec_get_tag(codec_au_tags, enc->codec_id); - if (tag == 0) + if(!enc->codec_tag) + enc->codec_tag = codec_get_tag(codec_au_tags, enc->codec_id); + if(!enc->codec_tag) return -1; put_tag(pb, ".snd"); /* magic number */ put_be32(pb, 24); /* header size */ put_be32(pb, AU_UNKOWN_SIZE); /* data size */ - put_be32(pb, (uint32_t)tag); /* codec ID */ + put_be32(pb, (uint32_t)enc->codec_tag); /* codec ID */ put_be32(pb, enc->sample_rate); put_be32(pb, (uint32_t)enc->channels); return 0; diff -r 0edf7458da7b -r 01bec1059bdf wav.c --- a/wav.c Tue Aug 12 18:20:29 2003 +0000 +++ b/wav.c Mon Aug 18 09:20:02 2003 +0000 @@ -38,13 +38,15 @@ /* returns the size or -1 on error */ int put_wav_header(ByteIOContext *pb, AVCodecContext *enc) { - int tag, bps, blkalign, bytespersec; + int bps, blkalign, bytespersec; int hdrsize = 18; - tag = codec_get_tag(codec_wav_tags, enc->codec_id); - if (tag == 0) + if(!enc->codec_tag) + enc->codec_tag = codec_get_tag(codec_wav_tags, enc->codec_id); + if(!enc->codec_tag) return -1; - put_le16(pb, tag); + + put_le16(pb, enc->codec_tag); put_le16(pb, enc->channels); put_le32(pb, enc->sample_rate); if (enc->codec_id == CODEC_ID_PCM_U8 ||