| @@ -352,20 +352,21 @@ static av_cold void h261_encode_init_static(void) · 351 unmodified lines |
| 352 | 352 | mv_codes[0][1] = 1; |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | | −av_cold int ff_h261_encode_init(MpegEncContext *s) |
| 355 | +static av_cold int h261_encode_init(AVCodecContext *avctx) |
| 356 | 356 | { |
| 357 | | − H261EncContext *const h = (H261EncContext*)s; |
| 358 | 357 | static AVOnce init_static_once = AV_ONCE_INIT; |
| 358 | + H261EncContext *const h = avctx->priv_data; |
| 359 | + MpegEncContext *const s = &h->s.s; |
| 359 | 360 | |
| 360 | | − if (s->width == 176 && s->height == 144) { |
| 361 | + if (avctx->width == 176 && avctx->height == 144) { |
| 361 | 362 | h->format = H261_QCIF; |
| 362 | | − } else if (s->width == 352 && s->height == 288) { |
| 363 | + } else if (avctx->width == 352 && avctx->height == 288) { |
| 363 | 364 | h->format = H261_CIF; |
| 364 | 365 | } else { |
| 365 | | − av_log(s->avctx, AV_LOG_ERROR, |
| 366 | + av_log(avctx, AV_LOG_ERROR, |
| 366 | 367 | "The specified picture size of %dx%d is not valid for the " |
| 367 | 368 | "H.261 codec.\nValid sizes are 176x144, 352x288\n", |
| 368 | | − s->width, s->height); |
| 369 | + avctx->width, avctx->height); |
| 369 | 370 | return AVERROR(EINVAL); |
| 370 | 371 | } |
| 371 | 372 | s->private_ctx = &h->common; |
| @@ -380,7 +381,7 @@ av_cold int ff_h261_encode_init(MpegEncContext *s) · 8 unmodified lines |
| 380 | 381 | s->intra_ac_vlc_last_length = s->inter_ac_vlc_last_length = uni_h261_rl_len_last; |
| 381 | 382 | ff_thread_once(&init_static_once, h261_encode_init_static); |
| 382 | 383 | |
| 383 | | − return 0; |
| 384 | + return ff_mpv_encode_init(avctx); |
| 384 | 385 | } |
| 385 | 386 | |
| 386 | 387 | const FFCodec ff_h261_encoder = { |
| @@ -391,7 +392,7 @@ const FFCodec ff_h261_encoder = { · 4 unmodified lines |
| 391 | 392 | .p.priv_class = &ff_mpv_enc_class, |
| 392 | 393 | .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE, |
| 393 | 394 | .priv_data_size = sizeof(H261EncContext), |
| 394 | | − .init = ff_mpv_encode_init, |
| 395 | + .init = h261_encode_init, |
| 395 | 396 | FF_CODEC_ENCODE_CB(ff_mpv_encode_picture), |
| 396 | 397 | .close = ff_mpv_encode_end, |
| 397 | 398 | .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, |