Mercurial > libavcodec.hg
comparison svq3.c @ 8209:65e05fda5280 libavcodec
move decoder initialization in separate function, earlier failure detection
author | bcoudurier |
---|---|
date | Mon, 24 Nov 2008 18:49:50 +0000 |
parents | 2717c68de07f |
children | 4a01f7144da5 |
comparison
equal
deleted
inserted
replaced
8208:1fbeeeec901d | 8209:65e05fda5280 |
---|---|
772 } | 772 } |
773 | 773 |
774 return 0; | 774 return 0; |
775 } | 775 } |
776 | 776 |
777 static int svq3_decode_frame(AVCodecContext *avctx, | 777 static int svq3_decode_init(AVCodecContext *avctx) |
778 void *data, int *data_size, | |
779 const uint8_t *buf, int buf_size) | |
780 { | 778 { |
781 MpegEncContext *const s = avctx->priv_data; | 779 MpegEncContext *const s = avctx->priv_data; |
782 H264Context *const h = avctx->priv_data; | 780 H264Context *const h = avctx->priv_data; |
783 int m, mb_type; | 781 int m; |
784 unsigned char *extradata; | 782 unsigned char *extradata; |
785 unsigned int size; | 783 unsigned int size; |
784 | |
785 if (decode_init(avctx) < 0) | |
786 return -1; | |
786 | 787 |
787 s->flags = avctx->flags; | 788 s->flags = avctx->flags; |
788 s->flags2 = avctx->flags2; | 789 s->flags2 = avctx->flags2; |
789 s->unrestricted_mv = 1; | 790 s->unrestricted_mv = 1; |
790 | 791 |
878 #endif | 879 #endif |
879 } | 880 } |
880 } | 881 } |
881 } | 882 } |
882 | 883 |
884 return 0; | |
885 } | |
886 | |
887 static int svq3_decode_frame(AVCodecContext *avctx, | |
888 void *data, int *data_size, | |
889 const uint8_t *buf, int buf_size) | |
890 { | |
891 MpegEncContext *const s = avctx->priv_data; | |
892 H264Context *const h = avctx->priv_data; | |
893 int m, mb_type; | |
894 | |
883 /* special case for last picture */ | 895 /* special case for last picture */ |
884 if (buf_size == 0) { | 896 if (buf_size == 0) { |
885 if (s->next_picture_ptr && !s->low_delay) { | 897 if (s->next_picture_ptr && !s->low_delay) { |
886 *(AVFrame *) data = *(AVFrame *) &s->next_picture; | 898 *(AVFrame *) data = *(AVFrame *) &s->next_picture; |
887 s->next_picture_ptr = NULL; | 899 s->next_picture_ptr = NULL; |
1028 AVCodec svq3_decoder = { | 1040 AVCodec svq3_decoder = { |
1029 "svq3", | 1041 "svq3", |
1030 CODEC_TYPE_VIDEO, | 1042 CODEC_TYPE_VIDEO, |
1031 CODEC_ID_SVQ3, | 1043 CODEC_ID_SVQ3, |
1032 sizeof(H264Context), | 1044 sizeof(H264Context), |
1033 decode_init, | 1045 svq3_decode_init, |
1034 NULL, | 1046 NULL, |
1035 decode_end, | 1047 decode_end, |
1036 svq3_decode_frame, | 1048 svq3_decode_frame, |
1037 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_DELAY, | 1049 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_DELAY, |
1038 .long_name = NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 3"), | 1050 .long_name = NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 3"), |