[FFmpeg-devel] [PATCH 2/3] lavc/mjpeg_parser: use ff_mjpeg_decode_header to parse frame info

Carl Eugen Hoyos ceffmpeg at gmail.com
Thu Jun 27 22:13:41 EEST 2019


Am Do., 27. Juni 2019 um 14:59 Uhr schrieb Zhong Li <zhong.li at intel.com>:

> +/* return the 8 bit start code value and update the search
> +   state. Return -1 if no start code found */
> +static int find_frame_header_marker(const uint8_t **pbuf_ptr, const uint8_t *buf_end)
> +{
> +    const uint8_t *buf_ptr;
> +    unsigned int v, v2;
> +    int val;
> +    int skipped = 0;
> +
> +    buf_ptr = *pbuf_ptr;
> +    while (buf_end - buf_ptr > 1) {
> +        v  = *buf_ptr++;
> +        v2 = *buf_ptr;
> +        if ((v == 0xff) && buf_ptr < buf_end &&
> +            ((v2 >= SOF0) && (v2 <= SOF3)) ) {
> +            val = *buf_ptr++;
> +            goto found;
> +        }
> +        skipped++;
> +    }
> +    buf_ptr = buf_end;
> +    val = -1;
> +found:
> +    ff_dlog(NULL, "find_marker skipped %d bytes\n", skipped);
> +    *pbuf_ptr = buf_ptr;
> +    return val;
> +}

Sorry for not realizing this earlier (I searched for "SOF0"):
Why is this function duplicated?

Carl Eugen


More information about the ffmpeg-devel mailing list