#include "avcodec.h"
#include "blockdsp.h"
#include "get_bits.h"
-#include "hwaccel.h"
+#include "hwconfig.h"
#include "internal.h"
#include "mpeg_er.h"
#include "mpegvideo.h"
if (s->avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || s->avctx->codec_id == AV_CODEC_ID_VC1IMAGE) {
for (i = 0; i < 4; i++)
if (!(v->sr_rows[i >> 1][i & 1] = av_malloc(v->output_width)))
- return AVERROR(ENOMEM);
+ goto error;
}
ret = ff_intrax8_common_init(s->avctx, &v->x8, &s->idsp,
return AVERROR_INVALIDDATA;
v->s.avctx = avctx;
- if ((ret = ff_vc1_init_common(v)) < 0)
- return ret;
+ ff_vc1_init_common(v);
if (avctx->codec_id == AV_CODEC_ID_WMV3 || avctx->codec_id == AV_CODEC_ID_WMV3IMAGE) {
int count = 0;
ff_h264chroma_init(&v->h264chroma, 8);
ff_qpeldsp_init(&s->qdsp);
- // Must happen after calling ff_vc1_decode_end
- // to avoid de-allocating the sprite_output_frame
- v->sprite_output_frame = av_frame_alloc();
- if (!v->sprite_output_frame)
- return AVERROR(ENOMEM);
-
avctx->has_b_frames = !!avctx->max_b_frames;
if (v->color_prim == 1 || v->color_prim == 5 || v->color_prim == 6)
v->sprite_height > 1 << 14 ||
v->output_width > 1 << 14 ||
v->output_height > 1 << 14) {
- ret = AVERROR_INVALIDDATA;
- goto error;
+ return AVERROR_INVALIDDATA;
}
if ((v->sprite_width&1) || (v->sprite_height&1)) {
avpriv_request_sample(avctx, "odd sprites support");
- ret = AVERROR_PATCHWELCOME;
- goto error;
+ return AVERROR_PATCHWELCOME;
}
}
return 0;
-error:
- av_frame_free(&v->sprite_output_frame);
- return ret;
}
/** Close a VC1/WMV3 decoder
for (i = 0; i < 4; i++)
av_freep(&v->sr_rows[i >> 1][i & 1]);
- av_freep(&v->hrd_rate);
- av_freep(&v->hrd_buffer);
ff_mpv_common_end(&v->s);
av_freep(&v->mv_type_mb_plane);
av_freep(&v->direct_mb_plane);
goto err;
}
slices = tmp;
- slices[n_slices].buf = av_mallocz(buf_size + AV_INPUT_BUFFER_PADDING_SIZE);
+ slices[n_slices].buf = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!slices[n_slices].buf) {
ret = AVERROR(ENOMEM);
goto err;
goto err;
}
slices = tmp;
- slices[n_slices].buf = av_mallocz(buf_size + AV_INPUT_BUFFER_PADDING_SIZE);
+ slices[n_slices].buf = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!slices[n_slices].buf) {
ret = AVERROR(ENOMEM);
goto err;
avctx->height = avctx->coded_height = v->output_height;
if (avctx->skip_frame >= AVDISCARD_NONREF)
goto end;
+ if (!v->sprite_output_frame &&
+ !(v->sprite_output_frame = av_frame_alloc())) {
+ ret = AVERROR(ENOMEM);
+ goto err;
+ }
#if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER
if ((ret = vc1_decode_sprites(v, &s->gb)) < 0)
goto err;
AV_PIX_FMT_NONE
};
-AVCodec ff_vc1_decoder = {
+const AVCodec ff_vc1_decoder = {
.name = "vc1",
.long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1"),
.type = AVMEDIA_TYPE_VIDEO,
.flush = ff_mpeg_flush,
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
.pix_fmts = vc1_hwaccel_pixfmt_list_420,
- .hw_configs = (const AVCodecHWConfigInternal*[]) {
+ .hw_configs = (const AVCodecHWConfigInternal *const []) {
#if CONFIG_VC1_DXVA2_HWACCEL
HWACCEL_DXVA2(vc1),
#endif
};
#if CONFIG_WMV3_DECODER
-AVCodec ff_wmv3_decoder = {
+const AVCodec ff_wmv3_decoder = {
.name = "wmv3",
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9"),
.type = AVMEDIA_TYPE_VIDEO,
.flush = ff_mpeg_flush,
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
.pix_fmts = vc1_hwaccel_pixfmt_list_420,
- .hw_configs = (const AVCodecHWConfigInternal*[]) {
+ .hw_configs = (const AVCodecHWConfigInternal *const []) {
#if CONFIG_WMV3_DXVA2_HWACCEL
HWACCEL_DXVA2(wmv3),
#endif
#endif
#if CONFIG_WMV3IMAGE_DECODER
-AVCodec ff_wmv3image_decoder = {
+const AVCodec ff_wmv3image_decoder = {
.name = "wmv3image",
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 Image"),
.type = AVMEDIA_TYPE_VIDEO,
#endif
#if CONFIG_VC1IMAGE_DECODER
-AVCodec ff_vc1image_decoder = {
+const AVCodec ff_vc1image_decoder = {
.name = "vc1image",
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 Image v2"),
.type = AVMEDIA_TYPE_VIDEO,