}
alpha = av_clip_uint16(sd->coefs[1][6]);
- for (plane = 0; plane < (CONFIG_GRAY && s->avctx->flags & CODEC_FLAG_GRAY ? 1 : 3); plane++) {
+ for (plane = 0; plane < (CONFIG_GRAY && s->avctx->flags & AV_CODEC_FLAG_GRAY ? 1 : 3); plane++) {
int width = v->output_width>>!!plane;
for (row = 0; row < v->output_height>>!!plane; row++) {
if (!s->current_picture.f || !s->current_picture.f->data[0]) {
av_log(avctx, AV_LOG_ERROR, "Got no sprites\n");
- return -1;
+ return AVERROR_UNKNOWN;
}
if (v->two_sprites && (!s->last_picture_ptr || !s->last_picture.f->data[0])) {
wrong but it looks better than doing nothing. */
if (f && f->data[0])
- for (plane = 0; plane < (CONFIG_GRAY && s->avctx->flags & CODEC_FLAG_GRAY ? 1 : 3); plane++)
+ for (plane = 0; plane < (CONFIG_GRAY && s->avctx->flags & AV_CODEC_FLAG_GRAY ? 1 : 3); plane++)
for (i = 0; i < v->sprite_height>>!!plane; i++)
memset(f->data[plane] + i * f->linesize[plane],
plane ? 128 : 0, f->linesize[plane]);
if (!avctx->extradata_size || !avctx->extradata)
return -1;
- if (!CONFIG_GRAY || !(avctx->flags & CODEC_FLAG_GRAY))
+ if (!CONFIG_GRAY || !(avctx->flags & AV_CODEC_FLAG_GRAY))
avctx->pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts);
else {
avctx->pix_fmt = AV_PIX_FMT_GRAY8;
return -1;
}
- buf2 = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
+ buf2 = av_mallocz(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!buf2)
return AVERROR(ENOMEM);
v->second_field = 0;
- if(s->avctx->flags & CODEC_FLAG_LOW_DELAY)
+ if(s->avctx->flags & AV_CODEC_FLAG_LOW_DELAY)
s->low_delay = 1;
/* no supplementary picture */
return buf_size;
}
- if (s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) {
+#if FF_API_CAP_VDPAU
+ if (s->avctx->codec->capabilities&AV_CODEC_CAP_HWACCEL_VDPAU) {
if (v->profile < PROFILE_ADVANCED)
avctx->pix_fmt = AV_PIX_FMT_VDPAU_WMV3;
else
avctx->pix_fmt = AV_PIX_FMT_VDPAU_VC1;
}
+#endif
//for advanced profile we may need to parse and unescape data
if (avctx->codec_id == AV_CODEC_ID_VC1 || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) {
int buf_size2 = 0;
- buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
+ buf2 = av_mallocz(buf_size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!buf2)
return AVERROR(ENOMEM);
if (size <= 0) continue;
switch (AV_RB32(start)) {
case VC1_CODE_FRAME:
- if (avctx->hwaccel ||
- s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
+ if (avctx->hwaccel
+#if FF_API_CAP_VDPAU
+ || s->avctx->codec->capabilities&AV_CODEC_CAP_HWACCEL_VDPAU
+#endif
+ )
buf_start = start;
buf_size2 = vc1_unescape_buffer(start + 4, size, buf2);
break;
case VC1_CODE_FIELD: {
int buf_size3;
- if (avctx->hwaccel ||
- s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
+ if (avctx->hwaccel
+#if FF_API_CAP_VDPAU
+ || s->avctx->codec->capabilities&AV_CODEC_CAP_HWACCEL_VDPAU
+#endif
+ )
buf_start_second_field = start;
tmp = av_realloc_array(slices, sizeof(*slices), (n_slices+1));
- if (!tmp)
+ if (!tmp) {
+ ret = AVERROR(ENOMEM);
goto err;
+ }
slices = tmp;
- slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
- if (!slices[n_slices].buf)
+ slices[n_slices].buf = av_mallocz(buf_size + AV_INPUT_BUFFER_PADDING_SIZE);
+ if (!slices[n_slices].buf) {
+ ret = AVERROR(ENOMEM);
goto err;
+ }
buf_size3 = vc1_unescape_buffer(start + 4, size,
slices[n_slices].buf);
init_get_bits(&slices[n_slices].gb, slices[n_slices].buf,
case VC1_CODE_SLICE: {
int buf_size3;
tmp = av_realloc_array(slices, sizeof(*slices), (n_slices+1));
- if (!tmp)
+ if (!tmp) {
+ ret = AVERROR(ENOMEM);
goto err;
+ }
slices = tmp;
- slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
- if (!slices[n_slices].buf)
+ slices[n_slices].buf = av_mallocz(buf_size + AV_INPUT_BUFFER_PADDING_SIZE);
+ if (!slices[n_slices].buf) {
+ ret = AVERROR(ENOMEM);
goto err;
+ }
buf_size3 = vc1_unescape_buffer(start + 4, size,
slices[n_slices].buf);
init_get_bits(&slices[n_slices].gb, slices[n_slices].buf,
divider = find_next_marker(buf, buf + buf_size);
if ((divider == (buf + buf_size)) || AV_RB32(divider) != VC1_CODE_FIELD) {
av_log(avctx, AV_LOG_ERROR, "Error in WVC1 interlaced frame\n");
+ ret = AVERROR_INVALIDDATA;
goto err;
} else { // found field marker, unescape second field
- if (avctx->hwaccel ||
- s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
+ if (avctx->hwaccel
+#if FF_API_CAP_VDPAU
+ || s->avctx->codec->capabilities&AV_CODEC_CAP_HWACCEL_VDPAU
+#endif
+ )
buf_start_second_field = divider;
tmp = av_realloc_array(slices, sizeof(*slices), (n_slices+1));
- if (!tmp)
+ if (!tmp) {
+ ret = AVERROR(ENOMEM);
goto err;
+ }
slices = tmp;
- slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
- if (!slices[n_slices].buf)
+ slices[n_slices].buf = av_mallocz(buf_size + AV_INPUT_BUFFER_PADDING_SIZE);
+ if (!slices[n_slices].buf) {
+ ret = AVERROR(ENOMEM);
goto err;
+ }
buf_size3 = vc1_unescape_buffer(divider + 4, buf + buf_size - divider - 4, slices[n_slices].buf);
init_get_bits(&slices[n_slices].gb, slices[n_slices].buf,
buf_size3 << 3);
}
if (!s->context_initialized) {
- if (ff_msmpeg4_decode_init(avctx) < 0)
+ if ((ret = ff_msmpeg4_decode_init(avctx)) < 0)
goto err;
- if (ff_vc1_decode_init_alloc_tables(v) < 0) {
+ if ((ret = ff_vc1_decode_init_alloc_tables(v)) < 0) {
ff_mpv_common_end(s);
goto err;
}
s->low_delay = !avctx->has_b_frames || v->res_sprite;
if (v->profile == PROFILE_ADVANCED) {
- if(avctx->coded_width<=1 || avctx->coded_height<=1)
+ if(avctx->coded_width<=1 || avctx->coded_height<=1) {
+ ret = AVERROR_INVALIDDATA;
goto err;
+ }
s->h_edge_pos = avctx->coded_width;
s->v_edge_pos = avctx->coded_height;
}
v->pic_header_flag = 0;
v->first_pic_header_flag = 1;
if (v->profile < PROFILE_ADVANCED) {
- if (ff_vc1_parse_frame_header(v, &s->gb) < 0) {
+ if ((ret = ff_vc1_parse_frame_header(v, &s->gb)) < 0) {
goto err;
}
} else {
- if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) {
+ if ((ret = ff_vc1_parse_frame_header_adv(v, &s->gb)) < 0) {
goto err;
}
}
if ((avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE)
&& s->pict_type != AV_PICTURE_TYPE_I) {
av_log(v->s.avctx, AV_LOG_ERROR, "Sprite decoder: expected I-frame\n");
+ ret = AVERROR_INVALIDDATA;
goto err;
}
if ((s->mb_height >> v->field_mode) == 0) {
av_log(v->s.avctx, AV_LOG_ERROR, "image too short\n");
+ ret = AVERROR_INVALIDDATA;
goto err;
}
s->next_p_frame_damaged = 0;
}
- if (ff_mpv_frame_start(s, avctx) < 0) {
+ if ((ret = ff_mpv_frame_start(s, avctx)) < 0) {
goto err;
}
s->me.qpel_put = s->qdsp.put_qpel_pixels_tab;
s->me.qpel_avg = s->qdsp.avg_qpel_pixels_tab;
+#if FF_API_CAP_VDPAU
if ((CONFIG_VC1_VDPAU_DECODER)
- &&s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) {
+ &&s->avctx->codec->capabilities&AV_CODEC_CAP_HWACCEL_VDPAU) {
if (v->field_mode && buf_start_second_field) {
ff_vdpau_vc1_decode_picture(s, buf_start, buf_start_second_field - buf_start);
ff_vdpau_vc1_decode_picture(s, buf_start_second_field, (buf + buf_size) - buf_start_second_field);
} else {
ff_vdpau_vc1_decode_picture(s, buf_start, (buf + buf_size) - buf_start);
}
- } else if (avctx->hwaccel) {
+ } else
+#endif
+ if (avctx->hwaccel) {
if (v->field_mode && buf_start_second_field) {
// decode first field
s->picture_structure = PICT_BOTTOM_FIELD - v->tff;
- if (avctx->hwaccel->start_frame(avctx, buf_start, buf_start_second_field - buf_start) < 0)
+ if ((ret = avctx->hwaccel->start_frame(avctx, buf_start, buf_start_second_field - buf_start)) < 0)
goto err;
- if (avctx->hwaccel->decode_slice(avctx, buf_start, buf_start_second_field - buf_start) < 0)
+ if ((ret = avctx->hwaccel->decode_slice(avctx, buf_start, buf_start_second_field - buf_start)) < 0)
goto err;
- if (avctx->hwaccel->end_frame(avctx) < 0)
+ if ((ret = avctx->hwaccel->end_frame(avctx)) < 0)
goto err;
// decode second field
v->pic_header_flag = 0;
if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) {
av_log(avctx, AV_LOG_ERROR, "parsing header for second field failed");
+ ret = AVERROR_INVALIDDATA;
goto err;
}
v->s.current_picture_ptr->f->pict_type = v->s.pict_type;
- if (avctx->hwaccel->start_frame(avctx, buf_start_second_field, (buf + buf_size) - buf_start_second_field) < 0)
+ if ((ret = avctx->hwaccel->start_frame(avctx, buf_start_second_field, (buf + buf_size) - buf_start_second_field)) < 0)
goto err;
- if (avctx->hwaccel->decode_slice(avctx, buf_start_second_field, (buf + buf_size) - buf_start_second_field) < 0)
+ if ((ret = avctx->hwaccel->decode_slice(avctx, buf_start_second_field, (buf + buf_size) - buf_start_second_field)) < 0)
goto err;
- if (avctx->hwaccel->end_frame(avctx) < 0)
+ if ((ret = avctx->hwaccel->end_frame(avctx)) < 0)
goto err;
} else {
s->picture_structure = PICT_FRAME;
- if (avctx->hwaccel->start_frame(avctx, buf_start, (buf + buf_size) - buf_start) < 0)
+ if ((ret = avctx->hwaccel->start_frame(avctx, buf_start, (buf + buf_size) - buf_start)) < 0)
goto err;
- if (avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start) < 0)
+ if ((ret = avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start)) < 0)
goto err;
- if (avctx->hwaccel->end_frame(avctx) < 0)
+ if ((ret = avctx->hwaccel->end_frame(avctx)) < 0)
goto err;
}
} else {
if (v->field_mode && i == n_slices1 + 2) {
if ((header_ret = ff_vc1_parse_frame_header_adv(v, &s->gb)) < 0) {
av_log(v->s.avctx, AV_LOG_ERROR, "Field header damaged\n");
+ ret = AVERROR_INVALIDDATA;
if (avctx->err_recognition & AV_EF_EXPLODE)
goto err;
continue;
v->pic_header_flag = 1;
if ((header_ret = ff_vc1_parse_frame_header_adv(v, &s->gb)) < 0) {
av_log(v->s.avctx, AV_LOG_ERROR, "Slice header damaged\n");
+ ret = AVERROR_INVALIDDATA;
if (avctx->err_recognition & AV_EF_EXPLODE)
goto err;
continue;
get_bits_count(&s->gb), s->gb.size_in_bits);
// if (get_bits_count(&s->gb) > buf_size * 8)
// return -1;
- if(s->er.error_occurred && s->pict_type == AV_PICTURE_TYPE_B)
+ if(s->er.error_occurred && s->pict_type == AV_PICTURE_TYPE_B) {
+ ret = AVERROR_INVALIDDATA;
goto err;
+ }
if (!v->field_mode)
ff_er_frame_end(&s->er);
}
if (avctx->skip_frame >= AVDISCARD_NONREF)
goto end;
#if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER
- if (vc1_decode_sprites(v, &s->gb))
+ if ((ret = vc1_decode_sprites(v, &s->gb)) < 0)
goto err;
#endif
if ((ret = av_frame_ref(pict, v->sprite_output_frame)) < 0)
for (i = 0; i < n_slices; i++)
av_free(slices[i].buf);
av_free(slices);
- return -1;
+ return ret;
}
AV_PIX_FMT_D3D11VA_VLD,
#endif
#if CONFIG_VC1_VAAPI_HWACCEL
- AV_PIX_FMT_VAAPI_VLD,
+ AV_PIX_FMT_VAAPI,
#endif
#if CONFIG_VC1_VDPAU_HWACCEL
AV_PIX_FMT_VDPAU,
.close = ff_vc1_decode_end,
.decode = vc1_decode_frame,
.flush = ff_mpeg_flush,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY,
+ .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
.pix_fmts = vc1_hwaccel_pixfmt_list_420,
.profiles = NULL_IF_CONFIG_SMALL(profiles)
};
.close = ff_vc1_decode_end,
.decode = vc1_decode_frame,
.flush = ff_mpeg_flush,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY,
+ .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
.pix_fmts = vc1_hwaccel_pixfmt_list_420,
.profiles = NULL_IF_CONFIG_SMALL(profiles)
};
#endif
-#if CONFIG_WMV3_VDPAU_DECODER
+#if CONFIG_WMV3_VDPAU_DECODER && FF_API_VDPAU
AVCodec ff_wmv3_vdpau_decoder = {
.name = "wmv3_vdpau",
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 VDPAU"),
.init = vc1_decode_init,
.close = ff_vc1_decode_end,
.decode = vc1_decode_frame,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU,
+ .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HWACCEL_VDPAU,
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_VDPAU_WMV3, AV_PIX_FMT_NONE },
.profiles = NULL_IF_CONFIG_SMALL(profiles)
};
#endif
-#if CONFIG_VC1_VDPAU_DECODER
+#if CONFIG_VC1_VDPAU_DECODER && FF_API_VDPAU
AVCodec ff_vc1_vdpau_decoder = {
.name = "vc1_vdpau",
.long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1 VDPAU"),
.init = vc1_decode_init,
.close = ff_vc1_decode_end,
.decode = vc1_decode_frame,
- .capabilities = CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU,
+ .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HWACCEL_VDPAU,
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_VDPAU_VC1, AV_PIX_FMT_NONE },
.profiles = NULL_IF_CONFIG_SMALL(profiles)
};
.init = vc1_decode_init,
.close = ff_vc1_decode_end,
.decode = vc1_decode_frame,
- .capabilities = CODEC_CAP_DR1,
+ .capabilities = AV_CODEC_CAP_DR1,
.flush = vc1_sprite_flush,
.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_YUV420P,
.init = vc1_decode_init,
.close = ff_vc1_decode_end,
.decode = vc1_decode_frame,
- .capabilities = CODEC_CAP_DR1,
+ .capabilities = AV_CODEC_CAP_DR1,
.flush = vc1_sprite_flush,
.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_YUV420P,