Will avoid forward declarations later. While just at it, forward ff_mpv_encode_init() errors.
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -73,27 +73,6 @@ static int encode_ext_header(WMV2EncContext *w) · 72 unmodified lines | ||
| 73 | 73 | return 0; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | −static av_cold int wmv2_encode_init(AVCodecContext *avctx) | |
| 77 | −{ | |
| 78 | − WMV2EncContext *const w = avctx->priv_data; | |
| 79 | − MpegEncContext *const s = &w->msmpeg4.m.s; | |
| 80 | − | |
| 81 | − s->private_ctx = &w->common; | |
| 82 | − if (ff_mpv_encode_init(avctx) < 0) | |
| 83 | − return -1; | |
| 84 | − | |
| 85 | − ff_wmv2_common_init(s); | |
| 86 | − | |
| 87 | − avctx->extradata_size = WMV2_EXTRADATA_SIZE; | |
| 88 | − avctx->extradata = av_mallocz(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); | |
| 89 | − if (!avctx->extradata) | |
| 90 | − return AVERROR(ENOMEM); | |
| 91 | − | |
| 92 | − encode_ext_header(w); | |
| 93 | − | |
| 94 | − return 0; | |
| 95 | −} | |
| 96 | − | |
| 97 | 76 | int ff_wmv2_encode_picture_header(MpegEncContext *s) |
| 98 | 77 | { |
| 99 | 78 | WMV2EncContext *const w = (WMV2EncContext *) s; |
| @@ -237,6 +216,29 @@ void ff_wmv2_encode_mb(MpegEncContext *s, int16_t block[6][64], · 137 unmodified lines | ||
| 237 | 216 | s->p_tex_bits += get_bits_diff(s); |
| 238 | 217 | } |
| 239 | 218 | |
| 219 | +static av_cold int wmv2_encode_init(AVCodecContext *avctx) | |
| 220 | +{ | |
| 221 | + WMV2EncContext *const w = avctx->priv_data; | |
| 222 | + MpegEncContext *const s = &w->msmpeg4.m.s; | |
| 223 | + int ret; | |
| 224 | + | |
| 225 | + s->private_ctx = &w->common; | |
| 226 | + ret = ff_mpv_encode_init(avctx); | |
| 227 | + if (ret < 0) | |
| 228 | + return ret; | |
| 229 | + | |
| 230 | + ff_wmv2_common_init(s); | |
| 231 | + | |
| 232 | + avctx->extradata_size = WMV2_EXTRADATA_SIZE; | |
| 233 | + avctx->extradata = av_mallocz(avctx->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); | |
| 234 | + if (!avctx->extradata) | |
| 235 | + return AVERROR(ENOMEM); | |
| 236 | + | |
| 237 | + encode_ext_header(w); | |
| 238 | + | |
| 239 | + return 0; | |
| 240 | +} | |
| 241 | + | |
| 240 | 242 | const FFCodec ff_wmv2_encoder = { |
| 241 | 243 | .p.name = "wmv2", |
| 242 | 244 | CODEC_LONG_NAME("Windows Media Video 8"), |