diff options
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/allcodecs.c | 2 | ||||
-rw-r--r-- | libavcodec/alsdec.c | 4 | ||||
-rw-r--r-- | libavcodec/assenc.c | 6 | ||||
-rw-r--r-- | libavcodec/avcodec.h | 5 | ||||
-rw-r--r-- | libavcodec/dvbsub.c | 8 | ||||
-rw-r--r-- | libavcodec/dvdsubenc.c | 6 | ||||
-rw-r--r-- | libavcodec/movtextenc.c | 5 | ||||
-rw-r--r-- | libavcodec/srtenc.c | 7 | ||||
-rw-r--r-- | libavcodec/utils.c | 6 | ||||
-rw-r--r-- | libavcodec/xsubenc.c | 15 |
10 files changed, 31 insertions, 33 deletions
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 8806c6a..03340ef 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -325,8 +325,6 @@ void avcodec_register_all(void) REGISTER_DECODER (SHORTEN, shorten); REGISTER_DECODER (SIPR, sipr); REGISTER_DECODER (SMACKAUD, smackaud); - REGISTER_ENCDEC (SONIC, sonic); - REGISTER_ENCODER (SONIC_LS, sonic_ls); REGISTER_DECODER (TRUEHD, truehd); REGISTER_DECODER (TRUESPEECH, truespeech); REGISTER_DECODER (TTA, tta); diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index 672fcba..226312e 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -651,10 +651,10 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd) for (k = 1; k < sub_blocks; k++) s[k] = s[k - 1] + decode_rice(gb, 0); } - for (k = 0; k < sub_blocks; k++) + for (k = 1; k < sub_blocks; k++) if (s[k] > 32) { av_log(avctx, AV_LOG_ERROR, "k invalid for rice code.\n"); - return -1; + return AVERROR_INVALIDDATA; } if (get_bits1(gb)) diff --git a/libavcodec/assenc.c b/libavcodec/assenc.c index 779a55a..7ed21ee 100644 --- a/libavcodec/assenc.c +++ b/libavcodec/assenc.c @@ -37,9 +37,9 @@ static av_cold int ass_encode_init(AVCodecContext *avctx) } static int ass_encode_frame(AVCodecContext *avctx, - unsigned char *buf, int bufsize, void *data) + unsigned char *buf, int bufsize, + const AVSubtitle *sub) { - AVSubtitle *sub = data; int i, len, total_len = 0; for (i=0; i<sub->num_rects; i++) { @@ -67,5 +67,5 @@ AVCodec ff_ass_encoder = { .type = AVMEDIA_TYPE_SUBTITLE, .id = AV_CODEC_ID_SSA, .init = ass_encode_init, - .encode = ass_encode_frame, + .encode_sub = ass_encode_frame, }; diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 62a261a..fdfd5c4 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3099,6 +3099,8 @@ typedef struct AVProfile { typedef struct AVCodecDefault AVCodecDefault; +struct AVSubtitle; + /** * AVCodec. */ @@ -3171,7 +3173,8 @@ typedef struct AVCodec { void (*init_static_data)(struct AVCodec *codec); int (*init)(AVCodecContext *); - int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data); + int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size, + const struct AVSubtitle *sub); /** * Encode data to an AVPacket. * diff --git a/libavcodec/dvbsub.c b/libavcodec/dvbsub.c index 37bb3e1..562db6a 100644 --- a/libavcodec/dvbsub.c +++ b/libavcodec/dvbsub.c @@ -248,7 +248,7 @@ static void dvb_encode_rle8(uint8_t **pq, } static int encode_dvb_subtitles(DVBSubtitleContext *s, - uint8_t *outbuf, AVSubtitle *h) + uint8_t *outbuf, const AVSubtitle *h) { uint8_t *q, *pseg_len; int page_id, region_id, clut_id, object_id, i, bpp_index, page_state; @@ -444,10 +444,10 @@ static int encode_dvb_subtitles(DVBSubtitleContext *s, } static int dvbsub_encode(AVCodecContext *avctx, - unsigned char *buf, int buf_size, void *data) + unsigned char *buf, int buf_size, + const AVSubtitle *sub) { DVBSubtitleContext *s = avctx->priv_data; - AVSubtitle *sub = data; int ret; ret = encode_dvb_subtitles(s, buf, sub); @@ -459,6 +459,6 @@ AVCodec ff_dvbsub_encoder = { .type = AVMEDIA_TYPE_SUBTITLE, .id = AV_CODEC_ID_DVB_SUBTITLE, .priv_data_size = sizeof(DVBSubtitleContext), - .encode = dvbsub_encode, + .encode_sub = dvbsub_encode, .long_name = NULL_IF_CONFIG_SMALL("DVB subtitles"), }; diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c index d913708..2e0c37d 100644 --- a/libavcodec/dvdsubenc.c +++ b/libavcodec/dvdsubenc.c @@ -416,10 +416,10 @@ static int dvdsub_init(AVCodecContext *avctx) } static int dvdsub_encode(AVCodecContext *avctx, - unsigned char *buf, int buf_size, void *data) + unsigned char *buf, int buf_size, + const AVSubtitle *sub) { //DVDSubtitleContext *s = avctx->priv_data; - AVSubtitle *sub = data; int ret; ret = encode_dvd_subtitles(avctx, buf, buf_size, sub); @@ -431,7 +431,7 @@ AVCodec ff_dvdsub_encoder = { .type = AVMEDIA_TYPE_SUBTITLE, .id = AV_CODEC_ID_DVD_SUBTITLE, .init = dvdsub_init, - .encode = dvdsub_encode, + .encode_sub = dvdsub_encode, .long_name = NULL_IF_CONFIG_SMALL("DVD subtitles"), .priv_data_size = sizeof(DVDSubtitleContext), }; diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c index 3f73f8b..7f1b5b8 100644 --- a/libavcodec/movtextenc.c +++ b/libavcodec/movtextenc.c @@ -104,10 +104,9 @@ static const ASSCodesCallbacks mov_text_callbacks = { }; static int mov_text_encode_frame(AVCodecContext *avctx, unsigned char *buf, - int bufsize, void *data) + int bufsize, const AVSubtitle *sub) { MovTextContext *s = avctx->priv_data; - AVSubtitle *sub = data; ASSDialog *dialog; int i, len, num; @@ -157,6 +156,6 @@ AVCodec ff_movtext_encoder = { .id = AV_CODEC_ID_MOV_TEXT, .priv_data_size = sizeof(MovTextContext), .init = mov_text_encode_init, - .encode = mov_text_encode_frame, + .encode_sub = mov_text_encode_frame, .close = mov_text_encode_close, }; diff --git a/libavcodec/srtenc.c b/libavcodec/srtenc.c index fa85ef5..473c88f 100644 --- a/libavcodec/srtenc.c +++ b/libavcodec/srtenc.c @@ -233,10 +233,9 @@ static const ASSCodesCallbacks srt_callbacks = { }; static int srt_encode_frame(AVCodecContext *avctx, - unsigned char *buf, int bufsize, void *data) + unsigned char *buf, int bufsize, const AVSubtitle *sub) { SRTContext *s = avctx->priv_data; - AVSubtitle *sub = data; ASSDialog *dialog; int i, len, num; @@ -299,7 +298,7 @@ AVCodec ff_srt_encoder = { .id = AV_CODEC_ID_SRT, .priv_data_size = sizeof(SRTContext), .init = srt_encode_init, - .encode = srt_encode_frame, + .encode_sub = srt_encode_frame, .close = srt_encode_close, }; #endif @@ -312,7 +311,7 @@ AVCodec ff_subrip_encoder = { .id = AV_CODEC_ID_SUBRIP, .priv_data_size = sizeof(SRTContext), .init = srt_encode_init, - .encode = srt_encode_frame, + .encode_sub = srt_encode_frame, .close = srt_encode_close, }; #endif diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 30b0d21..09b07e2 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -134,7 +134,7 @@ static void avcodec_init(void) int av_codec_is_encoder(const AVCodec *codec) { - return codec && (codec->encode || codec->encode2); + return codec && (codec->encode_sub || codec->encode2); } int av_codec_is_decoder(const AVCodec *codec) @@ -804,7 +804,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code goto end; } if (codec->priv_class) { - *(const AVClass**)avctx->priv_data= codec->priv_class; + *(const AVClass**)avctx->priv_data = codec->priv_class; av_opt_set_defaults(avctx->priv_data); } } @@ -1407,7 +1407,7 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, return -1; } - ret = avctx->codec->encode(avctx, buf, buf_size, (void *)(intptr_t)sub); + ret = avctx->codec->encode_sub(avctx, buf, buf_size, sub); avctx->frame_number++; return ret; } diff --git a/libavcodec/xsubenc.c b/libavcodec/xsubenc.c index 210a9bf..cb2a908 100644 --- a/libavcodec/xsubenc.c +++ b/libavcodec/xsubenc.c @@ -111,9 +111,8 @@ static int make_tc(uint64_t ms, int *tc) } static int xsub_encode(AVCodecContext *avctx, unsigned char *buf, - int bufsize, void *data) + int bufsize, const AVSubtitle *h) { - AVSubtitle *h = data; uint64_t startTime = h->pts / 1000; // FIXME: need better solution... uint64_t endTime = startTime + h->end_display_time - h->start_display_time; int start_tc[4], end_tc[4]; @@ -211,10 +210,10 @@ static av_cold int xsub_encoder_init(AVCodecContext *avctx) } AVCodec ff_xsub_encoder = { - .name = "xsub", - .type = AVMEDIA_TYPE_SUBTITLE, - .id = AV_CODEC_ID_XSUB, - .init = xsub_encoder_init, - .encode = xsub_encode, - .long_name = NULL_IF_CONFIG_SMALL("DivX subtitles (XSUB)"), + .name = "xsub", + .type = AVMEDIA_TYPE_SUBTITLE, + .id = AV_CODEC_ID_XSUB, + .init = xsub_encoder_init, + .encode_sub = xsub_encode, + .long_name = NULL_IF_CONFIG_SMALL("DivX subtitles (XSUB)"), }; |