diff --git a/Makefile b/Makefile index 95624781c0..6d4db62881 100644 --- a/Makefile +++ b/Makefile @@ -291,7 +291,7 @@ fate: $(FATE) $(FATE): ffmpeg$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF)) @echo "TEST $(@:fate-%=%)" - $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' '$(THREADS)' + $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' '$(THREADS)' '$(THREAD_TYPE)' fate-list: @printf '%s\n' $(sort $(FATE)) diff --git a/configure b/configure index 3cacb26412..aaa8eee602 100755 --- a/configure +++ b/configure @@ -1128,6 +1128,7 @@ HAVE_LIST=" ten_operands termios_h threads + trunc truncf vfp_args VirtualAlloc @@ -2887,6 +2888,7 @@ check_mathfunc lrint check_mathfunc lrintf check_mathfunc round check_mathfunc roundf +check_mathfunc trunc check_mathfunc truncf # these are off by default, so fail if requested and not available diff --git a/doc/APIchanges b/doc/APIchanges index aadf7b027e..8b1130b3f4 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -1,5 +1,6 @@ -Never assume the API of libav* to be stable unless at least 1 week has passed since -the last major version increase. +Never assume the API of libav* to be stable unless at least 1 month has passed +since the last major version increase. + The last version increases were: libavcodec: 2011-04-18 libavdevice: 2011-04-18 @@ -12,6 +13,9 @@ libavutil: 2011-04-18 API changes, most recent first: +2011-04-21 - 94f7451 - lavc 53.1.0 - avcodec.h + Add CODEC_CAP_SLICE_THREADS for codecs supporting sliced threading. + 2011-04-15 - lavc 52.120.0 - avcodec.h AVPacket structure got additional members for passing side information: 4de339e introduce side information for AVPacket diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 05316ce5cd..ffaadfe4f9 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -64,4 +64,15 @@ Note that the pattern must not necessarily contain "%d" or ffmpeg -f image2 -i img.jpeg img.png @end example +@section applehttp + +Apple HTTP Live Streaming demuxer. + +This demuxer presents all AVStreams from all variant streams. +The id field is set to the bitrate variant index number. By setting +the discard flags on AVStreams (by pressing 'a' or 'v' in ffplay), +the caller can decide which variant streams to actually receive. +The total bitrate of the variant that the stream belongs to is +available in a metadata key named "variant_bitrate". + @c man end INPUT DEVICES diff --git a/ffmpeg.c b/ffmpeg.c index d2232857c1..a5b51b790a 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -3852,7 +3852,7 @@ static void opt_output_file(const char *filename) /* check filename in case of an image number is expected */ if (oc->oformat->flags & AVFMT_NEEDNUMBER) { if (!av_filename_number_test(oc->filename)) { - print_error(oc->filename, AVERROR_NUMEXPECTED); + print_error(oc->filename, AVERROR(EINVAL)); ffmpeg_exit(1); } } diff --git a/libavcodec/Makefile b/libavcodec/Makefile index df2cda03dc..62ac8999a8 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -3,7 +3,7 @@ include $(SUBDIR)../config.mak NAME = avcodec FFLIBS = avutil -HEADERS = avcodec.h avfft.h dxva2.h vaapi.h vdpau.h version.h xvmc.h +HEADERS = avcodec.h avfft.h dxva2.h opt.h vaapi.h vdpau.h version.h xvmc.h OBJS = allcodecs.o \ audioconvert.o \ diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index dd1dd6bf3b..1919b2cd33 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -680,6 +680,10 @@ typedef struct RcOverride{ * Codec supports frame-level multithreading. */ #define CODEC_CAP_FRAME_THREADS 0x1000 +/** + * Codec supports slice-based (or partition-based) multithreading. + */ +#define CODEC_CAP_SLICE_THREADS 0x2000 //The following defines may change, don't expect compatibility if you use them. #define MB_TYPE_INTRA4x4 0x0001 @@ -3633,6 +3637,14 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt); +#if FF_API_THREAD_INIT +/** + * @deprecated Set s->thread_count before calling avcodec_open() instead of calling this. + */ +attribute_deprecated +int avcodec_thread_init(AVCodecContext *s, int thread_count); +#endif + int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); //FIXME func typedef diff --git a/libavcodec/cook.c b/libavcodec/cook.c index 3f7776bed0..27a45f318b 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -1136,7 +1136,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) switch (q->subpacket[s].cookversion) { case MONO: if (q->nb_channels != 1) { - av_log(avctx,AV_LOG_ERROR,"Container channels != 1, report sample!\n"); + av_log_ask_for_sample(avctx, "Container channels != 1.!\n"); return -1; } av_log(avctx,AV_LOG_DEBUG,"MONO\n"); @@ -1150,7 +1150,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) break; case JOINT_STEREO: if (q->nb_channels != 2) { - av_log(avctx,AV_LOG_ERROR,"Container channels != 2, report sample!\n"); + av_log_ask_for_sample(avctx, "Container channels != 2.\n"); return -1; } av_log(avctx,AV_LOG_DEBUG,"JOINT_STEREO\n"); @@ -1188,7 +1188,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) break; default: - av_log(avctx,AV_LOG_ERROR,"Unknown Cook version, report sample!\n"); + av_log_ask_for_sample(avctx, "Unknown Cook version.\n"); return -1; break; } @@ -1205,7 +1205,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) /* Try to catch some obviously faulty streams, othervise it might be exploitable */ if (q->subpacket[s].total_subbands > 53) { - av_log(avctx,AV_LOG_ERROR,"total_subbands > 53, report sample!\n"); + av_log_ask_for_sample(avctx, "total_subbands > 53\n"); return -1; } @@ -1215,7 +1215,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) } if (q->subpacket[s].subbands > 50) { - av_log(avctx,AV_LOG_ERROR,"subbands > 50, report sample!\n"); + av_log_ask_for_sample(avctx, "subbands > 50\n"); return -1; } q->subpacket[s].gains1.now = q->subpacket[s].gain_1; @@ -1226,7 +1226,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) q->num_subpackets++; s++; if (s > MAX_SUBPACKETS) { - av_log(avctx,AV_LOG_ERROR,"Too many subpackets > 5, report file!\n"); + av_log_ask_for_sample(avctx, "Too many subpackets > 5\n"); return -1; } } diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c index bd73290031..6d1a17fd0a 100644 --- a/libavcodec/dnxhdenc.c +++ b/libavcodec/dnxhdenc.c @@ -869,6 +869,7 @@ AVCodec ff_dnxhd_encoder = { dnxhd_encode_init, dnxhd_encode_picture, dnxhd_encode_end, + .capabilities = CODEC_CAP_SLICE_THREADS, .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"), .priv_class = &class, diff --git a/libavcodec/dv.c b/libavcodec/dv.c index 6a4914768d..5fca22f9f7 100644 --- a/libavcodec/dv.c +++ b/libavcodec/dv.c @@ -1297,6 +1297,7 @@ AVCodec ff_dvvideo_encoder = { sizeof(DVVideoContext), dvvideo_init_encoder, dvvideo_encode_frame, + .capabilities = CODEC_CAP_SLICE_THREADS, .pix_fmts = (const enum PixelFormat[]) {PIX_FMT_YUV411P, PIX_FMT_YUV422P, PIX_FMT_YUV420P, PIX_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"), }; @@ -1312,7 +1313,7 @@ AVCodec ff_dvvideo_decoder = { NULL, dvvideo_close, dvvideo_decode_frame, - CODEC_CAP_DR1, + CODEC_CAP_DR1 | CODEC_CAP_SLICE_THREADS, NULL, .max_lowres = 3, .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"), diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index b00b463e16..0a982e8754 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -1795,7 +1795,7 @@ AVCodec ff_ffv1_decoder = { NULL, common_end, decode_frame, - CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/, + CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/ | CODEC_CAP_SLICE_THREADS, NULL, .long_name= NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"), }; @@ -1809,6 +1809,7 @@ AVCodec ff_ffv1_encoder = { encode_init, encode_frame, common_end, + .capabilities = CODEC_CAP_SLICE_THREADS, .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV411P, PIX_FMT_YUV410P, PIX_FMT_RGB32, PIX_FMT_YUV420P16, PIX_FMT_YUV422P16, PIX_FMT_YUV444P16, PIX_FMT_NONE}, .long_name= NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"), }; diff --git a/libavcodec/h264.c b/libavcodec/h264.c index c64e6fb3f9..22a57866d4 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -3467,7 +3467,9 @@ AVCodec ff_h264_decoder = { NULL, ff_h264_decode_end, decode_frame, - /*CODEC_CAP_DRAW_HORIZ_BAND |*/ CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_FRAME_THREADS, + /*CODEC_CAP_DRAW_HORIZ_BAND |*/ CODEC_CAP_DR1 | CODEC_CAP_DELAY | + CODEC_CAP_FRAME_THREADS | + CODEC_CAP_SLICE_THREADS, .flush= flush_dpb, .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"), .init_thread_copy = ONLY_IF_THREADS_ENABLED(decode_init_thread_copy), diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 9afe8c3385..192ecdd478 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -2602,7 +2602,7 @@ AVCodec ff_mpeg2video_decoder = { NULL, mpeg_decode_end, mpeg_decode_frame, - CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY, + CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS, .flush= flush, .max_lowres= 3, .long_name= NULL_IF_CONFIG_SMALL("MPEG-2 video"), @@ -2619,7 +2619,7 @@ AVCodec ff_mpegvideo_decoder = { NULL, mpeg_decode_end, mpeg_decode_frame, - CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY, + CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS, .flush= flush, .max_lowres= 3, .long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"), diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index b2526f6b7a..cc1d9c8230 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -940,7 +940,7 @@ AVCodec ff_mpeg1video_encoder = { MPV_encode_end, .supported_framerates= ff_frame_rate_tab+1, .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, - .capabilities= CODEC_CAP_DELAY, + .capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS, .long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"), }; @@ -954,6 +954,6 @@ AVCodec ff_mpeg2video_encoder = { MPV_encode_end, .supported_framerates= ff_frame_rate_tab+1, .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE}, - .capabilities= CODEC_CAP_DELAY, + .capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS, .long_name= NULL_IF_CONFIG_SMALL("MPEG-2 video"), }; diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c index d6834a6e40..f6a18b77cc 100644 --- a/libavcodec/mpeg4videoenc.c +++ b/libavcodec/mpeg4videoenc.c @@ -1359,6 +1359,6 @@ AVCodec ff_mpeg4_encoder = { MPV_encode_picture, MPV_encode_end, .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, - .capabilities= CODEC_CAP_DELAY, + .capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS, .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2"), }; diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 9255fa872a..7760ee58b6 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -3802,6 +3802,7 @@ AVCodec ff_h263p_encoder = { MPV_encode_init, MPV_encode_picture, MPV_encode_end, + .capabilities = CODEC_CAP_SLICE_THREADS, .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, .long_name= NULL_IF_CONFIG_SMALL("H.263+ / H.263-1998 / H.263 version 2"), }; diff --git a/libavcodec/opt.h b/libavcodec/opt.h new file mode 100644 index 0000000000..e754bb93d8 --- /dev/null +++ b/libavcodec/opt.h @@ -0,0 +1,16 @@ +/** + * @file + * This header is provided for compatibility only and will be removed + * on next major bump + */ + +#ifndef AVCODEC_OPT_H +#define AVCODEC_OPT_H + +#include "libavcodec/version.h" + +#if FF_API_OPT_H +#include "libavutil/opt.h" +#endif + +#endif diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index 82b0732592..e0eea4b1f1 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -877,7 +877,8 @@ static void validate_thread_parameters(AVCodecContext *avctx) avctx->active_thread_type = 0; } else if (frame_threading_supported && (avctx->thread_type & FF_THREAD_FRAME)) { avctx->active_thread_type = FF_THREAD_FRAME; - } else if (avctx->thread_type & FF_THREAD_SLICE) { + } else if (avctx->codec->capabilities & CODEC_CAP_SLICE_THREADS && + avctx->thread_type & FF_THREAD_SLICE) { avctx->active_thread_type = FF_THREAD_SLICE; } } diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c index c7d414a648..b1b14319c5 100644 --- a/libavcodec/truemotion1.c +++ b/libavcodec/truemotion1.c @@ -353,7 +353,7 @@ static int truemotion1_decode_header(TrueMotion1Context *s) s->flags = FLAG_KEYFRAME; if (s->flags & FLAG_SPRITE) { - av_log(s->avctx, AV_LOG_INFO, "SPRITE frame found, please report the sample to the developers\n"); + av_log_ask_for_sample(s->avctx, "SPRITE frame found.\n"); /* FIXME header.width, height, xoffset and yoffset aren't initialized */ #if 0 s->w = header.width; @@ -370,7 +370,7 @@ static int truemotion1_decode_header(TrueMotion1Context *s) if ((s->w < 213) && (s->h >= 176)) { s->flags |= FLAG_INTERPOLATED; - av_log(s->avctx, AV_LOG_INFO, "INTERPOLATION selected, please report the sample to the developers\n"); + av_log_ask_for_sample(s->avctx, "INTERPOLATION selected.\n"); } } } diff --git a/libavcodec/tta.c b/libavcodec/tta.c index eb4d71ff85..ece5c1c43b 100644 --- a/libavcodec/tta.c +++ b/libavcodec/tta.c @@ -247,7 +247,7 @@ static av_cold int tta_decode_init(AVCodecContext * avctx) if (s->is_float) { avctx->sample_fmt = AV_SAMPLE_FMT_FLT; - av_log(s->avctx, AV_LOG_ERROR, "Unsupported sample format. Please contact the developers.\n"); + av_log_ask_for_sample(s->avctx, "Unsupported sample format.\n"); return -1; } else switch(s->bps) { @@ -256,7 +256,8 @@ static av_cold int tta_decode_init(AVCodecContext * avctx) // case 3: avctx->sample_fmt = AV_SAMPLE_FMT_S24; break; case 4: avctx->sample_fmt = AV_SAMPLE_FMT_S32; break; default: - av_log(s->avctx, AV_LOG_ERROR, "Invalid/unsupported sample format. Please contact the developers.\n"); + av_log_ask_for_sample(s->avctx, + "Invalid/unsupported sample format.\n"); return -1; } diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 47b752a794..ec3f4b965b 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1295,3 +1295,11 @@ void ff_thread_await_progress(AVFrame *f, int progress, int field) } #endif + +#if FF_API_THREAD_INIT +int avcodec_thread_init(AVCodecContext *s, int thread_count) +{ + s->thread_count = thread_count; + return ff_thread_init(s); +} +#endif diff --git a/libavcodec/v210x.c b/libavcodec/v210x.c index 0d6a681b78..962678dde6 100644 --- a/libavcodec/v210x.c +++ b/libavcodec/v210x.c @@ -52,7 +52,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac } if(avpkt->size > avctx->width * avctx->height * 8 / 3){ - av_log(avctx, AV_LOG_ERROR, "Probably padded data, need sample!\n"); + av_log_ask_for_sample(avctx, "Probably padded data\n"); } pic->reference= 0; diff --git a/libavcodec/version.h b/libavcodec/version.h index 5e88f10b99..e5ca102814 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -21,7 +21,7 @@ #define AVCODEC_VERSION_H #define LIBAVCODEC_VERSION_MAJOR 53 -#define LIBAVCODEC_VERSION_MINOR 0 +#define LIBAVCODEC_VERSION_MINOR 1 #define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ @@ -62,5 +62,11 @@ #ifndef FF_API_REQUEST_CHANNELS #define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 54) #endif +#ifndef FF_API_OPT_H +#define FF_API_OPT_H (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_THREAD_INIT +#define FF_API_THREAD_INIT (LIBAVCODEC_VERSION_MAJOR < 54) +#endif #endif /* AVCODEC_VERSION_H */ diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c index cec79a4989..fb5c45c7b6 100644 --- a/libavdevice/bktr.c +++ b/libavdevice/bktr.c @@ -26,6 +26,7 @@ #define _BSD_SOURCE 1 #define _NETBSD_SOURCE +#define _XOPEN_SOURCE 600 #include "libavformat/avformat.h" #if HAVE_DEV_BKTR_IOCTL_METEOR_H && HAVE_DEV_BKTR_IOCTL_BT848_H diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index 2b22cd401b..27d98583e7 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -367,6 +367,7 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap) for (i = 0; i < c->n_variants; i++) { struct variant *v = c->variants[i]; AVInputFormat *in_fmt = NULL; + char bitrate_str[20]; if (v->n_segments == 0) continue; @@ -393,6 +394,7 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap) if (ret < 0) goto fail; v->stream_offset = stream_offset; + snprintf(bitrate_str, sizeof(bitrate_str), "%d", v->bandwidth); /* Create new AVStreams for each stream in this variant */ for (j = 0; j < v->ctx->nb_streams; j++) { AVStream *st = av_new_stream(s, i); @@ -401,6 +403,7 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap) goto fail; } avcodec_copy_context(st->codec, v->ctx->streams[j]->codec); + av_metadata_set2(&st->metadata, "variant_bitrate", bitrate_str, 0); } stream_offset += v->ctx->nb_streams; } diff --git a/libavformat/avformat.h b/libavformat/avformat.h index c3c3de8362..767356a439 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -104,6 +104,7 @@ struct AVFormatContext; * service_provider -- name of the service provider in broadcasting. * title -- name of the work. * track -- number of this work in the set, can be in form current/total. + * variant_bitrate -- the total bitrate of the bitrate variant that the current stream is part of */ #define AV_METADATA_MATCH_CASE 1 diff --git a/libavformat/utils.c b/libavformat/utils.c index 6d5e1a8023..e7ce9110ab 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -586,7 +586,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, /* check filename in case an image number is expected */ if (fmt->flags & AVFMT_NEEDNUMBER) { if (!av_filename_number_test(filename)) { - err = AVERROR_NUMEXPECTED; + err = AVERROR(EINVAL); goto fail; } } diff --git a/libavformat/version.h b/libavformat/version.h index 0ec2400e27..7102dfd51b 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -25,7 +25,7 @@ #define LIBAVFORMAT_VERSION_MAJOR 53 #define LIBAVFORMAT_VERSION_MINOR 0 -#define LIBAVFORMAT_VERSION_MICRO 0 +#define LIBAVFORMAT_VERSION_MICRO 1 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ diff --git a/libavutil/error.c b/libavutil/error.c index 93f8925d44..5a1ddae5ab 100644 --- a/libavutil/error.c +++ b/libavutil/error.c @@ -25,19 +25,19 @@ int av_strerror(int errnum, char *errbuf, size_t errbuf_size) const char *errstr = NULL; switch (errnum) { - case AVERROR_EOF: errstr = "End of file"; break; - case AVERROR_INVALIDDATA: errstr = "Invalid data found when processing input"; break; - case AVERROR_NUMEXPECTED: errstr = "Number syntax expected in filename"; break; + case AVERROR_BSF_NOT_FOUND: errstr = "Bitstream filter not found" ; break; + case AVERROR_DECODER_NOT_FOUND: errstr = "Decoder not found" ; break; + case AVERROR_DEMUXER_NOT_FOUND: errstr = "Demuxer not found" ; break; + case AVERROR_ENCODER_NOT_FOUND: errstr = "Encoder not found" ; break; + case AVERROR_EOF: errstr = "End of file" ; break; + case AVERROR_EXIT: errstr = "Immediate exit requested" ; break; + case AVERROR_FILTER_NOT_FOUND: errstr = "Filter not found" ; break; + case AVERROR_INVALIDDATA: errstr = "Invalid data found when processing input" ; break; + case AVERROR_MUXER_NOT_FOUND: errstr = "Muxer not found" ; break; + case AVERROR_OPTION_NOT_FOUND: errstr = "Option not found" ; break; case AVERROR_PATCHWELCOME: errstr = "Not yet implemented in FFmpeg, patches welcome"; break; - case AVERROR_DEMUXER_NOT_FOUND: errstr = "Demuxer not found"; break; - case AVERROR_MUXER_NOT_FOUND: errstr = "Muxer not found"; break; - case AVERROR_DECODER_NOT_FOUND: errstr = "Decoder not found"; break; - case AVERROR_ENCODER_NOT_FOUND: errstr = "Encoder not found"; break; - case AVERROR_PROTOCOL_NOT_FOUND:errstr = "Protocol not found"; break; - case AVERROR_FILTER_NOT_FOUND: errstr = "Filter not found"; break; - case AVERROR_BSF_NOT_FOUND: errstr = "Bitstream filter not found"; break; - case AVERROR_STREAM_NOT_FOUND: errstr = "Stream not found"; break; - case AVERROR_EXIT: errstr = "Immediate exit requested"; break; + case AVERROR_PROTOCOL_NOT_FOUND:errstr = "Protocol not found" ; break; + case AVERROR_STREAM_NOT_FOUND: errstr = "Stream not found" ; break; } if (errstr) { diff --git a/libavutil/error.h b/libavutil/error.h index d371e6b0fe..f6a5942060 100644 --- a/libavutil/error.h +++ b/libavutil/error.h @@ -44,24 +44,22 @@ #define AVERROR_NOTSUPP AVERROR(ENOSYS) ///< Operation not supported #define AVERROR_UNKNOWN AVERROR(EINVAL) ///< Unknown error -#define AVERROR_EOF AVERROR(EPIPE) ///< End of file -#define AVERROR_PATCHWELCOME (-MKTAG('P','A','W','E')) ///< Not yet implemented in FFmpeg, patches welcome -#define AVERROR_INVALIDDATA (-MKTAG('I','N','D','A')) ///< Invalid data found when processing input -#define AVERROR_NUMEXPECTED (-MKTAG('N','U','E','X')) ///< Number syntax expected in filename - -#define AVERROR_DEMUXER_NOT_FOUND (-MKTAG(0xF8,'D','E','M')) ///< Demuxer not found -#define AVERROR_MUXER_NOT_FOUND (-MKTAG(0xF8,'M','U','X')) ///< Muxer not found -#define AVERROR_DECODER_NOT_FOUND (-MKTAG(0xF8,'D','E','C')) ///< Decoder not found -#define AVERROR_ENCODER_NOT_FOUND (-MKTAG(0xF8,'E','N','C')) ///< Encoder not found -#define AVERROR_PROTOCOL_NOT_FOUND (-MKTAG(0xF8,'P','R','O')) ///< Protocol not found -#define AVERROR_FILTER_NOT_FOUND (-MKTAG(0xF8,'F','I','L')) ///< Filter not found #define AVERROR_BSF_NOT_FOUND (-MKTAG(0xF8,'B','S','F')) ///< Bitstream filter not found +#define AVERROR_DECODER_NOT_FOUND (-MKTAG(0xF8,'D','E','C')) ///< Decoder not found +#define AVERROR_DEMUXER_NOT_FOUND (-MKTAG(0xF8,'D','E','M')) ///< Demuxer not found +#define AVERROR_ENCODER_NOT_FOUND (-MKTAG(0xF8,'E','N','C')) ///< Encoder not found +#define AVERROR_EOF (-MKTAG( 'E','O','F',' ')) ///< End of file +#define AVERROR_EXIT (-MKTAG( 'E','X','I','T')) ///< Immediate exit was requested; the called function should not be restarted +#define AVERROR_FILTER_NOT_FOUND (-MKTAG(0xF8,'F','I','L')) ///< Filter not found +#define AVERROR_INVALIDDATA (-MKTAG( 'I','N','D','A')) ///< Invalid data found when processing input +#define AVERROR_MUXER_NOT_FOUND (-MKTAG(0xF8,'M','U','X')) ///< Muxer not found +#define AVERROR_OPTION_NOT_FOUND (-MKTAG(0xF8,'O','P','T')) ///< Option not found +#define AVERROR_PATCHWELCOME (-MKTAG( 'P','A','W','E')) ///< Not yet implemented in FFmpeg, patches welcome +#define AVERROR_PROTOCOL_NOT_FOUND (-MKTAG(0xF8,'P','R','O')) ///< Protocol not found #define AVERROR_STREAM_NOT_FOUND (-MKTAG(0xF8,'S','T','R')) ///< Stream not found -#define AVERROR_EXIT (-MKTAG('E','X','I','T')) ///< Immediate exit was requested; the called function should not be restarted - /** * Put a description of the AVERROR code errnum in errbuf. * In case of failure the global variable errno is set to indicate the diff --git a/libavutil/libm.h b/libavutil/libm.h index c7c28ac27c..7e5f668e16 100644 --- a/libavutil/libm.h +++ b/libavutil/libm.h @@ -86,6 +86,13 @@ static av_always_inline av_const float roundf(float x) } #endif /* HAVE_ROUNDF */ +#if !HAVE_TRUNC +static av_always_inline av_const double trunc(double x) +{ + return (x > 0) ? floor(x) : ceil(x); +} +#endif /* HAVE_TRUNC */ + #if !HAVE_TRUNCF static av_always_inline av_const float truncf(float x) { diff --git a/libavutil/opt.c b/libavutil/opt.c index ab6021c71a..e6cf34081c 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -57,7 +57,7 @@ static int av_set_number2(void *obj, const char *name, double num, int den, int6 if (o_out) *o_out= o; if (!o || o->offset<=0) - return AVERROR(ENOENT); + return AVERROR_OPTION_NOT_FOUND; if (o->max*den < num*intnum || o->min*den > num*intnum) { av_log(obj, AV_LOG_ERROR, "Value %lf for parameter '%s' out of range\n", num, name); @@ -119,7 +119,7 @@ int av_set_string3(void *obj, const char *name, const char *val, int alloc, cons if (o_out) *o_out = o; if (!o) - return AVERROR(ENOENT); + return AVERROR_OPTION_NOT_FOUND; if (!val || o->offset<=0) return AVERROR(EINVAL); @@ -490,7 +490,7 @@ static int parse_key_value_pair(void *ctx, const char **buf, av_log(ctx, AV_LOG_DEBUG, "Setting value '%s' for key '%s'\n", val, key); ret = av_set_string3(ctx, key, val, 1, NULL); - if (ret == AVERROR(ENOENT)) + if (ret == AVERROR_OPTION_NOT_FOUND) av_log(ctx, AV_LOG_ERROR, "Key '%s' not found.\n", key); av_free(key); diff --git a/tests/fate-run.sh b/tests/fate-run.sh index 3a6b46b786..366145d22f 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -16,6 +16,7 @@ cmp=${6:-diff} ref=${7:-"${base}/ref/fate/${test}"} fuzz=$8 threads=${9:-1} +thread_type=${10:-3} outdir="tests/data/fate" outfile="${outdir}/${test}" @@ -49,7 +50,7 @@ run(){ } ffmpeg(){ - run ffmpeg -v 0 -threads $threads "$@" + run ffmpeg -v 0 -threads $threads -thread_type $thread_type "$@" } framecrc(){ @@ -78,7 +79,7 @@ regtest(){ cleanfiles="$cleanfiles $outfile $errfile" outfile=tests/data/regression/$2/$t errfile=tests/data/$t.$2.err - ${base}/${1}-regression.sh $t $2 $3 "$target_exec" "$target_path" "$threads" + ${base}/${1}-regression.sh $t $2 $3 "$target_exec" "$target_path" "$threads" "$thread_type" } codectest(){