[FFmpeg-devel] [PATCH v20 02/10] avcodec/evc_parser: Added parser implementation for EVC format
James Almer
jamrial at gmail.com
Wed Apr 19 16:12:16 EEST 2023
On 4/18/2023 7:30 AM, Dawid Kozinski wrote:
> static EVCParserSliceHeader *parse_slice_header(const uint8_t *bs, int bs_size, EVCParserContext *ev)
> {
> GetBitContext gb;
> EVCParserSliceHeader *sh;
> EVCParserPPS *pps;
> EVCParserSPS *sps;
>
> int num_tiles_in_slice = 0;
> int slice_pic_parameter_set_id;
>
> if (init_get_bits8(&gb, bs, bs_size) < 0)
> return NULL;
>
> slice_pic_parameter_set_id = get_ue_golomb(&gb);
>
> if (slice_pic_parameter_set_id < 0 || slice_pic_parameter_set_id >= EVC_MAX_PPS_COUNT)
> return NULL;
>
> sh = &ev->slice_header[slice_pic_parameter_set_id];
> pps = &ev->pps[slice_pic_parameter_set_id];
> sps = &ev->sps[slice_pic_parameter_set_id];
Missing a check to see if either of these two exist/were parsed.
[...]
> +static int evc_parse(AVCodecParserContext *s, AVCodecContext *avctx,
> + const uint8_t **poutbuf, int *poutbuf_size,
> + const uint8_t *buf, int buf_size)
> +{
> + int next;
> + EVCParserContext *ev = s->priv_data;
> + ParseContext *pc = &ev->pc;
> +
> + if (s->flags & PARSER_FLAG_COMPLETE_FRAMES)
> + next = buf_size;
> + else {
> + next = evc_find_frame_end(s, buf, buf_size, avctx);
> + if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
> + *poutbuf = NULL;
> + *poutbuf_size = 0;
> + return buf_size;
> + }
> + }
> +
> + parse_nal_units(s, buf, buf_size, avctx);
> +
> + // poutbuf contains just one Access Unit
> + *poutbuf = buf;
> + *poutbuf_size = buf_size;
> +
> + return next;
> +
Does the mp4 encapsulation allow the stripping of parameter sets from
packets? If so, you should parse extradata here too, otherwise no
sps/pps will be handled.
More information about the ffmpeg-devel
mailing list