[FFmpeg-devel] [PATCH] w64 muxer

Paul B Mahol onemda at gmail.com
Mon Dec 31 09:46:47 CET 2012


On 12/30/12, Stefano Sabatini <stefasab at gmail.com> wrote:
> On date Friday 2012-12-28 16:48:55 +0000, Paul B Mahol encoded:
>> Signed-off-by: Paul B Mahol <onemda at gmail.com>
>> ---
>>  doc/general.texi         |  2 +-
>>  libavformat/Makefile     |  3 +-
>>  libavformat/allformats.c |  2 +-
>>  libavformat/w64.c        | 33 ++++++++++++++++++++
>>  libavformat/w64.h        | 27 ++++++++++++++++
>>  libavformat/wavdec.c     | 27 +++++-----------
>>  libavformat/wavenc.c     | 81
>> ++++++++++++++++++++++++++++++++++++++++++++++++
>>  7 files changed, 153 insertions(+), 22 deletions(-)
>>  create mode 100644 libavformat/w64.c
>>  create mode 100644 libavformat/w64.h
>>

[...]

>> +    avio_wl64(pb, INT64_MAX);
>> +    return pos;
>> +}
>
> nit:
> static void start_guid(AVIOContext *pb, const uint8_t *guid, int64_t
> *start);
>
> since the return is usually used to return a code
>

done

>> +
>> +static void end_guid(AVIOContext *pb, int64_t start)
>> +{
>> +    int64_t end, pos = avio_tell(pb);
>> +
>> +    end = FFALIGN(pos, 8);
>> +    ffio_fill(pb, 0, end - pos);
>> +    avio_seek(pb, start + 16, SEEK_SET);
>> +    avio_wl64(pb, end - start);
>> +    avio_seek(pb, end, SEEK_SET);
>> +}
>> +
>> +static int w64_write_header(AVFormatContext *s)
>> +{
>> +    WAVMuxContext *wav = s->priv_data;
>> +    AVIOContext *pb = s->pb;
>> +    int64_t start;
>> +
>> +    avio_write(pb, ff_guid_riff, sizeof(ff_guid_riff));
>> +    avio_wl64(pb, -1);
>> +    avio_write(pb, ff_guid_wave, sizeof(ff_guid_wave));
>> +    start = start_guid(pb, ff_guid_fmt);
>
>> +    if (ff_put_wav_header(pb, s->streams[0]->codec) < 0) {
>> +        av_log(s, AV_LOG_ERROR, "%s codec not supported in WAVE
>> format\n",
>> +               s->streams[0]->codec->codec ?
>> s->streams[0]->codec->codec->name : "NONE");
>> +        return AVERROR(EINVAL);
>> +    }
>
> nit: here you could propagate the function error code

done

>
> [...]
>
> I couldn't spot any evident mistake and LGTM, thanks.

applied with some extra fixes and fate coverage.

> --
> FFmpeg = Fierce & Frightening Mega Programmable Empowered God
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list