From 04361427e65a687469a3bb0859971292d2dc11e4 Mon Sep 17 00:00:00 2001 From: Andrew Stone Date: Mon, 18 Aug 2014 17:28:23 -0400 Subject: [PATCH 01/26] Revert "lavf: eliminate ff_get_audio_frame_size()" This reverts commit 30e50c50274f88f0f5ae829f401cd3c7f5266719. The original commit broke the ability to stream AAC over HTTP/Icecast. It looks like avformat_find_stream_info() gets stuck in an infinite loop, never hitting AVFormatContext.max_analyze_duration since duration is never set for any of the packets. Example stream: http://listen.classicrocklounge.com:8000/aac64 Signed-off-by: Anton Khirnov --- libavformat/internal.h | 2 ++ libavformat/utils.c | 23 ++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/libavformat/internal.h b/libavformat/internal.h index 9921ce11e0..2824436286 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -326,6 +326,8 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, void ff_compute_frame_duration(int *pnum, int *pden, AVStream *st, AVCodecParserContext *pc, AVPacket *pkt); +int ff_get_audio_frame_size(AVCodecContext *enc, int size, int mux); + unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id); enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag); diff --git a/libavformat/utils.c b/libavformat/utils.c index 4cc246d9ee..973ab94d6f 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -453,6 +453,27 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt) /**********************************************************/ +/** + * Get the number of samples of an audio frame. Return -1 on error. + */ +int ff_get_audio_frame_size(AVCodecContext *enc, int size, int mux) +{ + int frame_size; + + /* give frame_size priority if demuxing */ + if (!mux && enc->frame_size > 1) + return enc->frame_size; + + if ((frame_size = av_get_audio_frame_duration(enc, size)) > 0) + return frame_size; + + /* Fall back on using frame_size if muxing. */ + if (enc->frame_size > 1) + return enc->frame_size; + + return -1; +} + /** * Return the frame duration in seconds. Return 0 if not available. */ @@ -488,7 +509,7 @@ void ff_compute_frame_duration(int *pnum, int *pden, AVStream *st, } break; case AVMEDIA_TYPE_AUDIO: - frame_size = av_get_audio_frame_duration(st->codec, pkt->size); + frame_size = ff_get_audio_frame_size(st->codec, pkt->size, 0); if (frame_size <= 0 || st->codec->sample_rate <= 0) break; *pnum = frame_size; From 7dfccac20c0c539e139bd9f75101f72ed4f2736c Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 20 Aug 2014 05:40:53 +0000 Subject: [PATCH 02/26] electronicarts: do not fail on zero-sized chunks At least one FATE sample contains such chunks and happens to work simply by accident (due to find_stream_info() swallowing the error). CC: libav-stable@libav.org (cherry picked from commit 4d6c5152849e23a4cc0f6a6ac2880c01ebcd301b) Signed-off-by: Anton Khirnov --- libavformat/electronicarts.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index 879ed9732d..adcd45a6f2 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -522,7 +522,7 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt) while (!packet_read) { chunk_type = avio_rl32(pb); chunk_size = ea->big_endian ? avio_rb32(pb) : avio_rl32(pb); - if (chunk_size <= 8) + if (chunk_size < 8) return AVERROR_INVALIDDATA; chunk_size -= 8; @@ -547,6 +547,9 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt) avio_skip(pb, 8); chunk_size -= 12; } + if (!chunk_size) + continue; + ret = av_get_packet(pb, pkt, chunk_size); if (ret < 0) return ret; @@ -607,6 +610,9 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt) goto get_video_packet; case mTCD_TAG: + if (chunk_size < 8) + return AVERROR_INVALIDDATA; + avio_skip(pb, 8); // skip ea DCT header chunk_size -= 8; goto get_video_packet; @@ -617,6 +623,9 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt) key = AV_PKT_FLAG_KEY; case MV0F_TAG: get_video_packet: + if (!chunk_size) + continue; + ret = av_get_packet(pb, pkt, chunk_size); if (ret < 0) return ret; From e8f2823f06513d3d1177b8ba7c853d63194e5d8a Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 20 Aug 2014 09:56:26 -0700 Subject: [PATCH 03/26] vsrc_movie: Adjust a silly typo from b977b287f61fea48ecd6251d54a26334213b7ec6 (cherry picked from commit 11cd727fbd603197cb1e49654fce3352d56f8fd8) Signed-off-by: Diego Biurrun --- libavfilter/vsrc_movie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vsrc_movie.c b/libavfilter/vsrc_movie.c index 1ee0f168f0..0e5df327d8 100644 --- a/libavfilter/vsrc_movie.c +++ b/libavfilter/vsrc_movie.c @@ -226,7 +226,7 @@ static int movie_get_frame(AVFilterLink *outlink) "movie_get_frame(): file:'%s' pts:%"PRId64" time:%f aspect:%d/%d\n", movie->file_name, movie->frame->pts, (double)movie->frame->pts * - av_q2d(movie->format_ctx->streams[movie->stream_index]), + av_q2d(movie->format_ctx->streams[movie->stream_index]->time_base), movie->frame->sample_aspect_ratio.num, movie->frame->sample_aspect_ratio.den); // We got it. Free the packet since we are returning From d04fb118684f7d57474ee52da9c03cfee7a442b5 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 20 Aug 2014 09:35:08 -0700 Subject: [PATCH 04/26] error_resilience: Drop asserts from guess_mv() The asserts check struct members that are not referenced in guess_mv() and one of them fails to compile. (cherry picked from commit 7cb66ebc0be48489785f7166c9d15eac594b0763) Signed-off-by: Diego Biurrun --- libavcodec/error_resilience.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c index b41474ad48..33b0360092 100644 --- a/libavcodec/error_resilience.c +++ b/libavcodec/error_resilience.c @@ -430,8 +430,6 @@ static void guess_mv(ERContext *s) if (fixed[mb_xy] == MV_FROZEN) continue; - assert(!IS_INTRA(s->cur_pic.mb_type[mb_xy])); - assert(s->last_pic && s->last_pic.f->data[0]); j = 0; if (mb_x > 0 && fixed[mb_xy - 1] == MV_FROZEN) From d2bad216f775da9c17a79c41ffd3df501b403100 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 20 Aug 2014 09:48:54 -0700 Subject: [PATCH 05/26] mpeg12enc: Add missing #include for PICT_FRAME (cherry picked from commit 8fc6a70c2167b645b7a37d0cbc0e276e7b787cc9) Signed-off-by: Diego Biurrun --- libavcodec/mpeg12enc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index c4089c9582..3376f1075f 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -37,6 +37,7 @@ #include "mathops.h" #include "mpeg12.h" #include "mpeg12data.h" +#include "mpegutils.h" #include "mpegvideo.h" From 63795fe5b967b93bd476aedfd6a9260b99355525 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 20 Aug 2014 09:54:50 -0700 Subject: [PATCH 06/26] setpts: Add missing inttypes.h #include for PRId64 Also convert a debug av_log() to av_dlog(). (cherry picked from commit 593aaee953f8b07c141ff115e67bae85ef0350c7) Signed-off-by: Diego Biurrun --- libavfilter/setpts.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/libavfilter/setpts.c b/libavfilter/setpts.c index ff0016d04c..fa7a0be0a9 100644 --- a/libavfilter/setpts.c +++ b/libavfilter/setpts.c @@ -24,6 +24,8 @@ * video presentation timestamp (PTS) modification filter */ +#include + #include "libavutil/eval.h" #include "libavutil/internal.h" #include "libavutil/mathematics.h" @@ -141,15 +143,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) d = av_expr_eval(setpts->expr, setpts->var_values, NULL); frame->pts = D2TS(d); -#ifdef DEBUG - av_log(inlink->dst, AV_LOG_DEBUG, - "n:%"PRId64" interlaced:%d pts:%"PRId64" t:%f -> pts:%"PRId64" t:%f\n", - (int64_t)setpts->var_values[VAR_N], - (int)setpts->var_values[VAR_INTERLACED], - in_pts, in_pts * av_q2d(inlink->time_base), - frame->pts, frame->pts * av_q2d(inlink->time_base)); -#endif - + av_dlog(inlink->dst, + "n:%"PRId64" interlaced:%d pts:%"PRId64" t:%f -> pts:%"PRId64" t:%f\n", + (int64_t)setpts->var_values[VAR_N], + (int)setpts->var_values[VAR_INTERLACED], + in_pts, in_pts * av_q2d(inlink->time_base), + frame->pts, frame->pts * av_q2d(inlink->time_base)); if (inlink->type == AVMEDIA_TYPE_VIDEO) { setpts->var_values[VAR_N] += 1.0; From 0263750a0db723760d61bcaafc6964a371adcdfc Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Mon, 25 Aug 2014 17:26:15 +0200 Subject: [PATCH 07/26] vfwcap: Add fallback define for HWND_MESSAGE Some obsolete versions of the MinGW32 runtime (<4.0.0) lack the definition. (cherry picked from commit ab56fabe6294524e99815451ad01e4ff50c6d734) Signed-off-by: Diego Biurrun --- libavdevice/vfwcap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c index c067be3f83..b47de1b282 100644 --- a/libavdevice/vfwcap.c +++ b/libavdevice/vfwcap.c @@ -27,6 +27,11 @@ #include #include +/* Some obsolete versions of MinGW32 before 4.0.0 lack this. */ +#ifndef HWND_MESSAGE +#define HWND_MESSAGE ((HWND) -3) +#endif + struct vfw_ctx { const AVClass *class; HWND hwnd; From 8c91414803e4cd26dcb27e6147424d09d19cd72a Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sun, 24 Aug 2014 19:34:13 +0200 Subject: [PATCH 08/26] vc1: Fix the skip condition As written in the comment above, skip must be added only if a start code is found. --- libavcodec/vc1_parser.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c index 43ca0ede87..a6532820d1 100644 --- a/libavcodec/vc1_parser.c +++ b/libavcodec/vc1_parser.c @@ -123,6 +123,7 @@ static int vc1_parse(AVCodecParserContext *s, uint8_t *unesc_buffer = vpc->unesc_buffer; size_t unesc_index = vpc->unesc_index; VC1ParseSearchState search_state = vpc->search_state; + int start_code_found; int next = END_NOT_FOUND; int i = vpc->bytes_to_skip; @@ -133,8 +134,8 @@ static int vc1_parse(AVCodecParserContext *s, next = 0; } while (i < buf_size) { - int start_code_found = 0; uint8_t b; + start_code_found = 0; while (i < buf_size && unesc_index < UNESCAPED_THRESHOLD) { b = buf[i++]; unesc_buffer[unesc_index++] = b; @@ -232,7 +233,7 @@ static int vc1_parse(AVCodecParserContext *s, * the start code we've already seen, or cause extra bytes to be * inserted at the start of the unescaped buffer. */ vpc->bytes_to_skip = 4; - if (next < 0) + if (next < 0 && start_code_found) vpc->bytes_to_skip += next; *poutbuf = buf; From c2d6cc2971b365bf3e90b5b57a6ba3fe0e19061f Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 25 Aug 2014 21:21:57 +0000 Subject: [PATCH 09/26] mpegenc: limit the maximum muxrate It is written to the file as a 22-bit value. CC: libav-stable@libav.org (cherry picked from commit 75bbaf2493a71ee66eaabe3c21fadd84d07888de) Signed-off-by: Anton Khirnov --- libavformat/mpegenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 1ba7647e80..88590b305b 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -1157,7 +1157,7 @@ static int mpeg_mux_end(AVFormatContext *ctx) #define OFFSET(x) offsetof(MpegMuxContext, x) #define E AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { - { "muxrate", NULL, OFFSET(mux_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, E }, + { "muxrate", NULL, OFFSET(mux_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, (1 << 22) - 1, E }, { "preload", "Initial demux-decode delay in microseconds.", OFFSET(preload), AV_OPT_TYPE_INT, { .i64 = 500000 }, 0, INT_MAX, E }, { NULL }, }; From 7c4685507498025d11bb48b3f54301a99fcf8582 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 25 Aug 2014 21:24:35 +0000 Subject: [PATCH 10/26] avconv: fix the muxrate values for -target The mpegenc private option values are in 50-byte units. CC: libav-stable@libav.org (cherry picked from commit 1688eef25385089026aba55da1885f70a57815ab) Signed-off-by: Anton Khirnov --- avconv_opt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/avconv_opt.c b/avconv_opt.c index f070b99b1c..33ac290b19 100644 --- a/avconv_opt.c +++ b/avconv_opt.c @@ -1803,7 +1803,7 @@ static int opt_target(void *optctx, const char *opt, const char *arg) parse_option(o, "ac", "2", options); opt_default(NULL, "packetsize", "2324"); - opt_default(NULL, "muxrate", "1411200"); // 2352 * 75 * 8; + opt_default(NULL, "muxrate", "3528"); // 2352 * 75 / 50; /* We have to offset the PTS, so that it is consistent with the SCR. SCR starts at 36000, but the first two packs contain only padding @@ -1849,7 +1849,7 @@ static int opt_target(void *optctx, const char *opt, const char *arg) opt_default(NULL, "bufsize", "1835008"); // 224*1024*8; opt_default(NULL, "packetsize", "2048"); // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack. - opt_default(NULL, "muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8 + opt_default(NULL, "muxrate", "25200"); // from mplex project: data_rate = 1260000. mux_rate = data_rate / 50 opt_default(NULL, "b:a", "448000"); parse_option(o, "ar", "48000", options); From e2a89f7f0f8fe1c769c83d33efa717cc7b2edc57 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 26 Aug 2014 06:26:35 +0000 Subject: [PATCH 11/26] avconv: fix parsing the AVOptions for -target CC: libav-stable@libav.org (cherry picked from commit f5245a9c6206878b892adf3ccbccc9311c202af5) Signed-off-by: Anton Khirnov --- avconv_opt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/avconv_opt.c b/avconv_opt.c index 33ac290b19..2d0691252a 100644 --- a/avconv_opt.c +++ b/avconv_opt.c @@ -1870,6 +1870,10 @@ static int opt_target(void *optctx, const char *opt, const char *arg) av_log(NULL, AV_LOG_ERROR, "Unknown target: %s\n", arg); return AVERROR(EINVAL); } + + av_dict_copy(&o->g->codec_opts, codec_opts, 0); + av_dict_copy(&o->g->format_opts, format_opts, 0); + return 0; } From ee099059e71efe44a877af6111b74878dac618ce Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Wed, 27 Aug 2014 02:50:58 +0200 Subject: [PATCH 12/26] vc1: Initialize start_code_found to 0 --- libavcodec/vc1_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c index a6532820d1..7d8d016be9 100644 --- a/libavcodec/vc1_parser.c +++ b/libavcodec/vc1_parser.c @@ -123,7 +123,7 @@ static int vc1_parse(AVCodecParserContext *s, uint8_t *unesc_buffer = vpc->unesc_buffer; size_t unesc_index = vpc->unesc_index; VC1ParseSearchState search_state = vpc->search_state; - int start_code_found; + int start_code_found = 0; int next = END_NOT_FOUND; int i = vpc->bytes_to_skip; From e62f08ca8d6e558956ff3094085338cb4dd6afd8 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sat, 23 Aug 2014 19:03:21 +0200 Subject: [PATCH 13/26] pulse: Add a wallclock option to be compatible with other other captures alsa and x11grab use av_gettime() to report timestamps. Have it on by default. Bug-Id: 647 (cherry picked from commit 424b929b5cb9ca4094099f25179829260d4b0fa3) (cherry picked from commit 404731bd20e1df5880e6fe381e975ba48afc75b2) Signed-off-by: Luca Barbato --- libavdevice/pulse.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavdevice/pulse.c b/libavdevice/pulse.c index a8e710d279..2136ee3fa4 100644 --- a/libavdevice/pulse.c +++ b/libavdevice/pulse.c @@ -31,6 +31,7 @@ #include "libavformat/avformat.h" #include "libavformat/internal.h" +#include "libavutil/time.h" #include "libavutil/opt.h" #define DEFAULT_CODEC_ID AV_NE(AV_CODEC_ID_PCM_S16BE, AV_CODEC_ID_PCM_S16LE) @@ -47,6 +48,7 @@ typedef struct PulseData { pa_simple *s; int64_t pts; int64_t frame_duration; + int wallclock; } PulseData; static pa_sample_format_t codec_id_to_pulse_format(int codec_id) { @@ -141,6 +143,8 @@ static int pulse_read_packet(AVFormatContext *s, AVPacket *pkt) if (pd->pts == AV_NOPTS_VALUE) { pd->pts = -latency; + if (pd->wallclock) + pd->pts += av_gettime(); } pkt->pts = pd->pts; @@ -168,6 +172,7 @@ static const AVOption options[] = { { "channels", "number of audio channels", OFFSET(channels), AV_OPT_TYPE_INT, {.i64 = 2}, 1, INT_MAX, D }, { "frame_size", "number of bytes per frame", OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = 1024}, 1, INT_MAX, D }, { "fragment_size", "buffering size, affects latency and cpu usage", OFFSET(fragment_size), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, D }, + { "wallclock", "set the initial pts using the current time", OFFSET(wallclock), AV_OPT_TYPE_INT, {.i64 = 1}, -1, 1, D }, { NULL }, }; From 1f52f82a55a544838f5e49e639488c1f15de8a42 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 18 May 2014 10:52:41 +0200 Subject: [PATCH 14/26] doc/APIchanges: fill in missing hashes and dates --- doc/APIchanges | 58 +++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 6d1f0614fa..14ec297f16 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,107 +13,107 @@ libavutil: 2014-08-09 API changes, most recent first: -2014-08-xx - xxxxxxx - lavu 54.03.0 - mem.h +2014-08-13 - 8ddc326 - lavu 54.03.0 - mem.h Add av_strndup(). -2014-xx-xx - xxxxxxx - lavu 54.02.0 - opt.h +2014-08-13 - a8c104a - lavu 54.02.0 - opt.h Add av_opt_get_dict_val/set_dict_val with AV_OPT_TYPE_DICT to support dictionary types being set as options. -2014-xx-xx - xxxxxxx - lavf 56.01.0 - avformat.h +2014-08-13 - afbd4b8 - lavf 56.01.0 - avformat.h Add AVFormatContext.event_flags and AVStream.event_flags for signaling to the user when events happen in the file/stream. -2014-04-xx - xxxxxxx - lavr 2.1.0 - avresample.h +2014-08-10 - fb1ddcd - lavr 2.1.0 - avresample.h Add avresample_convert_frame() and avresample_config(). -2014-04-xx - xxxxxxx - lavu 54.1.0 - error.h +2014-08-10 - fb1ddcd - lavu 54.1.0 - error.h Add AVERROR_INPUT_CHANGED and AVERROR_OUTPUT_CHANGED. -2014-08-xx - xxxxxxx - lavc 55.57.4 - avcodec.h +2014-08-08 - d35b94f - lavc 55.57.4 - avcodec.h Deprecate FF_IDCT_XVIDMMX define and xvidmmx idct option. Replaced by FF_IDCT_XVID and xvid respectively. -2014-08-xx - xxxxxxx - lsws 2.1.3 - swscale.h +2014-08-07 - bb78903 - lsws 2.1.3 - swscale.h sws_getCachedContext is not going to be removed in the future. -2014-08-xx - xxxxxxx - lavc 55.57.3 - avcodec.h +2014-08-07 - ad1ee5f - lavc 55.57.3 - avcodec.h reordered_opaque is not going to be removed in the future. -2014-08-xx - xxxxxxx - lavu 53.22.0 - pixfmt.h +2014-08-04 - e9abafc - lavu 53.22.0 - pixfmt.h Add AV_PIX_FMT_YA16 pixel format for 16 bit packed gray with alpha. -2014-08-xx - xxxxxxx - lavu 53.21.1 - avstring.h +2014-08-04 - e96c3b8 - lavu 53.21.1 - avstring.h Rename AV_PIX_FMT_Y400A to AV_PIX_FMT_YA8 to better identify the format. An alias pixel format and color space name are provided for compatibility. -2014-08-xx - xxxxxxx - lavu 53.21.0 - pixdesc.h +2014-08-04 - d2962e9 - lavu 53.21.0 - pixdesc.h Support name aliases for pixel formats. -2014-08-xx - xxxxxxx - lavc 55.57.2 - avcodec.h -2014-08-xx - xxxxxxx - lavu 53.20.0 - frame.h +2014-08-03 - 1ef9e83 - lavc 55.57.2 - avcodec.h +2014-08-03 - 1ef9e83 - lavu 53.20.0 - frame.h Deprecate AVCodecContext.dtg_active_format and use side-data instead. -2014-08-xx - xxxxxxx - lavc 55.57.1 - avcodec.h +2014-08-03 - 9f17685 - lavc 55.57.1 - avcodec.h Deprecate unused FF_IDCT_IPP define and ipp avcodec option. Deprecate unused FF_DEBUG_PTS define and pts avcodec option. Deprecate unused FF_CODER_TYPE_DEFLATE define and deflate avcodec option. Deprecate unused FF_DCT_INT define and int avcodec option. Deprecate unused avcodec option scenechange_factor. -2014-07-xx - xxxxxxx - lavu 53.19.0 - avstring.h +2014-07-29 - 69e7336 - lavu 53.19.0 - avstring.h Make name matching function from lavf public as av_match_name(). -2014-xx-xx - xxxxxxx - lavc 55.57.0 - avcodec.h +2014-07-28 - c5fca01 - lavc 55.57.0 - avcodec.h Add AV_CODEC_PROP_REORDER to mark codecs supporting frame reordering. -2014-07-xx - xxxxxxx - lavu 53.18.0 - display.h +2014-07-09 - a54f03b - lavu 53.18.0 - display.h Add av_display_matrix_flip() to flip the transformation matrix. -2014-07-xx - xxxxxxx - lavc 55.56.0 - dv_profile.h +2014-07-09 - f6ee61f - lavc 55.56.0 - dv_profile.h Add a public API for DV profile handling. -2014-06-xx - xxxxxxx - lavu 53.17.0 - imgutils.h +2014-06-20 - 9e500ef - lavu 53.17.0 - imgutils.h Add av_image_check_sar(). -2014-06-xx - xxxxxxx - lavc 55.55.0 - avcodec.h +2014-06-20 - 874390e - lavc 55.55.0 - avcodec.h Add av_packet_rescale_ts() to simplify timestamp conversion. -2014-xx-xx - xxxxxxx - lavf 55.20.0 - avformat.h +2014-06-18 - 194be1f - lavf 55.20.0 - avformat.h The proper way for providing a hint about the desired timebase to the muxers is now setting AVStream.time_base, instead of AVStream.codec.time_base as was done previously. The old method is now deprecated. -2014-04-xx - xxxxxxx - lavc 55.54.0 - avcodec.h +2014-06-01 - 0957b27 - lavc 55.54.0 - avcodec.h Add AVCodecContext.side_data_only_packets to allow encoders to output packets with only side data. This option may become mandatory in the future, so all users are recommended to update their code and enable this option. -2014-xx-xx - xxxxxxx - lavu 53.16.0 - frame.h, pixfmt.h +2014-06-01 - 8c02adc - lavu 53.16.0 - frame.h, pixfmt.h Move all color-related enums (AVColorPrimaries, AVColorSpace, AVColorRange, AVColorTransferCharacteristic, and AVChromaLocation) inside lavu. Add AVFrame fields for them on the next lavu major bump. -2014-04-xx - xxxxxxx - lavr 1.3.0 - avresample.h +2014-05-28 - b2d4565 - lavr 1.3.0 - avresample.h Add avresample_max_output_samples -2014-05-24 - xxxxxxx - lavf 55.19.0 - avformat.h +2014-05-28 - 6d21259 - lavf 55.19.0 - avformat.h Add strict_std_compliance and related AVOptions to support experimental muxing. -2014-05-19 - xxxxxxx - lavf 55.18.0 - avformat.h +2014-05-20 - c23c96b - lavf 55.18.0 - avformat.h Add av_stream_get_side_data() to access stream-level side data in the same way as av_packet_get_side_data(). -2014-05-xx - xxxxxxx - lavu 53.15.0 - frame.h, display.h +2014-05-19 - bddd8cb - lavu 53.15.0 - frame.h, display.h Add AV_FRAME_DATA_DISPLAYMATRIX for exporting frame-level spatial rendering on video frames for proper display. -2014-05-xx - xxxxxxx - lavc 55.53.0 - avcodec.h +2014-05-19 - bddd8cb - lavc 55.53.0 - avcodec.h Add AV_PKT_DATA_DISPLAYMATRIX for exporting packet-level spatial rendering on video frames for proper display. -2014-05-xx - xxxxxxx - lavf 55.17.1 - avformat.h +2014-05-19 - a312f71 - lavf 55.17.1 - avformat.h Deprecate AVStream.pts and the AVFrac struct, which was its only use case. Those fields were poorly defined and not meant to be public, so there is no replacement for them. From 5694831e0693ad70581a766d1f0ebefbbae8bc2f Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Wed, 23 Jul 2014 09:49:24 +0100 Subject: [PATCH 15/26] matroska: list supported extensions --- libavformat/matroskadec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 42204a4acf..431fe57348 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2601,6 +2601,7 @@ static int matroska_read_close(AVFormatContext *s) AVInputFormat ff_matroska_demuxer = { .name = "matroska,webm", .long_name = NULL_IF_CONFIG_SMALL("Matroska / WebM"), + .extensions = "mkv,mk3d,mka,mks", .priv_data_size = sizeof(MatroskaDemuxContext), .read_probe = matroska_probe, .read_header = matroska_read_header, From 110841c3ab1d617107f4fb229fcd33d5ca357bbe Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Wed, 23 Jul 2014 09:21:28 +0100 Subject: [PATCH 16/26] avcodec: add stream-level stereo3d side data --- doc/APIchanges | 3 +++ libavcodec/avcodec.h | 6 ++++++ libavcodec/utils.c | 9 ++++++++ libavcodec/version.h | 2 +- libavformat/dump.c | 50 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 69 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 14ec297f16..7134e786aa 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2014-08-09 API changes, most recent first: +2014-08-28 - 9301486 - lavc 56.1.0 - avcodec.h + Add AV_PKT_DATA_STEREO3D to export container-level stereo3d information. + 2014-08-13 - 8ddc326 - lavu 54.03.0 - mem.h Add av_strndup(). diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 93aad35d33..14440fe3c1 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -911,6 +911,12 @@ enum AVPacketSideDataType { * See libavutil/display.h for a detailed description of the data. */ AV_PKT_DATA_DISPLAYMATRIX, + + /* + * This side data should be associated with a video stream and contains + * Stereoscopic 3D information in form of the AVStereo3D struct. + */ + AV_PKT_DATA_STEREO3D, }; typedef struct AVPacketSideData { diff --git a/libavcodec/utils.c b/libavcodec/utils.c index afc0396375..c5fa50d06b 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -596,6 +596,15 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame) memcpy(frame_sd->data, packet_sd, size); } + /* copy the stereo3d format to the output frame */ + packet_sd = av_packet_get_side_data(pkt, AV_PKT_DATA_STEREO3D, &size); + if (packet_sd) { + frame_sd = av_frame_new_side_data(frame, AV_FRAME_DATA_STEREO3D, size); + if (!frame_sd) + return AVERROR(ENOMEM); + + memcpy(frame_sd->data, packet_sd, size); + } return 0; } diff --git a/libavcodec/version.h b/libavcodec/version.h index b42b9704ad..8cc2fb0317 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 56 -#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, \ diff --git a/libavformat/dump.c b/libavformat/dump.c index cdf2da1ca8..58ed6547a0 100644 --- a/libavformat/dump.c +++ b/libavformat/dump.c @@ -27,6 +27,7 @@ #include "libavutil/log.h" #include "libavutil/mathematics.h" #include "libavutil/replaygain.h" +#include "libavutil/stereo3d.h" #include "avformat.h" @@ -229,6 +230,51 @@ static void dump_replaygain(void *ctx, AVPacketSideData *sd) print_peak(ctx, "album peak", rg->album_peak); } +static void dump_stereo3d(void *ctx, AVPacketSideData *sd) +{ + AVStereo3D *stereo; + + if (sd->size < sizeof(*stereo)) { + av_log(ctx, AV_LOG_INFO, "invalid data"); + return; + } + + stereo = (AVStereo3D *)sd->data; + + switch (stereo->type) { + case AV_STEREO3D_2D: + av_log(ctx, AV_LOG_INFO, "2D"); + break; + case AV_STEREO3D_SIDEBYSIDE: + av_log(ctx, AV_LOG_INFO, "side by side"); + break; + case AV_STEREO3D_TOPBOTTOM: + av_log(ctx, AV_LOG_INFO, "top and bottom"); + break; + case AV_STEREO3D_FRAMESEQUENCE: + av_log(ctx, AV_LOG_INFO, "frame alternate"); + break; + case AV_STEREO3D_CHECKERBOARD: + av_log(ctx, AV_LOG_INFO, "checkerboard"); + break; + case AV_STEREO3D_LINES: + av_log(ctx, AV_LOG_INFO, "interleaved lines"); + break; + case AV_STEREO3D_COLUMNS: + av_log(ctx, AV_LOG_INFO, "interleaved columns"); + break; + case AV_STEREO3D_SIDEBYSIDE_QUINCUNX: + av_log(ctx, AV_LOG_INFO, "side by side (quincunx subsampling)"); + break; + default: + av_log(ctx, AV_LOG_WARNING, "unknown"); + break; + } + + if (stereo->flags & AV_STEREO3D_FLAG_INVERT) + av_log(ctx, AV_LOG_INFO, " (inverted)"); +} + static void dump_sidedata(void *ctx, AVStream *st, const char *indent) { int i; @@ -262,6 +308,10 @@ static void dump_sidedata(void *ctx, AVStream *st, const char *indent) av_log(ctx, AV_LOG_INFO, "displaymatrix: rotation of %.2f degrees", av_display_rotation_get((int32_t *)sd.data)); break; + case AV_PKT_DATA_STEREO3D: + av_log(ctx, AV_LOG_INFO, "stereo3d: "); + dump_stereo3d(ctx, &sd); + break; default: av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d bytes)", sd.type, sd.size); From 152e09fde7f6dd5ea92575c3a8e61129148c8478 Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Tue, 12 Aug 2014 22:28:49 +0100 Subject: [PATCH 17/26] matroskadec: parse stereo mode on decoding Convert the Matroska stereo format to the Stereo3D format, and add a Stereo3D side data to the stream. Bump the doctype version supported. Bug-Id: 728 / https://bugs.debian.org/757185 --- Changelog | 1 + libavformat/matroska.c | 64 +++++++++++++++++++++++++++++++++++++++ libavformat/matroska.h | 3 ++ libavformat/matroskadec.c | 12 ++++++-- 4 files changed, 78 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index ea9d721732..da12f599e3 100644 --- a/Changelog +++ b/Changelog @@ -31,6 +31,7 @@ version : - Icecast protocol - request icecast metadata by default - support for using metadata in stream specifiers in avtools +- matroska 3d support version 10: diff --git a/libavformat/matroska.c b/libavformat/matroska.c index 9628abcda1..237f26f49c 100644 --- a/libavformat/matroska.c +++ b/libavformat/matroska.c @@ -19,6 +19,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/stereo3d.h" + #include "matroska.h" const CodecTags ff_mkv_codec_tags[]={ @@ -103,3 +105,65 @@ const AVMetadataConv ff_mkv_metadata_conv[] = { { "PART_NUMBER" , "track" }, { 0 } }; + +int ff_mkv_stereo3d_conv(AVStream *st, MatroskaVideoStereoModeType stereo_mode) +{ + AVPacketSideData *sd, *tmp; + AVStereo3D *stereo; + + stereo = av_stereo3d_alloc(); + if (!stereo) + return AVERROR(ENOMEM); + + tmp = av_realloc_array(st->side_data, st->nb_side_data + 1, sizeof(*tmp)); + if (!tmp) { + av_freep(&stereo); + return AVERROR(ENOMEM); + } + st->side_data = tmp; + st->nb_side_data++; + + sd = &st->side_data[st->nb_side_data - 1]; + sd->type = AV_PKT_DATA_STEREO3D; + sd->data = (uint8_t *)stereo; + sd->size = sizeof(*stereo); + + // note: the missing breaks are intentional + switch (stereo_mode) { + case MATROSKA_VIDEO_STEREOMODE_TYPE_MONO: + stereo->type = AV_STEREO3D_2D; + break; + case MATROSKA_VIDEO_STEREOMODE_TYPE_RIGHT_LEFT: + stereo->flags |= AV_STEREO3D_FLAG_INVERT; + case MATROSKA_VIDEO_STEREOMODE_TYPE_LEFT_RIGHT: + stereo->type = AV_STEREO3D_SIDEBYSIDE; + break; + case MATROSKA_VIDEO_STEREOMODE_TYPE_BOTTOM_TOP: + stereo->flags |= AV_STEREO3D_FLAG_INVERT; + case MATROSKA_VIDEO_STEREOMODE_TYPE_TOP_BOTTOM: + stereo->type = AV_STEREO3D_TOPBOTTOM; + break; + case MATROSKA_VIDEO_STEREOMODE_TYPE_CHECKERBOARD_RL: + stereo->flags |= AV_STEREO3D_FLAG_INVERT; + case MATROSKA_VIDEO_STEREOMODE_TYPE_CHECKERBOARD_LR: + stereo->type = AV_STEREO3D_CHECKERBOARD; + break; + case MATROSKA_VIDEO_STEREOMODE_TYPE_ROW_INTERLEAVED_RL: + stereo->flags |= AV_STEREO3D_FLAG_INVERT; + case MATROSKA_VIDEO_STEREOMODE_TYPE_ROW_INTERLEAVED_LR: + stereo->type = AV_STEREO3D_LINES; + break; + case MATROSKA_VIDEO_STEREOMODE_TYPE_COL_INTERLEAVED_RL: + stereo->flags |= AV_STEREO3D_FLAG_INVERT; + case MATROSKA_VIDEO_STEREOMODE_TYPE_COL_INTERLEAVED_LR: + stereo->type = AV_STEREO3D_COLUMNS; + break; + case MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_RL: + stereo->flags |= AV_STEREO3D_FLAG_INVERT; + case MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_LR: + stereo->type = AV_STEREO3D_FRAMESEQUENCE; + break; + } + + return 0; +} diff --git a/libavformat/matroska.h b/libavformat/matroska.h index 667f92a720..d8f4f8ebec 100644 --- a/libavformat/matroska.h +++ b/libavformat/matroska.h @@ -237,6 +237,7 @@ typedef enum { MATROSKA_VIDEO_STEREOMODE_TYPE_ANAGLYPH_GREEN_MAG = 12, MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_LR = 13, MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_RL = 14, + MATROSKA_VIDEO_STEREOMODE_TYPE_NB, } MatroskaVideoStereoModeType; /* @@ -255,4 +256,6 @@ extern const CodecTags ff_mkv_codec_tags[]; extern const CodecMime ff_mkv_mime_tags[]; extern const AVMetadataConv ff_mkv_metadata_conv[]; +int ff_mkv_stereo3d_conv(AVStream *st, MatroskaVideoStereoModeType stereo_mode); + #endif /* AVFORMAT_MATROSKA_H */ diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 431fe57348..59fc34b142 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -123,6 +123,7 @@ typedef struct { uint64_t pixel_width; uint64_t pixel_height; uint64_t fourcc; + uint64_t stereo_mode; } MatroskaTrackVideo; typedef struct { @@ -319,7 +320,7 @@ static EbmlSyntax matroska_track_video[] = { { MATROSKA_ID_VIDEOPIXELCROPR, EBML_NONE }, { MATROSKA_ID_VIDEODISPLAYUNIT, EBML_NONE }, { MATROSKA_ID_VIDEOFLAGINTERLACED, EBML_NONE }, - { MATROSKA_ID_VIDEOSTEREOMODE, EBML_NONE }, + { MATROSKA_ID_VIDEOSTEREOMODE, EBML_UINT, 0, offsetof(MatroskaTrackVideo, stereo_mode), { .u = MATROSKA_VIDEO_STEREOMODE_TYPE_NB } }, { MATROSKA_ID_VIDEOASPECTRATIO, EBML_NONE }, { 0 } }; @@ -1786,6 +1787,13 @@ static int matroska_parse_tracks(AVFormatContext *s) av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den, 1000000000, track->default_duration, 30000); } + // add stream level stereo3d side data if it is a supported format + if (track->video.stereo_mode < MATROSKA_VIDEO_STEREOMODE_TYPE_NB && + track->video.stereo_mode != 10 && track->video.stereo_mode != 12) { + int ret = ff_mkv_stereo3d_conv(st, track->video.stereo_mode); + if (ret < 0) + return ret; + } } else if (track->type == MATROSKA_TRACK_TYPE_AUDIO) { st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->sample_rate = track->audio.out_samplerate; @@ -1821,7 +1829,7 @@ static int matroska_read_header(AVFormatContext *s) ebml.version > EBML_VERSION || ebml.max_size > sizeof(uint64_t) || ebml.id_length > sizeof(uint32_t) || - ebml.doctype_version > 2) { + ebml.doctype_version > 3) { av_log(matroska->ctx, AV_LOG_ERROR, "EBML header using unsupported features\n" "(EBML version %"PRIu64", doctype %s, doc version %"PRIu64")\n", From 5b740d1eaa63ebc9d210f0c348daa66fcd50a275 Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Tue, 5 Aug 2014 11:16:17 +0100 Subject: [PATCH 18/26] matroskaenc: convert avstream stereo3d side data during encoding Write the StereoMode Embl to bitstream. --- libavformat/matroskaenc.c | 94 +++++++++++++++++++++++++++++++-------- 1 file changed, 76 insertions(+), 18 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index cc4e71a4fb..225f6a6730 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -43,6 +43,7 @@ #include "libavutil/opt.h" #include "libavutil/random_seed.h" #include "libavutil/samplefmt.h" +#include "libavutil/stereo3d.h" #include "libavcodec/xiph.h" #include "libavcodec/mpeg4audio.h" @@ -624,25 +625,78 @@ static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, return ret; } -static void mkv_write_stereo_mode(AVIOContext *pb, uint8_t stereo_fmt, - int mode) +static int mkv_write_stereo_mode(AVFormatContext *s, AVIOContext *pb, + AVStream *st, int mode) { - int valid_fmt = 0; + int i; + AVDictionaryEntry *tag; + MatroskaVideoStereoModeType format = MATROSKA_VIDEO_STEREOMODE_TYPE_NB; - switch (mode) { - case MODE_WEBM: - if (stereo_fmt <= MATROSKA_VIDEO_STEREOMODE_TYPE_TOP_BOTTOM || - stereo_fmt == MATROSKA_VIDEO_STEREOMODE_TYPE_RIGHT_LEFT) - valid_fmt = 1; - break; - case MODE_MATROSKAv2: - if (stereo_fmt <= MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_RL) - valid_fmt = 1; - break; + // convert metadata into proper side data and add it to the stream + if ((tag = av_dict_get(s->metadata, "stereo_mode", NULL, 0))) { + int stereo_mode = atoi(tag->value); + if (stereo_mode < MATROSKA_VIDEO_STEREOMODE_TYPE_NB && + stereo_mode != 10 && stereo_mode != 12) { + int ret = ff_mkv_stereo3d_conv(st, stereo_mode); + if (ret < 0) + return ret; + } } - if (valid_fmt) - put_ebml_uint (pb, MATROSKA_ID_VIDEOSTEREOMODE, stereo_fmt); + for (i = 0; i < st->nb_side_data; i++) { + AVPacketSideData sd = st->side_data[i]; + if (sd.type == AV_PKT_DATA_STEREO3D) { + AVStereo3D *stereo = (AVStereo3D *)sd.data; + + switch (stereo->type) { + case AV_STEREO3D_2D: + format = MATROSKA_VIDEO_STEREOMODE_TYPE_MONO; + break; + case AV_STEREO3D_SIDEBYSIDE: + format = (stereo->flags & AV_STEREO3D_FLAG_INVERT) + ? MATROSKA_VIDEO_STEREOMODE_TYPE_RIGHT_LEFT + : MATROSKA_VIDEO_STEREOMODE_TYPE_LEFT_RIGHT; + break; + case AV_STEREO3D_TOPBOTTOM: + format = MATROSKA_VIDEO_STEREOMODE_TYPE_TOP_BOTTOM; + if (stereo->flags & AV_STEREO3D_FLAG_INVERT) + format--; + break; + case AV_STEREO3D_CHECKERBOARD: + format = MATROSKA_VIDEO_STEREOMODE_TYPE_CHECKERBOARD_LR; + if (stereo->flags & AV_STEREO3D_FLAG_INVERT) + format--; + break; + case AV_STEREO3D_LINES: + format = MATROSKA_VIDEO_STEREOMODE_TYPE_ROW_INTERLEAVED_LR; + if (stereo->flags & AV_STEREO3D_FLAG_INVERT) + format--; + break; + case AV_STEREO3D_COLUMNS: + format = MATROSKA_VIDEO_STEREOMODE_TYPE_COL_INTERLEAVED_LR; + if (stereo->flags & AV_STEREO3D_FLAG_INVERT) + format--; + break; + case AV_STEREO3D_FRAMESEQUENCE: + format = MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_LR; + if (stereo->flags & AV_STEREO3D_FLAG_INVERT) + format++; + break; + } + + break; + } + } + + if (mode == MODE_WEBM && + (format > MATROSKA_VIDEO_STEREOMODE_TYPE_TOP_BOTTOM && + format != MATROSKA_VIDEO_STEREOMODE_TYPE_RIGHT_LEFT)) + format = MATROSKA_VIDEO_STEREOMODE_TYPE_NB; + + if (format < MATROSKA_VIDEO_STEREOMODE_TYPE_NB) + put_ebml_uint(pb, MATROSKA_ID_VIDEOSTEREOMODE, format); + + return 0; } static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv, @@ -743,9 +797,13 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv, // XXX: interlace flag? put_ebml_uint (pb, MATROSKA_ID_VIDEOPIXELWIDTH , codec->width); put_ebml_uint (pb, MATROSKA_ID_VIDEOPIXELHEIGHT, codec->height); - if ((tag = av_dict_get(s->metadata, "stereo_mode", NULL, 0))) { - mkv_write_stereo_mode(pb, atoi(tag->value), mkv->mode); - } + + // check both side data and metadata for stereo information, + // write the result to the bitstream if any is found + ret = mkv_write_stereo_mode(s, pb, st, mkv->mode); + if (ret < 0) + return ret; + if (st->sample_aspect_ratio.num) { int d_width = codec->width*av_q2d(st->sample_aspect_ratio); put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYWIDTH , d_width); From 4cde8bae49275edb2815b98cc3404238bb5799dd Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 27 Aug 2014 13:14:20 +0200 Subject: [PATCH 19/26] license: Mention that vf_interlace is GPL, not LGPL (cherry picked from commit 9e8bbe7d4d1dcd5fec491dbfbb98ed2038a7bed5) Signed-off-by: Diego Biurrun --- LICENSE | 1 + 1 file changed, 1 insertion(+) diff --git a/LICENSE b/LICENSE index fb2917830c..701e6e1d6c 100644 --- a/LICENSE +++ b/LICENSE @@ -21,6 +21,7 @@ Specifically, the GPL parts of Libav are - vf_cropdetect.c - vf_delogo.c - vf_hqdn3d.c + - vf_interlace.c Should you, for whatever reason, prefer to use version 3 of the (L)GPL, then the configure parameter --enable-version3 will activate this licensing option From b5d4f49e3cb1a13642542f08c8c54791c3d54dfb Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Sat, 30 Aug 2014 11:51:28 -0400 Subject: [PATCH 20/26] Prepare for 11_beta2 Release --- RELEASE | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE b/RELEASE index 929c0bdb7a..d826aee365 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1,2 @@ 11_beta1 +11_beta2 From 480633c6c2e1434c981cc887c6d54d502e24d6d7 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 1 Sep 2014 00:48:50 +0100 Subject: [PATCH 21/26] avcodec: fix missing doxygen comment marker --- libavcodec/avcodec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 14440fe3c1..253e45ad05 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -912,7 +912,7 @@ enum AVPacketSideDataType { */ AV_PKT_DATA_DISPLAYMATRIX, - /* + /** * This side data should be associated with a video stream and contains * Stereoscopic 3D information in form of the AVStereo3D struct. */ From 9d3e69ae3013027b1d4d79edf2ed5db00e4d5462 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 18 Aug 2014 18:04:47 +0000 Subject: [PATCH 22/26] Add release notes for 11. (cherry picked from commit 12f0388f9cb32016ac0dacaeca631b088b29bb96) Signed-off-by: Diego Biurrun --- doc/RELEASE_NOTES | 109 +++++++++++++++++++++------------------------- 1 file changed, 50 insertions(+), 59 deletions(-) diff --git a/doc/RELEASE_NOTES b/doc/RELEASE_NOTES index 478bc1d20e..bda4789aff 100644 --- a/doc/RELEASE_NOTES +++ b/doc/RELEASE_NOTES @@ -1,51 +1,50 @@ Release Notes ============= -* 10 "Eks" +* 11 "One Louder" General notes ------------- -One of the main features of this release is the addition of reference-counted -data buffers to Libav and their use in various structures. Specifically, the -data buffers used by AVPacket and AVFrame can now be reference counted, which -should allow to significantly simplify many use cases. In addition, -reference-counted AVFrames can now be used in libavfilter, avoiding the need -for a separate libavfilter-specific frame structure. Frames can now be passed -straight from the decoders into filters or from filters to encoders. +With this release we are trying to answer the numerous calls from our users for +shorter development cycles. From now on we will aim for approximately two major +releases per year. -These additions made it necessary to bump the major versions of libavcodec, -libavformat, libavdevice, libavfilter, and libavutil, which was accompanied by -dropping some old deprecated APIs. These libraries are thus not ABI- or API- -compatible with the previous release. All the other libraries (libavresample -and libswscale) should be both ABI- and API-compatible. +Libav 11 is API-, but not ABI-compatible with the previous major release. This +means that the code using our libraries needs to be rebuilt, but no source +changes should be required. Note however, that a number of old APIs remain +deprecated and will be dropped in the near future. All users are strongly +encouraged to update their code as soon as possible. The doc/APIchanges file in +the Libav source tree and the migration guide on the wiki should help with +migration to the new APIs. If those are not sufficient, do not hesitate to +contact us on IRC or through the user mailing list. -Another major point is the inclusion of the HEVC (AKA H.265, the successor of -H.264) decoder in the main codebase. It was started in 2012 as a Libav Google -Summer of Code project by Guillaume Martres and subsequently completed with -the assistance of the OpenHEVC project and several Libav developers. +One specific API issue in libavformat deserves mentioning here. When using +libavcodec for decoding or encoding and libavformat for demuxing or muxing, +the standard practice was to use the stream codec context (AVStream.codec) for +actual decoding or encoding. There are multiple problems with this pattern +(the main one is that the decoder/demuxer or encoder/muxer are not necessarily +synchronized and may overwrite each other's state), so it is now strongly +discouraged and will likely be deprecated in the future. Users should instead +allocate a separate decoding or encoding context and populate it from the +demuxing codec context (or the reverse for encoding) with the +avcodec_copy_context() function. -As usual, this release also contains support for other new formats, many smaller -new features and countless bug fixes. We can highlight a native VP9 decoder, -with encoding provided through libvpx, native decoders for WebP, JPEG 2000, and -AIC, as well as improved WavPack support with encoding through libwavpack, -support for more AAC flavors (LD - low delay, ELD - enhanced low delay), slice -multithreading in libavfilter, or muxing chapters in ASF. Furthermore a few new -filters have been introduced, namely compand, to change audio dynamics, framepack, -to create stereoscopic videos, asetpts, to set audio pts, and interlace, to convert -progressive video to interlaced. Finally there is more fine-grained detection of -host and target libc, which should allow better portability to various cross -compilation scenarios. +The main highlights of this release include native Opus, VP7, OpenEXR, and On2 +AVC decoders, HEVC encoding through libx265, new APIs for exporting ReplayGain +and display transformation metadata and countless bug fixes. A large effort was +also expended on internal cleanups which are not very visible to our users, +but should make the codebase cleaner, safer and easier to maintain and extend. +One point worth mentioning is refactoring the large monolithic framework for +architecture-specific codec optimizations into small blocks, which reduces the +size of configurations that selectively enable or disable certain codecs. -See the Changelog file for a fuller list of significant changes. - -Please note that our policy on bug reports has not changed. We still only accept -bug reports against HEAD of the Libav trunk repository. If you are experiencing -issues with any formally released version of Libav, please try a current version -of the development code to check if the issue still exists. If it does, make -your report against the development code following the usual bug reporting -guidelines. +The avserver streaming tool, which has not been maintained for many years and +was mostly broken, was removed from the tree. It was decided that it is a +significant maintenance burden and that we do our users no service by pretending +to support it, while we in fact do not. +See the Changelog file for a more extensive list of significant changes. API changes ----------- @@ -54,31 +53,23 @@ A number of additional APIs have been introduced and some existing functions have been deprecated and are scheduled for removal in the next release. Significant API changes include: -[libavutil] -+ added the reference-counted buffers API (buffers.h) -+ moved the AVFrame struct to libavutil and added a new API for working with - reference-counted AVFrames (frame.h) - [libavcodec] -+ added an API for working with reference-counted AVPackets (av_packet_*) -+- converted VDPAU to the hwaccel framework; the old way of using VDPAU is no - longer supported -- old audio encoding and decoding APIs removed -- old video encoding API removed -- deprecated enum CodecID removed (enum AVCodecID should be used instead) -- deprecated audio resampling API removed (libavresample should be used - instead) ++ Added the avcodec_copy_context() function that must from now on be used for + freeing codec contexts. ++- Added a new VDA hardware acceleration API, since the old one was broken and + not fixable in a compatible way. Deprecated the old VDA API. -[libavfilter] -+- replaced AVFilterBufferRef with AVFrame; AVFilterBufferRef and everything - related to it still exists, but is deprecated -+ converted all filters to use the AVOptions system for configuration, it is - now possible to query the supported options, their values and set them - directly with av_opt_* -+ added a slice multithreading framework -+- merged avfiltergraph.h to avfilter.h, using AVFilterGraph is now explicitly - mandatory (it was implicitly required even before); added new API for - allocating and initializing filters +[libavformat] ++ Added support for exporting stream-global (as opposed to per-packet) side + data. This feature is now used by some demuxers to export ReplayGain or + display transformation matrix (aka rotation) or stereoscopic 3D mode. ++ Added an API for live metadata updates through event flags. ++- Changed the way to provide a hint about the desired timebase to muxers. + Previously it was done by setting AVStream.codec.time_base. Now callers + should set AVStream.time_base. + +[libavresample] ++ Added an API for working with AVFrames. Please see the file doc/APIchanges for details along with similar programmer-centric information. From 07b0ccf5116c3b2ce1ccfed4c8c593641a815fd6 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 3 Sep 2014 00:43:29 +0200 Subject: [PATCH 23/26] Mark 11 release in the changelog Also fix some typos in the entries for the 11 release. (cherry picked from commit d9792b773516a560ecb99694b8ee745a50027fac) Signed-off-by: Diego Biurrun --- Changelog | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Changelog b/Changelog index da12f599e3..73e837891b 100644 --- a/Changelog +++ b/Changelog @@ -1,7 +1,7 @@ Entries are sorted chronologically from oldest to youngest within each release, releases are sorted from youngest to oldest. -version : +version 11: - libx265 encoder - shuffleplanes filter - replaygain data export @@ -9,7 +9,7 @@ version : - BRender PIX image decoder - Amazing Studio PAF playback support - XBM decoder -- bmp standalone parser +- BMP standalone parser - OpenEXR image decoder - support encoding and decoding 4-channel SGI images - support decoding 16-bit RLE SGI images @@ -26,12 +26,12 @@ version : - support for decoding through DXVA2 in avconv - libbs2b-based stereo-to-binaural audio filter - native Opus decoder -- display matrix export and rotation api +- display matrix export and rotation API - drop avserver, it was unmaintained for years and largely broken - Icecast protocol -- request icecast metadata by default +- request Icecast metadata by default - support for using metadata in stream specifiers in avtools -- matroska 3d support +- Matroska 3D support version 10: From 7d8ebb877408e03beb9dd6b99a51291b17d9a969 Mon Sep 17 00:00:00 2001 From: Sean McGovern Date: Fri, 5 Sep 2014 01:04:21 -0400 Subject: [PATCH 24/26] Fix RELEASE identification This was accidentally left over in b5d4f49e3cb1a13642542f08c8c54791c3d54dfb --- RELEASE | 1 - 1 file changed, 1 deletion(-) diff --git a/RELEASE b/RELEASE index d826aee365..27383c37cb 100644 --- a/RELEASE +++ b/RELEASE @@ -1,2 +1 @@ -11_beta1 11_beta2 From 4f2d4b98fc9877f8618c1524570b230e51e8d474 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 10 Sep 2014 18:38:15 +0200 Subject: [PATCH 25/26] doc: Fix syntax and logical errors in avconv stream combination example Bug-Id: 661 CC: libav-stable@libav.org (cherry picked from commit 775a0b04f0cf8102fe322b2ee03fe1a0633dea04) Signed-off-by: Diego Biurrun --- doc/avconv.texi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/avconv.texi b/doc/avconv.texi index 11561768e1..37733bc2a9 100644 --- a/doc/avconv.texi +++ b/doc/avconv.texi @@ -1129,11 +1129,11 @@ only formats accepting a normal integer are suitable. You can put many streams of the same type in the output: @example -avconv -i test1.avi -i test2.avi -map 0.3 -map 0.2 -map 0.1 -map 0.0 -c copy test12.nut +avconv -i test1.avi -i test2.avi -map 1:1 -map 1:0 -map 0:1 -map 0:0 -c copy -y test12.nut @end example -The resulting output file @file{test12.avi} will contain first four streams from -the input file in reverse order. +The resulting output file @file{test12.nut} will contain the first four streams +from the input files in reverse order. @item To force CBR video output: From f851477889ae48e2f17073cf7486e1d5561b7ae4 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Sat, 13 Sep 2014 11:14:46 -0700 Subject: [PATCH 26/26] Prepare for 11 release --- RELEASE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE b/RELEASE index 27383c37cb..b4de394767 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -11_beta2 +11