avcodec/hevc_parser: use the old parser only when hevc decoder is available

If it's not, then the new dependence-free parser will be used instead

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2015-07-13 14:10:31 -03:00
parent feb6a94f74
commit 84e847c7c8
2 changed files with 5 additions and 7 deletions

2
configure vendored
View File

@ -2441,8 +2441,6 @@ wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
# parsers # parsers
h264_parser_select="h264_decoder" h264_parser_select="h264_decoder"
hevc_parser_select="golomb" hevc_parser_select="golomb"
#If ADVANCED_PARSER is enabled then the decoder is needed otherwise the next line can be removed
hevc_parser_select="hevc_decoder"
mpegvideo_parser_select="mpegvideo" mpegvideo_parser_select="mpegvideo"
mpeg4video_parser_select="error_resilience h263dsp mpeg_er mpegvideo qpeldsp" mpeg4video_parser_select="error_resilience h263dsp mpeg_er mpegvideo qpeldsp"
vc1_parser_select="mpegvideo startcode vc1_decoder" vc1_parser_select="mpegvideo startcode vc1_decoder"

View File

@ -30,7 +30,7 @@
#define IS_IRAP_NAL(nal) (nal->type >= 16 && nal->type <= 23) #define IS_IRAP_NAL(nal) (nal->type >= 16 && nal->type <= 23)
#define ADVANCED_PARSER #define ADVANCED_PARSER CONFIG_HEVC_DECODER
typedef struct HEVCParserContext { typedef struct HEVCParserContext {
ParseContext pc; ParseContext pc;
@ -40,11 +40,12 @@ typedef struct HEVCParserContext {
int parsed_extradata; int parsed_extradata;
#ifdef ADVANCED_PARSER #if ADVANCED_PARSER
HEVCContext h; HEVCContext h;
#endif #endif
} HEVCParserContext; } HEVCParserContext;
#if !ADVANCED_PARSER
static int hevc_parse_slice_header(AVCodecParserContext *s, HEVCNAL *nal, static int hevc_parse_slice_header(AVCodecParserContext *s, HEVCNAL *nal,
AVCodecContext *avctx) AVCodecContext *avctx)
{ {
@ -81,7 +82,6 @@ static int hevc_parse_slice_header(AVCodecParserContext *s, HEVCNAL *nal,
return 0; return 0;
} }
#ifndef ADVANCED_PARSER
static int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf, static int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
int buf_size, AVCodecContext *avctx) int buf_size, AVCodecContext *avctx)
{ {
@ -166,6 +166,7 @@ static int hevc_find_frame_end(AVCodecParserContext *s, const uint8_t *buf,
return END_NOT_FOUND; return END_NOT_FOUND;
} }
#if ADVANCED_PARSER
/** /**
* Parse NAL units of found picture and decode some basic information. * Parse NAL units of found picture and decode some basic information.
* *
@ -174,7 +175,6 @@ static int hevc_find_frame_end(AVCodecParserContext *s, const uint8_t *buf,
* @param buf buffer with field/frame data. * @param buf buffer with field/frame data.
* @param buf_size size of the buffer. * @param buf_size size of the buffer.
*/ */
#ifdef ADVANCED_PARSER
static inline int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf, static inline int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
int buf_size, AVCodecContext *avctx) int buf_size, AVCodecContext *avctx)
{ {
@ -418,7 +418,7 @@ static void hevc_parser_close(AVCodecParserContext *s)
HEVCParserContext *ctx = s->priv_data; HEVCParserContext *ctx = s->priv_data;
int i; int i;
#ifdef ADVANCED_PARSER #if ADVANCED_PARSER
HEVCContext *h = &ctx->h; HEVCContext *h = &ctx->h;
av_freep(&h->HEVClc); av_freep(&h->HEVClc);
#endif #endif