Commit ad9052c4 authored by Anton Khirnov's avatar Anton Khirnov

h264_ps: pass AVCodecContext as void* where possible

Makes sure it is only used for logging and nothing else.
parent ddf6ca3a
...@@ -104,14 +104,14 @@ static void remove_sps(H264ParamSets *s, int id) ...@@ -104,14 +104,14 @@ static void remove_sps(H264ParamSets *s, int id)
av_buffer_unref(&s->sps_list[id]); av_buffer_unref(&s->sps_list[id]);
} }
static inline int decode_hrd_parameters(GetBitContext *gb, AVCodecContext *avctx, static inline int decode_hrd_parameters(GetBitContext *gb, void *logctx,
SPS *sps) SPS *sps)
{ {
int cpb_count, i; int cpb_count, i;
cpb_count = get_ue_golomb_31(gb) + 1; cpb_count = get_ue_golomb_31(gb) + 1;
if (cpb_count > 32U) { if (cpb_count > 32U) {
av_log(avctx, AV_LOG_ERROR, "cpb_count %d invalid\n", cpb_count); av_log(logctx, AV_LOG_ERROR, "cpb_count %d invalid\n", cpb_count);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
...@@ -130,7 +130,7 @@ static inline int decode_hrd_parameters(GetBitContext *gb, AVCodecContext *avctx ...@@ -130,7 +130,7 @@ static inline int decode_hrd_parameters(GetBitContext *gb, AVCodecContext *avctx
return 0; return 0;
} }
static inline int decode_vui_parameters(GetBitContext *gb, AVCodecContext *avctx, static inline int decode_vui_parameters(GetBitContext *gb, void *logctx,
SPS *sps) SPS *sps)
{ {
int aspect_ratio_info_present_flag; int aspect_ratio_info_present_flag;
...@@ -146,7 +146,7 @@ static inline int decode_vui_parameters(GetBitContext *gb, AVCodecContext *avctx ...@@ -146,7 +146,7 @@ static inline int decode_vui_parameters(GetBitContext *gb, AVCodecContext *avctx
} else if (aspect_ratio_idc < FF_ARRAY_ELEMS(ff_h264_pixel_aspect)) { } else if (aspect_ratio_idc < FF_ARRAY_ELEMS(ff_h264_pixel_aspect)) {
sps->sar = ff_h264_pixel_aspect[aspect_ratio_idc]; sps->sar = ff_h264_pixel_aspect[aspect_ratio_idc];
} else { } else {
av_log(avctx, AV_LOG_ERROR, "illegal aspect ratio\n"); av_log(logctx, AV_LOG_ERROR, "illegal aspect ratio\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
} else { } else {
...@@ -187,7 +187,7 @@ static inline int decode_vui_parameters(GetBitContext *gb, AVCodecContext *avctx ...@@ -187,7 +187,7 @@ static inline int decode_vui_parameters(GetBitContext *gb, AVCodecContext *avctx
sps->chroma_location = AVCHROMA_LOC_LEFT; sps->chroma_location = AVCHROMA_LOC_LEFT;
if (show_bits1(gb) && get_bits_left(gb) < 10) { if (show_bits1(gb) && get_bits_left(gb) < 10) {
av_log(avctx, AV_LOG_WARNING, "Truncated VUI (%d)\n", get_bits_left(gb)); av_log(logctx, AV_LOG_WARNING, "Truncated VUI (%d)\n", get_bits_left(gb));
return 0; return 0;
} }
...@@ -196,7 +196,7 @@ static inline int decode_vui_parameters(GetBitContext *gb, AVCodecContext *avctx ...@@ -196,7 +196,7 @@ static inline int decode_vui_parameters(GetBitContext *gb, AVCodecContext *avctx
unsigned num_units_in_tick = get_bits_long(gb, 32); unsigned num_units_in_tick = get_bits_long(gb, 32);
unsigned time_scale = get_bits_long(gb, 32); unsigned time_scale = get_bits_long(gb, 32);
if (!num_units_in_tick || !time_scale) { if (!num_units_in_tick || !time_scale) {
av_log(avctx, AV_LOG_ERROR, av_log(logctx, AV_LOG_ERROR,
"time_scale/num_units_in_tick invalid or unsupported (%u/%u)\n", "time_scale/num_units_in_tick invalid or unsupported (%u/%u)\n",
time_scale, num_units_in_tick); time_scale, num_units_in_tick);
sps->timing_info_present_flag = 0; sps->timing_info_present_flag = 0;
...@@ -209,11 +209,11 @@ static inline int decode_vui_parameters(GetBitContext *gb, AVCodecContext *avctx ...@@ -209,11 +209,11 @@ static inline int decode_vui_parameters(GetBitContext *gb, AVCodecContext *avctx
sps->nal_hrd_parameters_present_flag = get_bits1(gb); sps->nal_hrd_parameters_present_flag = get_bits1(gb);
if (sps->nal_hrd_parameters_present_flag) if (sps->nal_hrd_parameters_present_flag)
if (decode_hrd_parameters(gb, avctx, sps) < 0) if (decode_hrd_parameters(gb, logctx, sps) < 0)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
sps->vcl_hrd_parameters_present_flag = get_bits1(gb); sps->vcl_hrd_parameters_present_flag = get_bits1(gb);
if (sps->vcl_hrd_parameters_present_flag) if (sps->vcl_hrd_parameters_present_flag)
if (decode_hrd_parameters(gb, avctx, sps) < 0) if (decode_hrd_parameters(gb, logctx, sps) < 0)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
if (sps->nal_hrd_parameters_present_flag || if (sps->nal_hrd_parameters_present_flag ||
sps->vcl_hrd_parameters_present_flag) sps->vcl_hrd_parameters_present_flag)
...@@ -238,7 +238,7 @@ static inline int decode_vui_parameters(GetBitContext *gb, AVCodecContext *avctx ...@@ -238,7 +238,7 @@ static inline int decode_vui_parameters(GetBitContext *gb, AVCodecContext *avctx
if (sps->num_reorder_frames > 16U if (sps->num_reorder_frames > 16U
/* max_dec_frame_buffering || max_dec_frame_buffering > 16 */) { /* max_dec_frame_buffering || max_dec_frame_buffering > 16 */) {
av_log(avctx, AV_LOG_ERROR, av_log(logctx, AV_LOG_ERROR,
"Clipping illegal num_reorder_frames %d\n", "Clipping illegal num_reorder_frames %d\n",
sps->num_reorder_frames); sps->num_reorder_frames);
sps->num_reorder_frames = 16; sps->num_reorder_frames = 16;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment