[FFmpeg-devel] Gaining access to a encoder context in avformat?

Reimar Döffinger Reimar.Doeffinger at gmx.de
Fri Feb 27 20:54:37 CET 2015


On Tue, Feb 24, 2015 at 10:10:21AM +0000, Kevin Wheatley wrote:
> +    if (track->vos_data && track->vos_len > 0x29) { 
> +        if (track->vos_data[0] == 0x00 &&
> +            track->vos_data[1] == 0x00 &&
> +            track->vos_data[2] == 0x02 &&
> +            track->vos_data[3] == 0x80 &&
> +            (track->vos_data[4] == 0x01 || track->vos_data[4] == 0x02)) {
> +            /* looks like a DNxHD bit stream */
> +            interlaced = (track->vos_data[5] & 2);
> +            cid = AV_RB32(track->vos_data + 0x28);
> +        } else {
> +            av_log(NULL, AV_LOG_WARNING, "Could not locate DNxHD bit stream in vos_data\n");
> +            return 0;
> +        }
> +    } else {
> +        av_log(NULL, AV_LOG_WARNING, "Could not locate DNxHD bit stream, vos_data too small\n");
> +        return 0;
> +    }

Note for future patches:
If you have a case that returns, please put it in the "if" part.
That way you do not need the "else" part and in this specific
case you would have avoided two nesting levels, IMHO making the
code a lot more readable.


More information about the ffmpeg-devel mailing list