[FFmpeg-devel] [PATCH] AST muxer

jamal jamrial at gmail.com
Sat Nov 24 19:10:12 CET 2012


On 24/11/12 6:03 AM, Paul B Mahol wrote:
>> +const AVCodecTag ff_codec_ast_tags[] = {
>> +    { AV_CODEC_ID_ADPCM_AFC,          0 },
>> +    { AV_CODEC_ID_PCM_S16BE_PLANAR,   1 },
>> +    { AV_CODEC_ID_NONE,               0 },
> 
> Better use some other value for NONE.

Regardless of what value i use with AV_CODEC_ID_NONE, enc->codec_tag or even ff_codec_get_tag() will return 0.
Other muxers with an entry using codec_tag 0 are also using that same value for AV_CODEC_ID_NONE (Check for example voc muxer), so I think it should be left like this.

>>      st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
>> +    st->codec->codec_id   = ff_codec_get_id(ff_codec_ast_tags, codec);
>> +    st->codec->codec_tag  = codec;
> 
> Do not set this.

st->codec->codec_tag? Ok.

>> +static int ast_write_header(AVFormatContext *s)
>> +{
>> +    ASTMuxContext *ast = s->priv_data;
>> +    AVIOContext *pb = s->pb;
>> +    AVCodecContext *enc = NULL;
>> +
>> +    if(s->nb_streams = 1) {
>> +        enc = s->streams[0]->codec;
>> +    } else {
>> +        av_log(s, AV_LOG_ERROR, "Muxer supports only one stream\n");
>> +        return AVERROR_INVALIDDATA;
>> +    }
>> +
>> +    if(!enc->codec_tag && enc->codec_id != AV_CODEC_ID_ADPCM_AFC) {
> 
> This can be simplified by returning 0xFFFF codec tag or similar.

See above, enc->codec_tag would not get that value.

Regards.


More information about the ffmpeg-devel mailing list