diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-04-20 04:48:23 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-04-20 04:48:23 +0200 |
commit | efb5fa79f5ca34140db357a00c999286097ab53e (patch) | |
tree | 16cc9f34b25abc571f7a9915ff98ff2bb787203c /libavcodec/utils.c | |
parent | f92b0084c0e02b3c816a9eb234c548487acadae8 (diff) | |
parent | 31d76ec2883c04d29d1f173ea99e605a6936613a (diff) | |
download | ffmpeg-streaming-efb5fa79f5ca34140db357a00c999286097ab53e.zip ffmpeg-streaming-efb5fa79f5ca34140db357a00c999286097ab53e.tar.gz |
Merge remote branch 'qatar/master'
* qatar/master: (37 commits)
In avcodec_open(), set return code to an error value only when an error occurs instead of unconditionally at the start of the function.
lavc: remove reference to opt.h from Makefile.
prefer avio_check() over url_exist()
avio: remove AVIO_* access symbols in favor of new AVIO_FLAG_* symbols
lavu: remove misc disabled cruft
lavu: remove FF_API_OLD_IMAGE_NAMES cruft
NOT PULLED lavu: remove FF_API_OLD_EVAL_NAMES cruft
lavc: remove misc disabled cruft.
lavc: remove the FF_API_INOFFICIAL cruft.
lavc: remove the FF_API_SET_STRING_OLD cruft.
lavc: remove the FF_API_USE_LPC cruft.
lavc: remove the FF_API_SUBTITLE_OLD cruft.
lavc: remove the FF_API_VIDEO_OLD cruft.
lavc: remove the FF_API_AUDIO_OLD cruft.
lavc: remove the FF_API_OPT_SHOW cruft.
lavc: remove the FF_API_MM_FLAGS cruft.
lavf: remove misc disabled cruft.
lavf: remove FF_API_INDEX_BUILT cruft
lavf: remove FF_API_URL_CLASS cruft.
lavf: remove FF_API_SYMVER cruft
...
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 86 |
1 files changed, 10 insertions, 76 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index a6fb871..47b752a 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -48,7 +48,7 @@ static int volatile entangled_thread_counter=0; static int (*ff_lockmgr_cb)(void **mutex, enum AVLockOp op); static void *codec_mutex; -void *av_fast_realloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_size) +void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size) { if(min_size < *size) return ptr; @@ -64,7 +64,7 @@ void *av_fast_realloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_s return ptr; } -void av_fast_malloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE min_size) +void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size) { void **p = ptr; if (min_size < *size) @@ -94,13 +94,6 @@ void avcodec_register(AVCodec *codec) codec->next = NULL; } -#if LIBAVCODEC_VERSION_MAJOR < 53 -void register_avcodec(AVCodec *codec) -{ - avcodec_register(codec); -} -#endif - unsigned avcodec_get_edge_width(void) { return EDGE_WIDTH; @@ -224,12 +217,6 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){ *width=FFALIGN(*width, align); } -#if LIBAVCODEC_VERSION_MAJOR < 53 -int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){ - return av_image_check_size(w, h, 0, av_log_ctx); -} -#endif - int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){ int i; int w= s->width; @@ -482,7 +469,7 @@ static void avcodec_get_subtitle_defaults(AVSubtitle *sub) int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) { - int ret= -1; + int ret = 0; /* If there is a user-supplied mutex locking routine, call it. */ if (ff_lockmgr_cb) { @@ -493,11 +480,14 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) entangled_thread_counter++; if(entangled_thread_counter != 1){ av_log(avctx, AV_LOG_ERROR, "insufficient thread locking around avcodec_open/close()\n"); + ret = -1; goto end; } - if(avctx->codec || !codec) + if(avctx->codec || !codec) { + ret = AVERROR(EINVAL); goto end; + } if (codec->priv_data_size > 0) { if(!avctx->priv_data){ @@ -547,6 +537,7 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) if (avctx->codec_id != codec->id || (avctx->codec_type != codec->type && avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) { av_log(avctx, AV_LOG_ERROR, "codec type or id mismatches\n"); + ret = AVERROR(EINVAL); goto free_and_end; } avctx->frame_number = 0; @@ -561,6 +552,7 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) if (avctx->codec->max_lowres < avctx->lowres) { av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n", avctx->codec->max_lowres); + ret = AVERROR(EINVAL); goto free_and_end; } if (avctx->codec->sample_fmts && avctx->codec->encode) { @@ -570,6 +562,7 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) break; if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) { av_log(avctx, AV_LOG_ERROR, "Specified sample_fmt is not supported.\n"); + ret = AVERROR(EINVAL); goto free_and_end; } } @@ -736,20 +729,6 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi return ret; } -#if FF_API_AUDIO_OLD -int attribute_align_arg avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples, - int *frame_size_ptr, - const uint8_t *buf, int buf_size) -{ - AVPacket avpkt; - av_init_packet(&avpkt); - avpkt.data = buf; - avpkt.size = buf_size; - - return avcodec_decode_audio3(avctx, samples, frame_size_ptr, &avpkt); -} -#endif - int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, AVPacket *avpkt) @@ -779,20 +758,6 @@ int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *sa return ret; } -#if FF_API_SUBTITLE_OLD -int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub, - int *got_sub_ptr, - const uint8_t *buf, int buf_size) -{ - AVPacket avpkt; - av_init_packet(&avpkt); - avpkt.data = buf; - avpkt.size = buf_size; - - return avcodec_decode_subtitle2(avctx, sub, got_sub_ptr, &avpkt); -} -#endif - int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt) @@ -1225,20 +1190,6 @@ unsigned int av_xiphlacing(unsigned char *s, unsigned int v) return n; } -#if LIBAVCODEC_VERSION_MAJOR < 53 -#include "libavutil/parseutils.h" - -int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str) -{ - return av_parse_video_size(width_ptr, height_ptr, str); -} - -int av_parse_video_frame_rate(AVRational *frame_rate, const char *arg) -{ - return av_parse_video_rate(frame_rate, arg); -} -#endif - int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b){ int i; for(i=0; i<size && !(tab[i][0]==a && tab[i][1]==b); i++); @@ -1344,20 +1295,3 @@ void ff_thread_await_progress(AVFrame *f, int progress, int field) } #endif - -#if LIBAVCODEC_VERSION_MAJOR < 53 - -int avcodec_thread_init(AVCodecContext *s, int thread_count) -{ - s->thread_count = thread_count; - return ff_thread_init(s); -} - -void avcodec_thread_free(AVCodecContext *s) -{ -#if HAVE_THREADS - ff_thread_free(s); -#endif -} - -#endif |