Currently identical to the H.261 and H.263 close functions (which it replaces). It will be extended in future commits.
Unified · Split
| @@ -24,7 +24,7 @@ · 23 unmodified lines | |||
| 24 | #include "flvdec.h" | 24 | #include "flvdec.h" |
| 25 | #include "h263dec.h" | 25 | #include "h263dec.h" |
| 26 | #include "mpegvideo.h" | 26 | #include "mpegvideo.h" |
| 27 | #include "mpegvideodata.h" | 27 | #include "mpegvideodec.h" |
| 28 | 28 | ||
| 29 | int ff_flv_decode_picture_header(MpegEncContext *s) | 29 | int ff_flv_decode_picture_header(MpegEncContext *s) |
| 30 | { | 30 | { |
| @@ -118,8 +118,8 @@ const FFCodec ff_flv_decoder = { · 87 unmodified lines | |||
| 118 | .p.id = AV_CODEC_ID_FLV1, | 118 | .p.id = AV_CODEC_ID_FLV1, |
| 119 | .priv_data_size = sizeof(MpegEncContext), | 119 | .priv_data_size = sizeof(MpegEncContext), |
| 120 | .init = ff_h263_decode_init, | 120 | .init = ff_h263_decode_init, |
| 121 | .close = ff_h263_decode_end, | ||
| 122 | FF_CODEC_DECODE_CB(ff_h263_decode_frame), | 121 | FF_CODEC_DECODE_CB(ff_h263_decode_frame), |
| 122 | .close = ff_mpv_decode_close, | ||
| 123 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, | 123 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, |
| 124 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, | 124 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, |
| 125 | .p.max_lowres = 3, | 125 | .p.max_lowres = 3, |
| @@ -660,15 +660,6 @@ static int h261_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 659 unmodified lines | |||
| 660 | return get_consumed_bytes(s, buf_size); | 660 | return get_consumed_bytes(s, buf_size); |
| 661 | } | 661 | } |
| 662 | 662 | ||
| 663 | static av_cold int h261_decode_end(AVCodecContext *avctx) | ||
| 664 | { | ||
| 665 | H261DecContext *const h = avctx->priv_data; | ||
| 666 | MpegEncContext *s = &h->s; | ||
| 667 | |||
| 668 | ff_mpv_common_end(s); | ||
| 669 | return 0; | ||
| 670 | } | ||
| 671 | |||
| 672 | const FFCodec ff_h261_decoder = { | 663 | const FFCodec ff_h261_decoder = { |
| 673 | .p.name = "h261", | 664 | .p.name = "h261", |
| 674 | CODEC_LONG_NAME("H.261"), | 665 | CODEC_LONG_NAME("H.261"), |
| @@ -676,8 +667,8 @@ const FFCodec ff_h261_decoder = { · 1 unmodified line | |||
| 676 | .p.id = AV_CODEC_ID_H261, | 667 | .p.id = AV_CODEC_ID_H261, |
| 677 | .priv_data_size = sizeof(H261DecContext), | 668 | .priv_data_size = sizeof(H261DecContext), |
| 678 | .init = h261_decode_init, | 669 | .init = h261_decode_init, |
| 679 | .close = h261_decode_end, | ||
| 680 | FF_CODEC_DECODE_CB(h261_decode_frame), | 670 | FF_CODEC_DECODE_CB(h261_decode_frame), |
| 671 | .close = ff_mpv_decode_close, | ||
| 681 | .p.capabilities = AV_CODEC_CAP_DR1, | 672 | .p.capabilities = AV_CODEC_CAP_DR1, |
| 682 | .p.max_lowres = 3, | 673 | .p.max_lowres = 3, |
| 683 | }; | 674 | }; |
| @@ -159,14 +159,6 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx) · 158 unmodified lines | |||
| 159 | return 0; | 159 | return 0; |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | av_cold int ff_h263_decode_end(AVCodecContext *avctx) | ||
| 163 | { | ||
| 164 | MpegEncContext *s = avctx->priv_data; | ||
| 165 | |||
| 166 | ff_mpv_common_end(s); | ||
| 167 | return 0; | ||
| 168 | } | ||
| 169 | |||
| 170 | /** | 162 | /** |
| 171 | * Return the number of bytes consumed for building the current frame. | 163 | * Return the number of bytes consumed for building the current frame. |
| 172 | */ | 164 | */ |
| @@ -702,8 +694,8 @@ const FFCodec ff_h263_decoder = { · 529 unmodified lines | |||
| 702 | .p.id = AV_CODEC_ID_H263, | 694 | .p.id = AV_CODEC_ID_H263, |
| 703 | .priv_data_size = sizeof(MpegEncContext), | 695 | .priv_data_size = sizeof(MpegEncContext), |
| 704 | .init = ff_h263_decode_init, | 696 | .init = ff_h263_decode_init, |
| 705 | .close = ff_h263_decode_end, | ||
| 706 | FF_CODEC_DECODE_CB(ff_h263_decode_frame), | 697 | FF_CODEC_DECODE_CB(ff_h263_decode_frame), |
| 698 | .close = ff_mpv_decode_close, | ||
| 707 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | | 699 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | |
| 708 | AV_CODEC_CAP_DELAY, | 700 | AV_CODEC_CAP_DELAY, |
| 709 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, | 701 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, |
| @@ -719,8 +711,8 @@ const FFCodec ff_h263p_decoder = { · 9 unmodified lines | |||
| 719 | .p.id = AV_CODEC_ID_H263P, | 711 | .p.id = AV_CODEC_ID_H263P, |
| 720 | .priv_data_size = sizeof(MpegEncContext), | 712 | .priv_data_size = sizeof(MpegEncContext), |
| 721 | .init = ff_h263_decode_init, | 713 | .init = ff_h263_decode_init, |
| 722 | .close = ff_h263_decode_end, | ||
| 723 | FF_CODEC_DECODE_CB(ff_h263_decode_frame), | 714 | FF_CODEC_DECODE_CB(ff_h263_decode_frame), |
| 715 | .close = ff_mpv_decode_close, | ||
| 724 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | | 716 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | |
| 725 | AV_CODEC_CAP_DELAY, | 717 | AV_CODEC_CAP_DELAY, |
| 726 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, | 718 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, |
| @@ -47,7 +47,6 @@ int ff_h263_decode_motion(MpegEncContext * s, int pred, int f_code); · 46 unmodified lines | |||
| 47 | int ff_h263_decode_init(AVCodecContext *avctx); | 47 | int ff_h263_decode_init(AVCodecContext *avctx); |
| 48 | int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *frame, | 48 | int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *frame, |
| 49 | int *got_frame, AVPacket *avpkt); | 49 | int *got_frame, AVPacket *avpkt); |
| 50 | int ff_h263_decode_end(AVCodecContext *avctx); | ||
| 51 | void ff_h263_decode_init_vlc(void); | 50 | void ff_h263_decode_init_vlc(void); |
| 52 | int ff_h263_decode_picture_header(MpegEncContext *s); | 51 | int ff_h263_decode_picture_header(MpegEncContext *s); |
| 53 | int ff_h263_decode_gob_header(MpegEncContext *s); | 52 | int ff_h263_decode_gob_header(MpegEncContext *s); |
| @@ -132,8 +132,8 @@ const FFCodec ff_h263i_decoder = { · 131 unmodified lines | |||
| 132 | .p.id = AV_CODEC_ID_H263I, | 132 | .p.id = AV_CODEC_ID_H263I, |
| 133 | .priv_data_size = sizeof(MpegEncContext), | 133 | .priv_data_size = sizeof(MpegEncContext), |
| 134 | .init = ff_h263_decode_init, | 134 | .init = ff_h263_decode_init, |
| 135 | .close = ff_h263_decode_end, | ||
| 136 | FF_CODEC_DECODE_CB(ff_h263_decode_frame), | 135 | FF_CODEC_DECODE_CB(ff_h263_decode_frame), |
| 136 | .close = ff_mpv_decode_close, | ||
| 137 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, | 137 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, |
| 138 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, | 138 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, |
| 139 | }; | 139 | }; |
| @@ -2595,9 +2595,8 @@ static av_cold int mpeg_decode_end(AVCodecContext *avctx) · 2594 unmodified lines | |||
| 2595 | { | 2595 | { |
| 2596 | Mpeg1Context *s = avctx->priv_data; | 2596 | Mpeg1Context *s = avctx->priv_data; |
| 2597 | 2597 | ||
| 2598 | ff_mpv_common_end(&s->mpeg_enc_ctx); | ||
| 2599 | av_buffer_unref(&s->a53_buf_ref); | 2598 | av_buffer_unref(&s->a53_buf_ref); |
| 2600 | return 0; | 2599 | return ff_mpv_decode_close(avctx); |
| 2601 | } | 2600 | } |
| 2602 | 2601 | ||
| 2603 | const FFCodec ff_mpeg1video_decoder = { | 2602 | const FFCodec ff_mpeg1video_decoder = { |
| @@ -3862,8 +3862,8 @@ const FFCodec ff_mpeg4_decoder = { · 3861 unmodified lines | |||
| 3862 | .p.id = AV_CODEC_ID_MPEG4, | 3862 | .p.id = AV_CODEC_ID_MPEG4, |
| 3863 | .priv_data_size = sizeof(Mpeg4DecContext), | 3863 | .priv_data_size = sizeof(Mpeg4DecContext), |
| 3864 | .init = decode_init, | 3864 | .init = decode_init, |
| 3865 | .close = ff_h263_decode_end, | ||
| 3866 | FF_CODEC_DECODE_CB(ff_h263_decode_frame), | 3865 | FF_CODEC_DECODE_CB(ff_h263_decode_frame), |
| 3866 | .close = ff_mpv_decode_close, | ||
| 3867 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | | 3867 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | |
| 3868 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_FRAME_THREADS, | 3868 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_FRAME_THREADS, |
| 3869 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, | 3869 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, |
| @@ -173,6 +173,14 @@ do {\ · 172 unmodified lines | |||
| 173 | return 0; | 173 | return 0; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | int ff_mpv_decode_close(AVCodecContext *avctx) | ||
| 177 | { | ||
| 178 | MpegEncContext *s = avctx->priv_data; | ||
| 179 | |||
| 180 | ff_mpv_common_end(s); | ||
| 181 | return 0; | ||
| 182 | } | ||
| 183 | |||
| 176 | int ff_mpv_common_frame_size_change(MpegEncContext *s) | 184 | int ff_mpv_common_frame_size_change(MpegEncContext *s) |
| 177 | { | 185 | { |
| 178 | int err = 0; | 186 | int err = 0; |
| @@ -63,6 +63,7 @@ int ff_mpv_export_qp_table(const MpegEncContext *s, AVFrame *f, · 62 unmodified lines | |||
| 63 | int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src); | 63 | int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src); |
| 64 | void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h); | 64 | void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h); |
| 65 | void ff_mpeg_flush(AVCodecContext *avctx); | 65 | void ff_mpeg_flush(AVCodecContext *avctx); |
| 66 | int ff_mpv_decode_close(AVCodecContext *avctx); | ||
| 66 | 67 | ||
| 67 | void ff_print_debug_info(const MpegEncContext *s, const MPVPicture *p, AVFrame *pict); | 68 | void ff_print_debug_info(const MpegEncContext *s, const MPVPicture *p, AVFrame *pict); |
| 68 | 69 | ||
| @@ -28,6 +28,7 @@ · 27 unmodified lines | |||
| 28 | #include "codec_internal.h" | 28 | #include "codec_internal.h" |
| 29 | #include "mpegutils.h" | 29 | #include "mpegutils.h" |
| 30 | #include "mpegvideo.h" | 30 | #include "mpegvideo.h" |
| 31 | #include "mpegvideodec.h" | ||
| 31 | #include "msmpeg4.h" | 32 | #include "msmpeg4.h" |
| 32 | #include "msmpeg4dec.h" | 33 | #include "msmpeg4dec.h" |
| 33 | #include "libavutil/imgutils.h" | 34 | #include "libavutil/imgutils.h" |
| @@ -848,8 +849,8 @@ const FFCodec ff_msmpeg4v1_decoder = { · 814 unmodified lines | |||
| 848 | .p.id = AV_CODEC_ID_MSMPEG4V1, | 849 | .p.id = AV_CODEC_ID_MSMPEG4V1, |
| 849 | .priv_data_size = sizeof(MpegEncContext), | 850 | .priv_data_size = sizeof(MpegEncContext), |
| 850 | .init = ff_msmpeg4_decode_init, | 851 | .init = ff_msmpeg4_decode_init, |
| 851 | .close = ff_h263_decode_end, | ||
| 852 | FF_CODEC_DECODE_CB(ff_h263_decode_frame), | 852 | FF_CODEC_DECODE_CB(ff_h263_decode_frame), |
| 853 | .close = ff_mpv_decode_close, | ||
| 853 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, | 854 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, |
| 854 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, | 855 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, |
| 855 | .p.max_lowres = 3, | 856 | .p.max_lowres = 3, |
| @@ -862,8 +863,8 @@ const FFCodec ff_msmpeg4v2_decoder = { · 6 unmodified lines | |||
| 862 | .p.id = AV_CODEC_ID_MSMPEG4V2, | 863 | .p.id = AV_CODEC_ID_MSMPEG4V2, |
| 863 | .priv_data_size = sizeof(MpegEncContext), | 864 | .priv_data_size = sizeof(MpegEncContext), |
| 864 | .init = ff_msmpeg4_decode_init, | 865 | .init = ff_msmpeg4_decode_init, |
| 865 | .close = ff_h263_decode_end, | ||
| 866 | FF_CODEC_DECODE_CB(ff_h263_decode_frame), | 866 | FF_CODEC_DECODE_CB(ff_h263_decode_frame), |
| 867 | .close = ff_mpv_decode_close, | ||
| 867 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, | 868 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, |
| 868 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, | 869 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, |
| 869 | .p.max_lowres = 3, | 870 | .p.max_lowres = 3, |
| @@ -876,8 +877,8 @@ const FFCodec ff_msmpeg4v3_decoder = { · 6 unmodified lines | |||
| 876 | .p.id = AV_CODEC_ID_MSMPEG4V3, | 877 | .p.id = AV_CODEC_ID_MSMPEG4V3, |
| 877 | .priv_data_size = sizeof(MpegEncContext), | 878 | .priv_data_size = sizeof(MpegEncContext), |
| 878 | .init = ff_msmpeg4_decode_init, | 879 | .init = ff_msmpeg4_decode_init, |
| 879 | .close = ff_h263_decode_end, | ||
| 880 | FF_CODEC_DECODE_CB(ff_h263_decode_frame), | 880 | FF_CODEC_DECODE_CB(ff_h263_decode_frame), |
| 881 | .close = ff_mpv_decode_close, | ||
| 881 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, | 882 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, |
| 882 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, | 883 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, |
| 883 | .p.max_lowres = 3, | 884 | .p.max_lowres = 3, |
| @@ -890,8 +891,8 @@ const FFCodec ff_wmv1_decoder = { · 6 unmodified lines | |||
| 890 | .p.id = AV_CODEC_ID_WMV1, | 891 | .p.id = AV_CODEC_ID_WMV1, |
| 891 | .priv_data_size = sizeof(MpegEncContext), | 892 | .priv_data_size = sizeof(MpegEncContext), |
| 892 | .init = ff_msmpeg4_decode_init, | 893 | .init = ff_msmpeg4_decode_init, |
| 893 | .close = ff_h263_decode_end, | ||
| 894 | FF_CODEC_DECODE_CB(ff_h263_decode_frame), | 894 | FF_CODEC_DECODE_CB(ff_h263_decode_frame), |
| 895 | .close = ff_mpv_decode_close, | ||
| 895 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, | 896 | .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1, |
| 896 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, | 897 | .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, |
| 897 | .p.max_lowres = 3, | 898 | .p.max_lowres = 3, |
| @@ -416,14 +416,6 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx) · 415 unmodified lines | |||
| 416 | return 0; | 416 | return 0; |
| 417 | } | 417 | } |
| 418 | 418 | ||
| 419 | static av_cold int rv10_decode_end(AVCodecContext *avctx) | ||
| 420 | { | ||
| 421 | MpegEncContext *s = avctx->priv_data; | ||
| 422 | |||
| 423 | ff_mpv_common_end(s); | ||
| 424 | return 0; | ||
| 425 | } | ||
| 426 | |||
| 427 | static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, | 419 | static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, |
| 428 | int buf_size, int buf_size2, int whole_size) | 420 | int buf_size, int buf_size2, int whole_size) |
| 429 | { | 421 | { |
| @@ -666,8 +658,8 @@ const FFCodec ff_rv10_decoder = { · 236 unmodified lines | |||
| 666 | .p.id = AV_CODEC_ID_RV10, | 658 | .p.id = AV_CODEC_ID_RV10, |
| 667 | .priv_data_size = sizeof(RVDecContext), | 659 | .priv_data_size = sizeof(RVDecContext), |
| 668 | .init = rv10_decode_init, | 660 | .init = rv10_decode_init, |
| 669 | .close = rv10_decode_end, | ||
| 670 | FF_CODEC_DECODE_CB(rv10_decode_frame), | 661 | FF_CODEC_DECODE_CB(rv10_decode_frame), |
| 662 | .close = ff_mpv_decode_close, | ||
| 671 | .p.capabilities = AV_CODEC_CAP_DR1, | 663 | .p.capabilities = AV_CODEC_CAP_DR1, |
| 672 | .p.max_lowres = 3, | 664 | .p.max_lowres = 3, |
| 673 | }; | 665 | }; |
| @@ -679,8 +671,8 @@ const FFCodec ff_rv20_decoder = { · 5 unmodified lines | |||
| 679 | .p.id = AV_CODEC_ID_RV20, | 671 | .p.id = AV_CODEC_ID_RV20, |
| 680 | .priv_data_size = sizeof(RVDecContext), | 672 | .priv_data_size = sizeof(RVDecContext), |
| 681 | .init = rv10_decode_init, | 673 | .init = rv10_decode_init, |
| 682 | .close = rv10_decode_end, | ||
| 683 | FF_CODEC_DECODE_CB(rv10_decode_frame), | 674 | FF_CODEC_DECODE_CB(rv10_decode_frame), |
| 675 | .close = ff_mpv_decode_close, | ||
| 684 | .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, | 676 | .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, |
| 685 | .flush = ff_mpeg_flush, | 677 | .flush = ff_mpeg_flush, |
| 686 | .p.max_lowres = 3, | 678 | .p.max_lowres = 3, |
| @@ -302,6 +302,7 @@ const FFCodec ff_rv30_decoder = { · 301 unmodified lines | |||
| 302 | FF_CODEC_DECODE_CB(ff_rv34_decode_frame), | 302 | FF_CODEC_DECODE_CB(ff_rv34_decode_frame), |
| 303 | .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | | 303 | .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | |
| 304 | AV_CODEC_CAP_FRAME_THREADS, | 304 | AV_CODEC_CAP_FRAME_THREADS, |
| 305 | .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, | ||
| 305 | .flush = ff_mpeg_flush, | 306 | .flush = ff_mpeg_flush, |
| 306 | UPDATE_THREAD_CONTEXT(ff_rv34_decode_update_thread_context), | 307 | UPDATE_THREAD_CONTEXT(ff_rv34_decode_update_thread_context), |
| 307 | }; | 308 | }; |
| @@ -1522,10 +1522,9 @@ av_cold int ff_rv34_decode_init(AVCodecContext *avctx) · 1521 unmodified lines | |||
| 1522 | 1522 | ||
| 1523 | ff_h264_pred_init(&r->h, AV_CODEC_ID_RV40, 8, 1); | 1523 | ff_h264_pred_init(&r->h, AV_CODEC_ID_RV40, 8, 1); |
| 1524 | 1524 | ||
| 1525 | if ((ret = rv34_decoder_alloc(r)) < 0) { | 1525 | ret = rv34_decoder_alloc(r); |
| 1526 | ff_mpv_common_end(&r->s); | 1526 | if (ret < 0) |
| 1527 | return ret; | 1527 | return ret; |
| 1528 | } | ||
| 1529 | 1528 | ||
| 1530 | ff_thread_once(&init_static_once, rv34_init_tables); | 1529 | ff_thread_once(&init_static_once, rv34_init_tables); |
| 1531 | 1530 | ||
| @@ -1823,8 +1822,7 @@ av_cold int ff_rv34_decode_end(AVCodecContext *avctx) · 291 unmodified lines | |||
| 1823 | { | 1822 | { |
| 1824 | RV34DecContext *r = avctx->priv_data; | 1823 | RV34DecContext *r = avctx->priv_data; |
| 1825 | 1824 | ||
| 1826 | ff_mpv_common_end(&r->s); | ||
| 1827 | rv34_decoder_free(r); | 1825 | rv34_decoder_free(r); |
| 1828 | 1826 | ||
| 1829 | return 0; | 1827 | return ff_mpv_decode_close(avctx); |
| 1830 | } | 1828 | } |
| @@ -580,6 +580,7 @@ const FFCodec ff_rv40_decoder = { · 579 unmodified lines | |||
| 580 | FF_CODEC_DECODE_CB(ff_rv34_decode_frame), | 580 | FF_CODEC_DECODE_CB(ff_rv34_decode_frame), |
| 581 | .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | | 581 | .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | |
| 582 | AV_CODEC_CAP_FRAME_THREADS, | 582 | AV_CODEC_CAP_FRAME_THREADS, |
| 583 | .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, | ||
| 583 | .flush = ff_mpeg_flush, | 584 | .flush = ff_mpeg_flush, |
| 584 | UPDATE_THREAD_CONTEXT(ff_rv34_decode_update_thread_context), | 585 | UPDATE_THREAD_CONTEXT(ff_rv34_decode_update_thread_context), |
| 585 | }; | 586 | }; |
| @@ -449,6 +449,8 @@ static enum AVPixelFormat vc1_get_format(AVCodecContext *avctx) · 448 unmodified lines | |||
| 449 | return ff_get_format(avctx, vc1_hwaccel_pixfmt_list_420); | 449 | return ff_get_format(avctx, vc1_hwaccel_pixfmt_list_420); |
| 450 | } | 450 | } |
| 451 | 451 | ||
| 452 | static void vc1_decode_reset(AVCodecContext *avctx); | ||
| 453 | |||
| 452 | av_cold int ff_vc1_decode_init(AVCodecContext *avctx) | 454 | av_cold int ff_vc1_decode_init(AVCodecContext *avctx) |
| 453 | { | 455 | { |
| 454 | VC1Context *const v = avctx->priv_data; | 456 | VC1Context *const v = avctx->priv_data; |
| @@ -477,7 +479,7 @@ av_cold int ff_vc1_decode_init(AVCodecContext *avctx) · 22 unmodified lines | |||
| 477 | 479 | ||
| 478 | ret = vc1_decode_init_alloc_tables(v); | 480 | ret = vc1_decode_init_alloc_tables(v); |
| 479 | if (ret < 0) { | 481 | if (ret < 0) { |
| 480 | ff_vc1_decode_end(avctx); | 482 | vc1_decode_reset(avctx); |
| 481 | return ret; | 483 | return ret; |
| 482 | } | 484 | } |
| 483 | return 0; | 485 | return 0; |
| @@ -774,10 +776,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) · 290 unmodified lines | |||
| 774 | return 0; | 776 | return 0; |
| 775 | } | 777 | } |
| 776 | 778 | ||
| 777 | /** Close a VC1/WMV3 decoder | 779 | static av_cold void vc1_decode_reset(AVCodecContext *avctx) |
| 778 | * @warning Initial try at using MpegEncContext stuff | ||
| 779 | */ | ||
| 780 | av_cold int ff_vc1_decode_end(AVCodecContext *avctx) | ||
| 781 | { | 780 | { |
| 782 | VC1Context *v = avctx->priv_data; | 781 | VC1Context *v = avctx->priv_data; |
| 783 | int i; | 782 | int i; |
| @@ -803,9 +802,16 @@ av_cold int ff_vc1_decode_end(AVCodecContext *avctx) · 19 unmodified lines | |||
| 803 | av_freep(&v->is_intra_base); // FIXME use v->mb_type[] | 802 | av_freep(&v->is_intra_base); // FIXME use v->mb_type[] |
| 804 | av_freep(&v->luma_mv_base); | 803 | av_freep(&v->luma_mv_base); |
| 805 | ff_intrax8_common_end(&v->x8); | 804 | ff_intrax8_common_end(&v->x8); |
| 806 | return 0; | ||
| 807 | } | 805 | } |
| 808 | 806 | ||
| 807 | /** | ||
| 808 | * Close a MSS2/VC1/WMV3 decoder | ||
| 809 | */ | ||
| 810 | av_cold int ff_vc1_decode_end(AVCodecContext *avctx) | ||
| 811 | { | ||
| 812 | vc1_decode_reset(avctx); | ||
| 813 | return ff_mpv_decode_close(avctx); | ||
| 814 | } | ||
| 809 | 815 | ||
| 810 | /** Decode a VC1/WMV3 frame | 816 | /** Decode a VC1/WMV3 frame |
| 811 | * @todo TODO: Handle VC-1 IDUs (Transport level?) | 817 | * @todo TODO: Handle VC-1 IDUs (Transport level?) |
| @@ -27,6 +27,7 @@ · 26 unmodified lines | |||
| 27 | #include "mathops.h" | 27 | #include "mathops.h" |
| 28 | #include "mpegutils.h" | 28 | #include "mpegutils.h" |
| 29 | #include "mpegvideo.h" | 29 | #include "mpegvideo.h" |
| 30 | #include "mpegvideodec.h" | ||
| 30 | #include "msmpeg4.h" | 31 | #include "msmpeg4.h" |
| 31 | #include "msmpeg4_vc1_data.h" | 32 | #include "msmpeg4_vc1_data.h" |
| 32 | #include "msmpeg4dec.h" | 33 | #include "msmpeg4dec.h" |
| @@ -584,7 +585,7 @@ static av_cold int wmv2_decode_end(AVCodecContext *avctx) · 551 unmodified lines | |||
| 584 | WMV2DecContext *const w = avctx->priv_data; | 585 | WMV2DecContext *const w = avctx->priv_data; |
| 585 | 586 | ||
| 586 | ff_intrax8_common_end(&w->x8); | 587 | ff_intrax8_common_end(&w->x8); |
| 587 | return ff_h263_decode_end(avctx); | 588 | return ff_mpv_decode_close(avctx); |
| 588 | } | 589 | } |
| 589 | 590 | ||
| 590 | const FFCodec ff_wmv2_decoder = { | 591 | const FFCodec ff_wmv2_decoder = { |