diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2005-07-19 20:30:38 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2005-07-19 20:30:38 +0000 |
commit | fcc9a6282dd3c541055636ac49882d1639da251b (patch) | |
tree | 588b324e232caccf8085c85c7119d8d29ee2b6e8 /src/libffmpeg/libavcodec/utils.c | |
parent | 6bfc655ee19aa82cce3277e6f9c861661cca5fb4 (diff) | |
download | xine-lib-fcc9a6282dd3c541055636ac49882d1639da251b.tar.gz xine-lib-fcc9a6282dd3c541055636ac49882d1639da251b.tar.bz2 |
here is cvs update people requested - somebody please check for gcc4 compatibility
CVS patchset: 7668
CVS date: 2005/07/19 20:30:38
Diffstat (limited to 'src/libffmpeg/libavcodec/utils.c')
-rw-r--r-- | src/libffmpeg/libavcodec/utils.c | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/src/libffmpeg/libavcodec/utils.c b/src/libffmpeg/libavcodec/utils.c index d1debfe40..0a0971fc3 100644 --- a/src/libffmpeg/libavcodec/utils.c +++ b/src/libffmpeg/libavcodec/utils.c @@ -583,13 +583,22 @@ int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, if((avctx->codec->capabilities & CODEC_CAP_DELAY) || pict){ int ret = avctx->codec->encode(avctx, buf, buf_size, (void *)pict); avctx->frame_number++; - emms_c(); //needed to avoid a emms_c() call before every return; + emms_c(); //needed to avoid an emms_c() call before every return; return ret; }else return 0; } +int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, + const AVSubtitle *sub) +{ + int ret; + ret = avctx->codec->encode(avctx, buf, buf_size, (void *)sub); + avctx->frame_number++; + return ret; +} + /** * decode a frame. * @param buf bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE larger then the actual read bytes @@ -612,7 +621,7 @@ int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, ret = avctx->codec->decode(avctx, picture, got_picture_ptr, buf, buf_size); - emms_c(); //needed to avoid a emms_c() call before every return; + emms_c(); //needed to avoid an emms_c() call before every return; if (*got_picture_ptr) avctx->frame_number++; @@ -633,9 +642,29 @@ int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples, int ret; *frame_size_ptr= 0; - ret = avctx->codec->decode(avctx, samples, frame_size_ptr, - buf, buf_size); - avctx->frame_number++; + if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size){ + ret = avctx->codec->decode(avctx, samples, frame_size_ptr, + buf, buf_size); + avctx->frame_number++; + }else + ret= 0; + return ret; +} + +/* decode a subtitle message. return -1 if error, otherwise return the + *number of bytes used. If no subtitle could be decompressed, + *got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. */ +int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub, + int *got_sub_ptr, + const uint8_t *buf, int buf_size) +{ + int ret; + + *got_sub_ptr = 0; + ret = avctx->codec->decode(avctx, sub, got_sub_ptr, + (uint8_t *)buf, buf_size); + if (*got_sub_ptr) + avctx->frame_number++; return ret; } @@ -808,6 +837,10 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) snprintf(buf, buf_size, "Data: %s", codec_name); bitrate = enc->bit_rate; break; + case CODEC_TYPE_SUBTITLE: + snprintf(buf, buf_size, "Subtitle: %s", codec_name); + bitrate = enc->bit_rate; + break; default: snprintf(buf, buf_size, "Invalid Codec type %d", enc->codec_type); return; |