#include "golomb.h"
#include "hevc.h"
+#include "hevc_parse.h"
#include "hevc_ps.h"
#include "hevc_sei.h"
#include "h2645_parse.h"
HEVCSEI sei;
SliceHeader sh;
+ int is_avc;
+ int nal_length_size;
int parsed_extradata;
int poc;
HEVCParserContext *ctx = s->priv_data;
HEVCParamSets *ps = &ctx->ps;
HEVCSEI *sei = &ctx->sei;
- int is_global = buf == avctx->extradata;
int ret, i;
/* set some sane default values */
ff_hevc_reset_sei(sei);
- ret = ff_h2645_packet_split(&ctx->pkt, buf, buf_size, avctx, 0, 0,
- AV_CODEC_ID_HEVC, 1);
+ ret = ff_h2645_packet_split(&ctx->pkt, buf, buf_size, avctx, ctx->is_avc,
+ ctx->nal_length_size, AV_CODEC_ID_HEVC, 1);
if (ret < 0)
return ret;
case HEVC_NAL_RADL_R:
case HEVC_NAL_RASL_N:
case HEVC_NAL_RASL_R:
-
- if (is_global) {
- av_log(avctx, AV_LOG_ERROR, "Invalid NAL unit: %d\n", nal->type);
- return AVERROR_INVALIDDATA;
- }
-
ret = hevc_parse_slice_header(s, nal, avctx);
if (ret)
return ret;
}
}
/* didn't find a picture! */
- if (!is_global)
- av_log(avctx, AV_LOG_ERROR, "missing picture in access unit\n");
+ av_log(avctx, AV_LOG_ERROR, "missing picture in access unit\n");
return -1;
}
ParseContext *pc = &ctx->pc;
if (avctx->extradata && !ctx->parsed_extradata) {
- parse_nal_units(s, avctx->extradata, avctx->extradata_size, avctx);
+ ff_hevc_decode_extradata(avctx->extradata, avctx->extradata_size, &ctx->ps, &ctx->sei,
+ &ctx->is_avc, &ctx->nal_length_size, avctx->err_recognition,
+ 1, avctx);
ctx->parsed_extradata = 1;
}
static void hevc_parser_close(AVCodecParserContext *s)
{
HEVCParserContext *ctx = s->priv_data;
- int i;
-
- for (i = 0; i < FF_ARRAY_ELEMS(ctx->ps.vps_list); i++)
- av_buffer_unref(&ctx->ps.vps_list[i]);
- for (i = 0; i < FF_ARRAY_ELEMS(ctx->ps.sps_list); i++)
- av_buffer_unref(&ctx->ps.sps_list[i]);
- for (i = 0; i < FF_ARRAY_ELEMS(ctx->ps.pps_list); i++)
- av_buffer_unref(&ctx->ps.pps_list[i]);
-
- ctx->ps.sps = NULL;
+ ff_hevc_ps_uninit(&ctx->ps);
ff_h2645_packet_uninit(&ctx->pkt);
ff_hevc_reset_sei(&ctx->sei);