From 722ec3eb35bc152ce91d0a4502eca0df1c0086d0 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 23 May 2016 14:09:08 +0200 Subject: [PATCH 001/102] avconv: decouple configuring filtergraphs and setting input parameters Currently, calling configure_filtergraph() will pull in the input parameters from the corresponding decoder context. This has the following disadvantages: - the decoded frame is a more proper source for this information - a filter accessing decoder data breaks proper layering Add functions for explicitly sending the input stream parameters to a filtergraph input - currently from a frame and a decoder. The decoder one will be dropped in future commits after some more restructuring. --- avconv.c | 30 +++++++++++++++++++++ avconv.h | 14 ++++++++++ avconv_filter.c | 70 ++++++++++++++++++++++++++++++++++++++++--------- avconv_opt.c | 24 ++++++++++++++--- 4 files changed, 122 insertions(+), 16 deletions(-) diff --git a/avconv.c b/avconv.c index 64017602cb6f1..4e19813312280 100644 --- a/avconv.c +++ b/avconv.c @@ -147,6 +147,7 @@ static void avconv_cleanup(int ret) FilterGraph *fg = filtergraphs[i]; avfilter_graph_free(&fg->graph); for (j = 0; j < fg->nb_inputs; j++) { + av_buffer_unref(&fg->inputs[j]->hw_frames_ctx); av_freep(&fg->inputs[j]->name); av_freep(&fg->inputs[j]); } @@ -1252,6 +1253,16 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output) ist->resample_channel_layout = decoded_frame->channel_layout; ist->resample_channels = avctx->channels; + for (i = 0; i < ist->nb_filters; i++) { + err = ifilter_parameters_from_frame(ist->filters[i], decoded_frame); + if (err < 0) { + av_log(NULL, AV_LOG_ERROR, + "Error reconfiguring input stream %d:%d filter %d\n", + ist->file_index, ist->st->index, i); + goto fail; + } + } + for (i = 0; i < nb_filtergraphs; i++) if (ist_in_filtergraph(filtergraphs[i], ist) && configure_filtergraph(filtergraphs[i]) < 0) { @@ -1279,6 +1290,7 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output) break; } +fail: av_frame_unref(ist->filter_frame); av_frame_unref(decoded_frame); return err < 0 ? err : ret; @@ -1336,6 +1348,16 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output) ist->resample_height = decoded_frame->height; ist->resample_pix_fmt = decoded_frame->format; + for (i = 0; i < ist->nb_filters; i++) { + err = ifilter_parameters_from_frame(ist->filters[i], decoded_frame); + if (err < 0) { + av_log(NULL, AV_LOG_ERROR, + "Error reconfiguring input stream %d:%d filter %d\n", + ist->file_index, ist->st->index, i); + goto fail; + } + } + for (i = 0; i < nb_filtergraphs; i++) if (ist_in_filtergraph(filtergraphs[i], ist) && configure_filtergraph(filtergraphs[i]) < 0) { @@ -2061,6 +2083,14 @@ static int transcode_init(void) enc_ctx->codec_type == AVMEDIA_TYPE_AUDIO) && filtergraph_is_simple(ost->filter->graph)) { FilterGraph *fg = ost->filter->graph; + + ret = ifilter_parameters_from_decoder(fg->inputs[0], + dec_ctx); + if (ret < 0) { + av_log(NULL, AV_LOG_FATAL, "Error initializing filter input\n"); + exit_program(1); + } + if (configure_filtergraph(fg)) { av_log(NULL, AV_LOG_FATAL, "Error opening filters!\n"); exit_program(1); diff --git a/avconv.h b/avconv.h index 60729c349122d..e201b92bcaf6d 100644 --- a/avconv.h +++ b/avconv.h @@ -199,6 +199,17 @@ typedef struct InputFilter { struct InputStream *ist; struct FilterGraph *graph; uint8_t *name; + + // parameters configured for this input + int format; + + int width, height; + AVRational sample_aspect_ratio; + + int sample_rate; + uint64_t channel_layout; + + AVBufferRef *hw_frames_ctx; } InputFilter; typedef struct OutputFilter { @@ -468,6 +479,9 @@ int filtergraph_is_simple(FilterGraph *fg); int init_simple_filtergraph(InputStream *ist, OutputStream *ost); int init_complex_filtergraph(FilterGraph *fg); +int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame); +int ifilter_parameters_from_decoder(InputFilter *ifilter, const AVCodecContext *avctx); + int avconv_parse_options(int argc, char **argv); int vdpau_init(AVCodecContext *s); diff --git a/avconv_filter.c b/avconv_filter.c index 875ce10e3262b..2332f99707ba1 100644 --- a/avconv_filter.c +++ b/avconv_filter.c @@ -97,6 +97,7 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost) exit(1); fg->inputs[0]->ist = ist; fg->inputs[0]->graph = fg; + fg->inputs[0]->format = -1; GROW_ARRAY(ist->filters, ist->nb_filters); ist->filters[ist->nb_filters - 1] = fg->inputs[0]; @@ -172,6 +173,7 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in) exit(1); fg->inputs[fg->nb_inputs - 1]->ist = ist; fg->inputs[fg->nb_inputs - 1]->graph = fg; + fg->inputs[fg->nb_inputs - 1]->format = -1; GROW_ARRAY(ist->filters, ist->nb_filters); ist->filters[ist->nb_filters - 1] = fg->inputs[fg->nb_inputs - 1]; @@ -505,15 +507,12 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, if (!par) return AVERROR(ENOMEM); - par->sample_aspect_ratio = ist->st->sample_aspect_ratio.num ? - ist->st->sample_aspect_ratio : - ist->dec_ctx->sample_aspect_ratio; - par->width = ist->dec_ctx->width; - par->height = ist->dec_ctx->height; - par->format = ist->hwaccel_retrieve_data ? - ist->hwaccel_retrieved_pix_fmt : ist->dec_ctx->pix_fmt; + par->sample_aspect_ratio = ifilter->sample_aspect_ratio; + par->width = ifilter->width; + par->height = ifilter->height; + par->format = ifilter->format; par->time_base = tb; - par->hw_frames_ctx = ist->hw_frames_ctx; + par->hw_frames_ctx = ifilter->hw_frames_ctx; ret = av_buffersrc_parameters_set(ifilter->filter, par); av_freep(&par); @@ -597,10 +596,10 @@ static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter, if (!par) return AVERROR(ENOMEM); - par->time_base = (AVRational){ 1, ist->dec_ctx->sample_rate }; - par->sample_rate = ist->dec_ctx->sample_rate; - par->format = ist->dec_ctx->sample_fmt; - par->channel_layout = ist->dec_ctx->channel_layout; + par->time_base = (AVRational){ 1, ifilter->sample_rate }; + par->sample_rate = ifilter->sample_rate; + par->format = ifilter->format; + par->channel_layout = ifilter->channel_layout; ret = av_buffersrc_parameters_set(ifilter->filter, par); av_freep(&par); @@ -751,6 +750,53 @@ int configure_filtergraph(FilterGraph *fg) return 0; } +int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame) +{ + av_buffer_unref(&ifilter->hw_frames_ctx); + + ifilter->format = frame->format; + + ifilter->width = frame->width; + ifilter->height = frame->height; + ifilter->sample_aspect_ratio = frame->sample_aspect_ratio; + + ifilter->sample_rate = frame->sample_rate; + ifilter->channel_layout = frame->channel_layout; + + if (frame->hw_frames_ctx) { + ifilter->hw_frames_ctx = av_buffer_ref(frame->hw_frames_ctx); + if (!ifilter->hw_frames_ctx) + return AVERROR(ENOMEM); + } + + return 0; +} + +int ifilter_parameters_from_decoder(InputFilter *ifilter, const AVCodecContext *avctx) +{ + av_buffer_unref(&ifilter->hw_frames_ctx); + + if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) + ifilter->format = avctx->pix_fmt; + else + ifilter->format = avctx->sample_fmt; + + ifilter->width = avctx->width; + ifilter->height = avctx->height; + ifilter->sample_aspect_ratio = avctx->sample_aspect_ratio; + + ifilter->sample_rate = avctx->sample_rate; + ifilter->channel_layout = avctx->channel_layout; + + if (avctx->hw_frames_ctx) { + ifilter->hw_frames_ctx = av_buffer_ref(avctx->hw_frames_ctx); + if (!ifilter->hw_frames_ctx) + return AVERROR(ENOMEM); + } + + return 0; +} + int ist_in_filtergraph(FilterGraph *fg, InputStream *ist) { int i; diff --git a/avconv_opt.c b/avconv_opt.c index a1729c30e5daf..ce58f2b6be2d1 100644 --- a/avconv_opt.c +++ b/avconv_opt.c @@ -1498,12 +1498,28 @@ static int init_complex_filters(void) static int configure_complex_filters(void) { - int i, ret = 0; + int i, j, ret = 0; + + for (i = 0; i < nb_filtergraphs; i++) { + FilterGraph *fg = filtergraphs[i]; + + if (filtergraph_is_simple(fg)) + continue; - for (i = 0; i < nb_filtergraphs; i++) - if (!filtergraph_is_simple(filtergraphs[i]) && - (ret = configure_filtergraph(filtergraphs[i])) < 0) + for (j = 0; j < fg->nb_inputs; j++) { + ret = ifilter_parameters_from_decoder(fg->inputs[j], + fg->inputs[j]->ist->dec_ctx); + if (ret < 0) { + av_log(NULL, AV_LOG_ERROR, + "Error initializing filtergraph %d input %d\n", i, j); + return ret; + } + } + + ret = configure_filtergraph(filtergraphs[i]); + if (ret < 0) return ret; + } return 0; } From 042faa847feea820451c474af0034fd3de9cff82 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 30 Oct 2016 13:44:52 +0100 Subject: [PATCH 002/102] avcodec/8bps: Check side data size before use Fixes out of array read Signed-off-by: Michael Niedermayer --- libavcodec/8bps.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c index 49fd44549486b..aa2318fa2d817 100644 --- a/libavcodec/8bps.c +++ b/libavcodec/8bps.c @@ -122,12 +122,15 @@ static int decode_frame(AVCodecContext *avctx, void *data, } if (avctx->bits_per_coded_sample <= 8) { + int size; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, - NULL); - if (pal) { + &size); + if (pal && size == AVPALETTE_SIZE) { frame->palette_has_changed = 1; memcpy(c->pal, pal, AVPALETTE_SIZE); + } else if (pal) { + av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size); } memcpy (frame->data[1], c->pal, AVPALETTE_SIZE); From 121be310607879841d19a34d9f16d4fe9ba7f18c Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 30 Oct 2016 13:47:38 +0100 Subject: [PATCH 003/102] avcodec/cinepak: Check side data size before use Fixes out of array read Signed-off-by: Michael Niedermayer --- libavcodec/cinepak.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c index a2190d7598f43..737462bd9cdc8 100644 --- a/libavcodec/cinepak.c +++ b/libavcodec/cinepak.c @@ -443,10 +443,13 @@ static int cinepak_decode_frame(AVCodecContext *avctx, return ret; if (s->palette_video) { - const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); - if (pal) { + int size; + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); + if (pal && size == AVPALETTE_SIZE) { s->frame->palette_has_changed = 1; memcpy(s->pal, pal, AVPALETTE_SIZE); + } else if (pal) { + av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size); } } From e8634fb92e2f624f19ee5fced6481d8ece503119 Mon Sep 17 00:00:00 2001 From: Mark Thompson Date: Fri, 28 Oct 2016 19:50:27 +0100 Subject: [PATCH 004/102] openssl: Allow newer TLS versions than TLSv1 The use of TLSv1_*_method() disallows newer protocol versions; instead use SSLv23_*_method() and then explicitly disable the deprecated protocol versions which should not be supported. Fixes ticket #5915. --- libavformat/tls_openssl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c index c551ac74e24b2..178ca9e0e4684 100644 --- a/libavformat/tls_openssl.c +++ b/libavformat/tls_openssl.c @@ -233,12 +233,17 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op if ((ret = ff_tls_open_underlying(c, h, uri, options)) < 0) goto fail; - p->ctx = SSL_CTX_new(c->listen ? TLSv1_server_method() : TLSv1_client_method()); + // We want to support all versions of TLS >= 1.0, but not the deprecated + // and insecure SSLv2 and SSLv3. Despite the name, SSLv23_*_method() + // enables support for all versions of SSL and TLS, and we then disable + // support for the old protocols immediately after creating the context. + p->ctx = SSL_CTX_new(c->listen ? SSLv23_server_method() : SSLv23_client_method()); if (!p->ctx) { av_log(h, AV_LOG_ERROR, "%s\n", ERR_error_string(ERR_get_error(), NULL)); ret = AVERROR(EIO); goto fail; } + SSL_CTX_set_options(p->ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3); if (c->ca_file) { if (!SSL_CTX_load_verify_locations(p->ctx, c->ca_file, NULL)) av_log(h, AV_LOG_ERROR, "SSL_CTX_load_verify_locations %s\n", ERR_error_string(ERR_get_error(), NULL)); From a2b8dde65947bfabf42269e124ef83ecf9c5974a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 30 Oct 2016 15:12:12 +0100 Subject: [PATCH 005/102] avcodec/idcinvideo: Check side data size before use Fixes out of array read Signed-off-by: Michael Niedermayer --- libavcodec/idcinvideo.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/idcinvideo.c b/libavcodec/idcinvideo.c index 0870172794e76..cff9ad31ac3d6 100644 --- a/libavcodec/idcinvideo.c +++ b/libavcodec/idcinvideo.c @@ -214,7 +214,8 @@ static int idcin_decode_frame(AVCodecContext *avctx, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; IdcinContext *s = avctx->priv_data; - const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); + int pal_size; + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size); AVFrame *frame = data; int ret; @@ -227,9 +228,11 @@ static int idcin_decode_frame(AVCodecContext *avctx, if (idcin_decode_vlcs(s, frame)) return AVERROR_INVALIDDATA; - if (pal) { + if (pal && pal_size == AVPALETTE_SIZE) { frame->palette_has_changed = 1; memcpy(s->pal, pal, AVPALETTE_SIZE); + } else if (pal) { + av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", pal_size); } /* make the palette available on the way out */ memcpy(frame->data[1], s->pal, AVPALETTE_SIZE); From 2d99101d0964f754822fb4af121c4abc69047dba Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 30 Oct 2016 15:12:12 +0100 Subject: [PATCH 006/102] avcodec/kmvc: Check side data size before use Fixes out of array read Signed-off-by: Michael Niedermayer --- libavcodec/kmvc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/kmvc.c b/libavcodec/kmvc.c index 7acaba7d21ca7..ffe6a142e9721 100644 --- a/libavcodec/kmvc.c +++ b/libavcodec/kmvc.c @@ -268,7 +268,8 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame, int i, ret; int header; int blocksize; - const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); + int pal_size; + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size); bytestream2_init(&ctx->g, avpkt->data, avpkt->size); @@ -303,9 +304,11 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame, } } - if (pal) { + if (pal && pal_size == AVPALETTE_SIZE) { frame->palette_has_changed = 1; memcpy(ctx->pal, pal, AVPALETTE_SIZE); + } else if (pal) { + av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", pal_size); } if (ctx->setpal) { From 14e4e26559697cfdea584767be4e68474a0a9c7f Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Sun, 30 Oct 2016 20:47:22 +0100 Subject: [PATCH 007/102] interplayacm: check for too large b This fixes out-of-bounds reads. Reviewed-by: Paul B Mahol Signed-off-by: Andreas Cadhalpun --- libavcodec/interplayacm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libavcodec/interplayacm.c b/libavcodec/interplayacm.c index 0fd350167a820..0486e00b1ed04 100644 --- a/libavcodec/interplayacm.c +++ b/libavcodec/interplayacm.c @@ -326,6 +326,10 @@ static int t15(InterplayACMContext *s, unsigned ind, unsigned col) for (i = 0; i < s->rows; i++) { /* b = (x1) + (x2 * 3) + (x3 * 9) */ b = get_bits(gb, 5); + if (b > 26) { + av_log(NULL, AV_LOG_ERROR, "Too large b = %d > 26\n", b); + return AVERROR_INVALIDDATA; + } n1 = (mul_3x3[b] & 0x0F) - 1; n2 = ((mul_3x3[b] >> 4) & 0x0F) - 1; @@ -351,6 +355,10 @@ static int t27(InterplayACMContext *s, unsigned ind, unsigned col) for (i = 0; i < s->rows; i++) { /* b = (x1) + (x2 * 5) + (x3 * 25) */ b = get_bits(gb, 7); + if (b > 124) { + av_log(NULL, AV_LOG_ERROR, "Too large b = %d > 124\n", b); + return AVERROR_INVALIDDATA; + } n1 = (mul_3x5[b] & 0x0F) - 2; n2 = ((mul_3x5[b] >> 4) & 0x0F) - 2; @@ -375,6 +383,10 @@ static int t37(InterplayACMContext *s, unsigned ind, unsigned col) for (i = 0; i < s->rows; i++) { /* b = (x1) + (x2 * 11) */ b = get_bits(gb, 7); + if (b > 120) { + av_log(NULL, AV_LOG_ERROR, "Too large b = %d > 120\n", b); + return AVERROR_INVALIDDATA; + } n1 = (mul_2x11[b] & 0x0F) - 5; n2 = ((mul_2x11[b] >> 4) & 0x0F) - 5; From 5540d6c1343e6d1e06d6601b7d35884761711e3e Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Sun, 30 Oct 2016 21:41:11 +0100 Subject: [PATCH 008/102] interplayacm: validate number of channels The number of channels is used as divisor in decode_frame, so it must not be zero to avoid SIGFPE crashes. Reviewed-by: Paul B Mahol Signed-off-by: Andreas Cadhalpun --- libavcodec/interplayacm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/interplayacm.c b/libavcodec/interplayacm.c index 0486e00b1ed04..032053103a9cc 100644 --- a/libavcodec/interplayacm.c +++ b/libavcodec/interplayacm.c @@ -62,6 +62,11 @@ static av_cold int decode_init(AVCodecContext *avctx) if (avctx->extradata_size < 14) return AVERROR_INVALIDDATA; + if (avctx->channels <= 0) { + av_log(avctx, AV_LOG_ERROR, "Invalid number of channels: %d\n", avctx->channels); + return AVERROR_INVALIDDATA; + } + s->level = AV_RL16(avctx->extradata + 12) & 0xf; s->rows = AV_RL16(avctx->extradata + 12) >> 4; s->cols = 1 << s->level; From 21b68cdbae6576bb58c19dd44c0669293f7d05d1 Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Sun, 30 Oct 2016 10:30:27 -0700 Subject: [PATCH 009/102] avcodec/cuvid: Don't claim to decode h.263 (it doesn't) Turns out cuvid doesn't support h.263. --- configure | 3 --- libavcodec/allcodecs.c | 2 -- libavcodec/cuvid.c | 9 --------- 3 files changed, 14 deletions(-) diff --git a/configure b/configure index 5993de5147907..c4122e9d7154a 100755 --- a/configure +++ b/configure @@ -2552,7 +2552,6 @@ videotoolbox_hwaccel_deps="videotoolbox pthreads" videotoolbox_hwaccel_extralibs="-framework QuartzCore" xvmc_deps="X11_extensions_XvMClib_h" -h263_cuvid_hwaccel_deps="cuda cuvid" h263_vaapi_hwaccel_deps="vaapi" h263_vaapi_hwaccel_select="h263_decoder" h263_videotoolbox_hwaccel_deps="videotoolbox" @@ -2696,8 +2695,6 @@ scale_npp_filter_deps="cuda libnpp" nvenc_deps_any="dlopen LoadLibrary" nvenc_encoder_deps="nvenc" -h263_cuvid_decoder_deps="cuda cuvid" -h263_cuvid_decoder_select="h263_cuvid_hwaccel" h264_cuvid_decoder_deps="cuda cuvid" h264_cuvid_decoder_select="h264_mp4toannexb_bsf h264_cuvid_hwaccel" h264_nvenc_encoder_deps="nvenc" diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 594d1040566d8..ada9481d27713 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -67,7 +67,6 @@ void avcodec_register_all(void) initialized = 1; /* hardware accelerators */ - REGISTER_HWACCEL(H263_CUVID, h263_cuvid); REGISTER_HWACCEL(H263_VAAPI, h263_vaapi); REGISTER_HWACCEL(H263_VIDEOTOOLBOX, h263_videotoolbox); REGISTER_HWACCEL(H264_CUVID, h264_cuvid); @@ -634,7 +633,6 @@ void avcodec_register_all(void) /* external libraries, that shouldn't be used by default if one of the * above is available */ REGISTER_ENCDEC (LIBOPENH264, libopenh264); - REGISTER_DECODER(H263_CUVID, h263_cuvid); REGISTER_DECODER(H264_CUVID, h264_cuvid); REGISTER_ENCODER(H264_NVENC, h264_nvenc); REGISTER_ENCODER(H264_OMX, h264_omx); diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c index 24ade94ab9aa1..eafce0ac19074 100644 --- a/libavcodec/cuvid.c +++ b/libavcodec/cuvid.c @@ -664,11 +664,6 @@ static av_cold int cuvid_decode_init(AVCodecContext *avctx) ctx->cuparseinfo.pExtVideoInfo = &ctx->cuparse_ext; switch (avctx->codec->id) { -#if CONFIG_H263_CUVID_DECODER - case AV_CODEC_ID_H263: - ctx->cuparseinfo.CodecType = cudaVideoCodec_MPEG4; - break; -#endif #if CONFIG_H264_CUVID_DECODER case AV_CODEC_ID_H264: ctx->cuparseinfo.CodecType = cudaVideoCodec_H264; @@ -895,10 +890,6 @@ static const AVOption options[] = { DEFINE_CUVID_CODEC(hevc, HEVC) #endif -#if CONFIG_H263_CUVID_DECODER -DEFINE_CUVID_CODEC(h263, H263) -#endif - #if CONFIG_H264_CUVID_DECODER DEFINE_CUVID_CODEC(h264, H264) #endif From a6330119a099840c5279697cf80cb768df97a90a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 30 Oct 2016 15:12:12 +0100 Subject: [PATCH 010/102] avcodec/msrle: Check side data size before use Fixes out of array read Signed-off-by: Michael Niedermayer --- libavcodec/msrle.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c index c2f624283d37c..adb55b1302c07 100644 --- a/libavcodec/msrle.c +++ b/libavcodec/msrle.c @@ -99,11 +99,14 @@ static int msrle_decode_frame(AVCodecContext *avctx, return ret; if (avctx->bits_per_coded_sample > 1 && avctx->bits_per_coded_sample <= 8) { - const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); + int size; + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); - if (pal) { + if (pal && size == AVPALETTE_SIZE) { s->frame->palette_has_changed = 1; memcpy(s->pal, pal, AVPALETTE_SIZE); + } else if (pal) { + av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size); } /* make the palette available */ memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE); From 7d196f2a5a48faf25fd904b33b1fd239daae9840 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 30 Oct 2016 15:12:12 +0100 Subject: [PATCH 011/102] avcodec/qtrle: Check side data size before use Fixes out of array read Signed-off-by: Michael Niedermayer --- libavcodec/qtrle.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c index d9d27f05064c4..1b0d2016b586f 100644 --- a/libavcodec/qtrle.c +++ b/libavcodec/qtrle.c @@ -506,11 +506,14 @@ static int qtrle_decode_frame(AVCodecContext *avctx, } if(has_palette) { - const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); + int size; + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); - if (pal) { + if (pal && size == AVPALETTE_SIZE) { s->frame->palette_has_changed = 1; memcpy(s->pal, pal, AVPALETTE_SIZE); + } else if (pal) { + av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size); } /* make the palette available on the way out */ From 16793504dfba44e738655807db3274301b9bc690 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 30 Oct 2016 15:12:12 +0100 Subject: [PATCH 012/102] avcodec/qpeg: Check side data size before use Fixes out of array read Signed-off-by: Michael Niedermayer --- libavcodec/qpeg.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c index 9eaf9b8054bf8..9bfecc3a31edd 100644 --- a/libavcodec/qpeg.c +++ b/libavcodec/qpeg.c @@ -260,7 +260,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame * const ref = a->ref; uint8_t* outdata; int delta, ret; - const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); + int pal_size; + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size); if (avpkt->size < 0x86) { av_log(avctx, AV_LOG_ERROR, "Packet is too small\n"); @@ -287,9 +288,11 @@ static int decode_frame(AVCodecContext *avctx, } /* make the palette available on the way out */ - if (pal) { + if (pal && pal_size == AVPALETTE_SIZE) { p->palette_has_changed = 1; memcpy(a->pal, pal, AVPALETTE_SIZE); + } else if (pal) { + av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", pal_size); } memcpy(p->data[1], a->pal, AVPALETTE_SIZE); From 161ccdaa06d1d109e8f77d2535bda11ce02720f5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 30 Oct 2016 15:12:12 +0100 Subject: [PATCH 013/102] avcodec/msvideo1: Check side data size before use Fixes out of array read Signed-off-by: Michael Niedermayer --- libavcodec/msvideo1.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/msvideo1.c b/libavcodec/msvideo1.c index 1d141723f6347..a49b9be364d7e 100644 --- a/libavcodec/msvideo1.c +++ b/libavcodec/msvideo1.c @@ -305,11 +305,14 @@ static int msvideo1_decode_frame(AVCodecContext *avctx, return ret; if (s->mode_8bit) { - const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); + int size; + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); - if (pal) { + if (pal && size == AVPALETTE_SIZE) { memcpy(s->pal, pal, AVPALETTE_SIZE); s->frame->palette_has_changed = 1; + } else if (pal) { + av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size); } } From 0f64b6cd22411f574cbc75cab3b6db7dba023ed6 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 30 Oct 2016 15:12:12 +0100 Subject: [PATCH 014/102] avcodec/rscc: Check side data size before use Fixes out of array read Signed-off-by: Michael Niedermayer --- libavcodec/rscc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/rscc.c b/libavcodec/rscc.c index 7f280a9a973b8..7eb8776886beb 100644 --- a/libavcodec/rscc.c +++ b/libavcodec/rscc.c @@ -310,12 +310,15 @@ static int rscc_decode_frame(AVCodecContext *avctx, void *data, frame->pict_type = AV_PICTURE_TYPE_P; } if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { + int size; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, - NULL); - if (pal) { + &size); + if (pal && size == AV_PKT_DATA_PALETTE) { frame->palette_has_changed = 1; memcpy(ctx->pal, pal, AVPALETTE_SIZE); + } else if (pal) { + av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size); } memcpy (frame->data[1], ctx->pal, AVPALETTE_SIZE); } From 5f0bc0215a0f7099a2bcba5dced2e045e70fee61 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 30 Oct 2016 15:12:12 +0100 Subject: [PATCH 015/102] avcodec/rawdec: Check side data size before use Fixes out of array read Signed-off-by: Michael Niedermayer --- libavcodec/rawdec.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c index 1259577397839..45cf27fa20853 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -364,9 +364,16 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, } if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { + int pal_size; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, - NULL); + &pal_size); int ret; + + if (pal_size != AVPALETTE_SIZE) { + av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", pal_size); + pal = NULL; + } + if (!context->palette) context->palette = av_buffer_alloc(AVPALETTE_SIZE); if (!context->palette) { From 894e7ef9b4256e92fd0ec9ec2518389502b8be91 Mon Sep 17 00:00:00 2001 From: "Reynaldo H. Verdejo Pinochet" Date: Fri, 28 Oct 2016 12:48:54 -0700 Subject: [PATCH 016/102] configure: add '-uninstalled' to uninstalled .pc files pkg-config(1) expects uninstalled pc files to follow the blah-uninstalled.pc naming convention and the behavior of the program is impacted by it. Without this fix overriding PKGP_CONFIG_LIBDIR is required to ensure uninstalled files are preferred (overkill), instead of just adding pc-uninstalled/ to the utility's search path by setting PKG_CONFIG_PATH accordingly. Signed-off-by: Reynaldo H. Verdejo Pinochet --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index c4122e9d7154a..d2ab550022ab7 100755 --- a/configure +++ b/configure @@ -6816,7 +6816,7 @@ EOF mkdir -p doc/examples/pc-uninstalled includedir=${source_path} [ "$includedir" = . ] && includedir="\${pcfiledir}/../../.." - cat < doc/examples/pc-uninstalled/$name.pc + cat < doc/examples/pc-uninstalled/${name}-uninstalled.pc prefix= exec_prefix= libdir=\${pcfiledir}/../../../$name From 5e965582d5129ec1c5cbe67125fff8c96c6ba3c6 Mon Sep 17 00:00:00 2001 From: Sasi Inguva Date: Sun, 23 Oct 2016 22:37:50 -0700 Subject: [PATCH 017/102] lavf/mov.c: Use the correct timescale when seeking for audio. Signed-off-by: Sasi Inguva Reviewed-by: Derek Buitenhuis --- libavformat/mov.c | 2 +- tests/fate/mov.mak | 6 +- tests/ref/fate/mov-aac-2048-priming | 217 ++++++++++++++++++++++++++++ 3 files changed, 223 insertions(+), 2 deletions(-) create mode 100644 tests/ref/fate/mov-aac-2048-priming diff --git a/libavformat/mov.c b/libavformat/mov.c index 357d800732a0e..414007e7aa128 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3028,7 +3028,7 @@ static void mov_fix_index(MOVContext *mov, AVStream *st) // Audio decoders like AAC need need a decoder delay samples previous to the current sample, // to correctly decode this frame. Hence for audio we seek to a frame 1 sec. before the // edit_list_media_time to cover the decoder delay. - search_timestamp = FFMAX(search_timestamp - mov->time_scale, e_old[0].timestamp); + search_timestamp = FFMAX(search_timestamp - msc->time_scale, e_old[0].timestamp); } index = find_prev_closest_keyframe_index(st, e_old, nb_old, search_timestamp, 0); diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak index 4b5885b462709..6b7983223c0dd 100644 --- a/tests/fate/mov.mak +++ b/tests/fate/mov.mak @@ -4,7 +4,8 @@ FATE_MOV = fate-mov-3elist \ fate-mov-1elist-noctts \ fate-mov-elist-starts-ctts-2ndsample \ fate-mov-1elist-ends-last-bframe \ - fate-mov-2elist-elist1-ends-bframe + fate-mov-2elist-elist1-ends-bframe \ + fate-mov-aac-2048-priming FATE_SAMPLES_AVCONV += $(FATE_MOV) @@ -26,3 +27,6 @@ fate-mov-1elist-ends-last-bframe: CMD = framemd5 -i $(TARGET_SAMPLES)/mov/mov-1e # Makes sure that we handle timestamps of packets in case of multiple edit lists with one of them ending on a B-frame correctly. fate-mov-2elist-elist1-ends-bframe: CMD = framemd5 -i $(TARGET_SAMPLES)/mov/mov-2elist-elist1-ends-bframe.mov + +fate-mov-aac-2048-priming: ffprobe$(PROGSSUF)$(EXESUF) +fate-mov-aac-2048-priming: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_packets -print_format compact $(TARGET_SAMPLES)/mov/aac-2048-priming.mov diff --git a/tests/ref/fate/mov-aac-2048-priming b/tests/ref/fate/mov-aac-2048-priming new file mode 100644 index 0000000000000..d5ae31eb915b8 --- /dev/null +++ b/tests/ref/fate/mov-aac-2048-priming @@ -0,0 +1,217 @@ +packet|codec_type=audio|stream_index=0|pts=-2048|pts_time=-0.046440|dts=-2048|dts_time=-0.046440|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=281|pos=36|flags=KD +packet|codec_type=audio|stream_index=0|pts=-1024|pts_time=-0.023220|dts=-1024|dts_time=-0.023220|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=258|pos=294|flags=KD +packet|codec_type=audio|stream_index=0|pts=0|pts_time=0.000000|dts=0|dts_time=0.000000|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=146|pos=552|flags=K_ +packet|codec_type=audio|stream_index=0|pts=1024|pts_time=0.023220|dts=1024|dts_time=0.023220|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=186|pos=698|flags=K_ +packet|codec_type=audio|stream_index=0|pts=2048|pts_time=0.046440|dts=2048|dts_time=0.046440|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=222|pos=884|flags=K_ +packet|codec_type=audio|stream_index=0|pts=3072|pts_time=0.069660|dts=3072|dts_time=0.069660|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=186|pos=1106|flags=K_ +packet|codec_type=audio|stream_index=0|pts=4096|pts_time=0.092880|dts=4096|dts_time=0.092880|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=206|pos=1292|flags=K_ +packet|codec_type=audio|stream_index=0|pts=5120|pts_time=0.116100|dts=5120|dts_time=0.116100|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=199|pos=1498|flags=K_ +packet|codec_type=audio|stream_index=0|pts=6144|pts_time=0.139320|dts=6144|dts_time=0.139320|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=236|pos=1697|flags=K_ +packet|codec_type=audio|stream_index=0|pts=7168|pts_time=0.162540|dts=7168|dts_time=0.162540|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=208|pos=1933|flags=K_ +packet|codec_type=audio|stream_index=0|pts=8192|pts_time=0.185760|dts=8192|dts_time=0.185760|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=238|pos=2141|flags=K_ +packet|codec_type=audio|stream_index=0|pts=9216|pts_time=0.208980|dts=9216|dts_time=0.208980|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=222|pos=2379|flags=K_ +packet|codec_type=audio|stream_index=0|pts=10240|pts_time=0.232200|dts=10240|dts_time=0.232200|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=211|pos=2601|flags=K_ +packet|codec_type=audio|stream_index=0|pts=11264|pts_time=0.255420|dts=11264|dts_time=0.255420|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=153|pos=2812|flags=K_ +packet|codec_type=audio|stream_index=0|pts=12288|pts_time=0.278639|dts=12288|dts_time=0.278639|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=191|pos=2965|flags=K_ +packet|codec_type=audio|stream_index=0|pts=13312|pts_time=0.301859|dts=13312|dts_time=0.301859|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=208|pos=3156|flags=K_ +packet|codec_type=audio|stream_index=0|pts=14336|pts_time=0.325079|dts=14336|dts_time=0.325079|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=188|pos=3364|flags=K_ +packet|codec_type=audio|stream_index=0|pts=15360|pts_time=0.348299|dts=15360|dts_time=0.348299|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=170|pos=3552|flags=K_ +packet|codec_type=audio|stream_index=0|pts=16384|pts_time=0.371519|dts=16384|dts_time=0.371519|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=221|pos=3722|flags=K_ +packet|codec_type=audio|stream_index=0|pts=17408|pts_time=0.394739|dts=17408|dts_time=0.394739|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=247|pos=3943|flags=K_ +packet|codec_type=audio|stream_index=0|pts=18432|pts_time=0.417959|dts=18432|dts_time=0.417959|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=202|pos=4190|flags=K_ +packet|codec_type=audio|stream_index=0|pts=19456|pts_time=0.441179|dts=19456|dts_time=0.441179|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=186|pos=4392|flags=K_ +packet|codec_type=audio|stream_index=0|pts=20480|pts_time=0.464399|dts=20480|dts_time=0.464399|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=196|pos=4578|flags=K_ +packet|codec_type=audio|stream_index=0|pts=21504|pts_time=0.487619|dts=21504|dts_time=0.487619|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=200|pos=4774|flags=K_ +packet|codec_type=audio|stream_index=0|pts=22528|pts_time=0.510839|dts=22528|dts_time=0.510839|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=170|pos=4974|flags=K_ +packet|codec_type=audio|stream_index=0|pts=23552|pts_time=0.534059|dts=23552|dts_time=0.534059|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=172|pos=5144|flags=K_ +packet|codec_type=audio|stream_index=0|pts=24576|pts_time=0.557279|dts=24576|dts_time=0.557279|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=206|pos=5316|flags=K_ +packet|codec_type=audio|stream_index=0|pts=25600|pts_time=0.580499|dts=25600|dts_time=0.580499|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=208|pos=5522|flags=K_ +packet|codec_type=audio|stream_index=0|pts=26624|pts_time=0.603719|dts=26624|dts_time=0.603719|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=217|pos=5730|flags=K_ +packet|codec_type=audio|stream_index=0|pts=27648|pts_time=0.626939|dts=27648|dts_time=0.626939|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=252|pos=5947|flags=K_ +packet|codec_type=audio|stream_index=0|pts=28672|pts_time=0.650159|dts=28672|dts_time=0.650159|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=171|pos=6199|flags=K_ +packet|codec_type=audio|stream_index=0|pts=29696|pts_time=0.673379|dts=29696|dts_time=0.673379|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=206|pos=6370|flags=K_ +packet|codec_type=audio|stream_index=0|pts=30720|pts_time=0.696599|dts=30720|dts_time=0.696599|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=237|pos=6576|flags=K_ +packet|codec_type=audio|stream_index=0|pts=31744|pts_time=0.719819|dts=31744|dts_time=0.719819|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=210|pos=6813|flags=K_ +packet|codec_type=audio|stream_index=0|pts=32768|pts_time=0.743039|dts=32768|dts_time=0.743039|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=166|pos=7023|flags=K_ +packet|codec_type=audio|stream_index=0|pts=33792|pts_time=0.766259|dts=33792|dts_time=0.766259|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=166|pos=7189|flags=K_ +packet|codec_type=audio|stream_index=0|pts=34816|pts_time=0.789478|dts=34816|dts_time=0.789478|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=177|pos=7355|flags=K_ +packet|codec_type=audio|stream_index=0|pts=35840|pts_time=0.812698|dts=35840|dts_time=0.812698|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=188|pos=7532|flags=K_ +packet|codec_type=audio|stream_index=0|pts=36864|pts_time=0.835918|dts=36864|dts_time=0.835918|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=193|pos=7720|flags=K_ +packet|codec_type=audio|stream_index=0|pts=37888|pts_time=0.859138|dts=37888|dts_time=0.859138|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=195|pos=7913|flags=K_ +packet|codec_type=audio|stream_index=0|pts=38912|pts_time=0.882358|dts=38912|dts_time=0.882358|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=211|pos=8108|flags=K_ +packet|codec_type=audio|stream_index=0|pts=39936|pts_time=0.905578|dts=39936|dts_time=0.905578|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=249|pos=8319|flags=K_ +packet|codec_type=audio|stream_index=0|pts=40960|pts_time=0.928798|dts=40960|dts_time=0.928798|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=223|pos=8568|flags=K_ +packet|codec_type=audio|stream_index=0|pts=41984|pts_time=0.952018|dts=41984|dts_time=0.952018|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=230|pos=8791|flags=K_ +packet|codec_type=audio|stream_index=0|pts=43008|pts_time=0.975238|dts=43008|dts_time=0.975238|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=203|pos=9021|flags=K_ +packet|codec_type=audio|stream_index=0|pts=44032|pts_time=0.998458|dts=44032|dts_time=0.998458|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=180|pos=9224|flags=K_ +packet|codec_type=audio|stream_index=0|pts=45056|pts_time=1.021678|dts=45056|dts_time=1.021678|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=172|pos=9404|flags=K_ +packet|codec_type=audio|stream_index=0|pts=46080|pts_time=1.044898|dts=46080|dts_time=1.044898|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=240|pos=9576|flags=K_ +packet|codec_type=audio|stream_index=0|pts=47104|pts_time=1.068118|dts=47104|dts_time=1.068118|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=179|pos=9816|flags=K_ +packet|codec_type=audio|stream_index=0|pts=48128|pts_time=1.091338|dts=48128|dts_time=1.091338|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=191|pos=9995|flags=K_ +packet|codec_type=audio|stream_index=0|pts=49152|pts_time=1.114558|dts=49152|dts_time=1.114558|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=184|pos=10186|flags=K_ +packet|codec_type=audio|stream_index=0|pts=50176|pts_time=1.137778|dts=50176|dts_time=1.137778|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=214|pos=10370|flags=K_ +packet|codec_type=audio|stream_index=0|pts=51200|pts_time=1.160998|dts=51200|dts_time=1.160998|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=194|pos=10584|flags=K_ +packet|codec_type=audio|stream_index=0|pts=52224|pts_time=1.184218|dts=52224|dts_time=1.184218|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=235|pos=10778|flags=K_ +packet|codec_type=audio|stream_index=0|pts=53248|pts_time=1.207438|dts=53248|dts_time=1.207438|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=195|pos=11013|flags=K_ +packet|codec_type=audio|stream_index=0|pts=54272|pts_time=1.230658|dts=54272|dts_time=1.230658|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=220|pos=11208|flags=K_ +packet|codec_type=audio|stream_index=0|pts=55296|pts_time=1.253878|dts=55296|dts_time=1.253878|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=187|pos=11428|flags=K_ +packet|codec_type=audio|stream_index=0|pts=56320|pts_time=1.277098|dts=56320|dts_time=1.277098|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=238|pos=11615|flags=K_ +packet|codec_type=audio|stream_index=0|pts=57344|pts_time=1.300317|dts=57344|dts_time=1.300317|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=175|pos=11853|flags=K_ +packet|codec_type=audio|stream_index=0|pts=58368|pts_time=1.323537|dts=58368|dts_time=1.323537|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=178|pos=12028|flags=K_ +packet|codec_type=audio|stream_index=0|pts=59392|pts_time=1.346757|dts=59392|dts_time=1.346757|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=219|pos=12206|flags=K_ +packet|codec_type=audio|stream_index=0|pts=60416|pts_time=1.369977|dts=60416|dts_time=1.369977|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=179|pos=12425|flags=K_ +packet|codec_type=audio|stream_index=0|pts=61440|pts_time=1.393197|dts=61440|dts_time=1.393197|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=193|pos=12604|flags=K_ +packet|codec_type=audio|stream_index=0|pts=62464|pts_time=1.416417|dts=62464|dts_time=1.416417|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=200|pos=12797|flags=K_ +packet|codec_type=audio|stream_index=0|pts=63488|pts_time=1.439637|dts=63488|dts_time=1.439637|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=218|pos=12997|flags=K_ +packet|codec_type=audio|stream_index=0|pts=64512|pts_time=1.462857|dts=64512|dts_time=1.462857|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=215|pos=13215|flags=K_ +packet|codec_type=audio|stream_index=0|pts=65536|pts_time=1.486077|dts=65536|dts_time=1.486077|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=209|pos=13430|flags=K_ +packet|codec_type=audio|stream_index=0|pts=66560|pts_time=1.509297|dts=66560|dts_time=1.509297|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=171|pos=13639|flags=K_ +packet|codec_type=audio|stream_index=0|pts=67584|pts_time=1.532517|dts=67584|dts_time=1.532517|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=179|pos=13810|flags=K_ +packet|codec_type=audio|stream_index=0|pts=68608|pts_time=1.555737|dts=68608|dts_time=1.555737|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=185|pos=13989|flags=K_ +packet|codec_type=audio|stream_index=0|pts=69632|pts_time=1.578957|dts=69632|dts_time=1.578957|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=225|pos=14174|flags=K_ +packet|codec_type=audio|stream_index=0|pts=70656|pts_time=1.602177|dts=70656|dts_time=1.602177|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=221|pos=14399|flags=K_ +packet|codec_type=audio|stream_index=0|pts=71680|pts_time=1.625397|dts=71680|dts_time=1.625397|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=201|pos=14620|flags=K_ +packet|codec_type=audio|stream_index=0|pts=72704|pts_time=1.648617|dts=72704|dts_time=1.648617|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=206|pos=14821|flags=K_ +packet|codec_type=audio|stream_index=0|pts=73728|pts_time=1.671837|dts=73728|dts_time=1.671837|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=182|pos=15027|flags=K_ +packet|codec_type=audio|stream_index=0|pts=74752|pts_time=1.695057|dts=74752|dts_time=1.695057|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=176|pos=15209|flags=K_ +packet|codec_type=audio|stream_index=0|pts=75776|pts_time=1.718277|dts=75776|dts_time=1.718277|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=233|pos=15385|flags=K_ +packet|codec_type=audio|stream_index=0|pts=76800|pts_time=1.741497|dts=76800|dts_time=1.741497|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=199|pos=15618|flags=K_ +packet|codec_type=audio|stream_index=0|pts=77824|pts_time=1.764717|dts=77824|dts_time=1.764717|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=220|pos=15817|flags=K_ +packet|codec_type=audio|stream_index=0|pts=78848|pts_time=1.787937|dts=78848|dts_time=1.787937|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=190|pos=16037|flags=K_ +packet|codec_type=audio|stream_index=0|pts=79872|pts_time=1.811156|dts=79872|dts_time=1.811156|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=210|pos=16227|flags=K_ +packet|codec_type=audio|stream_index=0|pts=80896|pts_time=1.834376|dts=80896|dts_time=1.834376|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=204|pos=16437|flags=K_ +packet|codec_type=audio|stream_index=0|pts=81920|pts_time=1.857596|dts=81920|dts_time=1.857596|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=171|pos=16641|flags=K_ +packet|codec_type=audio|stream_index=0|pts=82944|pts_time=1.880816|dts=82944|dts_time=1.880816|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=167|pos=16812|flags=K_ +packet|codec_type=audio|stream_index=0|pts=83968|pts_time=1.904036|dts=83968|dts_time=1.904036|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=200|pos=16979|flags=K_ +packet|codec_type=audio|stream_index=0|pts=84992|pts_time=1.927256|dts=84992|dts_time=1.927256|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=254|pos=17179|flags=K_ +packet|codec_type=audio|stream_index=0|pts=86016|pts_time=1.950476|dts=86016|dts_time=1.950476|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=205|pos=17433|flags=K_ +packet|codec_type=audio|stream_index=0|pts=87040|pts_time=1.973696|dts=87040|dts_time=1.973696|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=196|pos=17638|flags=K_ +packet|codec_type=audio|stream_index=0|pts=88064|pts_time=1.996916|dts=88064|dts_time=1.996916|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=190|pos=17834|flags=K_ +packet|codec_type=audio|stream_index=0|pts=89088|pts_time=2.020136|dts=89088|dts_time=2.020136|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=197|pos=18024|flags=K_ +packet|codec_type=audio|stream_index=0|pts=90112|pts_time=2.043356|dts=90112|dts_time=2.043356|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=186|pos=18221|flags=K_ +packet|codec_type=audio|stream_index=0|pts=91136|pts_time=2.066576|dts=91136|dts_time=2.066576|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=194|pos=18407|flags=K_ +packet|codec_type=audio|stream_index=0|pts=92160|pts_time=2.089796|dts=92160|dts_time=2.089796|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=227|pos=18601|flags=K_ +packet|codec_type=audio|stream_index=0|pts=93184|pts_time=2.113016|dts=93184|dts_time=2.113016|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=195|pos=18828|flags=K_ +packet|codec_type=audio|stream_index=0|pts=94208|pts_time=2.136236|dts=94208|dts_time=2.136236|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=228|pos=19023|flags=K_ +packet|codec_type=audio|stream_index=0|pts=95232|pts_time=2.159456|dts=95232|dts_time=2.159456|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=196|pos=19251|flags=K_ +packet|codec_type=audio|stream_index=0|pts=96256|pts_time=2.182676|dts=96256|dts_time=2.182676|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=197|pos=19447|flags=K_ +packet|codec_type=audio|stream_index=0|pts=97280|pts_time=2.205896|dts=97280|dts_time=2.205896|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=186|pos=19644|flags=K_ +packet|codec_type=audio|stream_index=0|pts=98304|pts_time=2.229116|dts=98304|dts_time=2.229116|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=191|pos=19830|flags=K_ +packet|codec_type=audio|stream_index=0|pts=99328|pts_time=2.252336|dts=99328|dts_time=2.252336|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=215|pos=20021|flags=K_ +packet|codec_type=audio|stream_index=0|pts=100352|pts_time=2.275556|dts=100352|dts_time=2.275556|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=203|pos=20236|flags=K_ +packet|codec_type=audio|stream_index=0|pts=101376|pts_time=2.298776|dts=101376|dts_time=2.298776|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=205|pos=20439|flags=K_ +packet|codec_type=audio|stream_index=0|pts=102400|pts_time=2.321995|dts=102400|dts_time=2.321995|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=205|pos=20644|flags=K_ +packet|codec_type=audio|stream_index=0|pts=103424|pts_time=2.345215|dts=103424|dts_time=2.345215|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=213|pos=20849|flags=K_ +packet|codec_type=audio|stream_index=0|pts=104448|pts_time=2.368435|dts=104448|dts_time=2.368435|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=198|pos=21062|flags=K_ +packet|codec_type=audio|stream_index=0|pts=105472|pts_time=2.391655|dts=105472|dts_time=2.391655|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=178|pos=21260|flags=K_ +packet|codec_type=audio|stream_index=0|pts=106496|pts_time=2.414875|dts=106496|dts_time=2.414875|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=195|pos=21438|flags=K_ +packet|codec_type=audio|stream_index=0|pts=107520|pts_time=2.438095|dts=107520|dts_time=2.438095|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=227|pos=21633|flags=K_ +packet|codec_type=audio|stream_index=0|pts=108544|pts_time=2.461315|dts=108544|dts_time=2.461315|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=185|pos=21860|flags=K_ +packet|codec_type=audio|stream_index=0|pts=109568|pts_time=2.484535|dts=109568|dts_time=2.484535|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=206|pos=22045|flags=K_ +packet|codec_type=audio|stream_index=0|pts=110592|pts_time=2.507755|dts=110592|dts_time=2.507755|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=183|pos=22251|flags=K_ +packet|codec_type=audio|stream_index=0|pts=111616|pts_time=2.530975|dts=111616|dts_time=2.530975|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=208|pos=22434|flags=K_ +packet|codec_type=audio|stream_index=0|pts=112640|pts_time=2.554195|dts=112640|dts_time=2.554195|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=204|pos=22642|flags=K_ +packet|codec_type=audio|stream_index=0|pts=113664|pts_time=2.577415|dts=113664|dts_time=2.577415|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=192|pos=22846|flags=K_ +packet|codec_type=audio|stream_index=0|pts=114688|pts_time=2.600635|dts=114688|dts_time=2.600635|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=190|pos=23038|flags=K_ +packet|codec_type=audio|stream_index=0|pts=115712|pts_time=2.623855|dts=115712|dts_time=2.623855|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=199|pos=23228|flags=K_ +packet|codec_type=audio|stream_index=0|pts=116736|pts_time=2.647075|dts=116736|dts_time=2.647075|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=229|pos=23427|flags=K_ +packet|codec_type=audio|stream_index=0|pts=117760|pts_time=2.670295|dts=117760|dts_time=2.670295|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=208|pos=23656|flags=K_ +packet|codec_type=audio|stream_index=0|pts=118784|pts_time=2.693515|dts=118784|dts_time=2.693515|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=195|pos=23864|flags=K_ +packet|codec_type=audio|stream_index=0|pts=119808|pts_time=2.716735|dts=119808|dts_time=2.716735|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=190|pos=24059|flags=K_ +packet|codec_type=audio|stream_index=0|pts=120832|pts_time=2.739955|dts=120832|dts_time=2.739955|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=190|pos=24249|flags=K_ +packet|codec_type=audio|stream_index=0|pts=121856|pts_time=2.763175|dts=121856|dts_time=2.763175|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=192|pos=24439|flags=K_ +packet|codec_type=audio|stream_index=0|pts=122880|pts_time=2.786395|dts=122880|dts_time=2.786395|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=226|pos=24631|flags=K_ +packet|codec_type=audio|stream_index=0|pts=123904|pts_time=2.809615|dts=123904|dts_time=2.809615|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=195|pos=24857|flags=K_ +packet|codec_type=audio|stream_index=0|pts=124928|pts_time=2.832834|dts=124928|dts_time=2.832834|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=230|pos=25052|flags=K_ +packet|codec_type=audio|stream_index=0|pts=125952|pts_time=2.856054|dts=125952|dts_time=2.856054|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=198|pos=25282|flags=K_ +packet|codec_type=audio|stream_index=0|pts=126976|pts_time=2.879274|dts=126976|dts_time=2.879274|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=183|pos=25480|flags=K_ +packet|codec_type=audio|stream_index=0|pts=128000|pts_time=2.902494|dts=128000|dts_time=2.902494|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=199|pos=25663|flags=K_ +packet|codec_type=audio|stream_index=0|pts=129024|pts_time=2.925714|dts=129024|dts_time=2.925714|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=196|pos=25862|flags=K_ +packet|codec_type=audio|stream_index=0|pts=130048|pts_time=2.948934|dts=130048|dts_time=2.948934|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=186|pos=26058|flags=K_ +packet|codec_type=audio|stream_index=0|pts=131072|pts_time=2.972154|dts=131072|dts_time=2.972154|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=200|pos=26244|flags=K_ +packet|codec_type=audio|stream_index=0|pts=132096|pts_time=2.995374|dts=132096|dts_time=2.995374|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=210|pos=26444|flags=K_ +packet|codec_type=audio|stream_index=0|pts=133120|pts_time=3.018594|dts=133120|dts_time=3.018594|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=196|pos=26654|flags=K_ +packet|codec_type=audio|stream_index=0|pts=134144|pts_time=3.041814|dts=134144|dts_time=3.041814|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=214|pos=26850|flags=K_ +packet|codec_type=audio|stream_index=0|pts=135168|pts_time=3.065034|dts=135168|dts_time=3.065034|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=185|pos=27064|flags=K_ +packet|codec_type=audio|stream_index=0|pts=136192|pts_time=3.088254|dts=136192|dts_time=3.088254|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=198|pos=27249|flags=K_ +packet|codec_type=audio|stream_index=0|pts=137216|pts_time=3.111474|dts=137216|dts_time=3.111474|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=200|pos=27447|flags=K_ +packet|codec_type=audio|stream_index=0|pts=138240|pts_time=3.134694|dts=138240|dts_time=3.134694|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=208|pos=27647|flags=K_ +packet|codec_type=audio|stream_index=0|pts=139264|pts_time=3.157914|dts=139264|dts_time=3.157914|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=212|pos=27855|flags=K_ +packet|codec_type=audio|stream_index=0|pts=140288|pts_time=3.181134|dts=140288|dts_time=3.181134|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=208|pos=28067|flags=K_ +packet|codec_type=audio|stream_index=0|pts=141312|pts_time=3.204354|dts=141312|dts_time=3.204354|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=192|pos=28275|flags=K_ +packet|codec_type=audio|stream_index=0|pts=142336|pts_time=3.227574|dts=142336|dts_time=3.227574|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=192|pos=28467|flags=K_ +packet|codec_type=audio|stream_index=0|pts=143360|pts_time=3.250794|dts=143360|dts_time=3.250794|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=211|pos=28659|flags=K_ +packet|codec_type=audio|stream_index=0|pts=144384|pts_time=3.274014|dts=144384|dts_time=3.274014|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=195|pos=28870|flags=K_ +packet|codec_type=audio|stream_index=0|pts=145408|pts_time=3.297234|dts=145408|dts_time=3.297234|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=208|pos=29065|flags=K_ +packet|codec_type=audio|stream_index=0|pts=146432|pts_time=3.320454|dts=146432|dts_time=3.320454|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=195|pos=29273|flags=K_ +packet|codec_type=audio|stream_index=0|pts=147456|pts_time=3.343673|dts=147456|dts_time=3.343673|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=204|pos=29468|flags=K_ +packet|codec_type=audio|stream_index=0|pts=148480|pts_time=3.366893|dts=148480|dts_time=3.366893|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=209|pos=29672|flags=K_ +packet|codec_type=audio|stream_index=0|pts=149504|pts_time=3.390113|dts=149504|dts_time=3.390113|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=195|pos=29881|flags=K_ +packet|codec_type=audio|stream_index=0|pts=150528|pts_time=3.413333|dts=150528|dts_time=3.413333|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=191|pos=30076|flags=K_ +packet|codec_type=audio|stream_index=0|pts=151552|pts_time=3.436553|dts=151552|dts_time=3.436553|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=210|pos=30267|flags=K_ +packet|codec_type=audio|stream_index=0|pts=152576|pts_time=3.459773|dts=152576|dts_time=3.459773|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=209|pos=30477|flags=K_ +packet|codec_type=audio|stream_index=0|pts=153600|pts_time=3.482993|dts=153600|dts_time=3.482993|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=175|pos=30686|flags=K_ +packet|codec_type=audio|stream_index=0|pts=154624|pts_time=3.506213|dts=154624|dts_time=3.506213|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=244|pos=30861|flags=K_ +packet|codec_type=audio|stream_index=0|pts=155648|pts_time=3.529433|dts=155648|dts_time=3.529433|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=177|pos=31105|flags=K_ +packet|codec_type=audio|stream_index=0|pts=156672|pts_time=3.552653|dts=156672|dts_time=3.552653|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=217|pos=31282|flags=K_ +packet|codec_type=audio|stream_index=0|pts=157696|pts_time=3.575873|dts=157696|dts_time=3.575873|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=182|pos=31499|flags=K_ +packet|codec_type=audio|stream_index=0|pts=158720|pts_time=3.599093|dts=158720|dts_time=3.599093|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=181|pos=31681|flags=K_ +packet|codec_type=audio|stream_index=0|pts=159744|pts_time=3.622313|dts=159744|dts_time=3.622313|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=203|pos=31862|flags=K_ +packet|codec_type=audio|stream_index=0|pts=160768|pts_time=3.645533|dts=160768|dts_time=3.645533|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=198|pos=32065|flags=K_ +packet|codec_type=audio|stream_index=0|pts=161792|pts_time=3.668753|dts=161792|dts_time=3.668753|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=217|pos=32263|flags=K_ +packet|codec_type=audio|stream_index=0|pts=162816|pts_time=3.691973|dts=162816|dts_time=3.691973|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=195|pos=32480|flags=K_ +packet|codec_type=audio|stream_index=0|pts=163840|pts_time=3.715193|dts=163840|dts_time=3.715193|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=198|pos=32675|flags=K_ +packet|codec_type=audio|stream_index=0|pts=164864|pts_time=3.738413|dts=164864|dts_time=3.738413|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=202|pos=32873|flags=K_ +packet|codec_type=audio|stream_index=0|pts=165888|pts_time=3.761633|dts=165888|dts_time=3.761633|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=185|pos=33075|flags=K_ +packet|codec_type=audio|stream_index=0|pts=166912|pts_time=3.784853|dts=166912|dts_time=3.784853|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=196|pos=33260|flags=K_ +packet|codec_type=audio|stream_index=0|pts=167936|pts_time=3.808073|dts=167936|dts_time=3.808073|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=226|pos=33456|flags=K_ +packet|codec_type=audio|stream_index=0|pts=168960|pts_time=3.831293|dts=168960|dts_time=3.831293|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=187|pos=33682|flags=K_ +packet|codec_type=audio|stream_index=0|pts=169984|pts_time=3.854512|dts=169984|dts_time=3.854512|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=193|pos=33869|flags=K_ +packet|codec_type=audio|stream_index=0|pts=171008|pts_time=3.877732|dts=171008|dts_time=3.877732|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=218|pos=34062|flags=K_ +packet|codec_type=audio|stream_index=0|pts=172032|pts_time=3.900952|dts=172032|dts_time=3.900952|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=200|pos=34280|flags=K_ +packet|codec_type=audio|stream_index=0|pts=173056|pts_time=3.924172|dts=173056|dts_time=3.924172|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=200|pos=34480|flags=K_ +packet|codec_type=audio|stream_index=0|pts=174080|pts_time=3.947392|dts=174080|dts_time=3.947392|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=198|pos=34680|flags=K_ +packet|codec_type=audio|stream_index=0|pts=175104|pts_time=3.970612|dts=175104|dts_time=3.970612|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=200|pos=34878|flags=K_ +packet|codec_type=audio|stream_index=0|pts=176128|pts_time=3.993832|dts=176128|dts_time=3.993832|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=197|pos=35078|flags=K_ +packet|codec_type=audio|stream_index=0|pts=177152|pts_time=4.017052|dts=177152|dts_time=4.017052|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=209|pos=35275|flags=K_ +packet|codec_type=audio|stream_index=0|pts=178176|pts_time=4.040272|dts=178176|dts_time=4.040272|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=205|pos=35484|flags=K_ +packet|codec_type=audio|stream_index=0|pts=179200|pts_time=4.063492|dts=179200|dts_time=4.063492|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=199|pos=35689|flags=K_ +packet|codec_type=audio|stream_index=0|pts=180224|pts_time=4.086712|dts=180224|dts_time=4.086712|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=192|pos=35888|flags=K_ +packet|codec_type=audio|stream_index=0|pts=181248|pts_time=4.109932|dts=181248|dts_time=4.109932|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=201|pos=36080|flags=K_ +packet|codec_type=audio|stream_index=0|pts=182272|pts_time=4.133152|dts=182272|dts_time=4.133152|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=200|pos=36281|flags=K_ +packet|codec_type=audio|stream_index=0|pts=183296|pts_time=4.156372|dts=183296|dts_time=4.156372|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=202|pos=36481|flags=K_ +packet|codec_type=audio|stream_index=0|pts=184320|pts_time=4.179592|dts=184320|dts_time=4.179592|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=196|pos=36683|flags=K_ +packet|codec_type=audio|stream_index=0|pts=185344|pts_time=4.202812|dts=185344|dts_time=4.202812|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=200|pos=36879|flags=K_ +packet|codec_type=audio|stream_index=0|pts=186368|pts_time=4.226032|dts=186368|dts_time=4.226032|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=209|pos=37079|flags=K_ +packet|codec_type=audio|stream_index=0|pts=187392|pts_time=4.249252|dts=187392|dts_time=4.249252|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=201|pos=37288|flags=K_ +packet|codec_type=audio|stream_index=0|pts=188416|pts_time=4.272472|dts=188416|dts_time=4.272472|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=201|pos=37489|flags=K_ +packet|codec_type=audio|stream_index=0|pts=189440|pts_time=4.295692|dts=189440|dts_time=4.295692|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=201|pos=37690|flags=K_ +packet|codec_type=audio|stream_index=0|pts=190464|pts_time=4.318912|dts=190464|dts_time=4.318912|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=199|pos=37891|flags=K_ +packet|codec_type=audio|stream_index=0|pts=191488|pts_time=4.342132|dts=191488|dts_time=4.342132|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=198|pos=38090|flags=K_ +packet|codec_type=audio|stream_index=0|pts=192512|pts_time=4.365351|dts=192512|dts_time=4.365351|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=205|pos=38288|flags=K_ +packet|codec_type=audio|stream_index=0|pts=193536|pts_time=4.388571|dts=193536|dts_time=4.388571|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=190|pos=38493|flags=K_ +packet|codec_type=audio|stream_index=0|pts=194560|pts_time=4.411791|dts=194560|dts_time=4.411791|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=207|pos=38683|flags=K_ +packet|codec_type=audio|stream_index=0|pts=195584|pts_time=4.435011|dts=195584|dts_time=4.435011|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=204|pos=38890|flags=K_ +packet|codec_type=audio|stream_index=0|pts=196608|pts_time=4.458231|dts=196608|dts_time=4.458231|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=192|pos=39094|flags=K_ +packet|codec_type=audio|stream_index=0|pts=197632|pts_time=4.481451|dts=197632|dts_time=4.481451|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=211|pos=39286|flags=K_ +packet|codec_type=audio|stream_index=0|pts=198656|pts_time=4.504671|dts=198656|dts_time=4.504671|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=195|pos=39497|flags=K_ +packet|codec_type=audio|stream_index=0|pts=199680|pts_time=4.527891|dts=199680|dts_time=4.527891|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=214|pos=39692|flags=K_ +packet|codec_type=audio|stream_index=0|pts=200704|pts_time=4.551111|dts=200704|dts_time=4.551111|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=195|pos=39906|flags=K_ +packet|codec_type=audio|stream_index=0|pts=201728|pts_time=4.574331|dts=201728|dts_time=4.574331|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=199|pos=40101|flags=K_ +packet|codec_type=audio|stream_index=0|pts=202752|pts_time=4.597551|dts=202752|dts_time=4.597551|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=183|pos=40300|flags=K_ +packet|codec_type=audio|stream_index=0|pts=203776|pts_time=4.620771|dts=203776|dts_time=4.620771|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=211|pos=40483|flags=K_ +packet|codec_type=audio|stream_index=0|pts=204800|pts_time=4.643991|dts=204800|dts_time=4.643991|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=200|pos=40694|flags=K_ +packet|codec_type=audio|stream_index=0|pts=205824|pts_time=4.667211|dts=205824|dts_time=4.667211|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=199|pos=40894|flags=K_ +packet|codec_type=audio|stream_index=0|pts=206848|pts_time=4.690431|dts=206848|dts_time=4.690431|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=213|pos=41093|flags=K_ +packet|codec_type=audio|stream_index=0|pts=207872|pts_time=4.713651|dts=207872|dts_time=4.713651|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=191|pos=41306|flags=K_ +packet|codec_type=audio|stream_index=0|pts=208896|pts_time=4.736871|dts=208896|dts_time=4.736871|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=211|pos=41497|flags=K_ +packet|codec_type=audio|stream_index=0|pts=209920|pts_time=4.760091|dts=209920|dts_time=4.760091|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=198|pos=41708|flags=K_ +packet|codec_type=audio|stream_index=0|pts=210944|pts_time=4.783311|dts=210944|dts_time=4.783311|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=203|pos=41906|flags=K_ +packet|codec_type=audio|stream_index=0|pts=211968|pts_time=4.806531|dts=211968|dts_time=4.806531|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=196|pos=42109|flags=K_ +packet|codec_type=audio|stream_index=0|pts=212992|pts_time=4.829751|dts=212992|dts_time=4.829751|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=197|pos=42305|flags=K_ +packet|codec_type=audio|stream_index=0|pts=214016|pts_time=4.852971|dts=214016|dts_time=4.852971|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=190|pos=42502|flags=K_ +packet|codec_type=audio|stream_index=0|pts=215040|pts_time=4.876190|dts=215040|dts_time=4.876190|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=208|pos=42692|flags=K_ +packet|codec_type=audio|stream_index=0|pts=216064|pts_time=4.899410|dts=216064|dts_time=4.899410|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=203|pos=42900|flags=K_ +packet|codec_type=audio|stream_index=0|pts=217088|pts_time=4.922630|dts=217088|dts_time=4.922630|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=198|pos=43103|flags=K_ +packet|codec_type=audio|stream_index=0|pts=218112|pts_time=4.945850|dts=218112|dts_time=4.945850|duration=1024|duration_time=0.023220|convergence_duration=N/A|convergence_duration_time=N/A|size=284|pos=43301|flags=K_ +packet|codec_type=audio|stream_index=0|pts=219136|pts_time=4.969070|dts=219136|dts_time=4.969070|duration=1364|duration_time=0.030930|convergence_duration=N/A|convergence_duration_time=N/A|size=5|pos=43585|flags=K_ From 4df6605da7e351116c99f19b8a98e1f236932600 Mon Sep 17 00:00:00 2001 From: Mark Thompson Date: Sun, 23 Oct 2016 18:42:22 +0100 Subject: [PATCH 018/102] vc1: Return stream format information from parser --- libavcodec/vc1_parser.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c index 9ca6154e71a3c..bb54947f559b0 100644 --- a/libavcodec/vc1_parser.c +++ b/libavcodec/vc1_parser.c @@ -115,6 +115,14 @@ static void vc1_extract_header(AVCodecParserContext *s, AVCodecContext *avctx, } if (avctx->framerate.num) avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1})); + s->format = vpc->v.chromaformat == 1 ? AV_PIX_FMT_YUV420P + : AV_PIX_FMT_NONE; + if (avctx->width && avctx->height) { + s->width = avctx->width; + s->height = avctx->height; + s->coded_width = FFALIGN(avctx->coded_width, 16); + s->coded_height = FFALIGN(avctx->coded_height, 16); + } } static int vc1_parse(AVCodecParserContext *s, From 0c559f7893e6f47aad1b0c1429287eaa218ec87c Mon Sep 17 00:00:00 2001 From: Mark Thompson Date: Wed, 26 Oct 2016 20:27:57 +0100 Subject: [PATCH 019/102] hevc: Return stream format information from parser --- libavcodec/hevc_parser.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c index d93586ba7dbd5..508f22f46d3af 100644 --- a/libavcodec/hevc_parser.c +++ b/libavcodec/hevc_parser.c @@ -312,6 +312,14 @@ static inline int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf, ps->vps = (HEVCVPS*)ps->vps_list[ps->sps->vps_id]->data; } + s->coded_width = ps->sps->width; + s->coded_height = ps->sps->height; + s->width = ps->sps->output_width; + s->height = ps->sps->output_height; + s->format = ps->sps->pix_fmt; + avctx->profile = ps->sps->ptl.general_ptl.profile_idc; + avctx->level = ps->sps->ptl.general_ptl.level_idc; + if (!sh->first_slice_in_pic_flag) { int slice_address_length; From 309fe16a126c6c00cc60070de3190cf23f5570fb Mon Sep 17 00:00:00 2001 From: Mark Thompson Date: Wed, 26 Oct 2016 20:28:18 +0100 Subject: [PATCH 020/102] mpegvideo: Return correct coded frame sizes from parser --- libavcodec/mpegvideo_parser.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c index 206f268a7857a..de70cd5632da9 100644 --- a/libavcodec/mpegvideo_parser.c +++ b/libavcodec/mpegvideo_parser.c @@ -168,8 +168,10 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, if (pix_fmt != AV_PIX_FMT_NONE) { s->format = pix_fmt; - s->width = s->coded_width = pc->width; - s->height = s->coded_height = pc->height; + s->width = pc->width; + s->height = pc->height; + s->coded_width = FFALIGN(pc->width, 16); + s->coded_height = FFALIGN(pc->height, 16); } #if FF_API_AVCTX_TIMEBASE From 1f26a231bb065276cd80ce02957c759f3197edfa Mon Sep 17 00:00:00 2001 From: Mark Thompson Date: Fri, 21 Oct 2016 18:57:12 +0100 Subject: [PATCH 021/102] qsv: Merge libav implementation Merged as-at libav 398f015, and therefore includes outstanding skipped merges 04b17ff and 130e1f1. All features not in libav are preserved, and no options change. --- libavcodec/qsv.c | 333 +++++++++++++--------- libavcodec/qsv_internal.h | 40 +-- libavcodec/qsvdec.c | 568 ++++++++++++++++---------------------- libavcodec/qsvdec.h | 30 +- libavcodec/qsvdec_h2645.c | 29 +- libavcodec/qsvdec_mpeg2.c | 85 +++++- libavcodec/qsvdec_vc1.c | 89 +++++- libavcodec/qsvenc.c | 160 ++++++----- libavcodec/qsvenc.h | 6 +- libavcodec/qsvenc_h264.c | 3 +- 10 files changed, 746 insertions(+), 597 deletions(-) diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index 11d453da85ce8..efd7cea0190a2 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -25,7 +25,10 @@ #include #include "libavutil/avstring.h" +#include "libavutil/common.h" #include "libavutil/error.h" +#include "libavutil/hwcontext.h" +#include "libavutil/hwcontext_qsv.h" #include "avcodec.h" #include "qsv_internal.h" @@ -51,6 +54,22 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id) return AVERROR(ENOSYS); } +int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile) +{ + if (profile == FF_PROFILE_UNKNOWN) + return MFX_PROFILE_UNKNOWN; + switch (codec_id) { + case AV_CODEC_ID_H264: + case AV_CODEC_ID_HEVC: + return profile; + case AV_CODEC_ID_VC1: + return 4 * profile + 1; + case AV_CODEC_ID_MPEG2VIDEO: + return 0x10 * profile; + } + return MFX_PROFILE_UNKNOWN; +} + int ff_qsv_error(int mfx_err) { switch (mfx_err) { @@ -85,90 +104,58 @@ int ff_qsv_error(int mfx_err) return AVERROR_UNKNOWN; } } -static int ff_qsv_set_display_handle(AVCodecContext *avctx, QSVSession *qs) + +static int qsv_load_plugins(mfxSession session, const char *load_plugins, + void *logctx) { - // this code is only required for Linux. It searches for a valid - // display handle. First in /dev/dri/renderD then in /dev/dri/card -#ifdef AVCODEC_QSV_LINUX_SESSION_HANDLE - // VAAPI display handle - int ret = 0; - VADisplay va_dpy = NULL; - VAStatus va_res = VA_STATUS_SUCCESS; - int major_version = 0, minor_version = 0; - int fd = -1; - char adapterpath[256]; - int adapter_num; - - qs->fd_display = -1; - qs->va_display = NULL; - - //search for valid graphics device - for (adapter_num = 0;adapter_num < 6;adapter_num++) { - - if (adapter_num<3) { - snprintf(adapterpath,sizeof(adapterpath), - "/dev/dri/renderD%d", adapter_num+128); - } else { - snprintf(adapterpath,sizeof(adapterpath), - "/dev/dri/card%d", adapter_num-3); - } + if (!load_plugins || !*load_plugins) + return 0; - fd = open(adapterpath, O_RDWR); - if (fd < 0) { - av_log(avctx, AV_LOG_ERROR, - "mfx init: %s fd open failed\n", adapterpath); - continue; - } + while (*load_plugins) { + mfxPluginUID uid; + mfxStatus ret; + int i, err = 0; - va_dpy = vaGetDisplayDRM(fd); - if (!va_dpy) { - av_log(avctx, AV_LOG_ERROR, - "mfx init: %s vaGetDisplayDRM failed\n", adapterpath); - close(fd); - continue; + char *plugin = av_get_token(&load_plugins, ":"); + if (!plugin) + return AVERROR(ENOMEM); + if (strlen(plugin) != 2 * sizeof(uid.Data)) { + av_log(logctx, AV_LOG_ERROR, "Invalid plugin UID length\n"); + err = AVERROR(EINVAL); + goto load_plugin_fail; } - va_res = vaInitialize(va_dpy, &major_version, &minor_version); - if (VA_STATUS_SUCCESS != va_res) { - av_log(avctx, AV_LOG_ERROR, - "mfx init: %s vaInitialize failed\n", adapterpath); - close(fd); - fd = -1; - continue; - } else { - av_log(avctx, AV_LOG_VERBOSE, - "mfx initialization: %s vaInitialize successful\n",adapterpath); - qs->fd_display = fd; - qs->va_display = va_dpy; - ret = MFXVideoCORE_SetHandle(qs->session, - (mfxHandleType)MFX_HANDLE_VA_DISPLAY, (mfxHDL)va_dpy); - if (ret < 0) { - av_log(avctx, AV_LOG_ERROR, - "Error %d during set display handle\n", ret); - return ff_qsv_error(ret); + for (i = 0; i < sizeof(uid.Data); i++) { + err = sscanf(plugin + 2 * i, "%2hhx", uid.Data + i); + if (err != 1) { + av_log(logctx, AV_LOG_ERROR, "Invalid plugin UID\n"); + err = AVERROR(EINVAL); + goto load_plugin_fail; } - break; + + } + + ret = MFXVideoUSER_Load(session, &uid, 1); + if (ret < 0) { + av_log(logctx, AV_LOG_ERROR, "Could not load the requested plugin: %s\n", + plugin); + err = ff_qsv_error(ret); + goto load_plugin_fail; } + + if (*load_plugins) + load_plugins++; +load_plugin_fail: + av_freep(&plugin); + if (err < 0) + return err; } -#endif //AVCODEC_QSV_LINUX_SESSION_HANDLE + return 0; + } -/** - * @brief Initialize a MSDK session - * - * Media SDK is based on sessions, so this is the prerequisite - * initialization for HW acceleration. For Windows the session is - * complete and ready to use, for Linux a display handle is - * required. For releases of Media Server Studio >= 2015 R4 the - * render nodes interface is preferred (/dev/dri/renderD). - * Using Media Server Studio 2015 R4 or newer is recommended - * but the older /dev/dri/card interface is also searched - * for broader compatibility. - * - * @param avctx ffmpeg metadata for this codec context - * @param session the MSDK session used - */ -int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs, + +int ff_qsv_init_internal_session(AVCodecContext *avctx, mfxSession *session, const char *load_plugins) { mfxIMPL impl = MFX_IMPL_AUTO_ANY; @@ -177,58 +164,19 @@ int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs, const char *desc; int ret; - ret = MFXInit(impl, &ver, &qs->session); + ret = MFXInit(impl, &ver, session); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error initializing an internal MFX session\n"); return ff_qsv_error(ret); } - ret = ff_qsv_set_display_handle(avctx, qs); - if (ret < 0) + ret = qsv_load_plugins(*session, load_plugins, avctx); + if (ret < 0) { + av_log(avctx, AV_LOG_ERROR, "Error loading plugins\n"); return ret; - - if (load_plugins && *load_plugins) { - while (*load_plugins) { - mfxPluginUID uid; - int i, err = 0; - - char *plugin = av_get_token(&load_plugins, ":"); - if (!plugin) - return AVERROR(ENOMEM); - if (strlen(plugin) != 2 * sizeof(uid.Data)) { - av_log(avctx, AV_LOG_ERROR, "Invalid plugin UID length\n"); - err = AVERROR(EINVAL); - goto load_plugin_fail; - } - - for (i = 0; i < sizeof(uid.Data); i++) { - err = sscanf(plugin + 2 * i, "%2hhx", uid.Data + i); - if (err != 1) { - av_log(avctx, AV_LOG_ERROR, "Invalid plugin UID\n"); - err = AVERROR(EINVAL); - goto load_plugin_fail; - } - - } - - ret = MFXVideoUSER_Load(qs->session, &uid, 1); - if (ret < 0) { - av_log(avctx, AV_LOG_ERROR, "Could not load the requested plugin: %s\n", - plugin); - err = ff_qsv_error(ret); - goto load_plugin_fail; - } - - if (*load_plugins) - load_plugins++; -load_plugin_fail: - av_freep(&plugin); - if (err < 0) - return err; - } } - MFXQueryIMPL(qs->session, &impl); + MFXQueryIMPL(*session, &impl); switch (MFX_IMPL_BASETYPE(impl)) { case MFX_IMPL_SOFTWARE: @@ -251,21 +199,146 @@ int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs, return 0; } -int ff_qsv_close_internal_session(QSVSession *qs) +static mfxStatus qsv_frame_alloc(mfxHDL pthis, mfxFrameAllocRequest *req, + mfxFrameAllocResponse *resp) { - if (qs->session) { - MFXClose(qs->session); - qs->session = NULL; + QSVFramesContext *ctx = pthis; + mfxFrameInfo *i = &req->Info; + mfxFrameInfo *i1 = &ctx->info; + + if (!(req->Type & MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET) || + !(req->Type & (MFX_MEMTYPE_FROM_DECODE | MFX_MEMTYPE_FROM_ENCODE)) || + !(req->Type & MFX_MEMTYPE_EXTERNAL_FRAME)) + return MFX_ERR_UNSUPPORTED; + if (i->Width != i1->Width || i->Height != i1->Height || + i->FourCC != i1->FourCC || i->ChromaFormat != i1->ChromaFormat) { + av_log(ctx, AV_LOG_ERROR, "Mismatching surface properties in an " + "allocation request: %dx%d %d %d vs %dx%d %d %d\n", + i->Width, i->Height, i->FourCC, i->ChromaFormat, + i1->Width, i1->Height, i1->FourCC, i1->ChromaFormat); + return MFX_ERR_UNSUPPORTED; + } + + resp->mids = ctx->mids; + resp->NumFrameActual = ctx->nb_mids; + + return MFX_ERR_NONE; +} + +static mfxStatus qsv_frame_free(mfxHDL pthis, mfxFrameAllocResponse *resp) +{ + return MFX_ERR_NONE; +} + +static mfxStatus qsv_frame_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) +{ + return MFX_ERR_UNSUPPORTED; +} + +static mfxStatus qsv_frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) +{ + return MFX_ERR_UNSUPPORTED; +} + +static mfxStatus qsv_frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl) +{ + *hdl = mid; + return MFX_ERR_NONE; +} + +int ff_qsv_init_session_hwcontext(AVCodecContext *avctx, mfxSession *psession, + QSVFramesContext *qsv_frames_ctx, + const char *load_plugins, int opaque) +{ + static const mfxHandleType handle_types[] = { + MFX_HANDLE_VA_DISPLAY, + MFX_HANDLE_D3D9_DEVICE_MANAGER, + MFX_HANDLE_D3D11_DEVICE, + }; + mfxFrameAllocator frame_allocator = { + .pthis = qsv_frames_ctx, + .Alloc = qsv_frame_alloc, + .Lock = qsv_frame_lock, + .Unlock = qsv_frame_unlock, + .GetHDL = qsv_frame_get_hdl, + .Free = qsv_frame_free, + }; + + AVHWFramesContext *frames_ctx = (AVHWFramesContext*)qsv_frames_ctx->hw_frames_ctx->data; + AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx; + AVQSVDeviceContext *device_hwctx = frames_ctx->device_ctx->hwctx; + mfxSession parent_session = device_hwctx->session; + + mfxSession session; + mfxVersion ver; + mfxIMPL impl; + mfxHDL handle = NULL; + mfxHandleType handle_type; + mfxStatus err; + + int i, ret; + + err = MFXQueryIMPL(parent_session, &impl); + if (err == MFX_ERR_NONE) + err = MFXQueryVersion(parent_session, &ver); + if (err != MFX_ERR_NONE) { + av_log(avctx, AV_LOG_ERROR, "Error querying the session attributes\n"); + return ff_qsv_error(err); } -#ifdef AVCODEC_QSV_LINUX_SESSION_HANDLE - if (qs->va_display) { - vaTerminate(qs->va_display); - qs->va_display = NULL; + + for (i = 0; i < FF_ARRAY_ELEMS(handle_types); i++) { + err = MFXVideoCORE_GetHandle(parent_session, handle_types[i], &handle); + if (err == MFX_ERR_NONE) { + handle_type = handle_types[i]; + break; + } + handle = NULL; } - if (qs->fd_display > 0) { - close(qs->fd_display); - qs->fd_display = -1; + if (!handle) { + av_log(avctx, AV_LOG_VERBOSE, "No supported hw handle could be retrieved " + "from the session\n"); } -#endif + + err = MFXInit(impl, &ver, &session); + if (err != MFX_ERR_NONE) { + av_log(avctx, AV_LOG_ERROR, + "Error initializing a child MFX session: %d\n", err); + return ff_qsv_error(err); + } + + if (handle) { + err = MFXVideoCORE_SetHandle(session, handle_type, handle); + if (err != MFX_ERR_NONE) { + av_log(avctx, AV_LOG_ERROR, "Error setting a HW handle: %d\n", err); + return ff_qsv_error(err); + } + } + + ret = qsv_load_plugins(session, load_plugins, avctx); + if (ret < 0) { + av_log(avctx, AV_LOG_ERROR, "Error loading plugins\n"); + return ret; + } + + if (!opaque) { + av_freep(&qsv_frames_ctx->mids); + qsv_frames_ctx->mids = av_mallocz_array(frames_hwctx->nb_surfaces, + sizeof(*qsv_frames_ctx->mids)); + if (!qsv_frames_ctx->mids) + return AVERROR(ENOMEM); + + qsv_frames_ctx->info = frames_hwctx->surfaces[0].Info; + qsv_frames_ctx->nb_mids = frames_hwctx->nb_surfaces; + for (i = 0; i < frames_hwctx->nb_surfaces; i++) + qsv_frames_ctx->mids[i] = frames_hwctx->surfaces[i].Data.MemId; + + err = MFXVideoCORE_SetFrameAllocator(session, &frame_allocator); + if (err != MFX_ERR_NONE) { + av_log(avctx, AV_LOG_ERROR, "Error setting a frame allocator: %d\n", err); + return ff_qsv_error(err); + } + } + + *psession = session; return 0; } diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h index f289a2b2fa3c1..82e1029a8bd1c 100644 --- a/libavcodec/qsv_internal.h +++ b/libavcodec/qsv_internal.h @@ -21,21 +21,6 @@ #ifndef AVCODEC_QSV_INTERNAL_H #define AVCODEC_QSV_INTERNAL_H -#if CONFIG_VAAPI -#define AVCODEC_QSV_LINUX_SESSION_HANDLE -#endif //CONFIG_VAAPI - -#ifdef AVCODEC_QSV_LINUX_SESSION_HANDLE -#include -#include -#if HAVE_UNISTD_H -#include -#endif -#include -#include -#include -#endif - #include #include "libavutil/frame.h" @@ -43,7 +28,7 @@ #include "avcodec.h" #define QSV_VERSION_MAJOR 1 -#define QSV_VERSION_MINOR 9 +#define QSV_VERSION_MINOR 1 #define ASYNC_DEPTH_DEFAULT 4 // internal parallelism @@ -65,23 +50,26 @@ typedef struct QSVFrame { struct QSVFrame *next; } QSVFrame; -typedef struct QSVSession { - mfxSession session; -#ifdef AVCODEC_QSV_LINUX_SESSION_HANDLE - int fd_display; - VADisplay va_display; -#endif -} QSVSession; +typedef struct QSVFramesContext { + AVBufferRef *hw_frames_ctx; + mfxFrameInfo info; + mfxMemId *mids; + int nb_mids; +} QSVFramesContext; /** - * Convert a libmfx error code into a ffmpeg error code. + * Convert a libmfx error code into an ffmpeg error code. */ int ff_qsv_error(int mfx_err); int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id); +int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile); -int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs, +int ff_qsv_init_internal_session(AVCodecContext *avctx, mfxSession *session, const char *load_plugins); -int ff_qsv_close_internal_session(QSVSession *qs); + +int ff_qsv_init_session_hwcontext(AVCodecContext *avctx, mfxSession *session, + QSVFramesContext *qsv_frames_ctx, + const char *load_plugins, int opaque); #endif /* AVCODEC_QSV_INTERNAL_H */ diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index 6409312d31d17..51da8f850c6df 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -27,6 +27,8 @@ #include #include "libavutil/common.h" +#include "libavutil/hwcontext.h" +#include "libavutil/hwcontext_qsv.h" #include "libavutil/mem.h" #include "libavutil/log.h" #include "libavutil/pixfmt.h" @@ -49,88 +51,129 @@ int ff_qsv_map_pixfmt(enum AVPixelFormat format) } } -static int qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession session) +static int qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession session, + AVBufferRef *hw_frames_ref) { - if (!session) { - if (!q->internal_qs.session) { - int ret = ff_qsv_init_internal_session(avctx, &q->internal_qs, - q->load_plugins); + int ret; + + if (session) { + q->session = session; + } else if (hw_frames_ref) { + if (q->internal_session) { + MFXClose(q->internal_session); + q->internal_session = NULL; + } + av_buffer_unref(&q->frames_ctx.hw_frames_ctx); + + q->frames_ctx.hw_frames_ctx = av_buffer_ref(hw_frames_ref); + if (!q->frames_ctx.hw_frames_ctx) + return AVERROR(ENOMEM); + + ret = ff_qsv_init_session_hwcontext(avctx, &q->internal_session, + &q->frames_ctx, q->load_plugins, + q->iopattern == MFX_IOPATTERN_OUT_OPAQUE_MEMORY); + if (ret < 0) { + av_buffer_unref(&q->frames_ctx.hw_frames_ctx); + return ret; + } + + q->session = q->internal_session; + } else { + if (!q->internal_session) { + ret = ff_qsv_init_internal_session(avctx, &q->internal_session, + q->load_plugins); if (ret < 0) return ret; } - q->session = q->internal_qs.session; - } else { - q->session = session; + q->session = q->internal_session; } - return 0; + /* make sure the decoder is uninitialized */ + MFXVideoDECODE_Close(q->session); + + return 0; } -static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q, AVPacket *avpkt) +static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q) { mfxSession session = NULL; + int iopattern = 0; mfxVideoParam param = { { 0 } }; - mfxBitstream bs = { { { 0 } } }; int ret; - enum AVPixelFormat pix_fmts[3] = { AV_PIX_FMT_QSV, - AV_PIX_FMT_NV12, - AV_PIX_FMT_NONE }; - ret = ff_get_format(avctx, pix_fmts); - if (ret < 0) - return ret; - - avctx->pix_fmt = ret; + if (!q->async_fifo) { + q->async_fifo = av_fifo_alloc((1 + q->async_depth) * + (sizeof(mfxSyncPoint*) + sizeof(QSVFrame*))); + if (!q->async_fifo) + return AVERROR(ENOMEM); + } - q->iopattern = MFX_IOPATTERN_OUT_SYSTEM_MEMORY; if (avctx->hwaccel_context) { - AVQSVContext *qsv = avctx->hwaccel_context; + AVQSVContext *user_ctx = avctx->hwaccel_context; + session = user_ctx->session; + iopattern = user_ctx->iopattern; + q->ext_buffers = user_ctx->ext_buffers; + q->nb_ext_buffers = user_ctx->nb_ext_buffers; + } - session = qsv->session; - q->iopattern = qsv->iopattern; - q->ext_buffers = qsv->ext_buffers; - q->nb_ext_buffers = qsv->nb_ext_buffers; + if (avctx->hw_frames_ctx) { + AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; + AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx; + + if (!iopattern) { + if (frames_hwctx->frame_type & MFX_MEMTYPE_OPAQUE_FRAME) + iopattern = MFX_IOPATTERN_OUT_OPAQUE_MEMORY; + else if (frames_hwctx->frame_type & MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET) + iopattern = MFX_IOPATTERN_OUT_VIDEO_MEMORY; + } } - ret = qsv_init_session(avctx, q, session); + if (!iopattern) + iopattern = MFX_IOPATTERN_OUT_SYSTEM_MEMORY; + q->iopattern = iopattern; + + ret = qsv_init_session(avctx, q, session, avctx->hw_frames_ctx); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error initializing an MFX session\n"); return ret; } - if (avpkt->size) { - bs.Data = avpkt->data; - bs.DataLength = avpkt->size; - bs.MaxLength = bs.DataLength; - bs.TimeStamp = avpkt->pts; - } else - return AVERROR_INVALIDDATA; - ret = ff_qsv_codec_id_to_mfx(avctx->codec_id); - if (ret < 0) { - av_log(avctx, AV_LOG_ERROR, "Unsupported codec_id %08x\n", avctx->codec_id); + if (ret < 0) return ret; - } - param.mfx.CodecId = ret; + param.mfx.CodecId = ret; + param.mfx.CodecProfile = ff_qsv_profile_to_mfx(avctx->codec_id, avctx->profile); + param.mfx.CodecLevel = avctx->level == FF_LEVEL_UNKNOWN ? MFX_LEVEL_UNKNOWN : avctx->level; - ret = MFXVideoDECODE_DecodeHeader(q->session, &bs, ¶m); - if (MFX_ERR_MORE_DATA==ret) { - /* this code means that header not found so we return packet size to skip - a current packet - */ - return avpkt->size; - } else if (ret < 0) { - av_log(avctx, AV_LOG_ERROR, "Decode header error %d\n", ret); - return ff_qsv_error(ret); + param.mfx.FrameInfo.BitDepthLuma = 8; + param.mfx.FrameInfo.BitDepthChroma = 8; + param.mfx.FrameInfo.Shift = 0; + param.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12; + param.mfx.FrameInfo.Width = avctx->coded_width; + param.mfx.FrameInfo.Height = avctx->coded_height; + param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; + + switch (avctx->field_order) { + case AV_FIELD_PROGRESSIVE: + param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE; + break; + case AV_FIELD_TT: + param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_FIELD_TFF; + break; + case AV_FIELD_BB: + param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_FIELD_BFF; + break; + default: + param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_UNKNOWN; + break; } + param.IOPattern = q->iopattern; param.AsyncDepth = q->async_depth; param.ExtParam = q->ext_buffers; param.NumExtParam = q->nb_ext_buffers; - param.mfx.FrameInfo.BitDepthLuma = 8; - param.mfx.FrameInfo.BitDepthChroma = 8; ret = MFXVideoDECODE_Init(q->session, ¶m); if (ret < 0) { @@ -144,37 +187,6 @@ static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q, AVPacket *avpkt return ff_qsv_error(ret); } - avctx->profile = param.mfx.CodecProfile; - avctx->level = param.mfx.CodecLevel; - avctx->coded_width = param.mfx.FrameInfo.Width; - avctx->coded_height = param.mfx.FrameInfo.Height; - avctx->width = param.mfx.FrameInfo.CropW - param.mfx.FrameInfo.CropX; - avctx->height = param.mfx.FrameInfo.CropH - param.mfx.FrameInfo.CropY; - - /* maximum decoder latency should be not exceed max DPB size for h.264 and - HEVC which is 16 for both cases. - So weare pre-allocating fifo big enough for 17 elements: - */ - if (!q->async_fifo) { - q->async_fifo = av_fifo_alloc((1 + 16) * - (sizeof(mfxSyncPoint) + sizeof(QSVFrame*))); - if (!q->async_fifo) - return AVERROR(ENOMEM); - } - - if (!q->input_fifo) { - q->input_fifo = av_fifo_alloc(1024*16); - if (!q->input_fifo) - return AVERROR(ENOMEM); - } - - if (!q->pkt_fifo) { - q->pkt_fifo = av_fifo_alloc( sizeof(AVPacket) * (1 + 16) ); - if (!q->pkt_fifo) - return AVERROR(ENOMEM); - } - q->engine_ready = 1; - return 0; } @@ -270,161 +282,77 @@ static QSVFrame *find_frame(QSVContext *q, mfxFrameSurface1 *surf) return NULL; } -/* This function uses for 'smart' releasing of consumed data - from the input bitstream fifo. - Since the input fifo mapped to mfxBitstream which does not understand - a wrapping of data over fifo end, we should also to relocate a possible - data rest to fifo begin. If rest of data is absent then we just reset fifo's - pointers to initial positions. - NOTE the case when fifo does contain unconsumed data is rare and typical - amount of such data is 1..4 bytes. -*/ -static void qsv_fifo_relocate(AVFifoBuffer *f, int bytes_to_free) -{ - int data_size; - int data_rest = 0; - - av_fifo_drain(f, bytes_to_free); - - data_size = av_fifo_size(f); - if (data_size > 0) { - if (f->buffer!=f->rptr) { - if ( (f->end - f->rptr) < data_size) { - data_rest = data_size - (f->end - f->rptr); - data_size-=data_rest; - memmove(f->buffer+data_size, f->buffer, data_rest); - } - memmove(f->buffer, f->rptr, data_size); - data_size+= data_rest; - } - } - f->rptr = f->buffer; - f->wptr = f->buffer + data_size; - f->wndx = data_size; - f->rndx = 0; -} - - -static void close_decoder(QSVContext *q) -{ - QSVFrame *cur; - - if (q->session) - MFXVideoDECODE_Close(q->session); - - cur = q->work_frames; - while (cur) { - q->work_frames = cur->next; - av_frame_free(&cur->frame); - av_freep(&cur); - cur = q->work_frames; - } - - q->engine_ready = 0; - q->reinit_pending = 0; -} - -static int do_qsv_decode(AVCodecContext *avctx, QSVContext *q, - AVFrame *frame, int *got_frame, - AVPacket *avpkt) +static int qsv_decode(AVCodecContext *avctx, QSVContext *q, + AVFrame *frame, int *got_frame, + AVPacket *avpkt) { QSVFrame *out_frame; mfxFrameSurface1 *insurf; mfxFrameSurface1 *outsurf; - mfxSyncPoint sync; + mfxSyncPoint *sync; mfxBitstream bs = { { { 0 } } }; int ret; - int n_out_frames; - int buffered = 0; - int flush = !avpkt->size || q->reinit_pending; - - if (!q->engine_ready) { - ret = qsv_decode_init(avctx, q, avpkt); - if (ret) - return ret; - } - if (!flush) { - if (av_fifo_size(q->input_fifo)) { - /* we have got rest of previous packet into buffer */ - if (av_fifo_space(q->input_fifo) < avpkt->size) { - ret = av_fifo_grow(q->input_fifo, avpkt->size); - if (ret < 0) - return ret; - } - av_fifo_generic_write(q->input_fifo, avpkt->data, avpkt->size, NULL); - bs.Data = q->input_fifo->rptr; - bs.DataLength = av_fifo_size(q->input_fifo); - buffered = 1; - } else { - bs.Data = avpkt->data; - bs.DataLength = avpkt->size; - } + if (avpkt->size) { + bs.Data = avpkt->data; + bs.DataLength = avpkt->size; bs.MaxLength = bs.DataLength; bs.TimeStamp = avpkt->pts; } - while (1) { + sync = av_mallocz(sizeof(*sync)); + if (!sync) { + av_freep(&sync); + return AVERROR(ENOMEM); + } + + do { ret = get_surface(avctx, q, &insurf); if (ret < 0) return ret; - do { - ret = MFXVideoDECODE_DecodeFrameAsync(q->session, flush ? NULL : &bs, - insurf, &outsurf, &sync); - if (ret != MFX_WRN_DEVICE_BUSY) - break; - av_usleep(500); - } while (1); - - if (MFX_WRN_VIDEO_PARAM_CHANGED==ret) { - /* TODO: handle here minor sequence header changing */ - } else if (MFX_ERR_INCOMPATIBLE_VIDEO_PARAM==ret) { - av_fifo_reset(q->input_fifo); - flush = q->reinit_pending = 1; - continue; - } - - if (sync) { - QSVFrame *out_frame = find_frame(q, outsurf); - if (!out_frame) { - av_log(avctx, AV_LOG_ERROR, - "The returned surface does not correspond to any frame\n"); - return AVERROR_BUG; - } + ret = MFXVideoDECODE_DecodeFrameAsync(q->session, avpkt->size ? &bs : NULL, + insurf, &outsurf, sync); + if (ret == MFX_WRN_DEVICE_BUSY) + av_usleep(500); - out_frame->queued = 1; - av_fifo_generic_write(q->async_fifo, &out_frame, sizeof(out_frame), NULL); - av_fifo_generic_write(q->async_fifo, &sync, sizeof(sync), NULL); + } while (ret == MFX_WRN_DEVICE_BUSY || ret == MFX_ERR_MORE_SURFACE); - continue; - } - if (MFX_ERR_MORE_SURFACE != ret && ret < 0) - break; + if (ret != MFX_ERR_NONE && + ret != MFX_ERR_MORE_DATA && + ret != MFX_WRN_VIDEO_PARAM_CHANGED && + ret != MFX_ERR_MORE_SURFACE) { + av_log(avctx, AV_LOG_ERROR, "Error during QSV decoding.\n"); + av_freep(&sync); + return ff_qsv_error(ret); } /* make sure we do not enter an infinite loop if the SDK * did not consume any data and did not return anything */ - if (!sync && !bs.DataOffset && !flush) { + if (!*sync && !bs.DataOffset) { av_log(avctx, AV_LOG_WARNING, "A decode call did not consume any data\n"); bs.DataOffset = avpkt->size; } - if (buffered) { - qsv_fifo_relocate(q->input_fifo, bs.DataOffset); - } else if (bs.DataOffset!=avpkt->size) { - /* some data of packet was not consumed. store it to local buffer */ - av_fifo_generic_write(q->input_fifo, avpkt->data+bs.DataOffset, - avpkt->size - bs.DataOffset, NULL); - } + if (*sync) { + QSVFrame *out_frame = find_frame(q, outsurf); - if (MFX_ERR_MORE_DATA!=ret && ret < 0) { - av_log(avctx, AV_LOG_ERROR, "Error %d during QSV decoding.\n", ret); - return ff_qsv_error(ret); + if (!out_frame) { + av_log(avctx, AV_LOG_ERROR, + "The returned surface does not correspond to any frame\n"); + av_freep(&sync); + return AVERROR_BUG; + } + + out_frame->queued = 1; + av_fifo_generic_write(q->async_fifo, &out_frame, sizeof(out_frame), NULL); + av_fifo_generic_write(q->async_fifo, &sync, sizeof(sync), NULL); + } else { + av_freep(&sync); } - n_out_frames = av_fifo_size(q->async_fifo) / (sizeof(out_frame)+sizeof(sync)); - if (n_out_frames > q->async_depth || (flush && n_out_frames) ) { + if (!av_fifo_space(q->async_fifo) || + (!avpkt->size && av_fifo_size(q->async_fifo))) { AVFrame *src_frame; av_fifo_generic_read(q->async_fifo, &out_frame, sizeof(out_frame), NULL); @@ -432,9 +360,11 @@ static int do_qsv_decode(AVCodecContext *avctx, QSVContext *q, out_frame->queued = 0; do { - ret = MFXVideoCORE_SyncOperation(q->session, sync, 1000); + ret = MFXVideoCORE_SyncOperation(q->session, *sync, 1000); } while (ret == MFX_WRN_IN_EXECUTION); + av_freep(&sync); + src_frame = out_frame->frame; ret = av_frame_ref(frame, src_frame); @@ -462,149 +392,125 @@ FF_ENABLE_DEPRECATION_WARNINGS *got_frame = 1; } - return avpkt->size; + return bs.DataOffset; } -/* - This function inserts a packet at fifo front. -*/ -static void qsv_packet_push_front(QSVContext *q, AVPacket *avpkt) -{ - int fifo_size = av_fifo_size(q->pkt_fifo); - if (!fifo_size) { - /* easy case fifo is empty */ - av_fifo_generic_write(q->pkt_fifo, avpkt, sizeof(*avpkt), NULL); - } else { - /* realloc necessary */ - AVPacket pkt; - AVFifoBuffer *fifo = av_fifo_alloc(fifo_size+av_fifo_space(q->pkt_fifo)); - av_fifo_generic_write(fifo, avpkt, sizeof(*avpkt), NULL); - - while (av_fifo_size(q->pkt_fifo)) { - av_fifo_generic_read(q->pkt_fifo, &pkt, sizeof(pkt), NULL); - av_fifo_generic_write(fifo, &pkt, sizeof(pkt), NULL); - } - av_fifo_free(q->pkt_fifo); - q->pkt_fifo = fifo; - } -} -int ff_qsv_decode(AVCodecContext *avctx, QSVContext *q, - AVFrame *frame, int *got_frame, - AVPacket *avpkt) +int ff_qsv_decode_close(QSVContext *q) { - AVPacket pkt_ref = { 0 }; - int ret = 0; + QSVFrame *cur = q->work_frames; - if (q->pkt_fifo && av_fifo_size(q->pkt_fifo) >= sizeof(AVPacket)) { - /* we already have got some buffered packets. so add new to tail */ - ret = av_packet_ref(&pkt_ref, avpkt); - if (ret < 0) - return ret; - av_fifo_generic_write(q->pkt_fifo, &pkt_ref, sizeof(pkt_ref), NULL); - } - if (q->reinit_pending) { - ret = do_qsv_decode(avctx, q, frame, got_frame, avpkt); + if (q->session) + MFXVideoDECODE_Close(q->session); - if (!*got_frame) { - /* Flushing complete, no more frames */ - close_decoder(q); - //return ff_qsv_decode(avctx, q, frame, got_frame, avpkt); - } - } - if (!q->reinit_pending) { - if (q->pkt_fifo && av_fifo_size(q->pkt_fifo) >= sizeof(AVPacket)) { - /* process buffered packets */ - while (!*got_frame && av_fifo_size(q->pkt_fifo) >= sizeof(AVPacket)) { - av_fifo_generic_read(q->pkt_fifo, &pkt_ref, sizeof(pkt_ref), NULL); - ret = do_qsv_decode(avctx, q, frame, got_frame, &pkt_ref); - if (q->reinit_pending) { - /* - A rare case: new reinit pending when buffering existing. - We should to return the pkt_ref back to same place of fifo - */ - qsv_packet_push_front(q, &pkt_ref); - } else { - av_packet_unref(&pkt_ref); - } - } - } else { - /* general decoding */ - ret = do_qsv_decode(avctx, q, frame, got_frame, avpkt); - if (q->reinit_pending) { - ret = av_packet_ref(&pkt_ref, avpkt); - if (ret < 0) - return ret; - av_fifo_generic_write(q->pkt_fifo, &pkt_ref, sizeof(pkt_ref), NULL); - } - } - } + while (q->async_fifo && av_fifo_size(q->async_fifo)) { + QSVFrame *out_frame; + mfxSyncPoint *sync; - return ret; -} -/* - This function resets decoder and corresponded buffers before seek operation -*/ -void ff_qsv_decode_reset(AVCodecContext *avctx, QSVContext *q) -{ - QSVFrame *cur; - AVPacket pkt; - int ret = 0; - mfxVideoParam param = { { 0 } }; - - if (q->reinit_pending) { - close_decoder(q); - } else if (q->engine_ready) { - ret = MFXVideoDECODE_GetVideoParam(q->session, ¶m); - if (ret < 0) { - av_log(avctx, AV_LOG_ERROR, "MFX decode get param error %d\n", ret); - } + av_fifo_generic_read(q->async_fifo, &out_frame, sizeof(out_frame), NULL); + av_fifo_generic_read(q->async_fifo, &sync, sizeof(sync), NULL); - ret = MFXVideoDECODE_Reset(q->session, ¶m); - if (ret < 0) { - av_log(avctx, AV_LOG_ERROR, "MFX decode reset error %d\n", ret); - } + av_freep(&sync); + } - /* Free all frames*/ + while (cur) { + q->work_frames = cur->next; + av_frame_free(&cur->frame); + av_freep(&cur); cur = q->work_frames; - while (cur) { - q->work_frames = cur->next; - av_frame_free(&cur->frame); - av_freep(&cur); - cur = q->work_frames; - } } - /* Reset output surfaces */ - if (q->async_fifo) - av_fifo_reset(q->async_fifo); + av_fifo_free(q->async_fifo); + q->async_fifo = NULL; + + av_parser_close(q->parser); + avcodec_free_context(&q->avctx_internal); - /* Reset input packets fifo */ - while (q->pkt_fifo && av_fifo_size(q->pkt_fifo)) { - av_fifo_generic_read(q->pkt_fifo, &pkt, sizeof(pkt), NULL); - av_packet_unref(&pkt); - } + if (q->internal_session) + MFXClose(q->internal_session); - /* Reset input bitstream fifo */ - if (q->input_fifo) - av_fifo_reset(q->input_fifo); + av_buffer_unref(&q->frames_ctx.hw_frames_ctx); + av_freep(&q->frames_ctx.mids); + q->frames_ctx.nb_mids = 0; + + return 0; } -int ff_qsv_decode_close(QSVContext *q) +int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q, + AVFrame *frame, int *got_frame, AVPacket *pkt) { - close_decoder(q); + uint8_t *dummy_data; + int dummy_size; + int ret; - q->session = NULL; + if (!q->avctx_internal) { + q->avctx_internal = avcodec_alloc_context3(NULL); + if (!q->avctx_internal) + return AVERROR(ENOMEM); - ff_qsv_close_internal_session(&q->internal_qs); + q->parser = av_parser_init(avctx->codec_id); + if (!q->parser) + return AVERROR(ENOMEM); - av_fifo_free(q->async_fifo); - q->async_fifo = NULL; + q->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES; + q->orig_pix_fmt = AV_PIX_FMT_NONE; + } + + if (!pkt->size) + return qsv_decode(avctx, q, frame, got_frame, pkt); + + /* we assume the packets are already split properly and want + * just the codec parameters here */ + av_parser_parse2(q->parser, q->avctx_internal, + &dummy_data, &dummy_size, + pkt->data, pkt->size, pkt->pts, pkt->dts, + pkt->pos); + + /* TODO: flush delayed frames on reinit */ + if (q->parser->format != q->orig_pix_fmt || + q->parser->coded_width != avctx->coded_width || + q->parser->coded_height != avctx->coded_height) { + enum AVPixelFormat pix_fmts[3] = { AV_PIX_FMT_QSV, + AV_PIX_FMT_NONE, + AV_PIX_FMT_NONE }; + enum AVPixelFormat qsv_format; + + qsv_format = ff_qsv_map_pixfmt(q->parser->format); + if (qsv_format < 0) { + av_log(avctx, AV_LOG_ERROR, + "Only 8-bit YUV420 streams are supported.\n"); + ret = AVERROR(ENOSYS); + goto reinit_fail; + } - av_fifo_free(q->input_fifo); - q->input_fifo = NULL; + q->orig_pix_fmt = q->parser->format; + avctx->pix_fmt = pix_fmts[1] = qsv_format; + avctx->width = q->parser->width; + avctx->height = q->parser->height; + avctx->coded_width = q->parser->coded_width; + avctx->coded_height = q->parser->coded_height; + avctx->field_order = q->parser->field_order; + avctx->level = q->avctx_internal->level; + avctx->profile = q->avctx_internal->profile; + + ret = ff_get_format(avctx, pix_fmts); + if (ret < 0) + goto reinit_fail; - av_fifo_free(q->pkt_fifo); - q->pkt_fifo = NULL; + avctx->pix_fmt = ret; - return 0; + ret = qsv_decode_init(avctx, q); + if (ret < 0) + goto reinit_fail; + } + + return qsv_decode(avctx, q, frame, got_frame, pkt); + +reinit_fail: + q->orig_pix_fmt = q->parser->format = avctx->pix_fmt = AV_PIX_FMT_NONE; + return ret; +} + +void ff_qsv_decode_flush(AVCodecContext *avctx, QSVContext *q) +{ + q->orig_pix_fmt = AV_PIX_FMT_NONE; } diff --git a/libavcodec/qsvdec.h b/libavcodec/qsvdec.h index 97a3315b75b5e..0bf1e55ffa7b5 100644 --- a/libavcodec/qsvdec.h +++ b/libavcodec/qsvdec.h @@ -41,7 +41,9 @@ typedef struct QSVContext { // the session we allocated internally, in case the caller did not provide // one - QSVSession internal_qs; + mfxSession internal_session; + + QSVFramesContext frames_ctx; /** * a linked list of frames currently being used by QSV @@ -49,22 +51,11 @@ typedef struct QSVContext { QSVFrame *work_frames; AVFifoBuffer *async_fifo; - AVFifoBuffer *input_fifo; - - // we should to buffer input packets at some cases - // else it is not possible to handle dynamic stream changes correctly - // this fifo uses for input packets buffering - AVFifoBuffer *pkt_fifo; - - // this flag indicates that header parsed, - // decoder instance created and ready to general decoding - int engine_ready; - // we can not just re-init decoder if different sequence header arrived - // we should to deliver all buffered frames but we can not decode new packets - // this time. So when reinit_pending is non-zero we flushing decoder and - // accumulate new arrived packets into pkt_fifo - int reinit_pending; + // the internal parser and codec context for parsing the data + AVCodecParserContext *parser; + AVCodecContext *avctx_internal; + enum AVPixelFormat orig_pix_fmt; // options set by the caller int async_depth; @@ -78,11 +69,10 @@ typedef struct QSVContext { int ff_qsv_map_pixfmt(enum AVPixelFormat format); -int ff_qsv_decode(AVCodecContext *s, QSVContext *q, - AVFrame *frame, int *got_frame, - AVPacket *avpkt); +int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q, + AVFrame *frame, int *got_frame, AVPacket *pkt); -void ff_qsv_decode_reset(AVCodecContext *avctx, QSVContext *q); +void ff_qsv_decode_flush(AVCodecContext *avctx, QSVContext *q); int ff_qsv_decode_close(QSVContext *q); diff --git a/libavcodec/qsvdec_h2645.c b/libavcodec/qsvdec_h2645.c index 98a19520b6996..df86eea746ba6 100644 --- a/libavcodec/qsvdec_h2645.c +++ b/libavcodec/qsvdec_h2645.c @@ -33,11 +33,14 @@ #include "avcodec.h" #include "internal.h" +#include "qsv_internal.h" #include "qsvdec.h" +#include "qsv.h" enum LoadPlugin { LOAD_PLUGIN_NONE, LOAD_PLUGIN_HEVC_SW, + LOAD_PLUGIN_HEVC_HW, }; typedef struct QSVH2645Context { @@ -86,7 +89,8 @@ static av_cold int qsv_decode_init(AVCodecContext *avctx) int ret; if (avctx->codec_id == AV_CODEC_ID_HEVC && s->load_plugin != LOAD_PLUGIN_NONE) { - static const char *uid_hevcenc_sw = "15dd936825ad475ea34e35f3f54217a6"; + static const char *uid_hevcdec_sw = "15dd936825ad475ea34e35f3f54217a6"; + static const char *uid_hevcdec_hw = "33a61c0b4c27454ca8d85dde757c6f8e"; if (s->qsv.load_plugins[0]) { av_log(avctx, AV_LOG_WARNING, @@ -94,22 +98,22 @@ static av_cold int qsv_decode_init(AVCodecContext *avctx) "The load_plugin value will be ignored.\n"); } else { av_freep(&s->qsv.load_plugins); - s->qsv.load_plugins = av_strdup(uid_hevcenc_sw); + + if (s->load_plugin == LOAD_PLUGIN_HEVC_SW) + s->qsv.load_plugins = av_strdup(uid_hevcdec_sw); + else + s->qsv.load_plugins = av_strdup(uid_hevcdec_hw); if (!s->qsv.load_plugins) return AVERROR(ENOMEM); } } + s->packet_fifo = av_fifo_alloc(sizeof(AVPacket)); if (!s->packet_fifo) { ret = AVERROR(ENOMEM); goto fail; } - if (avctx->codec_id == AV_CODEC_ID_H264) { - //regarding ticks_per_frame description, should be 2 for h.264: - avctx->ticks_per_frame = 2; - } - return 0; fail: qsv_decode_close(avctx); @@ -184,7 +188,7 @@ static int qsv_decode_frame(AVCodecContext *avctx, void *data, /* no more data */ if (av_fifo_size(s->packet_fifo) < sizeof(AVPacket)) - return avpkt->size ? avpkt->size : ff_qsv_decode(avctx, &s->qsv, frame, got_frame, avpkt); + return avpkt->size ? avpkt->size : ff_qsv_process_data(avctx, &s->qsv, frame, got_frame, avpkt); av_packet_unref(&s->pkt_filtered); @@ -202,7 +206,7 @@ static int qsv_decode_frame(AVCodecContext *avctx, void *data, av_packet_unref(&input_ref); } - ret = ff_qsv_decode(avctx, &s->qsv, frame, got_frame, &s->pkt_filtered); + ret = ff_qsv_process_data(avctx, &s->qsv, frame, got_frame, &s->pkt_filtered); if (ret < 0) return ret; @@ -216,7 +220,9 @@ static int qsv_decode_frame(AVCodecContext *avctx, void *data, static void qsv_decode_flush(AVCodecContext *avctx) { QSVH2645Context *s = avctx->priv_data; - ff_qsv_decode_reset(avctx, &s->qsv); + + qsv_clear_buffers(s); + ff_qsv_decode_flush(avctx, &s->qsv); } #define OFFSET(x) offsetof(QSVH2645Context, x) @@ -233,9 +239,10 @@ AVHWAccel ff_hevc_qsv_hwaccel = { static const AVOption hevc_options[] = { { "async_depth", "Internal parallelization depth, the higher the value the higher the latency.", OFFSET(qsv.async_depth), AV_OPT_TYPE_INT, { .i64 = ASYNC_DEPTH_DEFAULT }, 0, INT_MAX, VD }, - { "load_plugin", "A user plugin to load in an internal session", OFFSET(load_plugin), AV_OPT_TYPE_INT, { .i64 = LOAD_PLUGIN_HEVC_SW }, LOAD_PLUGIN_NONE, LOAD_PLUGIN_HEVC_SW, VD, "load_plugin" }, + { "load_plugin", "A user plugin to load in an internal session", OFFSET(load_plugin), AV_OPT_TYPE_INT, { .i64 = LOAD_PLUGIN_HEVC_SW }, LOAD_PLUGIN_NONE, LOAD_PLUGIN_HEVC_HW, VD, "load_plugin" }, { "none", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_NONE }, 0, 0, VD, "load_plugin" }, { "hevc_sw", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_HEVC_SW }, 0, 0, VD, "load_plugin" }, + { "hevc_hw", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_HEVC_HW }, 0, 0, VD, "load_plugin" }, { "load_plugins", "A :-separate list of hexadecimal plugin UIDs to load in an internal session", OFFSET(qsv.load_plugins), AV_OPT_TYPE_STRING, { .str = "" }, 0, 0, VD }, diff --git a/libavcodec/qsvdec_mpeg2.c b/libavcodec/qsvdec_mpeg2.c index 70ccbc5949da6..c08065751ccd1 100644 --- a/libavcodec/qsvdec_mpeg2.c +++ b/libavcodec/qsvdec_mpeg2.c @@ -1,5 +1,7 @@ /* - * Intel MediaSDK QSV based MPEG-2 video decoder + * Intel MediaSDK QSV based MPEG-2 decoder + * + * copyright (c) 2015 Anton Khirnov * * This file is part of FFmpeg. * @@ -18,32 +20,70 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ + #include #include +#include + #include "libavutil/common.h" +#include "libavutil/fifo.h" #include "libavutil/opt.h" #include "avcodec.h" +#include "internal.h" +#include "qsv_internal.h" #include "qsvdec.h" +#include "qsv.h" typedef struct QSVMPEG2Context { AVClass *class; QSVContext qsv; + + AVFifoBuffer *packet_fifo; + + AVPacket input_ref; } QSVMPEG2Context; +static void qsv_clear_buffers(QSVMPEG2Context *s) +{ + AVPacket pkt; + while (av_fifo_size(s->packet_fifo) >= sizeof(pkt)) { + av_fifo_generic_read(s->packet_fifo, &pkt, sizeof(pkt), NULL); + av_packet_unref(&pkt); + } + + av_packet_unref(&s->input_ref); +} + static av_cold int qsv_decode_close(AVCodecContext *avctx) { QSVMPEG2Context *s = avctx->priv_data; ff_qsv_decode_close(&s->qsv); + qsv_clear_buffers(s); + + av_fifo_free(s->packet_fifo); + return 0; } static av_cold int qsv_decode_init(AVCodecContext *avctx) { + QSVMPEG2Context *s = avctx->priv_data; + int ret; + + s->packet_fifo = av_fifo_alloc(sizeof(AVPacket)); + if (!s->packet_fifo) { + ret = AVERROR(ENOMEM); + goto fail; + } + return 0; +fail: + qsv_decode_close(avctx); + return ret; } static int qsv_decode_frame(AVCodecContext *avctx, void *data, @@ -51,14 +91,53 @@ static int qsv_decode_frame(AVCodecContext *avctx, void *data, { QSVMPEG2Context *s = avctx->priv_data; AVFrame *frame = data; + int ret; + + /* buffer the input packet */ + if (avpkt->size) { + AVPacket input_ref = { 0 }; + + if (av_fifo_space(s->packet_fifo) < sizeof(input_ref)) { + ret = av_fifo_realloc2(s->packet_fifo, + av_fifo_size(s->packet_fifo) + sizeof(input_ref)); + if (ret < 0) + return ret; + } + + ret = av_packet_ref(&input_ref, avpkt); + if (ret < 0) + return ret; + av_fifo_generic_write(s->packet_fifo, &input_ref, sizeof(input_ref), NULL); + } - return ff_qsv_decode(avctx, &s->qsv, frame, got_frame, avpkt); + /* process buffered data */ + while (!*got_frame) { + if (s->input_ref.size <= 0) { + /* no more data */ + if (av_fifo_size(s->packet_fifo) < sizeof(AVPacket)) + return avpkt->size ? avpkt->size : ff_qsv_process_data(avctx, &s->qsv, frame, got_frame, avpkt); + + av_packet_unref(&s->input_ref); + av_fifo_generic_read(s->packet_fifo, &s->input_ref, sizeof(s->input_ref), NULL); + } + + ret = ff_qsv_process_data(avctx, &s->qsv, frame, got_frame, &s->input_ref); + if (ret < 0) + return ret; + + s->input_ref.size -= ret; + s->input_ref.data += ret; + } + + return avpkt->size; } static void qsv_decode_flush(AVCodecContext *avctx) { QSVMPEG2Context *s = avctx->priv_data; - ff_qsv_decode_reset(avctx, &s->qsv); + + qsv_clear_buffers(s); + ff_qsv_decode_flush(avctx, &s->qsv); } AVHWAccel ff_mpeg2_qsv_hwaccel = { diff --git a/libavcodec/qsvdec_vc1.c b/libavcodec/qsvdec_vc1.c index fcf101f758790..f7b1fb093b2a6 100644 --- a/libavcodec/qsvdec_vc1.c +++ b/libavcodec/qsvdec_vc1.c @@ -21,18 +21,37 @@ #include #include +#include + #include "libavutil/common.h" #include "libavutil/fifo.h" #include "libavutil/opt.h" #include "avcodec.h" +#include "internal.h" +#include "qsv_internal.h" #include "qsvdec.h" +#include "qsv.h" typedef struct QSVVC1Context { AVClass *class; QSVContext qsv; + + AVFifoBuffer *packet_fifo; + + AVPacket input_ref; } QSVVC1Context; +static void qsv_clear_buffers(QSVVC1Context *s) +{ + AVPacket pkt; + while (av_fifo_size(s->packet_fifo) >= sizeof(pkt)) { + av_fifo_generic_read(s->packet_fifo, &pkt, sizeof(pkt), NULL); + av_packet_unref(&pkt); + } + + av_packet_unref(&s->input_ref); +} static av_cold int qsv_decode_close(AVCodecContext *avctx) { @@ -40,22 +59,82 @@ static av_cold int qsv_decode_close(AVCodecContext *avctx) ff_qsv_decode_close(&s->qsv); + qsv_clear_buffers(s); + + av_fifo_free(s->packet_fifo); + return 0; } +static av_cold int qsv_decode_init(AVCodecContext *avctx) +{ + QSVVC1Context *s = avctx->priv_data; + int ret; + + s->packet_fifo = av_fifo_alloc(sizeof(AVPacket)); + if (!s->packet_fifo) { + ret = AVERROR(ENOMEM); + goto fail; + } + + return 0; +fail: + qsv_decode_close(avctx); + return ret; +} + static int qsv_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { QSVVC1Context *s = avctx->priv_data; - AVFrame *frame = data; + AVFrame *frame = data; + int ret; + + /* buffer the input packet */ + if (avpkt->size) { + AVPacket input_ref = { 0 }; + + if (av_fifo_space(s->packet_fifo) < sizeof(input_ref)) { + ret = av_fifo_realloc2(s->packet_fifo, + av_fifo_size(s->packet_fifo) + sizeof(input_ref)); + if (ret < 0) + return ret; + } + + ret = av_packet_ref(&input_ref, avpkt); + if (ret < 0) + return ret; + av_fifo_generic_write(s->packet_fifo, &input_ref, sizeof(input_ref), NULL); + } - return ff_qsv_decode(avctx, &s->qsv, frame, got_frame, avpkt); + /* process buffered data */ + while (!*got_frame) { + if (s->input_ref.size <= 0) { + /* no more data */ + if (av_fifo_size(s->packet_fifo) < sizeof(AVPacket)) + return avpkt->size ? avpkt->size : ff_qsv_process_data(avctx, &s->qsv, frame, got_frame, avpkt); + + av_packet_unref(&s->input_ref); + av_fifo_generic_read(s->packet_fifo, &s->input_ref, sizeof(s->input_ref), NULL); + } + + ret = ff_qsv_process_data(avctx, &s->qsv, frame, got_frame, &s->input_ref); + if (ret < 0) + return ret; + + s->input_ref.size -= ret; + s->input_ref.data += ret; + } + + return avpkt->size; } static void qsv_decode_flush(AVCodecContext *avctx) { QSVVC1Context *s = avctx->priv_data; - ff_qsv_decode_reset(avctx, &s->qsv); + + qsv_clear_buffers(s); + ff_qsv_decode_flush(avctx, &s->qsv); } AVHWAccel ff_vc1_qsv_hwaccel = { @@ -85,11 +164,11 @@ AVCodec ff_vc1_qsv_decoder = { .priv_data_size = sizeof(QSVVC1Context), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_VC1, - .init = NULL, + .init = qsv_decode_init, .decode = qsv_decode_frame, .flush = qsv_decode_flush, .close = qsv_decode_close, - .capabilities = AV_CODEC_CAP_DELAY, + .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1, .priv_class = &class, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12, AV_PIX_FMT_QSV, diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index f56cb612b6f2b..84eba4191e86d 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -26,6 +26,8 @@ #include #include "libavutil/common.h" +#include "libavutil/hwcontext.h" +#include "libavutil/hwcontext_qsv.h" #include "libavutil/mem.h" #include "libavutil/log.h" #include "libavutil/time.h" @@ -379,31 +381,25 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) q->param.mfx.EncodedOrder = 0; q->param.mfx.BufferSizeInKB = 0; - q->param.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12; - q->param.mfx.FrameInfo.CropX = 0; - q->param.mfx.FrameInfo.CropY = 0; - q->param.mfx.FrameInfo.CropW = avctx->width; - q->param.mfx.FrameInfo.CropH = avctx->height; - q->param.mfx.FrameInfo.AspectRatioW = avctx->sample_aspect_ratio.num; - q->param.mfx.FrameInfo.AspectRatioH = avctx->sample_aspect_ratio.den; - q->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; - q->param.mfx.FrameInfo.BitDepthLuma = 8; - q->param.mfx.FrameInfo.BitDepthChroma = 8; - q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, q->width_align); - - if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) { - /* A true field layout (TFF or BFF) is not important here, - it will specified later during frame encoding. But it is important - to specify is frame progressive or not because allowed heigh alignment - does depend by this. - */ - q->param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_FIELD_TFF; - q->height_align = 32; + if (avctx->hw_frames_ctx) { + AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; + AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx; + q->param.mfx.FrameInfo = frames_hwctx->surfaces[0].Info; } else { - q->param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE; - q->height_align = 16; + q->param.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12; + q->param.mfx.FrameInfo.Width = FFALIGN(avctx->width, q->width_align); + q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, 32); + q->param.mfx.FrameInfo.CropX = 0; + q->param.mfx.FrameInfo.CropY = 0; + q->param.mfx.FrameInfo.CropW = avctx->width; + q->param.mfx.FrameInfo.CropH = avctx->height; + q->param.mfx.FrameInfo.AspectRatioW = avctx->sample_aspect_ratio.num; + q->param.mfx.FrameInfo.AspectRatioH = avctx->sample_aspect_ratio.den; + q->param.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE; + q->param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; + q->param.mfx.FrameInfo.BitDepthLuma = 8; + q->param.mfx.FrameInfo.BitDepthChroma = 8; } - q->param.mfx.FrameInfo.Height = FFALIGN(avctx->height, q->height_align); if (avctx->framerate.den > 0 && avctx->framerate.num > 0) { q->param.mfx.FrameInfo.FrameRateExtN = avctx->framerate.num; @@ -536,7 +532,7 @@ FF_ENABLE_DEPRECATION_WARNINGS q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q->extco2; -#if QSV_VERSION_ATLEAST(1,8) +#if QSV_HAVE_LA_DS q->extco2.LookAheadDS = q->look_ahead_downsampling; #endif } @@ -673,12 +669,45 @@ static int qsv_init_opaque_alloc(AVCodecContext *avctx, QSVEncContext *q) return 0; } +static int qsvenc_init_session(AVCodecContext *avctx, QSVEncContext *q) +{ + int ret; + + if (avctx->hwaccel_context) { + AVQSVContext *qsv = avctx->hwaccel_context; + q->session = qsv->session; + } else if (avctx->hw_frames_ctx) { + q->frames_ctx.hw_frames_ctx = av_buffer_ref(avctx->hw_frames_ctx); + if (!q->frames_ctx.hw_frames_ctx) + return AVERROR(ENOMEM); + + ret = ff_qsv_init_session_hwcontext(avctx, &q->internal_session, + &q->frames_ctx, q->load_plugins, + q->param.IOPattern == MFX_IOPATTERN_IN_OPAQUE_MEMORY); + if (ret < 0) { + av_buffer_unref(&q->frames_ctx.hw_frames_ctx); + return ret; + } + + q->session = q->internal_session; + } else { + ret = ff_qsv_init_internal_session(avctx, &q->internal_session, + q->load_plugins); + if (ret < 0) + return ret; + + q->session = q->internal_session; + } + + return 0; +} + int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q) { + int iopattern = 0; int opaque_alloc = 0; int ret; - q->param.IOPattern = MFX_IOPATTERN_IN_SYSTEM_MEMORY; q->param.AsyncDepth = q->async_depth; q->async_fifo = av_fifo_alloc((1 + q->async_depth) * @@ -689,32 +718,34 @@ int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q) if (avctx->hwaccel_context) { AVQSVContext *qsv = avctx->hwaccel_context; - q->session = qsv->session; - q->param.IOPattern = qsv->iopattern; - + iopattern = qsv->iopattern; opaque_alloc = qsv->opaque_alloc; } - if (!q->session) { - ret = ff_qsv_init_internal_session(avctx, &q->internal_qs, - q->load_plugins); - if (ret < 0) - return ret; + if (avctx->hw_frames_ctx) { + AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; + AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx; - q->session = q->internal_qs.session; + if (!iopattern) { + if (frames_hwctx->frame_type & MFX_MEMTYPE_OPAQUE_FRAME) + iopattern = MFX_IOPATTERN_IN_OPAQUE_MEMORY; + else if (frames_hwctx->frame_type & + (MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET | MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET)) + iopattern = MFX_IOPATTERN_IN_VIDEO_MEMORY; + } } - ret = init_video_param(avctx, q); + if (!iopattern) + iopattern = MFX_IOPATTERN_IN_SYSTEM_MEMORY; + q->param.IOPattern = iopattern; + + ret = qsvenc_init_session(avctx, q); if (ret < 0) return ret; - ret = MFXVideoENCODE_Query(q->session, &q->param,&q->param); - if (MFX_WRN_PARTIAL_ACCELERATION==ret) { - av_log(avctx, AV_LOG_WARNING, "Encoder will work with partial HW acceleration\n"); - } else if (ret < 0) { - av_log(avctx, AV_LOG_ERROR, "Error %d querying encoder params\n", ret); - return ff_qsv_error(ret); - } + ret = init_video_param(avctx, q); + if (ret < 0) + return ret; ret = MFXVideoENCODE_QueryIOSurf(q->session, &q->param, &q->req); if (ret < 0) { @@ -758,7 +789,7 @@ int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q) } ret = MFXVideoENCODE_Init(q->session, &q->param); - if (MFX_WRN_PARTIAL_ACCELERATION==ret) { + if (ret == MFX_WRN_PARTIAL_ACCELERATION) { av_log(avctx, AV_LOG_WARNING, "Encoder will work with partial HW acceleration\n"); } else if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error initializing the encoder\n"); @@ -856,9 +887,8 @@ static int submit_frame(QSVEncContext *q, const AVFrame *frame, qf->surface = (mfxFrameSurface1*)qf->frame->data[3]; } else { /* make a copy if the input is not padded as libmfx requires */ - if ( frame->height & (q->height_align - 1) || - frame->linesize[0] & (q->width_align - 1)) { - qf->frame->height = FFALIGN(frame->height, q->height_align); + if (frame->height & 31 || frame->linesize[0] & (q->width_align - 1)) { + qf->frame->height = FFALIGN(frame->height, 32); qf->frame->width = FFALIGN(frame->width, q->width_align); ret = ff_get_buffer(q->avctx, qf->frame, AV_GET_BUFFER_FLAG_REF); @@ -924,7 +954,7 @@ static int encode_frame(AVCodecContext *avctx, QSVEncContext *q, mfxBitstream *bs; mfxFrameSurface1 *surf = NULL; - mfxSyncPoint *sync = NULL; + mfxSyncPoint *sync = NULL; QSVFrame *qsv_frame = NULL; mfxEncodeCtrl* enc_ctrl = NULL; int ret; @@ -968,30 +998,21 @@ static int encode_frame(AVCodecContext *avctx, QSVEncContext *q, do { ret = MFXVideoENCODE_EncodeFrameAsync(q->session, enc_ctrl, surf, bs, sync); - if (ret == MFX_WRN_DEVICE_BUSY) { + if (ret == MFX_WRN_DEVICE_BUSY) av_usleep(500); - continue; - } - break; - } while ( 1 ); + } while (ret > 0); if (ret < 0) { av_packet_unref(&new_pkt); av_freep(&bs); - if (ret == MFX_ERR_MORE_DATA) - return 0; - av_log(avctx, AV_LOG_ERROR, "EncodeFrameAsync returned %d\n", ret); - return ff_qsv_error(ret); + av_freep(&sync); + return (ret == MFX_ERR_MORE_DATA) ? 0 : ff_qsv_error(ret); } - if (ret == MFX_WRN_INCOMPATIBLE_VIDEO_PARAM) { - if (frame->interlaced_frame) - print_interlace_msg(avctx, q); - else - av_log(avctx, AV_LOG_WARNING, - "EncodeFrameAsync returned 'incompatible param' code\n"); - } - if (sync) { + if (ret == MFX_WRN_INCOMPATIBLE_VIDEO_PARAM && frame->interlaced_frame) + print_interlace_msg(avctx, q); + + if (*sync) { av_fifo_generic_write(q->async_fifo, &new_pkt, sizeof(new_pkt), NULL); av_fifo_generic_write(q->async_fifo, &sync, sizeof(sync), NULL); av_fifo_generic_write(q->async_fifo, &bs, sizeof(bs), NULL); @@ -1079,9 +1100,14 @@ int ff_qsv_enc_close(AVCodecContext *avctx, QSVEncContext *q) if (q->session) MFXVideoENCODE_Close(q->session); - q->session = NULL; - - ff_qsv_close_internal_session(&q->internal_qs); + if (q->internal_session) + MFXClose(q->internal_session); + q->session = NULL; + q->internal_session = NULL; + + av_buffer_unref(&q->frames_ctx.hw_frames_ctx); + av_freep(&q->frames_ctx.mids); + q->frames_ctx.nb_mids = 0; cur = q->work_frames; while (cur) { diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index 2d7bd326f33ad..361d9333d865f 100644 --- a/libavcodec/qsvenc.h +++ b/libavcodec/qsvenc.h @@ -42,6 +42,7 @@ #define QSV_HAVE_BREF_TYPE QSV_VERSION_ATLEAST(1, 8) #define QSV_HAVE_LA QSV_VERSION_ATLEAST(1, 7) +#define QSV_HAVE_LA_DS QSV_VERSION_ATLEAST(1, 8) #define QSV_HAVE_LA_HRD QSV_VERSION_ATLEAST(1, 11) #define QSV_HAVE_ICQ QSV_VERSION_ATLEAST(1, 8) #define QSV_HAVE_VCM QSV_VERSION_ATLEAST(1, 8) @@ -79,11 +80,10 @@ typedef struct QSVEncContext { QSVFrame *work_frames; mfxSession session; - QSVSession internal_qs; + mfxSession internal_session; int packet_size; int width_align; - int height_align; mfxVideoParam param; mfxFrameAllocRequest req; @@ -104,6 +104,8 @@ typedef struct QSVEncContext { AVFifoBuffer *async_fifo; + QSVFramesContext frames_ctx; + // options set by the caller int async_depth; int idr_interval; diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c index f5b01bb99252d..7ff1a98b4fa28 100644 --- a/libavcodec/qsvenc_h264.c +++ b/libavcodec/qsvenc_h264.c @@ -111,8 +111,7 @@ static const AVOption options[] = { { "look_ahead", "Use VBR algorithm with look ahead", OFFSET(qsv.look_ahead), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE }, { "look_ahead_depth", "Depth of look ahead in number frames", OFFSET(qsv.look_ahead_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, VE }, #endif - -#if QSV_VERSION_ATLEAST(1,8) +#if QSV_HAVE_LA_DS { "look_ahead_downsampling", NULL, OFFSET(qsv.look_ahead_downsampling), AV_OPT_TYPE_INT, { .i64 = MFX_LOOKAHEAD_DS_UNKNOWN }, MFX_LOOKAHEAD_DS_UNKNOWN, MFX_LOOKAHEAD_DS_2x, VE, "look_ahead_downsampling" }, { "unknown" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_LOOKAHEAD_DS_UNKNOWN }, INT_MIN, INT_MAX, VE, "look_ahead_downsampling" }, { "off" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_LOOKAHEAD_DS_OFF }, INT_MIN, INT_MAX, VE, "look_ahead_downsampling" }, From 4e7a7a96cfc8654a4bf5d3b6c249113ea5ade295 Mon Sep 17 00:00:00 2001 From: Mark Thompson Date: Sat, 29 Oct 2016 21:26:40 +0100 Subject: [PATCH 022/102] qsvdec: Avoid probing with qsv decoders Set the AV_CODEC_CAP_AVOID_PROBING flag on all of the qsv decoders. --- libavcodec/qsvdec_h2645.c | 4 ++-- libavcodec/qsvdec_mpeg2.c | 2 +- libavcodec/qsvdec_vc1.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/qsvdec_h2645.c b/libavcodec/qsvdec_h2645.c index df86eea746ba6..94fbd07fb9bcc 100644 --- a/libavcodec/qsvdec_h2645.c +++ b/libavcodec/qsvdec_h2645.c @@ -266,7 +266,7 @@ AVCodec ff_hevc_qsv_decoder = { .decode = qsv_decode_frame, .flush = qsv_decode_flush, .close = qsv_decode_close, - .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1, + .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_AVOID_PROBING, .priv_class = &hevc_class, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12, AV_PIX_FMT_QSV, @@ -304,7 +304,7 @@ AVCodec ff_h264_qsv_decoder = { .decode = qsv_decode_frame, .flush = qsv_decode_flush, .close = qsv_decode_close, - .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1, + .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_AVOID_PROBING, .priv_class = &class, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12, AV_PIX_FMT_QSV, diff --git a/libavcodec/qsvdec_mpeg2.c b/libavcodec/qsvdec_mpeg2.c index c08065751ccd1..e558ca0183af1 100644 --- a/libavcodec/qsvdec_mpeg2.c +++ b/libavcodec/qsvdec_mpeg2.c @@ -171,7 +171,7 @@ AVCodec ff_mpeg2_qsv_decoder = { .decode = qsv_decode_frame, .flush = qsv_decode_flush, .close = qsv_decode_close, - .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1, + .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_AVOID_PROBING, .priv_class = &class, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12, AV_PIX_FMT_QSV, diff --git a/libavcodec/qsvdec_vc1.c b/libavcodec/qsvdec_vc1.c index f7b1fb093b2a6..70a47b1e5a257 100644 --- a/libavcodec/qsvdec_vc1.c +++ b/libavcodec/qsvdec_vc1.c @@ -168,7 +168,7 @@ AVCodec ff_vc1_qsv_decoder = { .decode = qsv_decode_frame, .flush = qsv_decode_flush, .close = qsv_decode_close, - .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1, + .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_AVOID_PROBING, .priv_class = &class, .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12, AV_PIX_FMT_QSV, From 5d542936680e1f3b67bd48265fc56c9227436e48 Mon Sep 17 00:00:00 2001 From: Kyle Schwarz Date: Sat, 18 Jun 2016 00:33:12 -0400 Subject: [PATCH 023/102] avcodec/qsv: remove MFX_EXTBUFF_CODING_OPTION3 4th generation Intel CPUs don't support MFX_EXTBUFF_CODING_OPTION3. This patch fixes bug #5324. --- libavcodec/qsvenc.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 84eba4191e86d..7445d5b1220e3 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -134,9 +134,6 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q, #if QSV_HAVE_CO2 mfxExtCodingOption2 *co2 = (mfxExtCodingOption2*)coding_opts[1]; #endif -#if QSV_HAVE_CO3 - mfxExtCodingOption3 *co3 = (mfxExtCodingOption3*)coding_opts[2]; -#endif av_log(avctx, AV_LOG_VERBOSE, "profile: %s; level: %"PRIu16"\n", print_profile(info->CodecProfile), info->CodecLevel); @@ -188,12 +185,6 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q, info->ICQQuality, co2->LookAheadDepth); } #endif -#if QSV_HAVE_QVBR - else if (info->RateControlMethod == MFX_RATECONTROL_QVBR) { - av_log(avctx, AV_LOG_VERBOSE, "QVBRQuality: %"PRIu16"\n", - co3->QVBRQuality); - } -#endif av_log(avctx, AV_LOG_VERBOSE, "NumSlice: %"PRIu16"; NumRefFrame: %"PRIu16"\n", info->NumSlice, info->NumRefFrame); @@ -573,21 +564,12 @@ static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q) .Header.BufferSz = sizeof(co2), }; #endif -#if QSV_HAVE_CO3 - mfxExtCodingOption3 co3 = { - .Header.BufferId = MFX_EXTBUFF_CODING_OPTION3, - .Header.BufferSz = sizeof(co3), - }; -#endif mfxExtBuffer *ext_buffers[] = { (mfxExtBuffer*)&extradata, (mfxExtBuffer*)&co, #if QSV_HAVE_CO2 (mfxExtBuffer*)&co2, -#endif -#if QSV_HAVE_CO3 - (mfxExtBuffer*)&co3, #endif }; From 5a123f1424feb7299d9e5138112cdcea80a48cb7 Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Sun, 30 Oct 2016 03:07:44 -0400 Subject: [PATCH 024/102] vf_colorspace: Add support for iec61966-2.4 (xvYCC) transfer Signed-off-by: Vittorio Giovara Reviewed-by: "Ronald S. Bultje" Signed-off-by: Michael Niedermayer --- libavfilter/vf_colorspace.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c index 930aa951f1a5f..d26f658591391 100644 --- a/libavfilter/vf_colorspace.c +++ b/libavfilter/vf_colorspace.c @@ -232,6 +232,7 @@ static const struct TransferCharacteristics transfer_characteristics[AVCOL_TRC_N [AVCOL_TRC_SMPTE170M] = { 1.099, 0.018, 0.45, 4.5 }, [AVCOL_TRC_SMPTE240M] = { 1.1115, 0.0228, 0.45, 4.0 }, [AVCOL_TRC_IEC61966_2_1] = { 1.055, 0.0031308, 1.0 / 2.4, 12.92 }, + [AVCOL_TRC_IEC61966_2_4] = { 1.099, 0.018, 0.45, 4.5 }, [AVCOL_TRC_BT2020_10] = { 1.099, 0.018, 0.45, 4.5 }, [AVCOL_TRC_BT2020_12] = { 1.0993, 0.0181, 0.45, 4.5 }, }; @@ -1078,6 +1079,8 @@ static const AVOption colorspace_options[] = { ENUM("smpte240m", AVCOL_TRC_SMPTE240M, "trc"), ENUM("srgb", AVCOL_TRC_IEC61966_2_1, "trc"), ENUM("iec61966-2-1", AVCOL_TRC_IEC61966_2_1, "trc"), + ENUM("xvycc", AVCOL_TRC_IEC61966_2_4, "trc"), + ENUM("iec61966-2-4", AVCOL_TRC_IEC61966_2_4, "trc"), ENUM("bt2020-10", AVCOL_TRC_BT2020_10, "trc"), ENUM("bt2020-12", AVCOL_TRC_BT2020_12, "trc"), From e167610794db8f2202f9dbe013c54f6b34d7f7a0 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 31 Oct 2016 23:01:09 +0100 Subject: [PATCH 025/102] avcodec/rscc: Fix constant Signed-off-by: Michael Niedermayer --- libavcodec/rscc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/rscc.c b/libavcodec/rscc.c index 7eb8776886beb..d01f05c022eea 100644 --- a/libavcodec/rscc.c +++ b/libavcodec/rscc.c @@ -314,7 +314,7 @@ static int rscc_decode_frame(AVCodecContext *avctx, void *data, const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); - if (pal && size == AV_PKT_DATA_PALETTE) { + if (pal && size == AVPALETTE_SIZE) { frame->palette_has_changed = 1; memcpy(ctx->pal, pal, AVPALETTE_SIZE); } else if (pal) { From 979bca513424879ed0c653cb1b55fc4156a89576 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 30 Oct 2016 15:12:12 +0100 Subject: [PATCH 026/102] avcodec/tscc: Check side data size before use Fixes out of array read Signed-off-by: Michael Niedermayer --- libavcodec/tscc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/tscc.c b/libavcodec/tscc.c index bd5fe035cf002..cb86b584c1dd1 100644 --- a/libavcodec/tscc.c +++ b/libavcodec/tscc.c @@ -98,11 +98,14 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, /* make the palette available on the way out */ if (c->avctx->pix_fmt == AV_PIX_FMT_PAL8) { - const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); + int size; + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); - if (pal) { + if (pal && size == AVPALETTE_SIZE) { frame->palette_has_changed = 1; memcpy(c->pal, pal, AVPALETTE_SIZE); + } else if (pal) { + av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size); } memcpy(frame->data[1], c->pal, AVPALETTE_SIZE); } From 140f48b90fbe32a88423aad473bccc72c3bb450e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 30 Oct 2016 15:12:12 +0100 Subject: [PATCH 027/102] avcodec/smc: Check side data size before use Fixes out of array read Signed-off-by: Michael Niedermayer --- libavcodec/smc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/smc.c b/libavcodec/smc.c index 69d78ad1d1a8d..89524219f8a5e 100644 --- a/libavcodec/smc.c +++ b/libavcodec/smc.c @@ -431,7 +431,8 @@ static int smc_decode_frame(AVCodecContext *avctx, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; SmcContext *s = avctx->priv_data; - const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); + int pal_size; + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size); int ret; bytestream2_init(&s->gb, buf, buf_size); @@ -439,9 +440,11 @@ static int smc_decode_frame(AVCodecContext *avctx, if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) return ret; - if (pal) { + if (pal && pal_size == AVPALETTE_SIZE) { s->frame->palette_has_changed = 1; memcpy(s->pal, pal, AVPALETTE_SIZE); + } else if (pal) { + av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", pal_size); } smc_decode_stream(s); From 60178e78f2fe9a7bfb9da0abc985835e2ebfd2f1 Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Sun, 30 Oct 2016 21:18:20 +0100 Subject: [PATCH 028/102] interplayacm: increase bitstream buffer size by AV_INPUT_BUFFER_PADDING_SIZE This fixes out-of-bounds reads by the bitstream reader. Reviewed-by: Paul B Mahol Signed-off-by: Andreas Cadhalpun --- libavcodec/interplayacm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/interplayacm.c b/libavcodec/interplayacm.c index 032053103a9cc..c897e72bb629f 100644 --- a/libavcodec/interplayacm.c +++ b/libavcodec/interplayacm.c @@ -77,7 +77,7 @@ static av_cold int decode_init(AVCodecContext *avctx) s->block = av_calloc(s->block_len, sizeof(int)); s->wrapbuf = av_calloc(s->wrapbuf_len, sizeof(int)); s->ampbuf = av_calloc(0x10000, sizeof(int)); - s->bitstream = av_calloc(s->max_framesize, sizeof(*s->bitstream)); + s->bitstream = av_calloc(s->max_framesize + AV_INPUT_BUFFER_PADDING_SIZE / sizeof(*s->bitstream) + 1, sizeof(*s->bitstream)); if (!s->block || !s->wrapbuf || !s->ampbuf || !s->bitstream) return AVERROR(ENOMEM); From f73a3aacbb871666b5fb2867e45921444b93e7e1 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Tue, 1 Nov 2016 11:31:39 +0100 Subject: [PATCH 029/102] lavf/mov: Only search for invalid moov in free if compliance < STRICT. --- libavformat/mov.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index 414007e7aa128..b4806f754e6da 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -4884,6 +4884,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) a.type = avio_rl32(pb); if (a.type == MKTAG('f','r','e','e') && a.size >= 8 && + c->fc->strict_std_compliance < FF_COMPLIANCE_STRICT && c->moov_retry) { uint8_t buf[8]; uint32_t *type = (uint32_t *)buf + 1; From 1a65d2a3ccc2a07e2da19d47c987e1e5a0bd77c6 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sun, 30 Oct 2016 00:25:12 +0200 Subject: [PATCH 030/102] lavfi/mergeplanes: Fix >8 bit for big endian formats and yuv4xxp16le. Fixes part of ticket #5916. --- libavfilter/vf_mergeplanes.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_mergeplanes.c b/libavfilter/vf_mergeplanes.c index 8128f33704447..c4948cc8c8134 100644 --- a/libavfilter/vf_mergeplanes.c +++ b/libavfilter/vf_mergeplanes.c @@ -192,9 +192,9 @@ static int config_output(AVFilterLink *outlink) outlink->sample_aspect_ratio = ctx->inputs[0]->sample_aspect_ratio; s->planewidth[1] = - s->planewidth[2] = AV_CEIL_RSHIFT(outlink->w, s->outdesc->log2_chroma_w); + s->planewidth[2] = AV_CEIL_RSHIFT(((s->outdesc->comp[1].depth > 8) + 1) * outlink->w, s->outdesc->log2_chroma_w); s->planewidth[0] = - s->planewidth[3] = outlink->w; + s->planewidth[3] = ((s->outdesc->comp[0].depth > 8) + 1) * outlink->w; s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(outlink->h, s->outdesc->log2_chroma_h); s->planeheight[0] = @@ -220,9 +220,9 @@ static int config_output(AVFilterLink *outlink) } inputp->planewidth[1] = - inputp->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, indesc->log2_chroma_w); + inputp->planewidth[2] = AV_CEIL_RSHIFT(((indesc->comp[1].depth > 8) + 1) * inlink->w, indesc->log2_chroma_w); inputp->planewidth[0] = - inputp->planewidth[3] = inlink->w; + inputp->planewidth[3] = ((indesc->comp[0].depth > 8) + 1) * inlink->w; inputp->planeheight[1] = inputp->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, indesc->log2_chroma_h); inputp->planeheight[0] = From bf52730051202f5b4d5f06a399a236268e72e296 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sun, 30 Oct 2016 00:39:19 +0200 Subject: [PATCH 031/102] lavfi/mergeplanes: Fix little endian yuv formats >8 bit and <16bit. Fixes remaining cases of ticket #5916. --- libavfilter/vf_mergeplanes.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavfilter/vf_mergeplanes.c b/libavfilter/vf_mergeplanes.c index c4948cc8c8134..c21104320d136 100644 --- a/libavfilter/vf_mergeplanes.c +++ b/libavfilter/vf_mergeplanes.c @@ -122,6 +122,7 @@ static int query_formats(AVFilterContext *ctx) for (i = 0; av_pix_fmt_desc_get(i); i++) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(i); if (desc->comp[0].depth == s->outdesc->comp[0].depth && + (desc->comp[0].depth <= 8 || (desc->flags & AV_PIX_FMT_FLAG_BE) == (s->outdesc->flags & AV_PIX_FMT_FLAG_BE)) && av_pix_fmt_count_planes(i) == desc->nb_components && (ret = ff_add_format(&formats, i)) < 0) return ret; From 584f509a4b9eeff375d99483bf55d7a1faa5d9aa Mon Sep 17 00:00:00 2001 From: Martin Vignali Date: Mon, 24 Oct 2016 23:00:23 +0200 Subject: [PATCH 032/102] fate filter metadata : add test for aphasemeter - Test a mono file (in phase) -> 1. as result - Test a out of phase 1000 Hz -> -1. as result Signed-off-by: Michael Niedermayer --- tests/fate/filter-video.mak | 8 ++++++ .../filter-metadata-avf-aphase-meter-mono | 25 +++++++++++++++++++ ...ter-metadata-avf-aphase-meter-out-of-phase | 25 +++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 tests/ref/fate/filter-metadata-avf-aphase-meter-mono create mode 100644 tests/ref/fate/filter-metadata-avf-aphase-meter-out-of-phase diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak index ec22d25e4513e..a9094b43949a5 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -663,6 +663,14 @@ FATE_METADATA_FILTER-$(call ALLYES, $(READVITC_METADATA_DEPS)) += fate-filter-me fate-filter-metadata-readvitc-thr: SRC = $(TARGET_SAMPLES)/filter/sample-vitc.avi fate-filter-metadata-readvitc-thr: CMD = run $(FILTER_METADATA_COMMAND) "movie='$(SRC)',readvitc=thr_b=0.3:thr_w=0.5" +AVF_PHASE_METER_DEPS = FFPROBE AVDEVICE LAVFI_INDEV AMOVIE_FILTER FLAC_DEMUXER FLAC_DECODER SINE_FILTER APHASEMETER_FILTER +FATE_METADATA_FILTER-$(call ALLYES, $(AVF_PHASE_METER_DEPS)) += fate-filter-metadata-avf-aphase-meter-mono +fate-filter-metadata-avf-aphase-meter-mono: CMD = run $(FILTER_METADATA_COMMAND) sine="frequency=1000:sample_rate=48000:duration=1,aphasemeter" + +FATE_METADATA_FILTER-$(call ALLYES, $(AVF_PHASE_METER_DEPS)) += fate-filter-metadata-avf-aphase-meter-out-of-phase +fate-filter-metadata-avf-aphase-meter-out-of-phase: SRC = $(TARGET_SAMPLES)/filter/out-of-phase-1000hz.flac +fate-filter-metadata-avf-aphase-meter-out-of-phase: CMD = run $(FILTER_METADATA_COMMAND) "amovie='$(SRC)',aphasemeter" + tests/data/file4560-override2rotate0.mov: TAG = GEN tests/data/file4560-override2rotate0.mov: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \ diff --git a/tests/ref/fate/filter-metadata-avf-aphase-meter-mono b/tests/ref/fate/filter-metadata-avf-aphase-meter-mono new file mode 100644 index 0000000000000..3c7237504004d --- /dev/null +++ b/tests/ref/fate/filter-metadata-avf-aphase-meter-mono @@ -0,0 +1,25 @@ +pkt_pts=0|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=1920|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=3840|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=5760|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=7680|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=9600|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=11520|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=13440|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=15360|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=17280|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=19200|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=21120|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=23040|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=24960|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=26880|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=28800|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=30720|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=32640|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=34560|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=36480|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=38400|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=40320|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=42240|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=44160|tag:lavfi.aphasemeter.phase=1.000000 +pkt_pts=46080|tag:lavfi.aphasemeter.phase=1.000000 diff --git a/tests/ref/fate/filter-metadata-avf-aphase-meter-out-of-phase b/tests/ref/fate/filter-metadata-avf-aphase-meter-out-of-phase new file mode 100644 index 0000000000000..425b2aea3b944 --- /dev/null +++ b/tests/ref/fate/filter-metadata-avf-aphase-meter-out-of-phase @@ -0,0 +1,25 @@ +pkt_pts=0|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=1920|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=3840|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=5760|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=7680|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=9600|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=11520|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=13440|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=15360|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=17280|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=19200|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=21120|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=23040|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=24960|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=26880|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=28800|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=30720|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=32640|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=34560|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=36480|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=38400|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=40320|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=42240|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=44160|tag:lavfi.aphasemeter.phase=-1.000000 +pkt_pts=46080|tag:lavfi.aphasemeter.phase=-1.000000 From 6089c44a2af1394bb34257814ba50e05b84112ec Mon Sep 17 00:00:00 2001 From: Adriano Pallavicino Date: Tue, 1 Nov 2016 13:42:27 +0100 Subject: [PATCH 033/102] Fix build warnings due to misleading indentation Signed-off-by: Michael Niedermayer --- libavcodec/mpegvideo.c | 54 +++++++++++++++++++-------------------- libavformat/matroskaenc.c | 20 +++++++-------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index eb14b8c9c12cf..9a17a6e25c8e8 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -940,37 +940,37 @@ av_cold int ff_mpv_common_init(MpegEncContext *s) if (!s->new_picture.f) goto fail; - if (init_context_frame(s)) - goto fail; + if (init_context_frame(s)) + goto fail; - s->parse_context.state = -1; + s->parse_context.state = -1; - s->context_initialized = 1; - memset(s->thread_context, 0, sizeof(s->thread_context)); - s->thread_context[0] = s; + s->context_initialized = 1; + memset(s->thread_context, 0, sizeof(s->thread_context)); + s->thread_context[0] = s; // if (s->width && s->height) { - if (nb_slices > 1) { - for (i = 0; i < nb_slices; i++) { - if (i) { - s->thread_context[i] = av_memdup(s, sizeof(MpegEncContext)); - if (!s->thread_context[i]) - goto fail; - } - if (init_duplicate_context(s->thread_context[i]) < 0) + if (nb_slices > 1) { + for (i = 0; i < nb_slices; i++) { + if (i) { + s->thread_context[i] = av_memdup(s, sizeof(MpegEncContext)); + if (!s->thread_context[i]) goto fail; - s->thread_context[i]->start_mb_y = - (s->mb_height * (i) + nb_slices / 2) / nb_slices; - s->thread_context[i]->end_mb_y = - (s->mb_height * (i + 1) + nb_slices / 2) / nb_slices; } - } else { - if (init_duplicate_context(s) < 0) + if (init_duplicate_context(s->thread_context[i]) < 0) goto fail; - s->start_mb_y = 0; - s->end_mb_y = s->mb_height; + s->thread_context[i]->start_mb_y = + (s->mb_height * (i) + nb_slices / 2) / nb_slices; + s->thread_context[i]->end_mb_y = + (s->mb_height * (i + 1) + nb_slices / 2) / nb_slices; } - s->slice_context_count = nb_slices; + } else { + if (init_duplicate_context(s) < 0) + goto fail; + s->start_mb_y = 0; + s->end_mb_y = s->mb_height; + } + s->slice_context_count = nb_slices; // } return 0; @@ -1090,10 +1090,10 @@ int ff_mpv_common_frame_size_change(MpegEncContext *s) } if ((err = init_duplicate_context(s->thread_context[i])) < 0) goto fail; - s->thread_context[i]->start_mb_y = - (s->mb_height * (i) + nb_slices / 2) / nb_slices; - s->thread_context[i]->end_mb_y = - (s->mb_height * (i + 1) + nb_slices / 2) / nb_slices; + s->thread_context[i]->start_mb_y = + (s->mb_height * (i) + nb_slices / 2) / nb_slices; + s->thread_context[i]->end_mb_y = + (s->mb_height * (i + 1) + nb_slices / 2) / nb_slices; } } else { err = init_duplicate_context(s); diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index d91055f89ef5e..57041193a1a63 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -755,16 +755,16 @@ static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, if (!par->codec_tag) par->codec_tag = ff_codec_get_tag(ff_codec_movvideo_tags, par->codec_id); - if ( ff_codec_get_id(ff_codec_movvideo_tags, par->codec_tag) == par->codec_id - && (!par->extradata_size || ff_codec_get_id(ff_codec_movvideo_tags, AV_RL32(par->extradata + 4)) != par->codec_id) - ) { - int i; - avio_wb32(dyn_cp, 0x5a + par->extradata_size); - avio_wl32(dyn_cp, par->codec_tag); - for(i = 0; i < 0x5a - 8; i++) - avio_w8(dyn_cp, 0); - } - avio_write(dyn_cp, par->extradata, par->extradata_size); + if ( ff_codec_get_id(ff_codec_movvideo_tags, par->codec_tag) == par->codec_id + && (!par->extradata_size || ff_codec_get_id(ff_codec_movvideo_tags, AV_RL32(par->extradata + 4)) != par->codec_id) + ) { + int i; + avio_wb32(dyn_cp, 0x5a + par->extradata_size); + avio_wl32(dyn_cp, par->codec_tag); + for(i = 0; i < 0x5a - 8; i++) + avio_w8(dyn_cp, 0); + } + avio_write(dyn_cp, par->extradata, par->extradata_size); } else { if (!ff_codec_get_tag(ff_codec_bmp_tags, par->codec_id)) av_log(s, AV_LOG_WARNING, "codec %s is not supported by this format\n", From 9d83b209d8861f1daf55f6719b1e0c226ed7269a Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Tue, 1 Nov 2016 01:05:01 +0100 Subject: [PATCH 034/102] mov: immediately return from mov_fix_index without old index entries If there are no index entries, e_old = st->index_entries is only one byte large, since it was created by av_realloc called with size 0. Thus accessing e_old[0].timestamp causes a heap buffer overflow. Reviewed-by: Sasi Inguva Signed-off-by: Andreas Cadhalpun --- libavformat/mov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index b4806f754e6da..4222088315628 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2961,7 +2961,7 @@ static void mov_fix_index(MOVContext *mov, AVStream *st) int first_non_zero_audio_edit = -1; int packet_skip_samples = 0; - if (!msc->elst_data || msc->elst_count <= 0) { + if (!msc->elst_data || msc->elst_count <= 0 || nb_old <= 0) { return; } // Clean AVStream from traces of old index From e0c6b32046f4bab7d34be77dd2f03b2a80c86d39 Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Tue, 1 Nov 2016 17:06:51 +0100 Subject: [PATCH 035/102] apngdec: use side data to pass extradata to the decoder Fixes remuxing apng streams coming from the apng demuxer. This is a regression since 940b8908b94404a65f9f55e33efb4ccc6c81383c. Found-by: James Almer Reviewed-by: James Almer Signed-off-by: Andreas Cadhalpun --- libavcodec/pngdec.c | 23 ++++++++++++-- libavformat/apngdec.c | 73 +++++++++++++++++++++++++++++-------------- 2 files changed, 70 insertions(+), 26 deletions(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 36275ae43f58a..83eeb8d322aef 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -45,6 +45,9 @@ typedef struct PNGDecContext { ThreadFrame last_picture; ThreadFrame picture; + uint8_t* extra_data; + int extra_data_size; + int state; int width, height; int cur_w, cur_h; @@ -1361,14 +1364,28 @@ static int decode_frame_apng(AVCodecContext *avctx, p = s->picture.f; if (!(s->state & PNG_IHDR)) { - if (!avctx->extradata_size) + int side_data_size = 0; + uint8_t *side_data = NULL; + if (avpkt) + side_data = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &side_data_size); + + if (side_data_size) { + av_freep(&s->extra_data); + s->extra_data = av_mallocz(side_data_size + AV_INPUT_BUFFER_PADDING_SIZE); + if (!s->extra_data) + return AVERROR(ENOMEM); + s->extra_data_size = side_data_size; + memcpy(s->extra_data, side_data, s->extra_data_size); + } + + if (!s->extra_data_size) return AVERROR_INVALIDDATA; /* only init fields, there is no zlib use in extradata */ s->zstream.zalloc = ff_png_zalloc; s->zstream.zfree = ff_png_zfree; - bytestream2_init(&s->gb, avctx->extradata, avctx->extradata_size); + bytestream2_init(&s->gb, s->extra_data, s->extra_data_size); if ((ret = decode_frame_common(avctx, s, p, avpkt)) < 0) goto end; } @@ -1494,6 +1511,8 @@ static av_cold int png_dec_end(AVCodecContext *avctx) s->last_row_size = 0; av_freep(&s->tmp_row); s->tmp_row_size = 0; + av_freep(&s->extra_data); + s->extra_data_size = 0; return 0; } diff --git a/libavformat/apngdec.c b/libavformat/apngdec.c index bb17896ee50ef..07a21e6d43669 100644 --- a/libavformat/apngdec.c +++ b/libavformat/apngdec.c @@ -49,6 +49,10 @@ typedef struct APNGDemuxContext { int is_key_frame; + uint8_t *extra_data; + int extra_data_size; + int extra_data_updated; + /* * loop options */ @@ -122,9 +126,9 @@ static int apng_probe(AVProbeData *p) return AVPROBE_SCORE_MAX; } -static int append_extradata(AVCodecParameters *par, AVIOContext *pb, int len) +static int append_extradata(APNGDemuxContext *ctx, AVIOContext *pb, int len) { - int previous_size = par->extradata_size; + int previous_size = ctx->extra_data_size; int new_size, ret; uint8_t *new_extradata; @@ -132,18 +136,30 @@ static int append_extradata(AVCodecParameters *par, AVIOContext *pb, int len) return AVERROR_INVALIDDATA; new_size = previous_size + len; - new_extradata = av_realloc(par->extradata, new_size + AV_INPUT_BUFFER_PADDING_SIZE); + new_extradata = av_realloc(ctx->extra_data, new_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!new_extradata) return AVERROR(ENOMEM); - par->extradata = new_extradata; - par->extradata_size = new_size; + ctx->extra_data = new_extradata; + ctx->extra_data_size = new_size; - if ((ret = avio_read(pb, par->extradata + previous_size, len)) < 0) + if ((ret = avio_read(pb, ctx->extra_data + previous_size, len)) < 0) return ret; return previous_size; } +static int send_extradata(APNGDemuxContext *ctx, AVPacket *pkt) +{ + if (!ctx->extra_data_updated) { + uint8_t *side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, ctx->extra_data_size); + if (!side_data) + return AVERROR(ENOMEM); + memcpy(side_data, ctx->extra_data, ctx->extra_data_size); + ctx->extra_data_updated = 1; + } + return 0; +} + static int apng_read_header(AVFormatContext *s) { APNGDemuxContext *ctx = s->priv_data; @@ -178,15 +194,15 @@ static int apng_read_header(AVFormatContext *s) return ret; /* extradata will contain every chunk up to the first fcTL (excluded) */ - st->codecpar->extradata = av_malloc(len + 12 + AV_INPUT_BUFFER_PADDING_SIZE); - if (!st->codecpar->extradata) + ctx->extra_data = av_malloc(len + 12 + AV_INPUT_BUFFER_PADDING_SIZE); + if (!ctx->extra_data) return AVERROR(ENOMEM); - st->codecpar->extradata_size = len + 12; - AV_WB32(st->codecpar->extradata, len); - AV_WL32(st->codecpar->extradata+4, tag); - AV_WB32(st->codecpar->extradata+8, st->codecpar->width); - AV_WB32(st->codecpar->extradata+12, st->codecpar->height); - if ((ret = avio_read(pb, st->codecpar->extradata+16, 9)) < 0) + ctx->extra_data_size = len + 12; + AV_WB32(ctx->extra_data, len); + AV_WL32(ctx->extra_data+4, tag); + AV_WB32(ctx->extra_data+8, st->codecpar->width); + AV_WB32(ctx->extra_data+12, st->codecpar->height); + if ((ret = avio_read(pb, ctx->extra_data+16, 9)) < 0) goto fail; while (!avio_feof(pb)) { @@ -218,11 +234,11 @@ static int apng_read_header(AVFormatContext *s) switch (tag) { case MKTAG('a', 'c', 'T', 'L'): if ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0 || - (ret = append_extradata(st->codecpar, pb, len + 12)) < 0) + (ret = append_extradata(ctx, pb, len + 12)) < 0) goto fail; acTL_found = 1; - ctx->num_frames = AV_RB32(st->codecpar->extradata + ret + 8); - ctx->num_play = AV_RB32(st->codecpar->extradata + ret + 12); + ctx->num_frames = AV_RB32(ctx->extra_data + ret + 8); + ctx->num_play = AV_RB32(ctx->extra_data + ret + 12); av_log(s, AV_LOG_DEBUG, "num_frames: %"PRIu32", num_play: %"PRIu32"\n", ctx->num_frames, ctx->num_play); break; @@ -236,15 +252,15 @@ static int apng_read_header(AVFormatContext *s) return 0; default: if ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0 || - (ret = append_extradata(st->codecpar, pb, len + 12)) < 0) + (ret = append_extradata(ctx, pb, len + 12)) < 0) goto fail; } } fail: - if (st->codecpar->extradata_size) { - av_freep(&st->codecpar->extradata); - st->codecpar->extradata_size = 0; + if (ctx->extra_data_size) { + av_freep(&ctx->extra_data); + ctx->extra_data_size = 0; } return ret; } @@ -393,16 +409,16 @@ static int apng_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->pts = ctx->pkt_pts; pkt->duration = ctx->pkt_duration; ctx->pkt_pts += ctx->pkt_duration; - return ret; + return send_extradata(ctx, pkt); case MKTAG('I', 'E', 'N', 'D'): ctx->cur_loop++; if (ctx->ignore_loop || ctx->num_play >= 1 && ctx->cur_loop == ctx->num_play) { avio_seek(pb, -8, SEEK_CUR); return AVERROR_EOF; } - if ((ret = avio_seek(pb, s->streams[0]->codecpar->extradata_size + 8, SEEK_SET)) < 0) + if ((ret = avio_seek(pb, ctx->extra_data_size + 8, SEEK_SET)) < 0) return ret; - return 0; + return send_extradata(ctx, pkt); default: { char tag_buf[32]; @@ -417,6 +433,14 @@ static int apng_read_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR_PATCHWELCOME; } +static int apng_read_close(AVFormatContext *s) +{ + APNGDemuxContext *ctx = s->priv_data; + av_freep(&ctx->extra_data); + ctx->extra_data_size = 0; + return 0; +} + static const AVOption options[] = { { "ignore_loop", "ignore loop setting" , offsetof(APNGDemuxContext, ignore_loop), AV_OPT_TYPE_BOOL, { .i64 = 1 } , 0, 1 , AV_OPT_FLAG_DECODING_PARAM }, @@ -442,6 +466,7 @@ AVInputFormat ff_apng_demuxer = { .read_probe = apng_probe, .read_header = apng_read_header, .read_packet = apng_read_packet, + .read_close = apng_read_close, .flags = AVFMT_GENERIC_INDEX, .priv_class = &demuxer_class, }; From 719c15aa9ad6983200b78e5dbc17443f649c8af9 Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Tue, 1 Nov 2016 17:36:47 +0100 Subject: [PATCH 036/102] fate: add streamcopy test for apng Reviewed-by: James Almer Signed-off-by: Andreas Cadhalpun --- tests/lavf-regression.sh | 3 +++ tests/ref/lavf/apng | 3 +++ 2 files changed, 6 insertions(+) diff --git a/tests/lavf-regression.sh b/tests/lavf-regression.sh index 941f4d1ddd5e1..12954d5044ca9 100755 --- a/tests/lavf-regression.sh +++ b/tests/lavf-regression.sh @@ -216,6 +216,9 @@ if [ -n "$do_apng" ] ; then file=${outfile}lavf.apng do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -t 1 -pix_fmt rgb24 do_avconv_crc $file $DEC_OPTS -i $target_path/$file -pix_fmt rgb24 +file_copy=${outfile}lavf.copy.apng +do_avconv $file_copy $DEC_OPTS -i $file $ENC_OPTS -c copy +do_avconv_crc $file_copy $DEC_OPTS -i $target_path/$file_copy file=${outfile}lavf.png do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -pix_fmt rgb24 -frames:v 1 -f apng do_avconv_crc $file $DEC_OPTS -i $target_path/$file -pix_fmt rgb24 diff --git a/tests/ref/lavf/apng b/tests/ref/lavf/apng index 4d354089ab937..8e9e5e6b73dcb 100644 --- a/tests/ref/lavf/apng +++ b/tests/ref/lavf/apng @@ -1,6 +1,9 @@ a4c46fad7716ad094eb3c78b74ca0244 *./tests/data/lavf/lavf.apng 6209864 ./tests/data/lavf/lavf.apng ./tests/data/lavf/lavf.apng CRC=0x87b3c15f +a4c46fad7716ad094eb3c78b74ca0244 *./tests/data/lavf/lavf.copy.apng +6209864 ./tests/data/lavf/lavf.copy.apng +./tests/data/lavf/lavf.copy.apng CRC=0x87b3c15f c5900fdd1b2fc30b985793f5226fd0c4 *./tests/data/lavf/lavf.png 248854 ./tests/data/lavf/lavf.png ./tests/data/lavf/lavf.png CRC=0xd8c7b7a1 From 7ddfa0be6298d1713b809eadbc91820bca1a99be Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 1 Nov 2016 02:31:10 +0100 Subject: [PATCH 037/102] avcodec/dnxhdenc: Fix alignment of edge_buf* Signed-off-by: Michael Niedermayer --- libavcodec/dnxhdenc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/dnxhdenc.h b/libavcodec/dnxhdenc.h index 91ef6d06022fd..eb9da12deefca 100644 --- a/libavcodec/dnxhdenc.h +++ b/libavcodec/dnxhdenc.h @@ -71,8 +71,8 @@ typedef struct DNXHDEncContext { int intra_quant_bias; DECLARE_ALIGNED(16, int16_t, blocks)[8][64]; - uint8_t edge_buf_y[256]; - uint8_t edge_buf_uv[2][128]; + DECLARE_ALIGNED(16, uint8_t, edge_buf_y)[256]; + DECLARE_ALIGNED(16, uint8_t, edge_buf_uv)[2][128]; int (*qmatrix_c) [64]; int (*qmatrix_l) [64]; From 1a956c64c8eff5edecb004fc7aafd21207e6485c Mon Sep 17 00:00:00 2001 From: rogerdpack Date: Tue, 25 Oct 2016 18:33:12 -0600 Subject: [PATCH 038/102] img2 encoder: allow %t in filename, based on patch from Yuval Adam Signed-off-by: rogerdpack Signed-off-by: Michael Niedermayer --- doc/muxers.texi | 13 +++++++++++++ libavformat/avformat.h | 3 ++- libavformat/hlsenc.c | 6 +++--- libavformat/img2enc.c | 6 ++++-- libavformat/utils.c | 42 ++++++++++++++++++++++++++++++++++++++---- 5 files changed, 60 insertions(+), 10 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 0d856dbf79c2a..0c3a19847dd67 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -619,6 +619,12 @@ If the pattern contains "%d" or "%0@var{N}d", the first filename of the file list specified will contain the number 1, all the following numbers will be sequential. +If the pattern contains "%t", the frame's timestamps will be inserted +in the filename like "00.00.00.000" for hours, minutes, seconds, +and milliseconds. + +The "%t" and "%d" patterns may be used simultaneously. + The pattern may contain a suffix which is used to automatically determine the format of the image files to write. @@ -664,6 +670,13 @@ can be used: ffmpeg -f v4l2 -r 1 -i /dev/video0 -f image2 -strftime 1 "%Y-%m-%d_%H-%M-%S.jpg" @end example +The following example uses the timestamp parameter to generate one +image file per video frame from the input, and name it including its original +timestamp. +@example +ffmpeg -i in.avi -vsync vfr -copyts img-%t.jpg +@end example + @subsection Options @table @option diff --git a/libavformat/avformat.h b/libavformat/avformat.h index f9f4d725f5dd3..7f396980bd538 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -2780,10 +2780,11 @@ void av_dump_format(AVFormatContext *ic, * @param path numbered sequence string * @param number frame number * @param flags AV_FRAME_FILENAME_FLAGS_* + * @param ts frame timestamp in AV_TIME_BASE fractional seconds. * @return 0 if OK, -1 on format error */ int av_get_frame_filename2(char *buf, int buf_size, - const char *path, int number, int flags); + const char *path, int number, int flags, int64_t ts); int av_get_frame_filename(char *buf, int buf_size, const char *path, int number); diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 9ca2df7bf29f2..02d8d444c728e 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -654,7 +654,7 @@ static int hls_start(AVFormatContext *s) } else if (c->max_seg_size > 0) { if (av_get_frame_filename2(oc->filename, sizeof(oc->filename), c->basename, c->wrap ? c->sequence % c->wrap : c->sequence, - AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) { + AV_FRAME_FILENAME_FLAGS_MULTIPLE, 0) < 0) { av_log(oc, AV_LOG_ERROR, "Invalid segment filename template '%s', you can try to use -use_localtime 1 with it\n", c->basename); return AVERROR(EINVAL); } @@ -685,14 +685,14 @@ static int hls_start(AVFormatContext *s) } } else if (av_get_frame_filename2(oc->filename, sizeof(oc->filename), c->basename, c->wrap ? c->sequence % c->wrap : c->sequence, - AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) { + AV_FRAME_FILENAME_FLAGS_MULTIPLE, 0) < 0) { av_log(oc, AV_LOG_ERROR, "Invalid segment filename template '%s' you can try to use -use_localtime 1 with it\n", c->basename); return AVERROR(EINVAL); } if( c->vtt_basename) { if (av_get_frame_filename2(vtt_oc->filename, sizeof(vtt_oc->filename), c->vtt_basename, c->wrap ? c->sequence % c->wrap : c->sequence, - AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) { + AV_FRAME_FILENAME_FLAGS_MULTIPLE, 0) < 0) { av_log(vtt_oc, AV_LOG_ERROR, "Invalid segment filename template '%s'\n", c->vtt_basename); return AVERROR(EINVAL); } diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c index 1297b1aaba5f8..69dbebe8616fb 100644 --- a/libavformat/img2enc.c +++ b/libavformat/img2enc.c @@ -80,10 +80,12 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) VideoMuxData *img = s->priv_data; AVIOContext *pb[4]; char filename[1024]; - AVCodecParameters *par = s->streams[pkt->stream_index]->codecpar; + AVStream *stream = s->streams[ pkt->stream_index ]; + AVCodecParameters *par = stream->codecpar; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(par->format); int i; int nb_renames = 0; + int64_t ts = av_rescale_q(pkt->pts, stream->time_base, AV_TIME_BASE_Q); if (!img->is_pipe) { if (img->update) { @@ -99,7 +101,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) } } else if (av_get_frame_filename2(filename, sizeof(filename), img->path, img->img_number, - AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0 && + AV_FRAME_FILENAME_FLAGS_MULTIPLE, ts) < 0 && img->img_number > 1) { av_log(s, AV_LOG_ERROR, "Could not get frame filename number %d from pattern '%s' (either set updatefirst or use a pattern like %%03d within the filename pattern)\n", diff --git a/libavformat/utils.c b/libavformat/utils.c index 31572f3807c6b..b6a7461d199a9 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4379,15 +4379,18 @@ uint64_t ff_ntp_time(void) return (av_gettime() / 1000) * 1000 + NTP_OFFSET_US; } -int av_get_frame_filename2(char *buf, int buf_size, const char *path, int number, int flags) +int av_get_frame_filename2(char *buf, int buf_size, const char *path, int number, int flags, int64_t ts) { const char *p; char *q, buf1[20], c; - int nd, len, percentd_found; + int nd, len, percentd_found, percentt_found; + int hours, mins, secs, ms; + int64_t abs_ts; q = buf; p = path; percentd_found = 0; + percentt_found = 0; for (;;) { c = *p++; if (c == '\0') @@ -4416,6 +4419,37 @@ int av_get_frame_filename2(char *buf, int buf_size, const char *path, int number memcpy(q, buf1, len); q += len; break; + case 't': + if (!(flags & AV_FRAME_FILENAME_FLAGS_MULTIPLE) && percentt_found) { + av_log(NULL, AV_LOG_ERROR, "double %%t not allowed"); + goto fail; + } + if (ts == 0) { + av_log(NULL, AV_LOG_DEBUG, "%%t but no ts, using 0"); // necessary for first frame on some streams + } + percentt_found = 1; + abs_ts = llabs(ts); + ms = abs_ts % AV_TIME_BASE; + abs_ts /= AV_TIME_BASE; + secs = abs_ts % 60; + abs_ts /= 60; + mins = abs_ts % 60; + abs_ts /= 60; + hours = abs_ts; + if (ts < 0) + snprintf(buf1, sizeof(buf1), + "-%02d.%02d.%02d.%03d", hours, mins, secs, ms); + else + snprintf(buf1, sizeof(buf1), + "%02d.%02d.%02d.%03d", hours, mins, secs, ms); + len = strlen(buf1); + if ((q - buf + len) > buf_size - 1) { + av_log(NULL, AV_LOG_ERROR, "%%t size overflow"); + goto fail; + } + memcpy(q, buf1, len); + q += len; + break; default: goto fail; } @@ -4425,7 +4459,7 @@ int av_get_frame_filename2(char *buf, int buf_size, const char *path, int number *q++ = c; } } - if (!percentd_found) + if (!percentd_found && !percentt_found) goto fail; *q = '\0'; return 0; @@ -4436,7 +4470,7 @@ int av_get_frame_filename2(char *buf, int buf_size, const char *path, int number int av_get_frame_filename(char *buf, int buf_size, const char *path, int number) { - return av_get_frame_filename2(buf, buf_size, path, number, 0); + return av_get_frame_filename2(buf, buf_size, path, number, 0, 0); } void av_url_split(char *proto, int proto_size, From 8459e6fd122715365a4d8b613d88298b3c4acdd7 Mon Sep 17 00:00:00 2001 From: rogerdpack Date: Tue, 25 Oct 2016 18:33:30 -0600 Subject: [PATCH 039/102] img2 encoder: use more descriptive vsync names Signed-off-by: rogerdpack Signed-off-by: Michael Niedermayer --- doc/muxers.texi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 0c3a19847dd67..ef2116a7f6ae4 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -641,7 +641,7 @@ The following example shows how to use @command{ffmpeg} for creating a sequence of files @file{img-001.jpeg}, @file{img-002.jpeg}, ..., taking one image every second from the input video: @example -ffmpeg -i in.avi -vsync 1 -r 1 -f image2 'img-%03d.jpeg' +ffmpeg -i in.avi -vsync cfr -r 1 -f image2 'img-%03d.jpeg' @end example Note that with @command{ffmpeg}, if the format is not specified with the @@ -649,12 +649,12 @@ Note that with @command{ffmpeg}, if the format is not specified with the format, the image2 muxer is automatically selected, so the previous command can be written as: @example -ffmpeg -i in.avi -vsync 1 -r 1 'img-%03d.jpeg' +ffmpeg -i in.avi -vsync cfr -r 1 'img-%03d.jpeg' @end example Note also that the pattern must not necessarily contain "%d" or "%0@var{N}d", for example to create a single image file -@file{img.jpeg} from the input video you can employ the command: +@file{img.jpeg} from the start of the input video you can employ the command: @example ffmpeg -i in.avi -f image2 -frames:v 1 img.jpeg @end example From 2996604acda448fcba057ddc9259f95538fdb2b1 Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Tue, 1 Nov 2016 17:37:23 -0400 Subject: [PATCH 040/102] vf_colorspace: Add support for ycgco color space Signed-off-by: Vittorio Giovara Signed-off-by: Ronald S. Bultje --- libavfilter/vf_colorspace.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c index d26f658591391..7e0bafad23785 100644 --- a/libavfilter/vf_colorspace.c +++ b/libavfilter/vf_colorspace.c @@ -175,6 +175,13 @@ typedef struct ColorSpaceContext { // FIXME dithering if bitdepth goes down? // FIXME bitexact for fate integration? +static const double ycgco_matrix[3][3] = +{ + { 0.25, 0.5, 0.25 }, + { -0.25, 0.5, -0.25 }, + { 0.5, 0, -0.5 }, +}; + /* * All constants explained in e.g. https://linuxtv.org/downloads/v4l-dvb-apis/ch02s06.html * The older ones (bt470bg/m) are also explained in their respective ITU docs @@ -187,6 +194,7 @@ static const struct LumaCoefficients luma_coefficients[AVCOL_SPC_NB] = { [AVCOL_SPC_SMPTE170M] = { 0.299, 0.587, 0.114 }, [AVCOL_SPC_BT709] = { 0.2126, 0.7152, 0.0722 }, [AVCOL_SPC_SMPTE240M] = { 0.212, 0.701, 0.087 }, + [AVCOL_SPC_YCOCG] = { 0.25, 0.5, 0.25 }, [AVCOL_SPC_BT2020_NCL] = { 0.2627, 0.6780, 0.0593 }, [AVCOL_SPC_BT2020_CL] = { 0.2627, 0.6780, 0.0593 }, }; @@ -209,6 +217,12 @@ static void fill_rgb2yuv_table(const struct LumaCoefficients *coeffs, { double bscale, rscale; + // special ycgco matrix + if (coeffs->cr == 0.25 && coeffs->cg == 0.5 && coeffs->cb == 0.25) { + memcpy(rgb2yuv, ycgco_matrix, sizeof(double) * 9); + return; + } + rgb2yuv[0][0] = coeffs->cr; rgb2yuv[0][1] = coeffs->cg; rgb2yuv[0][2] = coeffs->cb; @@ -1047,6 +1061,7 @@ static const AVOption colorspace_options[] = { ENUM("bt470bg", AVCOL_SPC_BT470BG, "csp"), ENUM("smpte170m", AVCOL_SPC_SMPTE170M, "csp"), ENUM("smpte240m", AVCOL_SPC_SMPTE240M, "csp"), + ENUM("ycgco", AVCOL_SPC_YCGCO, "csp"), ENUM("bt2020ncl", AVCOL_SPC_BT2020_NCL, "csp"), { "range", "Output color range", From 4697f6044489d9a528eac823c7ae216bc431f38a Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Tue, 1 Nov 2016 17:38:13 -0400 Subject: [PATCH 041/102] vf_colorspace: Add support for smpte 431/432 (dci/display p3) primaries Signed-off-by: Vittorio Giovara Signed-off-by: Ronald S. Bultje --- libavfilter/vf_colorspace.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c index 7e0bafad23785..4265aa14ec5ca 100644 --- a/libavfilter/vf_colorspace.c +++ b/libavfilter/vf_colorspace.c @@ -56,6 +56,7 @@ enum Colorspace { enum Whitepoint { WP_D65, WP_C, + WP_DCI, WP_NB, }; @@ -268,6 +269,7 @@ static const struct TransferCharacteristics * static const struct WhitepointCoefficients whitepoint_coefficients[WP_NB] = { [WP_D65] = { 0.3127, 0.3290 }, [WP_C] = { 0.3100, 0.3160 }, + [WP_DCI] = { 0.3140, 0.3510 }, }; static const struct ColorPrimaries color_primaries[AVCOL_PRI_NB] = { @@ -276,6 +278,8 @@ static const struct ColorPrimaries color_primaries[AVCOL_PRI_NB] = { [AVCOL_PRI_BT470BG] = { WP_D65, 0.640, 0.330, 0.290, 0.600, 0.150, 0.060,}, [AVCOL_PRI_SMPTE170M] = { WP_D65, 0.630, 0.340, 0.310, 0.595, 0.155, 0.070 }, [AVCOL_PRI_SMPTE240M] = { WP_D65, 0.630, 0.340, 0.310, 0.595, 0.155, 0.070 }, + [AVCOL_PRI_SMPTE431] = { WP_DCI, 0.680, 0.320, 0.265, 0.690, 0.150, 0.060 }, + [AVCOL_PRI_SMPTE432] = { WP_D65, 0.680, 0.320, 0.265, 0.690, 0.150, 0.060 }, [AVCOL_PRI_BT2020] = { WP_D65, 0.708, 0.292, 0.170, 0.797, 0.131, 0.046 }, }; @@ -1080,6 +1084,8 @@ static const AVOption colorspace_options[] = { ENUM("bt470bg", AVCOL_PRI_BT470BG, "prm"), ENUM("smpte170m", AVCOL_PRI_SMPTE170M, "prm"), ENUM("smpte240m", AVCOL_PRI_SMPTE240M, "prm"), + ENUM("smpte431", AVCOL_PRI_SMPTE431, "prm"), + ENUM("smpte432", AVCOL_PRI_SMPTE432, "prm"), ENUM("bt2020", AVCOL_PRI_BT2020, "prm"), { "trc", "Output transfer characteristics", From 6f2ad32a167ce4e0fd9ac8b38054a297c6463067 Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Tue, 1 Nov 2016 17:36:50 -0400 Subject: [PATCH 042/102] vf_colorspace: Add support for film primaries Signed-off-by: Vittorio Giovara Signed-off-by: Ronald S. Bultje --- libavfilter/vf_colorspace.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c index 4265aa14ec5ca..c7a2286813a23 100644 --- a/libavfilter/vf_colorspace.c +++ b/libavfilter/vf_colorspace.c @@ -280,6 +280,7 @@ static const struct ColorPrimaries color_primaries[AVCOL_PRI_NB] = { [AVCOL_PRI_SMPTE240M] = { WP_D65, 0.630, 0.340, 0.310, 0.595, 0.155, 0.070 }, [AVCOL_PRI_SMPTE431] = { WP_DCI, 0.680, 0.320, 0.265, 0.690, 0.150, 0.060 }, [AVCOL_PRI_SMPTE432] = { WP_D65, 0.680, 0.320, 0.265, 0.690, 0.150, 0.060 }, + [AVCOL_PRI_FILM] = { WP_C, 0.681, 0.319, 0.243, 0.692, 0.145, 0.049 }, [AVCOL_PRI_BT2020] = { WP_D65, 0.708, 0.292, 0.170, 0.797, 0.131, 0.046 }, }; @@ -1084,6 +1085,7 @@ static const AVOption colorspace_options[] = { ENUM("bt470bg", AVCOL_PRI_BT470BG, "prm"), ENUM("smpte170m", AVCOL_PRI_SMPTE170M, "prm"), ENUM("smpte240m", AVCOL_PRI_SMPTE240M, "prm"), + ENUM("film", AVCOL_PRI_FILM, "prm"), ENUM("smpte431", AVCOL_PRI_SMPTE431, "prm"), ENUM("smpte432", AVCOL_PRI_SMPTE432, "prm"), ENUM("bt2020", AVCOL_PRI_BT2020, "prm"), From 2b09a3ad19520bc3ae9adcff5506ac1f628406b4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 1 Nov 2016 22:58:01 +0100 Subject: [PATCH 043/102] Revert "img2 encoder: allow %t in filename, based on patch from Yuval Adam" breaks API Found-by: jamrial This reverts commit 1a956c64c8eff5edecb004fc7aafd21207e6485c. --- doc/muxers.texi | 13 ------------- libavformat/avformat.h | 3 +-- libavformat/hlsenc.c | 6 +++--- libavformat/img2enc.c | 6 ++---- libavformat/utils.c | 42 ++++-------------------------------------- 5 files changed, 10 insertions(+), 60 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index ef2116a7f6ae4..1b9abcd5e71e6 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -619,12 +619,6 @@ If the pattern contains "%d" or "%0@var{N}d", the first filename of the file list specified will contain the number 1, all the following numbers will be sequential. -If the pattern contains "%t", the frame's timestamps will be inserted -in the filename like "00.00.00.000" for hours, minutes, seconds, -and milliseconds. - -The "%t" and "%d" patterns may be used simultaneously. - The pattern may contain a suffix which is used to automatically determine the format of the image files to write. @@ -670,13 +664,6 @@ can be used: ffmpeg -f v4l2 -r 1 -i /dev/video0 -f image2 -strftime 1 "%Y-%m-%d_%H-%M-%S.jpg" @end example -The following example uses the timestamp parameter to generate one -image file per video frame from the input, and name it including its original -timestamp. -@example -ffmpeg -i in.avi -vsync vfr -copyts img-%t.jpg -@end example - @subsection Options @table @option diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 7f396980bd538..f9f4d725f5dd3 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -2780,11 +2780,10 @@ void av_dump_format(AVFormatContext *ic, * @param path numbered sequence string * @param number frame number * @param flags AV_FRAME_FILENAME_FLAGS_* - * @param ts frame timestamp in AV_TIME_BASE fractional seconds. * @return 0 if OK, -1 on format error */ int av_get_frame_filename2(char *buf, int buf_size, - const char *path, int number, int flags, int64_t ts); + const char *path, int number, int flags); int av_get_frame_filename(char *buf, int buf_size, const char *path, int number); diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 02d8d444c728e..9ca2df7bf29f2 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -654,7 +654,7 @@ static int hls_start(AVFormatContext *s) } else if (c->max_seg_size > 0) { if (av_get_frame_filename2(oc->filename, sizeof(oc->filename), c->basename, c->wrap ? c->sequence % c->wrap : c->sequence, - AV_FRAME_FILENAME_FLAGS_MULTIPLE, 0) < 0) { + AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) { av_log(oc, AV_LOG_ERROR, "Invalid segment filename template '%s', you can try to use -use_localtime 1 with it\n", c->basename); return AVERROR(EINVAL); } @@ -685,14 +685,14 @@ static int hls_start(AVFormatContext *s) } } else if (av_get_frame_filename2(oc->filename, sizeof(oc->filename), c->basename, c->wrap ? c->sequence % c->wrap : c->sequence, - AV_FRAME_FILENAME_FLAGS_MULTIPLE, 0) < 0) { + AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) { av_log(oc, AV_LOG_ERROR, "Invalid segment filename template '%s' you can try to use -use_localtime 1 with it\n", c->basename); return AVERROR(EINVAL); } if( c->vtt_basename) { if (av_get_frame_filename2(vtt_oc->filename, sizeof(vtt_oc->filename), c->vtt_basename, c->wrap ? c->sequence % c->wrap : c->sequence, - AV_FRAME_FILENAME_FLAGS_MULTIPLE, 0) < 0) { + AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) { av_log(vtt_oc, AV_LOG_ERROR, "Invalid segment filename template '%s'\n", c->vtt_basename); return AVERROR(EINVAL); } diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c index 69dbebe8616fb..1297b1aaba5f8 100644 --- a/libavformat/img2enc.c +++ b/libavformat/img2enc.c @@ -80,12 +80,10 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) VideoMuxData *img = s->priv_data; AVIOContext *pb[4]; char filename[1024]; - AVStream *stream = s->streams[ pkt->stream_index ]; - AVCodecParameters *par = stream->codecpar; + AVCodecParameters *par = s->streams[pkt->stream_index]->codecpar; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(par->format); int i; int nb_renames = 0; - int64_t ts = av_rescale_q(pkt->pts, stream->time_base, AV_TIME_BASE_Q); if (!img->is_pipe) { if (img->update) { @@ -101,7 +99,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) } } else if (av_get_frame_filename2(filename, sizeof(filename), img->path, img->img_number, - AV_FRAME_FILENAME_FLAGS_MULTIPLE, ts) < 0 && + AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0 && img->img_number > 1) { av_log(s, AV_LOG_ERROR, "Could not get frame filename number %d from pattern '%s' (either set updatefirst or use a pattern like %%03d within the filename pattern)\n", diff --git a/libavformat/utils.c b/libavformat/utils.c index b6a7461d199a9..31572f3807c6b 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4379,18 +4379,15 @@ uint64_t ff_ntp_time(void) return (av_gettime() / 1000) * 1000 + NTP_OFFSET_US; } -int av_get_frame_filename2(char *buf, int buf_size, const char *path, int number, int flags, int64_t ts) +int av_get_frame_filename2(char *buf, int buf_size, const char *path, int number, int flags) { const char *p; char *q, buf1[20], c; - int nd, len, percentd_found, percentt_found; - int hours, mins, secs, ms; - int64_t abs_ts; + int nd, len, percentd_found; q = buf; p = path; percentd_found = 0; - percentt_found = 0; for (;;) { c = *p++; if (c == '\0') @@ -4419,37 +4416,6 @@ int av_get_frame_filename2(char *buf, int buf_size, const char *path, int number memcpy(q, buf1, len); q += len; break; - case 't': - if (!(flags & AV_FRAME_FILENAME_FLAGS_MULTIPLE) && percentt_found) { - av_log(NULL, AV_LOG_ERROR, "double %%t not allowed"); - goto fail; - } - if (ts == 0) { - av_log(NULL, AV_LOG_DEBUG, "%%t but no ts, using 0"); // necessary for first frame on some streams - } - percentt_found = 1; - abs_ts = llabs(ts); - ms = abs_ts % AV_TIME_BASE; - abs_ts /= AV_TIME_BASE; - secs = abs_ts % 60; - abs_ts /= 60; - mins = abs_ts % 60; - abs_ts /= 60; - hours = abs_ts; - if (ts < 0) - snprintf(buf1, sizeof(buf1), - "-%02d.%02d.%02d.%03d", hours, mins, secs, ms); - else - snprintf(buf1, sizeof(buf1), - "%02d.%02d.%02d.%03d", hours, mins, secs, ms); - len = strlen(buf1); - if ((q - buf + len) > buf_size - 1) { - av_log(NULL, AV_LOG_ERROR, "%%t size overflow"); - goto fail; - } - memcpy(q, buf1, len); - q += len; - break; default: goto fail; } @@ -4459,7 +4425,7 @@ int av_get_frame_filename2(char *buf, int buf_size, const char *path, int number *q++ = c; } } - if (!percentd_found && !percentt_found) + if (!percentd_found) goto fail; *q = '\0'; return 0; @@ -4470,7 +4436,7 @@ int av_get_frame_filename2(char *buf, int buf_size, const char *path, int number int av_get_frame_filename(char *buf, int buf_size, const char *path, int number) { - return av_get_frame_filename2(buf, buf_size, path, number, 0, 0); + return av_get_frame_filename2(buf, buf_size, path, number, 0); } void av_url_split(char *proto, int proto_size, From 5a51ca2da7b76cad2a86476590c18b26a98eafbe Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Wed, 2 Nov 2016 01:55:40 +0100 Subject: [PATCH 044/102] lavc/hapenc: Use the correct printf length modifier for size_t arguments. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the following warning: libavcodec/hapenc.c:122:20: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘size_t’ [-Wformat] Based on a patch by Diego Biurrun. --- libavcodec/hapenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/hapenc.c b/libavcodec/hapenc.c index cb5dcfac56ff5..c09a639932502 100644 --- a/libavcodec/hapenc.c +++ b/libavcodec/hapenc.c @@ -118,7 +118,7 @@ static int hap_compress_frame(AVCodecContext *avctx, uint8_t *dst) /* If there is no gain from snappy, just use the raw texture. */ if (chunk->compressed_size >= chunk->uncompressed_size) { av_log(avctx, AV_LOG_VERBOSE, - "Snappy buffer bigger than uncompressed (%lu >= %lu bytes).\n", + "Snappy buffer bigger than uncompressed (%"SIZE_SPECIFIER" >= %"SIZE_SPECIFIER" bytes).\n", chunk->compressed_size, chunk->uncompressed_size); memcpy(chunk_dst, chunk_src, chunk->uncompressed_size); chunk->compressor = HAP_COMP_NONE; From 8e6478b723affe4d44f94d34b98e0c47f6a0b411 Mon Sep 17 00:00:00 2001 From: Rodger Combs Date: Wed, 26 Oct 2016 22:03:02 -0500 Subject: [PATCH 045/102] lavf/segment: fix autobsf --- libavformat/segment.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/libavformat/segment.c b/libavformat/segment.c index 868f0a81dadf3..9b3dc178ebbd7 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -798,9 +798,26 @@ static int seg_write_header(AVFormatContext *s) { SegmentContext *seg = s->priv_data; AVFormatContext *oc = seg->avf; - int ret; + int ret, i; if (!seg->header_written) { + for (i = 0; i < s->nb_streams; i++) { + AVStream *st = oc->streams[i]; + AVCodecParameters *ipar, *opar; + + ipar = s->streams[i]->codecpar; + opar = oc->streams[i]->codecpar; + avcodec_parameters_copy(opar, ipar); + if (!oc->oformat->codec_tag || + av_codec_get_id (oc->oformat->codec_tag, ipar->codec_tag) == opar->codec_id || + av_codec_get_tag(oc->oformat->codec_tag, ipar->codec_id) <= 0) { + opar->codec_tag = ipar->codec_tag; + } else { + opar->codec_tag = 0; + } + st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio; + st->time_base = s->streams[i]->time_base; + } ret = avformat_write_header(oc, NULL); if (ret < 0) return ret; @@ -978,6 +995,25 @@ static int seg_write_trailer(struct AVFormatContext *s) return ret; } +static int seg_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) +{ + SegmentContext *seg = s->priv_data; + AVFormatContext *oc = seg->avf; + if (oc->oformat->check_bitstream) { + int ret = oc->oformat->check_bitstream(oc, pkt); + if (ret == 1) { + AVStream *st = s->streams[pkt->stream_index]; + AVStream *ost = oc->streams[pkt->stream_index]; + st->internal->bsfcs = ost->internal->bsfcs; + st->internal->nb_bsfcs = ost->internal->nb_bsfcs; + ost->internal->bsfcs = NULL; + ost->internal->nb_bsfcs = 0; + } + return ret; + } + return 1; +} + #define OFFSET(x) offsetof(SegmentContext, x) #define E AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { @@ -1041,6 +1077,7 @@ AVOutputFormat ff_segment_muxer = { .write_packet = seg_write_packet, .write_trailer = seg_write_trailer, .deinit = seg_free, + .check_bitstream = seg_check_bitstream, .priv_class = &seg_class, }; @@ -1061,5 +1098,6 @@ AVOutputFormat ff_stream_segment_muxer = { .write_packet = seg_write_packet, .write_trailer = seg_write_trailer, .deinit = seg_free, + .check_bitstream = seg_check_bitstream, .priv_class = &sseg_class, }; From be28ce210d5674603838e67509fc597f30c1bb1c Mon Sep 17 00:00:00 2001 From: Rodger Combs Date: Thu, 27 Oct 2016 01:09:23 -0500 Subject: [PATCH 046/102] lavf/matroskaenc: fix uninitialized read --- libavformat/matroskaenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 57041193a1a63..56174fff9a2dc 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1547,7 +1547,7 @@ static int mkv_write_attachments(AVFormatContext *s) mkv->attachments = av_mallocz(sizeof(*mkv->attachments)); if (!mkv->attachments) - return ret; + return AVERROR(ENOMEM); av_lfg_init(&c, av_get_random_seed()); From 1a958f4eb0984fada564a5648d211b408ebb8c3d Mon Sep 17 00:00:00 2001 From: Rodger Combs Date: Thu, 27 Oct 2016 01:10:47 -0500 Subject: [PATCH 047/102] lavf/matroskaenc: don't try to modify the header when live-streaming --- libavformat/matroskaenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 56174fff9a2dc..78540fb384967 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1783,7 +1783,7 @@ static int mkv_write_header(AVFormatContext *s) put_ebml_void(pb, 11); // assumes double-precision float to be written } } - if (s->pb->seekable) + if (s->pb->seekable && !mkv->is_live) put_ebml_void(s->pb, avio_tell(pb)); else end_ebml_master_crc32(s->pb, &mkv->info_bc, mkv, mkv->info); @@ -2274,7 +2274,7 @@ static int mkv_write_trailer(AVFormatContext *s) return ret; } - if (pb->seekable) { + if (pb->seekable && !mkv->is_live) { if (mkv->cues->num_entries) { if (mkv->reserve_cues_space) { int64_t cues_end; From d401c37ef5036a12c03d4cbdbbde561d9a7ba4b3 Mon Sep 17 00:00:00 2001 From: Rodger Combs Date: Thu, 27 Oct 2016 01:16:08 -0500 Subject: [PATCH 048/102] tests/fate/avformat: add segment.c tests --- tests/fate/avformat.mak | 56 ++++++++ tests/ref/fate/segment-adts-to-mkv-header-000 | 21 +++ tests/ref/fate/segment-adts-to-mkv-header-001 | 22 +++ tests/ref/fate/segment-adts-to-mkv-header-002 | 9 ++ tests/ref/fate/segment-adts-to-mkv-header-all | 40 ++++++ tests/ref/fate/segment-mp4-to-ts | 132 ++++++++++++++++++ 6 files changed, 280 insertions(+) create mode 100644 tests/ref/fate/segment-adts-to-mkv-header-000 create mode 100644 tests/ref/fate/segment-adts-to-mkv-header-001 create mode 100644 tests/ref/fate/segment-adts-to-mkv-header-002 create mode 100644 tests/ref/fate/segment-adts-to-mkv-header-all create mode 100644 tests/ref/fate/segment-mp4-to-ts diff --git a/tests/fate/avformat.mak b/tests/fate/avformat.mak index bbb1f9811a62a..0a3800b0ea570 100644 --- a/tests/fate/avformat.mak +++ b/tests/fate/avformat.mak @@ -81,3 +81,59 @@ $(FATE_LAVF_FATE): CMD = lavffatetest FATE_SAMPLES_FFMPEG += $(FATE_LAVF_FATE) fate-lavf-fate: $(FATE_LAVF_FATE) + +tests/data/mp4-to-ts.m3u8: TAG = GEN +tests/data/mp4-to-ts.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data + $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \ + -i $(TARGET_SAMPLES)/h264/interlaced_crop.mp4 \ + -f ssegment -segment_time 1 -map 0 -flags +bitexact -codec copy \ + -segment_list $(TARGET_PATH)/$@ -y $(TARGET_PATH)/tests/data/mp4-to-ts-%03d.ts 2>/dev/null + +tests/data/adts-to-mkv.m3u8: TAG = GEN +tests/data/adts-to-mkv.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data + $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \ + -i $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.adts \ + -f segment -segment_time 1 -map 0 -flags +bitexact -codec copy -segment_format_options live=1 \ + -segment_list $(TARGET_PATH)/$@ -y $(TARGET_PATH)/tests/data/adts-to-mkv-%03d.mkv 2>/dev/null + +tests/data/adts-to-mkv-header.mkv: TAG = GEN +tests/data/adts-to-mkv-header.mkv: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data + $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \ + -i $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.adts \ + -f segment -segment_time 1 -map 0 -flags +bitexact -codec copy -segment_format_options live=1 \ + -segment_header_filename $(TARGET_PATH)/tests/data/adts-to-mkv-header.mkv \ + -y $(TARGET_PATH)/tests/data/adts-to-mkv-header-%03d.mkv 2>/dev/null + +tests/data/adts-to-mkv-header-%.mkv: tests/data/adts-to-mkv-header.mkv ; + +FATE_SEGMENT_PARTS += 000 001 002 + +tests/data/adts-to-mkv-cated-all.mkv: TAG = GEN +tests/data/adts-to-mkv-cated-all.mkv: tests/data/adts-to-mkv-header.mkv $(FATE_SEGMENT_PARTS:%=tests/data/adts-to-mkv-header-%.mkv) | tests/data + $(M)cat $^ >$@ + +tests/data/adts-to-mkv-cated-%.mkv: TAG = GEN +tests/data/adts-to-mkv-cated-%.mkv: tests/data/adts-to-mkv-header.mkv tests/data/adts-to-mkv-header-%.mkv | tests/data + $(M)cat $^ >$@ + +FATE_SEGMENT += fate-segment-mp4-to-ts +fate-segment-mp4-to-ts: tests/data/mp4-to-ts.m3u8 +fate-segment-mp4-to-ts: CMD = framecrc -flags +bitexact -i $(TARGET_PATH)/tests/data/mp4-to-ts.m3u8 -c copy +FATE_SEGMENT-$(call ALLYES, MOV_DEMUXER H264_MP4TOANNEXB_BSF MPEGTS_MUXER MATROSKA_DEMUXER SEGMENT_MUXER HLS_DEMUXER) += fate-segment-mp4-to-ts + +FATE_SEGMENT += fate-segment-adts-to-mkv +fate-segment-adts-to-mkv: tests/data/adts-to-mkv.m3u8 +fate-segment-adts-to-mkv: CMD = framecrc -flags +bitexact -i $(TARGET_PATH)/tests/data/adts-to-mkv.m3u8 -c copy +fate-segment-adts-to-mkv: REF = $(SRC_PATH)/tests/ref/fate/segment-adts-to-mkv-header-all +FATE_SEGMENT-$(call ALLYES, AAC_DEMUXER AAC_ADTSTOASC_BSF MATROSKA_MUXER MATROSKA_DEMUXER SEGMENT_MUXER HLS_DEMUXER) += fate-segment-adts-to-mkv + +FATE_SEGMENT_ALLPARTS = $(FATE_SEGMENT_PARTS) +FATE_SEGMENT_ALLPARTS += all +FATE_SEGMENT_SPLIT += $(FATE_SEGMENT_ALLPARTS:%=fate-segment-adts-to-mkv-header-%) +$(foreach N,$(FATE_SEGMENT_ALLPARTS),$(eval $(N:%=fate-segment-adts-to-mkv-header-%): tests/data/adts-to-mkv-cated-$(N).mkv)) +fate-segment-adts-to-mkv-header-%: CMD = framecrc -flags +bitexact -i $(TARGET_PATH)/tests/data/$(@:fate-segment-adts-to-mkv-header-%=adts-to-mkv-cated-%).mkv -c copy +FATE_SEGMENT-$(call ALLYES, AAC_DEMUXER AAC_ADTSTOASC_BSF MATROSKA_MUXER MATROSKA_DEMUXER SEGMENT_MUXER HLS_DEMUXER) += $(FATE_SEGMENT_SPLIT) + +FATE_SAMPLES_FFMPEG += $(FATE_SEGMENT-yes) + +fate-segment: $(FATE_SEGMENT-yes) diff --git a/tests/ref/fate/segment-adts-to-mkv-header-000 b/tests/ref/fate/segment-adts-to-mkv-header-000 new file mode 100644 index 0000000000000..d00e886849923 --- /dev/null +++ b/tests/ref/fate/segment-adts-to-mkv-header-000 @@ -0,0 +1,21 @@ +#extradata 0: 2, 0x0030001c +#tb 0: 1/1000 +#media_type 0: audio +#codec_id 0: aac +#sample_rate 0: 16000 +#channel_layout 0: 4 +0, 0, 0, 64, 4, 0x02f70117 +0, 64, 64, 64, 163, 0xd5f85007 +0, 128, 128, 64, 127, 0x66484065 +0, 192, 192, 64, 94, 0x55222bd6 +0, 256, 256, 64, 314, 0x3c7e923a +0, 320, 320, 64, 207, 0x1efc5d1b +0, 384, 384, 64, 119, 0xb2a13601 +0, 448, 448, 64, 184, 0xcafc6091 +0, 512, 512, 64, 132, 0xddd33c0b +0, 576, 576, 64, 152, 0x83935031 +0, 640, 640, 64, 227, 0x32a86bc4 +0, 704, 704, 64, 122, 0xd04e3571 +0, 768, 768, 64, 163, 0x57d44d16 +0, 832, 832, 64, 147, 0x226043d7 +0, 896, 896, 64, 119, 0x8ad931ed diff --git a/tests/ref/fate/segment-adts-to-mkv-header-001 b/tests/ref/fate/segment-adts-to-mkv-header-001 new file mode 100644 index 0000000000000..87adbb810c51a --- /dev/null +++ b/tests/ref/fate/segment-adts-to-mkv-header-001 @@ -0,0 +1,22 @@ +#extradata 0: 2, 0x0030001c +#tb 0: 1/1000 +#media_type 0: audio +#codec_id 0: aac +#sample_rate 0: 16000 +#channel_layout 0: 4 +0, 0, 0, 64, 153, 0xbb6e432f +0, 64, 64, 64, 185, 0xa01f4ff3 +0, 128, 128, 64, 126, 0x85503ce6 +0, 192, 192, 64, 246, 0x652c7b59 +0, 256, 256, 64, 162, 0xc9f04da0 +0, 320, 320, 64, 135, 0x71fa3be0 +0, 384, 384, 64, 246, 0x7a6f7788 +0, 448, 448, 64, 262, 0xd3097781 +0, 512, 512, 64, 60, 0x09a118f5 +0, 576, 576, 64, 255, 0xbab5793c +0, 640, 640, 64, 153, 0x6b6a44fb +0, 704, 704, 64, 160, 0x550e4530 +0, 768, 768, 64, 215, 0x7fe66144 +0, 832, 832, 64, 144, 0xcd723f7d +0, 896, 896, 64, 187, 0x2a0b5c1b +0, 960, 960, 64, 177, 0xb8c355d5 diff --git a/tests/ref/fate/segment-adts-to-mkv-header-002 b/tests/ref/fate/segment-adts-to-mkv-header-002 new file mode 100644 index 0000000000000..eae15bc4df1dd --- /dev/null +++ b/tests/ref/fate/segment-adts-to-mkv-header-002 @@ -0,0 +1,9 @@ +#extradata 0: 2, 0x0030001c +#tb 0: 1/1000 +#media_type 0: audio +#codec_id 0: aac +#sample_rate 0: 16000 +#channel_layout 0: 4 +0, 0, 0, 64, 156, 0x867d4f3a +0, 64, 64, 64, 201, 0x62745ff9 +0, 128, 128, 64, 137, 0x90c639e0 diff --git a/tests/ref/fate/segment-adts-to-mkv-header-all b/tests/ref/fate/segment-adts-to-mkv-header-all new file mode 100644 index 0000000000000..1f7d7722684e0 --- /dev/null +++ b/tests/ref/fate/segment-adts-to-mkv-header-all @@ -0,0 +1,40 @@ +#extradata 0: 2, 0x0030001c +#tb 0: 1/1000 +#media_type 0: audio +#codec_id 0: aac +#sample_rate 0: 16000 +#channel_layout 0: 4 +0, 0, 0, 64, 4, 0x02f70117 +0, 64, 64, 64, 163, 0xd5f85007 +0, 128, 128, 64, 127, 0x66484065 +0, 192, 192, 64, 94, 0x55222bd6 +0, 256, 256, 64, 314, 0x3c7e923a +0, 320, 320, 64, 207, 0x1efc5d1b +0, 384, 384, 64, 119, 0xb2a13601 +0, 448, 448, 64, 184, 0xcafc6091 +0, 512, 512, 64, 132, 0xddd33c0b +0, 576, 576, 64, 152, 0x83935031 +0, 640, 640, 64, 227, 0x32a86bc4 +0, 704, 704, 64, 122, 0xd04e3571 +0, 768, 768, 64, 163, 0x57d44d16 +0, 832, 832, 64, 147, 0x226043d7 +0, 896, 896, 64, 119, 0x8ad931ed +0, 960, 960, 64, 153, 0xbb6e432f +0, 1024, 1024, 64, 185, 0xa01f4ff3 +0, 1088, 1088, 64, 126, 0x85503ce6 +0, 1152, 1152, 64, 246, 0x652c7b59 +0, 1216, 1216, 64, 162, 0xc9f04da0 +0, 1280, 1280, 64, 135, 0x71fa3be0 +0, 1344, 1344, 64, 246, 0x7a6f7788 +0, 1408, 1408, 64, 262, 0xd3097781 +0, 1472, 1472, 64, 60, 0x09a118f5 +0, 1536, 1536, 64, 255, 0xbab5793c +0, 1600, 1600, 64, 153, 0x6b6a44fb +0, 1664, 1664, 64, 160, 0x550e4530 +0, 1728, 1728, 64, 215, 0x7fe66144 +0, 1792, 1792, 64, 144, 0xcd723f7d +0, 1856, 1856, 64, 187, 0x2a0b5c1b +0, 1920, 1920, 64, 177, 0xb8c355d5 +0, 1984, 1984, 64, 156, 0x867d4f3a +0, 2048, 2048, 64, 201, 0x62745ff9 +0, 2112, 2112, 64, 137, 0x90c639e0 diff --git a/tests/ref/fate/segment-mp4-to-ts b/tests/ref/fate/segment-mp4-to-ts new file mode 100644 index 0000000000000..8513027b9f681 --- /dev/null +++ b/tests/ref/fate/segment-mp4-to-ts @@ -0,0 +1,132 @@ +#extradata 0: 795, 0x395101dc +#tb 0: 1/90000 +#media_type 0: video +#codec_id 0: h264 +#dimensions 0: 640x360 +#sar 0: 1/1 +0, -7200, 0, 0, 22630, 0x9b109541, S=1, 1, 0x00e000e0 +0, -3600, 14400, 0, 4021, 0xbf7cdb02, F=0x0, S=1, 1, 0x00e000e0 +0, 0, 7200, 0, 1096, 0x4f162690, F=0x0, S=1, 1, 0x00e000e0 +0, 3600, 3600, 0, 687, 0x00394b95, F=0x0, S=1, 1, 0x00e000e0 +0, 7200, 10800, 0, 445, 0x08c3d065, F=0x0, S=1, 1, 0x00e000e0 +0, 10800, 28800, 0, 4212, 0x56d12b8f, F=0x0, S=1, 1, 0x00e000e0 +0, 14400, 21600, 0, 1117, 0xd521260b, F=0x0, S=1, 1, 0x00e000e0 +0, 18000, 18000, 0, 892, 0x4262bdbc, F=0x0, S=1, 1, 0x00e000e0 +0, 21600, 25200, 0, 480, 0x3be1ef0b, F=0x0, S=1, 1, 0x00e000e0 +0, 25200, 43200, 0, 4065, 0x40dee237, F=0x0, S=1, 1, 0x00e000e0 +0, 28800, 36000, 0, 962, 0x31a4ceb1, F=0x0, S=1, 1, 0x00e000e0 +0, 32400, 32400, 0, 651, 0xb2aa317a, F=0x0, S=1, 1, 0x00e000e0 +0, 36000, 39600, 0, 543, 0x9c4e0024, F=0x0, S=1, 1, 0x00e000e0 +0, 39600, 57600, 0, 4221, 0x77c23977, F=0x0, S=1, 1, 0x00e000e0 +0, 43200, 50400, 0, 1040, 0x482cfa34, F=0x0, S=1, 1, 0x00e000e0 +0, 46800, 46800, 0, 576, 0x2686136a, F=0x0, S=1, 1, 0x00e000e0 +0, 50400, 54000, 0, 607, 0xc53c2339, F=0x0, S=1, 1, 0x00e000e0 +0, 54000, 72000, 0, 4755, 0x2f642b58, F=0x0, S=1, 1, 0x00e000e0 +0, 57600, 64800, 0, 1182, 0xbe1a4847, F=0x0, S=1, 1, 0x00e000e0 +0, 61200, 61200, 0, 809, 0x8d948a4e, F=0x0, S=1, 1, 0x00e000e0 +0, 64800, 68400, 0, 656, 0x4fa03c2b, F=0x0, S=1, 1, 0x00e000e0 +0, 68400, 86400, 0, 26555, 0x5629b584, S=1, 1, 0x00e000e0 +0, 72000, 79200, 0, 1141, 0x761b31e8, F=0x0, S=1, 1, 0x00e000e0 +0, 75600, 75600, 0, 717, 0x57746351, F=0x0, S=1, 1, 0x00e000e0 +0, 79200, 82800, 0, 693, 0x78b24263, F=0x0, S=1, 1, 0x00e000e0 +0, 82800, 100800, 0, 3417, 0x560dbc89, F=0x0, S=1, 1, 0x00e000e0 +0, 86400, 93600, 0, 1128, 0xc0f1383c, F=0x0, S=1, 1, 0x00e000e0 +0, 90000, 90000, 0, 650, 0xc3ad485e, F=0x0, S=1, 1, 0x00e000e0 +0, 93600, 97200, 0, 766, 0xd3e9757d, F=0x0, S=1, 1, 0x00e000e0 +0, 97200, 115200, 3600, 4268, 0xec1235b5, F=0x0, S=1, 1, 0x00e000e0 +0, 100800, 108000, 3600, 1119, 0x65f51fb7, F=0x0, S=1, 1, 0x00e000e0 +0, 104400, 104400, 3600, 766, 0x213b78d3, F=0x0, S=1, 1, 0x00e000e0 +0, 108000, 111600, 3600, 770, 0xa7537e6d, F=0x0, S=1, 1, 0x00e000e0 +0, 111600, 129600, 3600, 6349, 0xec225cf9, F=0x0, S=1, 1, 0x00e000e0 +0, 115200, 122400, 3600, 1188, 0x9dea396c, F=0x0, S=1, 1, 0x00e000e0 +0, 118800, 118800, 3600, 805, 0xdd9e88d0, F=0x0, S=1, 1, 0x00e000e0 +0, 122400, 126000, 3600, 752, 0x1f93730a, F=0x0, S=1, 1, 0x00e000e0 +0, 126000, 144000, 3600, 5502, 0x501bda5c, F=0x0, S=1, 1, 0x00e000e0 +0, 129600, 136800, 3600, 1240, 0x7e3661ea, F=0x0, S=1, 1, 0x00e000e0 +0, 133200, 133200, 3600, 830, 0xa8249f38, F=0x0, S=1, 1, 0x00e000e0 +0, 136800, 140400, 3600, 754, 0xab1c815e, F=0x0, S=1, 1, 0x00e000e0 +0, 140400, 158400, 3600, 5328, 0xd2c55ac6, F=0x0, S=1, 1, 0x00e000e0 +0, 144000, 151200, 3600, 1271, 0x46006870, F=0x0, S=1, 1, 0x00e000e0 +0, 147600, 147600, 3600, 849, 0x94dc99c7, F=0x0, S=1, 1, 0x00e000e0 +0, 151200, 154800, 3600, 753, 0xf4236cab, F=0x0, S=1, 1, 0x00e000e0 +0, 154800, 172800, 3600, 25825, 0xd5464dee, S=1, 1, 0x00e000e0 +0, 158400, 165600, 3600, 1206, 0x8ce84344, F=0x0, S=1, 1, 0x00e000e0 +0, 162000, 162000, 3600, 867, 0x312fa07d, F=0x0, S=1, 1, 0x00e000e0 +0, 165600, 169200, 3600, 719, 0x810666d1, F=0x0, S=1, 1, 0x00e000e0 +0, 169200, 187200, 3600, 3786, 0xa96a6825, F=0x0, S=1, 1, 0x00e000e0 +0, 172800, 180000, 3600, 1187, 0x77e649a2, F=0x0, S=1, 1, 0x00e000e0 +0, 176400, 176400, 3600, 750, 0x86da6d2e, F=0x0, S=1, 1, 0x00e000e0 +0, 180000, 183600, 3600, 815, 0xf09a9881, F=0x0, S=1, 1, 0x00e000e0 +0, 183600, 201600, 3600, 5275, 0xee3450bb, F=0x0, S=1, 1, 0x00e000e0 +0, 187200, 194400, 3600, 1352, 0x150a96e1, F=0x0, S=1, 1, 0x00e000e0 +0, 190800, 190800, 3600, 877, 0x6062a120, F=0x0, S=1, 1, 0x00e000e0 +0, 194400, 198000, 3600, 829, 0x5180988c, F=0x0, S=1, 1, 0x00e000e0 +0, 198000, 216000, 3600, 4421, 0x623aad33, F=0x0, S=1, 1, 0x00e000e0 +0, 201600, 208800, 3600, 1464, 0xd34dc851, F=0x0, S=1, 1, 0x00e000e0 +0, 205200, 205200, 3600, 903, 0xf63bbed0, F=0x0, S=1, 1, 0x00e000e0 +0, 208800, 212400, 3600, 717, 0xc17054b8, F=0x0, S=1, 1, 0x00e000e0 +0, 212400, 230400, 3600, 4787, 0x75e9400e, F=0x0, S=1, 1, 0x00e000e0 +0, 216000, 223200, 3600, 1435, 0xb01ccabb, F=0x0, S=1, 1, 0x00e000e0 +0, 219600, 219600, 3600, 851, 0x54bda291, F=0x0, S=1, 1, 0x00e000e0 +0, 223200, 226800, 3600, 809, 0x84e37fee, F=0x0, S=1, 1, 0x00e000e0 +0, 226800, 244800, 3600, 4541, 0xd4e5c0de, F=0x0, S=1, 1, 0x00e000e0 +0, 230400, 237600, 3600, 1545, 0x0099fc98, F=0x0, S=1, 1, 0x00e000e0 +0, 234000, 234000, 3600, 929, 0xfd72d049, F=0x0, S=1, 1, 0x00e000e0 +0, 237600, 241200, 3600, 829, 0xcfda9e96, F=0x0, S=1, 1, 0x00e000e0 +0, 241200, 259200, 3600, 24220, 0x5ca21d71, S=1, 1, 0x00e000e0 +0, 244800, 252000, 3600, 1422, 0xcde6cc34, F=0x0, S=1, 1, 0x00e000e0 +0, 248400, 248400, 3600, 883, 0xedacbe25, F=0x0, S=1, 1, 0x00e000e0 +0, 252000, 255600, 3600, 768, 0x89d774bc, F=0x0, S=1, 1, 0x00e000e0 +0, 255600, 273600, 3600, 3802, 0xea1d70d4, F=0x0, S=1, 1, 0x00e000e0 +0, 259200, 266400, 3600, 1284, 0x2c927097, F=0x0, S=1, 1, 0x00e000e0 +0, 262800, 262800, 3600, 745, 0x81076a7f, F=0x0, S=1, 1, 0x00e000e0 +0, 266400, 270000, 3600, 931, 0x3675dbfe, F=0x0, S=1, 1, 0x00e000e0 +0, 270000, 288000, 3600, 4830, 0x7a807a68, F=0x0, S=1, 1, 0x00e000e0 +0, 273600, 280800, 3600, 1446, 0x6224bc81, F=0x0, S=1, 1, 0x00e000e0 +0, 277200, 277200, 3600, 833, 0x56f78ae2, F=0x0, S=1, 1, 0x00e000e0 +0, 280800, 284400, 3600, 873, 0x9caeaf00, F=0x0, S=1, 1, 0x00e000e0 +0, 284400, 302400, 3600, 5167, 0x1703151f, F=0x0, S=1, 1, 0x00e000e0 +0, 288000, 295200, 3600, 1449, 0x0881b0d6, F=0x0, S=1, 1, 0x00e000e0 +0, 291600, 291600, 3600, 866, 0x0bffa719, F=0x0, S=1, 1, 0x00e000e0 +0, 295200, 298800, 3600, 874, 0xc243a65f, F=0x0, S=1, 1, 0x00e000e0 +0, 298800, 316800, 3600, 5426, 0x7c899c30, F=0x0, S=1, 1, 0x00e000e0 +0, 302400, 309600, 3600, 1574, 0x03b00f0d, F=0x0, S=1, 1, 0x00e000e0 +0, 306000, 306000, 3600, 860, 0x65cea74e, F=0x0, S=1, 1, 0x00e000e0 +0, 309600, 313200, 3600, 829, 0xffd795cd, F=0x0, S=1, 1, 0x00e000e0 +0, 313200, 331200, 3600, 5352, 0x59997996, F=0x0, S=1, 1, 0x00e000e0 +0, 316800, 324000, 3600, 1501, 0xb3b8f001, F=0x0, S=1, 1, 0x00e000e0 +0, 320400, 320400, 3600, 941, 0x92b0cb18, F=0x0, S=1, 1, 0x00e000e0 +0, 324000, 327600, 3600, 823, 0x3d548355, F=0x0, S=1, 1, 0x00e000e0 +0, 327600, 345600, 3600, 24042, 0x441e94fb, S=1, 1, 0x00e000e0 +0, 331200, 338400, 3600, 1582, 0x4f5d1049, F=0x0, S=1, 1, 0x00e000e0 +0, 334800, 334800, 3600, 945, 0x4f3cc9e8, F=0x0, S=1, 1, 0x00e000e0 +0, 338400, 342000, 3600, 815, 0x0ca790a4, F=0x0, S=1, 1, 0x00e000e0 +0, 342000, 360000, 3600, 4425, 0x1db2a088, F=0x0, S=1, 1, 0x00e000e0 +0, 345600, 352800, 3600, 1492, 0x881ce798, F=0x0, S=1, 1, 0x00e000e0 +0, 349200, 349200, 3600, 905, 0xbdd9c278, F=0x0, S=1, 1, 0x00e000e0 +0, 352800, 356400, 3600, 870, 0x64fbb0e1, F=0x0, S=1, 1, 0x00e000e0 +0, 356400, 374400, 3600, 5194, 0x138b1e1d, F=0x0, S=1, 1, 0x00e000e0 +0, 360000, 367200, 3600, 1483, 0xc5c9d717, F=0x0, S=1, 1, 0x00e000e0 +0, 363600, 363600, 3600, 977, 0x3648d9fc, F=0x0, S=1, 1, 0x00e000e0 +0, 367200, 370800, 3600, 834, 0x6c5d8969, F=0x0, S=1, 1, 0x00e000e0 +0, 370800, 388800, 3600, 6956, 0x6a548e0b, F=0x0, S=1, 1, 0x00e000e0 +0, 374400, 381600, 3600, 1187, 0x795f4163, F=0x0, S=1, 1, 0x00e000e0 +0, 378000, 378000, 3600, 925, 0x92bfc2fb, F=0x0, S=1, 1, 0x00e000e0 +0, 381600, 385200, 3600, 747, 0xea9978fc, F=0x0, S=1, 1, 0x00e000e0 +0, 385200, 403200, 3600, 5005, 0xc558c189, F=0x0, S=1, 1, 0x00e000e0 +0, 388800, 396000, 3600, 452, 0x7d92d9d8, F=0x0, S=1, 1, 0x00e000e0 +0, 392400, 392400, 3600, 784, 0xfd597a5f, F=0x0, S=1, 1, 0x00e000e0 +0, 396000, 399600, 3600, 199, 0x79b06355, F=0x0, S=1, 1, 0x00e000e0 +0, 399600, 417600, 3600, 1862, 0x22a2a06c, F=0x0, S=1, 1, 0x00e000e0 +0, 403200, 410400, 3600, 359, 0x11bdae52, F=0x0, S=1, 1, 0x00e000e0 +0, 406800, 406800, 3600, 235, 0xbec26964, F=0x0, S=1, 1, 0x00e000e0 +0, 410400, 414000, 3600, 221, 0x8380682c, F=0x0, S=1, 1, 0x00e000e0 +0, 414000, 432000, 3600, 22588, 0xf0ecf072, S=1, 1, 0x00e000e0 +0, 417600, 424800, 3600, 383, 0x4f3bb571, F=0x0, S=1, 1, 0x00e000e0 +0, 421200, 421200, 3600, 257, 0x22e87802, F=0x0, S=1, 1, 0x00e000e0 +0, 424800, 428400, 3600, 261, 0xdb988134, F=0x0, S=1, 1, 0x00e000e0 +0, 428400, 435600, 3600, 156, 0xd2c3406c, F=0x0, S=1, 1, 0x00e000e0 +0, 432000, 439200, 3600, 330, 0x150d9b60, F=0x0, S=1, 1, 0x00e000e0 +0, 435600, 446400, 3600, 324, 0x558194ee, F=0x0, S=1, 1, 0x00e000e0 +0, 439200, 442800, 3600, 191, 0x108e54d1, F=0x0, S=1, 1, 0x00e000e0 +0, 442800, 450000, 3600, 233, 0xac5b6486, F=0x0 From 37138338ff602803d174b13fecd363a083bc2f9a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 1 Nov 2016 19:24:49 +0100 Subject: [PATCH 049/102] avcodec/sunrast: Fix input buffer pointer check Fixes: out of array read Fixes: poc.dat Found-by: Bingchang, Liu @VARAS of IIE Tested-by: bc L Signed-off-by: Michael Niedermayer --- libavcodec/sunrast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c index 25e11f6cd21f9..0af5626e35182 100644 --- a/libavcodec/sunrast.c +++ b/libavcodec/sunrast.c @@ -168,7 +168,7 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data, } } else { for (y = 0; y < h; y++) { - if (buf_end - buf < len) + if (buf_end - buf < alen) break; memcpy(ptr, buf, len); ptr += stride; From 271afd632f4de87db99ec085e75446b648dc6e60 Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Tue, 1 Nov 2016 19:17:37 -0400 Subject: [PATCH 050/102] lavc: Add hevc main10 profile to ffmpeg cli Signed-off-by: Michael Niedermayer --- libavcodec/options_table.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index 995906b977e39..4323ae9d8dcec 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -394,6 +394,7 @@ static const AVOption avcodec_options[] = { {"mpeg4_core", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_MPEG4_CORE }, INT_MIN, INT_MAX, V|E, "profile"}, {"mpeg4_main", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_MPEG4_MAIN }, INT_MIN, INT_MAX, V|E, "profile"}, {"mpeg4_asp", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_MPEG4_ADVANCED_SIMPLE }, INT_MIN, INT_MAX, V|E, "profile"}, +{"main10", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_HEVC_MAIN_10 }, INT_MIN, INT_MAX, V|E, "profile"}, {"level", NULL, OFFSET(level), AV_OPT_TYPE_INT, {.i64 = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"}, {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"}, {"lowres", "decode at 1= 1/2, 2=1/4, 3=1/8 resolutions", OFFSET(lowres), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, V|A|D}, From a566c952f905639456966413fee0b5701867ddcd Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 2 Nov 2016 00:51:52 +0100 Subject: [PATCH 051/102] avformat/mpegtsenc: Add option to mark stream begin as discontinuous This avoids continuity check failures in concatenated streams Reviewed-by: Steven Liu Signed-off-by: Michael Niedermayer --- doc/muxers.texi | 2 ++ libavformat/mpegtsenc.c | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/doc/muxers.texi b/doc/muxers.texi index 1b9abcd5e71e6..488ed431ab189 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -1055,6 +1055,8 @@ Use LATM packetization for AAC. Reemit PAT and PMT at each video frame. @item system_b Conform to System B (DVB) instead of System A (ATSC). +@item initial_discontinuity +Mark the initial packet of each stream as discontinuity. @end table @subsection Example diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 3ad3de705c197..71a66424be3fa 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -46,6 +46,7 @@ typedef struct MpegTSSection { int pid; int cc; + int discontinuity; void (*write_packet)(struct MpegTSSection *s, const uint8_t *packet); void *opaque; } MpegTSSection; @@ -104,6 +105,7 @@ typedef struct MpegTSWrite { #define MPEGTS_FLAG_AAC_LATM 0x02 #define MPEGTS_FLAG_PAT_PMT_AT_FRAMES 0x04 #define MPEGTS_FLAG_SYSTEM_B 0x08 +#define MPEGTS_FLAG_DISCONT 0x10 int flags; int copyts; int tables_version; @@ -153,6 +155,12 @@ static void mpegts_write_section(MpegTSSection *s, uint8_t *buf, int len) *q++ = s->pid; s->cc = s->cc + 1 & 0xf; *q++ = 0x10 | s->cc; + if (s->discontinuity) { + q[-1] |= 0x20; + *q++ = 1; + *q++ = 0x80; + s->discontinuity = 0; + } if (first) *q++ = 0; /* 0 offset */ len1 = TS_PACKET_SIZE - (q - packet); @@ -223,6 +231,7 @@ typedef struct MpegTSWriteStream { struct MpegTSService *service; int pid; /* stream associated pid */ int cc; + int discontinuity; int payload_size; int first_pts_check; ///< first pts check needed int prev_payload_key; @@ -782,6 +791,7 @@ static int mpegts_init(AVFormatContext *s) service->pmt.write_packet = section_write_packet; service->pmt.opaque = s; service->pmt.cc = 15; + service->pmt.discontinuity= ts->flags & MPEGTS_FLAG_DISCONT; } else { for (i = 0; i < s->nb_programs; i++) { AVProgram *program = s->programs[i]; @@ -800,6 +810,7 @@ static int mpegts_init(AVFormatContext *s) service->pmt.write_packet = section_write_packet; service->pmt.opaque = s; service->pmt.cc = 15; + service->pmt.discontinuity= ts->flags & MPEGTS_FLAG_DISCONT; service->program = program; } } @@ -808,11 +819,13 @@ static int mpegts_init(AVFormatContext *s) /* Initialize at 15 so that it wraps and is equal to 0 for the * first packet we write. */ ts->pat.cc = 15; + ts->pat.discontinuity= ts->flags & MPEGTS_FLAG_DISCONT; ts->pat.write_packet = section_write_packet; ts->pat.opaque = s; ts->sdt.pid = SDT_PID; ts->sdt.cc = 15; + ts->sdt.discontinuity= ts->flags & MPEGTS_FLAG_DISCONT; ts->sdt.write_packet = section_write_packet; ts->sdt.opaque = s; @@ -883,6 +896,7 @@ static int mpegts_init(AVFormatContext *s) ts_st->payload_dts = AV_NOPTS_VALUE; ts_st->first_pts_check = 1; ts_st->cc = 15; + ts_st->discontinuity = ts->flags & MPEGTS_FLAG_DISCONT; /* update PCR pid by using the first video stream */ if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && service->pcr_pid == 0x1fff) { @@ -1078,6 +1092,10 @@ static void mpegts_insert_pcr_only(AVFormatContext *s, AVStream *st) /* Continuity Count field does not increment (see 13818-1 section 2.4.3.3) */ *q++ = TS_PACKET_SIZE - 5; /* Adaptation Field Length */ *q++ = 0x10; /* Adaptation flags: PCR present */ + if (ts_st->discontinuity) { + q[-1] |= 0x80; + ts_st->discontinuity = 0; + } /* PCR coded into 6 bytes */ q += write_pcr_bits(q, get_pcr(ts, s->pb)); @@ -1195,6 +1213,11 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st, *q++ = ts_st->pid; ts_st->cc = ts_st->cc + 1 & 0xf; *q++ = 0x10 | ts_st->cc; // payload indicator + CC + if (ts_st->discontinuity) { + set_af_flag(buf, 0x80); + q = get_ts_payload_start(buf); + ts_st->discontinuity = 0; + } if (key && is_start && pts != AV_NOPTS_VALUE) { // set Random Access for key frames if (ts_st->pid == ts_st->service->pcr_pid) @@ -1872,6 +1895,9 @@ static const AVOption options[] = { { "system_b", "Conform to System B (DVB) instead of System A (ATSC)", 0, AV_OPT_TYPE_CONST, { .i64 = MPEGTS_FLAG_SYSTEM_B }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "mpegts_flags" }, + { "initial_discontinuity", "Mark initial packets as discontinuous", + 0, AV_OPT_TYPE_CONST, { .i64 = MPEGTS_FLAG_DISCONT }, 0, INT_MAX, + AV_OPT_FLAG_ENCODING_PARAM, "mpegts_flags" }, // backward compatibility { "resend_headers", "Reemit PAT/PMT before writing the next packet", offsetof(MpegTSWrite, reemit_pat_pmt), AV_OPT_TYPE_INT, From bab6b606752e5ba93f9d2d1b71f264dc8e3031b3 Mon Sep 17 00:00:00 2001 From: James Almer Date: Sat, 15 Oct 2016 11:17:37 -0300 Subject: [PATCH 052/102] avformat/matroskaenc: support writing Chroma Location elements Signed-off-by: James Almer --- libavformat/matroskaenc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 78540fb384967..99f61fe56d056 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -832,6 +832,14 @@ static int mkv_write_video_color(AVIOContext *pb, AVCodecParameters *par, AVStre par->color_range < AVCOL_RANGE_NB) { put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORRANGE, par->color_range); } + if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED && + par->chroma_location <= AVCHROMA_LOC_TOP) { + int xpos, ypos; + + avcodec_enum_to_chroma_pos(&xpos, &ypos, par->chroma_location); + put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORCHROMASITINGHORZ, (xpos >> 7) + 1); + put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORCHROMASITINGVERT, (ypos >> 7) + 1); + } if (side_data_size == sizeof(AVMasteringDisplayMetadata)) { ebml_master meta_element = start_ebml_master( dyn_cp, MATROSKA_ID_VIDEOCOLORMASTERINGMETA, 0); From 5cb57131d3bb2422858467828a5763646f004bbe Mon Sep 17 00:00:00 2001 From: James Almer Date: Sat, 22 Oct 2016 15:56:28 -0300 Subject: [PATCH 053/102] avformat/matroskaenc: use display aspect ratio for DisplayWidth and DisplayHeight when possible This avoids potential rounding errors and guarantees the source aspect ratio is preserved. Keep writing pixel values when Stereo 3D Mode is enabled and for WebM, as the format doesn't support anything else. This fixes ticket #5743, implementing the suggestion from ticket #5903. Signed-off-by: James Almer --- libavformat/matroskaenc.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 99f61fe56d056..2cfeee9529578 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1204,8 +1204,19 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv, return AVERROR(EINVAL); } if (d_width != par->width || display_width_div != 1 || display_height_div != 1) { - put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYWIDTH , d_width / display_width_div); - put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYHEIGHT, par->height / display_height_div); + if (mkv->mode == MODE_WEBM || display_width_div != 1 || display_height_div != 1) { + put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYWIDTH , d_width / display_width_div); + put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYHEIGHT, par->height / display_height_div); + } else { + AVRational display_aspect_ratio; + av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, + par->width * (int64_t)st->sample_aspect_ratio.num, + par->height * (int64_t)st->sample_aspect_ratio.den, + 1024 * 1024); + put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYWIDTH, display_aspect_ratio.num); + put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYHEIGHT, display_aspect_ratio.den); + put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYUNIT, MATROSKA_VIDEO_DISPLAYUNIT_DAR); + } } } else if (display_width_div != 1 || display_height_div != 1) { put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYWIDTH , par->width / display_width_div); From 234d3cbf469e9feef255e229202d4b029e66e9fe Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Sat, 15 Oct 2016 13:30:52 -0700 Subject: [PATCH 054/102] crystalhd: Fix up the missing first sample Why on earth the hardware returns garbage for the first sample of a decoded picture is anyone's guess. The simplest reasonable way to patch it up is to copy the first sample of the second line. This should result in the correct chroma values (because the data was original 4:2:0 upsampled to 4:2:2) even if the luma is isn't. --- libavcodec/crystalhd.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c index 912094088a195..137ed208a4cb2 100644 --- a/libavcodec/crystalhd.c +++ b/libavcodec/crystalhd.c @@ -706,6 +706,15 @@ static inline CopyRet copy_frame(AVCodecContext *avctx, av_log(priv->avctx, AV_LOG_VERBOSE, "CrystalHD: Copying out frame\n"); + /* + * The hardware doesn't return the first sample of a picture. + * Ignoring why it behaves this way, it's better to copy the sample from + * the second line, rather than the next sample across because the chroma + * values should be correct (assuming the decoded video was 4:2:0, which + * it was). + */ + *((uint32_t *)src) = *((uint32_t *)(src + sStride)); + if (interlaced) { int dY = 0; int sY = 0; From b5d714f493946f02b957f57e491321abc816e753 Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Sun, 9 Oct 2016 20:46:38 -0700 Subject: [PATCH 055/102] crystalhd: Switch to new decode API and remove the insanity The new decode API allows for m:n decode patterns, which is what you need to use this hardware in a sane way. There are so many situations where 1:1 doesn't happen naturally that it's a miracle I got it working as well as I did. With this change, we can throw all of the crazy heuristics and sleeps(!) out, and things work correctly. --- Changelog | 1 + libavcodec/crystalhd.c | 480 +++++++++++------------------------------ libavcodec/version.h | 2 +- 3 files changed, 127 insertions(+), 356 deletions(-) diff --git a/Changelog b/Changelog index a3dfb9a6170c1..11a769aa7ef91 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest within each release, releases are sorted from youngest to oldest. version : +- CrystalHD decoder moved to new decode API version 3.2: - libopenmpt demuxer diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c index 137ed208a4cb2..dca58f2c8bd3c 100644 --- a/libavcodec/crystalhd.c +++ b/libavcodec/crystalhd.c @@ -97,10 +97,6 @@ #define OUTPUT_PROC_TIMEOUT 50 /** Step between fake timestamps passed to hardware in units of 100ns */ #define TIMESTAMP_UNIT 100000 -/** Initial value in us of the wait in decode() */ -#define BASE_WAIT 10000 -/** Increment in us to adjust wait in decode() */ -#define WAIT_UNIT 1000 /***************************************************************************** @@ -110,9 +106,6 @@ typedef enum { RET_ERROR = -1, RET_OK = 0, - RET_COPY_AGAIN = 1, - RET_SKIP_NEXT_COPY = 2, - RET_COPY_NEXT_FIELD = 3, } CopyRet; typedef struct OpaqueList { @@ -138,10 +131,7 @@ typedef struct { uint8_t *sps_pps_buf; uint32_t sps_pps_size; uint8_t is_nal; - uint8_t output_ready; uint8_t need_second_field; - uint8_t skip_next_output; - uint64_t decode_wait; uint64_t last_picture; @@ -188,42 +178,42 @@ static inline BC_MEDIA_SUBTYPE id2subtype(CHDContext *priv, enum AVCodecID id) static inline void print_frame_info(CHDContext *priv, BC_DTS_PROC_OUT *output) { - av_log(priv->avctx, AV_LOG_VERBOSE, "\tYBuffSz: %u\n", output->YbuffSz); - av_log(priv->avctx, AV_LOG_VERBOSE, "\tYBuffDoneSz: %u\n", + av_log(priv->avctx, AV_LOG_TRACE, "\tYBuffSz: %u\n", output->YbuffSz); + av_log(priv->avctx, AV_LOG_TRACE, "\tYBuffDoneSz: %u\n", output->YBuffDoneSz); - av_log(priv->avctx, AV_LOG_VERBOSE, "\tUVBuffDoneSz: %u\n", + av_log(priv->avctx, AV_LOG_TRACE, "\tUVBuffDoneSz: %u\n", output->UVBuffDoneSz); - av_log(priv->avctx, AV_LOG_VERBOSE, "\tTimestamp: %"PRIu64"\n", + av_log(priv->avctx, AV_LOG_TRACE, "\tTimestamp: %"PRIu64"\n", output->PicInfo.timeStamp); - av_log(priv->avctx, AV_LOG_VERBOSE, "\tPicture Number: %u\n", + av_log(priv->avctx, AV_LOG_TRACE, "\tPicture Number: %u\n", output->PicInfo.picture_number); - av_log(priv->avctx, AV_LOG_VERBOSE, "\tWidth: %u\n", + av_log(priv->avctx, AV_LOG_TRACE, "\tWidth: %u\n", output->PicInfo.width); - av_log(priv->avctx, AV_LOG_VERBOSE, "\tHeight: %u\n", + av_log(priv->avctx, AV_LOG_TRACE, "\tHeight: %u\n", output->PicInfo.height); - av_log(priv->avctx, AV_LOG_VERBOSE, "\tChroma: 0x%03x\n", + av_log(priv->avctx, AV_LOG_TRACE, "\tChroma: 0x%03x\n", output->PicInfo.chroma_format); - av_log(priv->avctx, AV_LOG_VERBOSE, "\tPulldown: %u\n", + av_log(priv->avctx, AV_LOG_TRACE, "\tPulldown: %u\n", output->PicInfo.pulldown); - av_log(priv->avctx, AV_LOG_VERBOSE, "\tFlags: 0x%08x\n", + av_log(priv->avctx, AV_LOG_TRACE, "\tFlags: 0x%08x\n", output->PicInfo.flags); - av_log(priv->avctx, AV_LOG_VERBOSE, "\tFrame Rate/Res: %u\n", + av_log(priv->avctx, AV_LOG_TRACE, "\tFrame Rate/Res: %u\n", output->PicInfo.frame_rate); - av_log(priv->avctx, AV_LOG_VERBOSE, "\tAspect Ratio: %u\n", + av_log(priv->avctx, AV_LOG_TRACE, "\tAspect Ratio: %u\n", output->PicInfo.aspect_ratio); - av_log(priv->avctx, AV_LOG_VERBOSE, "\tColor Primaries: %u\n", + av_log(priv->avctx, AV_LOG_TRACE, "\tColor Primaries: %u\n", output->PicInfo.colour_primaries); - av_log(priv->avctx, AV_LOG_VERBOSE, "\tMetaData: %u\n", + av_log(priv->avctx, AV_LOG_TRACE, "\tMetaData: %u\n", output->PicInfo.picture_meta_payload); - av_log(priv->avctx, AV_LOG_VERBOSE, "\tSession Number: %u\n", + av_log(priv->avctx, AV_LOG_TRACE, "\tSession Number: %u\n", output->PicInfo.sess_num); - av_log(priv->avctx, AV_LOG_VERBOSE, "\tycom: %u\n", + av_log(priv->avctx, AV_LOG_TRACE, "\tycom: %u\n", output->PicInfo.ycom); - av_log(priv->avctx, AV_LOG_VERBOSE, "\tCustom Aspect: %u\n", + av_log(priv->avctx, AV_LOG_TRACE, "\tCustom Aspect: %u\n", output->PicInfo.custom_aspect_ratio_width_height); - av_log(priv->avctx, AV_LOG_VERBOSE, "\tFrames to Drop: %u\n", + av_log(priv->avctx, AV_LOG_TRACE, "\tFrames to Drop: %u\n", output->PicInfo.n_drop); - av_log(priv->avctx, AV_LOG_VERBOSE, "\tH264 Valid Fields: 0x%08x\n", + av_log(priv->avctx, AV_LOG_TRACE, "\tH264 Valid Fields: 0x%08x\n", output->PicInfo.other.h264.valid); } @@ -319,12 +309,8 @@ static void flush(AVCodecContext *avctx) { CHDContext *priv = avctx->priv_data; - avctx->has_b_frames = 0; priv->last_picture = -1; - priv->output_ready = 0; priv->need_second_field = 0; - priv->skip_next_output = 0; - priv->decode_wait = BASE_WAIT; av_frame_unref (priv->pic); @@ -460,7 +446,6 @@ static av_cold int init(AVCodecContext *avctx) priv->avctx = avctx; priv->is_nal = avctx->extradata_size > 0 && *(avctx->extradata) == 1; priv->last_picture = -1; - priv->decode_wait = BASE_WAIT; priv->pic = av_frame_alloc(); subtype = id2subtype(priv, avctx->codec->id); @@ -759,35 +744,7 @@ FF_ENABLE_DEPRECATION_WARNINGS } } - /* - * Two types of PAFF content have been observed. One form causes the - * hardware to return a field pair and the other individual fields, - * even though the input is always individual fields. We must skip - * copying on the next decode() call to maintain pipeline length in - * the first case. - */ - if (!interlaced && (output->PicInfo.flags & VDEC_FLAG_UNKNOWN_SRC) && - (pic_type == PICT_TOP_FIELD || pic_type == PICT_BOTTOM_FIELD)) { - av_log(priv->avctx, AV_LOG_VERBOSE, "Fieldpair from two packets.\n"); - return RET_SKIP_NEXT_COPY; - } - - /* - * The logic here is purely based on empirical testing with samples. - * If we need a second field, it could come from a second input packet, - * or it could come from the same field-pair input packet at the current - * field. In the first case, we should return and wait for the next time - * round to get the second field, while in the second case, we should - * ask the decoder for it immediately. - * - * Testing has shown that we are dealing with the fieldpair -> two fields - * case if the VDEC_FLAG_UNKNOWN_SRC is not set or if the input picture - * type was PICT_FRAME (in this second case, the flag might still be set) - */ - return priv->need_second_field && - (!(output->PicInfo.flags & VDEC_FLAG_UNKNOWN_SRC) || - pic_type == PICT_FRAME) ? - RET_COPY_NEXT_FIELD : RET_OK; + return RET_OK; } @@ -860,7 +817,7 @@ static inline CopyRet receive_frame(AVCodecContext *avctx, avctx->sample_aspect_ratio = (AVRational) {221, 1}; break; } - return RET_COPY_AGAIN; + return RET_OK; } else if (ret == BC_STS_SUCCESS) { int copy_ret = -1; if (output.PoutFlags & BC_POUT_FLAGS_PIB_VALID) { @@ -878,24 +835,16 @@ static inline CopyRet receive_frame(AVCodecContext *avctx, av_log(avctx, AV_LOG_WARNING, "CrystalHD: Picture Number discontinuity\n"); /* - * Have we lost frames? If so, we need to shrink the - * pipeline length appropriately. - * * XXX: I have no idea what the semantics of this situation * are so I don't even know if we've lost frames or which * ones. - * - * In any case, only warn the first time. */ priv->last_picture = output.PicInfo.picture_number - 1; } copy_ret = copy_frame(avctx, &output, data, got_frame); if (*got_frame > 0) { - avctx->has_b_frames--; priv->last_picture++; - av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: Pipeline length: %u\n", - avctx->has_b_frames); } } else { /* @@ -903,108 +852,88 @@ static inline CopyRet receive_frame(AVCodecContext *avctx, */ av_log(avctx, AV_LOG_ERROR, "CrystalHD: ProcOutput succeeded with " "invalid PIB\n"); - avctx->has_b_frames--; copy_ret = RET_OK; } DtsReleaseOutputBuffs(dev, NULL, FALSE); return copy_ret; } else if (ret == BC_STS_BUSY) { - return RET_COPY_AGAIN; + return RET_OK; } else { av_log(avctx, AV_LOG_ERROR, "CrystalHD: ProcOutput failed %d\n", ret); return RET_ERROR; } } - -static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) +static int crystalhd_decode_packet(AVCodecContext *avctx, const AVPacket *avpkt) { - BC_STATUS ret; - BC_DTS_STATUS decoder_status = { 0, }; - CopyRet rec_ret; + BC_STATUS bc_ret; CHDContext *priv = avctx->priv_data; HANDLE dev = priv->dev; - uint8_t *in_data = avpkt->data; - int len = avpkt->size; - int free_data = 0; uint8_t pic_type = 0; + AVPacket filtered_packet = { 0 }; + int ret = 0; - av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: decode_frame\n"); + av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: decode_packet\n"); - if (len) { + if (avpkt && avpkt->size) { int32_t tx_free = (int32_t)DtsTxFreeSize(dev); if (priv->bsfc) { - int ret = 0; AVPacket filter_packet = { 0 }; - AVPacket filtered_packet = { 0 }; ret = av_packet_ref(&filter_packet, avpkt); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "CrystalHD: mpv4toannexb filter " "failed to ref input packet\n"); - return ret; + goto exit; } - ret = av_bsf_send_packet(priv->bsfc, &filter_packet); - if (ret < 0) { + ret = av_bsf_send_packet(priv->bsfc, &filter_packet); + if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "CrystalHD: mpv4toannexb filter " "failed to send input packet\n"); - return ret; + goto exit; } ret = av_bsf_receive_packet(priv->bsfc, &filtered_packet); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "CrystalHD: mpv4toannexb filter " "failed to receive output packet\n"); - return ret; + goto exit; } - in_data = filtered_packet.data; - len = filtered_packet.size; - + avpkt = &filtered_packet; av_packet_unref(&filter_packet); } if (priv->parser) { - int ret = 0; - - free_data = ret > 0; - - if (ret >= 0) { - uint8_t *pout; - int psize; - int index; - H264Context *h = priv->parser->priv_data; - - index = av_parser_parse2(priv->parser, avctx, &pout, &psize, - in_data, len, avpkt->pts, - avpkt->dts, 0); - if (index < 0) { - av_log(avctx, AV_LOG_WARNING, - "CrystalHD: Failed to parse h.264 packet to " - "detect interlacing.\n"); - } else if (index != len) { - av_log(avctx, AV_LOG_WARNING, - "CrystalHD: Failed to parse h.264 packet " - "completely. Interlaced frames may be " - "incorrectly detected.\n"); - } else { - av_log(avctx, AV_LOG_VERBOSE, - "CrystalHD: parser picture type %d\n", - h->picture_structure); - pic_type = h->picture_structure; - } - } else { + uint8_t *pout; + int psize; + int index; + H264Context *h = priv->parser->priv_data; + + index = av_parser_parse2(priv->parser, avctx, &pout, &psize, + avpkt->data, avpkt->size, avpkt->pts, + avpkt->dts, 0); + if (index < 0) { av_log(avctx, AV_LOG_WARNING, - "CrystalHD: mp4toannexb filter failed to filter " - "packet. Interlaced frames may be incorrectly " - "detected.\n"); + "CrystalHD: Failed to parse h.264 packet to " + "detect interlacing.\n"); + } else if (index != avpkt->size) { + av_log(avctx, AV_LOG_WARNING, + "CrystalHD: Failed to parse h.264 packet " + "completely. Interlaced frames may be " + "incorrectly detected.\n"); + } else { + av_log(avctx, AV_LOG_VERBOSE, + "CrystalHD: parser picture type %d\n", + h->picture_structure); + pic_type = h->picture_structure; } } - if (len < tx_free - 1024) { + if (avpkt->size < tx_free) { /* * Despite being notionally opaque, either libcrystalhd or * the hardware itself will mangle pts values that are too @@ -1017,272 +946,113 @@ static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *a int64_t safe_pts = avpkt->pts == AV_NOPTS_VALUE ? 0 : avpkt->pts; uint64_t pts = opaque_list_push(priv, safe_pts, pic_type); if (!pts) { - if (free_data) { - av_freep(&in_data); - } - return AVERROR(ENOMEM); + ret = AVERROR(ENOMEM); + goto exit; } av_log(priv->avctx, AV_LOG_VERBOSE, "input \"pts\": %"PRIu64"\n", pts); - ret = DtsProcInput(dev, in_data, len, pts, 0); - if (free_data) { - av_freep(&in_data); - } - if (ret == BC_STS_BUSY) { + bc_ret = DtsProcInput(dev, avpkt->data, avpkt->size, pts, 0); + if (bc_ret == BC_STS_BUSY) { av_log(avctx, AV_LOG_WARNING, "CrystalHD: ProcInput returned busy\n"); - usleep(BASE_WAIT); - return AVERROR(EBUSY); - } else if (ret != BC_STS_SUCCESS) { + ret = AVERROR(EAGAIN); + goto exit; + } else if (bc_ret != BC_STS_SUCCESS) { av_log(avctx, AV_LOG_ERROR, "CrystalHD: ProcInput failed: %u\n", ret); - return -1; + ret = -1; + goto exit; } - avctx->has_b_frames++; } else { - av_log(avctx, AV_LOG_WARNING, "CrystalHD: Input buffer full\n"); - len = 0; // We didn't consume any bytes. + av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: Input buffer full\n"); + ret = AVERROR(EAGAIN); + goto exit; } } else { av_log(avctx, AV_LOG_INFO, "CrystalHD: No more input data\n"); + ret = AVERROR_EOF; + goto exit; } + exit: + av_packet_unref(&filtered_packet); + return ret; +} - if (priv->skip_next_output) { - av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: Skipping next output.\n"); - priv->skip_next_output = 0; - avctx->has_b_frames--; - return len; - } +static int crystalhd_receive_frame(AVCodecContext *avctx, AVFrame *frame) +{ + BC_STATUS bc_ret; + BC_DTS_STATUS decoder_status = { 0, }; + CopyRet rec_ret; + CHDContext *priv = avctx->priv_data; + HANDLE dev = priv->dev; + int got_frame = 0; - ret = DtsGetDriverStatus(dev, &decoder_status); - if (ret != BC_STS_SUCCESS) { + av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: receive_frame\n"); + + bc_ret = DtsGetDriverStatus(dev, &decoder_status); + if (bc_ret != BC_STS_SUCCESS) { av_log(avctx, AV_LOG_ERROR, "CrystalHD: GetDriverStatus failed\n"); return -1; } - /* - * No frames ready. Don't try to extract. - * - * Empirical testing shows that ReadyListCount can be a damn lie, - * and ProcOut still fails when count > 0. The same testing showed - * that two more iterations were needed before ProcOutput would - * succeed. - */ - if (priv->output_ready < 2) { - if (decoder_status.ReadyListCount != 0) - priv->output_ready++; - usleep(BASE_WAIT); - av_log(avctx, AV_LOG_INFO, "CrystalHD: Filling pipeline.\n"); - return len; - } else if (decoder_status.ReadyListCount == 0) { - /* - * After the pipeline is established, if we encounter a lack of frames - * that probably means we're not giving the hardware enough time to - * decode them, so start increasing the wait time at the end of a - * decode call. - */ - usleep(BASE_WAIT); - priv->decode_wait += WAIT_UNIT; - av_log(avctx, AV_LOG_INFO, "CrystalHD: No frames ready. Returning\n"); - return len; + if (decoder_status.ReadyListCount == 0) { + av_log(avctx, AV_LOG_INFO, "CrystalHD: Insufficient frames ready. Returning\n"); + return AVERROR(EAGAIN); } - do { - rec_ret = receive_frame(avctx, data, got_frame); - if (rec_ret == RET_OK && *got_frame == 0) { - /* - * This case is for when the encoded fields are stored - * separately and we get a separate avpkt for each one. To keep - * the pipeline stable, we should return nothing and wait for - * the next time round to grab the second field. - * H.264 PAFF is an example of this. - */ - av_log(avctx, AV_LOG_VERBOSE, "Returning after first field.\n"); - avctx->has_b_frames--; - } else if (rec_ret == RET_COPY_NEXT_FIELD) { - /* - * This case is for when the encoded fields are stored in a - * single avpkt but the hardware returns then separately. Unless - * we grab the second field before returning, we'll slip another - * frame in the pipeline and if that happens a lot, we're sunk. - * So we have to get that second field now. - * Interlaced mpeg2 and vc1 are examples of this. - */ - av_log(avctx, AV_LOG_VERBOSE, "Trying to get second field.\n"); - while (1) { - usleep(priv->decode_wait); - ret = DtsGetDriverStatus(dev, &decoder_status); - if (ret == BC_STS_SUCCESS && - decoder_status.ReadyListCount > 0) { - rec_ret = receive_frame(avctx, data, got_frame); - if ((rec_ret == RET_OK && *got_frame > 0) || - rec_ret == RET_ERROR) - break; - } - } - av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: Got second field.\n"); - } else if (rec_ret == RET_SKIP_NEXT_COPY) { - /* - * Two input packets got turned into a field pair. Gawd. - */ - av_log(avctx, AV_LOG_VERBOSE, - "Don't output on next decode call.\n"); - priv->skip_next_output = 1; - } - /* - * If rec_ret == RET_COPY_AGAIN, that means that either we just handled - * a FMT_CHANGE event and need to go around again for the actual frame, - * we got a busy status and need to try again, or we're dealing with - * packed b-frames, where the hardware strangely returns the packed - * p-frame twice. We choose to keep the second copy as it carries the - * valid pts. - */ - } while (rec_ret == RET_COPY_AGAIN); - usleep(priv->decode_wait); - return len; + rec_ret = receive_frame(avctx, frame, &got_frame); + if (rec_ret == RET_ERROR) { + return -1; + } else if (got_frame == 0) { + return AVERROR(EAGAIN); + } else { + return 0; + } } +#define DEFINE_CRYSTALHD_DECODER(x, X) \ + static const AVClass x##_crystalhd_class = { \ + .class_name = #x "_crystalhd", \ + .item_name = av_default_item_name, \ + .option = options, \ + .version = LIBAVUTIL_VERSION_INT, \ + }; \ + AVCodec ff_##x##_crystalhd_decoder = { \ + .name = #x "_crystalhd", \ + .long_name = NULL_IF_CONFIG_SMALL("CrystalHD " #X " decoder"), \ + .type = AVMEDIA_TYPE_VIDEO, \ + .id = AV_CODEC_ID_##X, \ + .priv_data_size = sizeof(CHDContext), \ + .priv_class = &x##_crystalhd_class, \ + .init = init, \ + .close = uninit, \ + .send_packet = crystalhd_decode_packet, \ + .receive_frame = crystalhd_receive_frame, \ + .flush = flush, \ + .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING, \ + .pix_fmts = (const enum AVPixelFormat[]){AV_PIX_FMT_YUYV422, AV_PIX_FMT_NONE}, \ + }; #if CONFIG_H264_CRYSTALHD_DECODER -static AVClass h264_class = { - "h264_crystalhd", - av_default_item_name, - options, - LIBAVUTIL_VERSION_INT, -}; - -AVCodec ff_h264_crystalhd_decoder = { - .name = "h264_crystalhd", - .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (CrystalHD acceleration)"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_H264, - .priv_data_size = sizeof(CHDContext), - .init = init, - .close = uninit, - .decode = decode, - .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, - .flush = flush, - .pix_fmts = (const enum AVPixelFormat[]){AV_PIX_FMT_YUYV422, AV_PIX_FMT_NONE}, - .priv_class = &h264_class, -}; +DEFINE_CRYSTALHD_DECODER(h264, H264) #endif #if CONFIG_MPEG2_CRYSTALHD_DECODER -static AVClass mpeg2_class = { - "mpeg2_crystalhd", - av_default_item_name, - options, - LIBAVUTIL_VERSION_INT, -}; - -AVCodec ff_mpeg2_crystalhd_decoder = { - .name = "mpeg2_crystalhd", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 Video (CrystalHD acceleration)"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_MPEG2VIDEO, - .priv_data_size = sizeof(CHDContext), - .init = init, - .close = uninit, - .decode = decode, - .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, - .flush = flush, - .pix_fmts = (const enum AVPixelFormat[]){AV_PIX_FMT_YUYV422, AV_PIX_FMT_NONE}, - .priv_class = &mpeg2_class, -}; +DEFINE_CRYSTALHD_DECODER(mpeg2, MPEG2VIDEO) #endif #if CONFIG_MPEG4_CRYSTALHD_DECODER -static AVClass mpeg4_class = { - "mpeg4_crystalhd", - av_default_item_name, - options, - LIBAVUTIL_VERSION_INT, -}; - -AVCodec ff_mpeg4_crystalhd_decoder = { - .name = "mpeg4_crystalhd", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 Part 2 (CrystalHD acceleration)"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_MPEG4, - .priv_data_size = sizeof(CHDContext), - .init = init, - .close = uninit, - .decode = decode, - .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, - .flush = flush, - .pix_fmts = (const enum AVPixelFormat[]){AV_PIX_FMT_YUYV422, AV_PIX_FMT_NONE}, - .priv_class = &mpeg4_class, -}; +DEFINE_CRYSTALHD_DECODER(mpeg4, MPEG4) #endif #if CONFIG_MSMPEG4_CRYSTALHD_DECODER -static AVClass msmpeg4_class = { - "msmpeg4_crystalhd", - av_default_item_name, - options, - LIBAVUTIL_VERSION_INT, -}; - -AVCodec ff_msmpeg4_crystalhd_decoder = { - .name = "msmpeg4_crystalhd", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 Part 2 Microsoft variant version 3 (CrystalHD acceleration)"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_MSMPEG4V3, - .priv_data_size = sizeof(CHDContext), - .init = init, - .close = uninit, - .decode = decode, - .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_EXPERIMENTAL, - .flush = flush, - .pix_fmts = (const enum AVPixelFormat[]){AV_PIX_FMT_YUYV422, AV_PIX_FMT_NONE}, - .priv_class = &msmpeg4_class, -}; +DEFINE_CRYSTALHD_DECODER(msmpeg4, MSMPEG4V3) #endif #if CONFIG_VC1_CRYSTALHD_DECODER -static AVClass vc1_class = { - "vc1_crystalhd", - av_default_item_name, - options, - LIBAVUTIL_VERSION_INT, -}; - -AVCodec ff_vc1_crystalhd_decoder = { - .name = "vc1_crystalhd", - .long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1 (CrystalHD acceleration)"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_VC1, - .priv_data_size = sizeof(CHDContext), - .init = init, - .close = uninit, - .decode = decode, - .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, - .flush = flush, - .pix_fmts = (const enum AVPixelFormat[]){AV_PIX_FMT_YUYV422, AV_PIX_FMT_NONE}, - .priv_class = &vc1_class, -}; +DEFINE_CRYSTALHD_DECODER(vc1, VC1) #endif #if CONFIG_WMV3_CRYSTALHD_DECODER -static AVClass wmv3_class = { - "wmv3_crystalhd", - av_default_item_name, - options, - LIBAVUTIL_VERSION_INT, -}; - -AVCodec ff_wmv3_crystalhd_decoder = { - .name = "wmv3_crystalhd", - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 (CrystalHD acceleration)"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_WMV3, - .priv_data_size = sizeof(CHDContext), - .init = init, - .close = uninit, - .decode = decode, - .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, - .flush = flush, - .pix_fmts = (const enum AVPixelFormat[]){AV_PIX_FMT_YUYV422, AV_PIX_FMT_NONE}, - .priv_class = &wmv3_class, -}; +DEFINE_CRYSTALHD_DECODER(wmv3, WMV3) #endif diff --git a/libavcodec/version.h b/libavcodec/version.h index f292d9d85fc43..f7e2561c69d80 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 57 -#define LIBAVCODEC_VERSION_MINOR 65 +#define LIBAVCODEC_VERSION_MINOR 66 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ From 6cc390dd5a53623de14010c0ae9067e345e36565 Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Sat, 15 Oct 2016 15:50:29 -0700 Subject: [PATCH 056/102] crystalhd: Revert back to letting hardware handle packed b-frames I'm not sure why, but the mpeg4_unpack_bframes bsf is not interacting well with seeking. Looking at the code, it should be ok, with possibly one warning shown, but I see it getting stuck for an extended period of time after a seek where a packed frame is cached to be shown later. So, I gave up on that and went back to making the old hardware based path work. Turns out that it wasn't broken except that some samples have a 6 byte drop packet which I wasn't accounting for. Now it works again and seeks are good. --- libavcodec/crystalhd.c | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c index dca58f2c8bd3c..c1ca066d2f3bd 100644 --- a/libavcodec/crystalhd.c +++ b/libavcodec/crystalhd.c @@ -140,6 +140,7 @@ typedef struct { /* Options */ uint32_t sWidth; + uint8_t bframe_bug; } CHDContext; static const AVOption options[] = { @@ -460,14 +461,6 @@ static av_cold int init(AVCodecContext *avctx) format.pMetaData = avctx->extradata; format.metaDataSz = avctx->extradata_size; break; - case BC_MSUBTYPE_DIVX: - avret = init_bsf(avctx, "mpeg4_unpack_bframes"); - if (avret != 0) { - return avret; - } - format.pMetaData = avctx->extradata; - format.metaDataSz = avctx->extradata_size; - break; case BC_MSUBTYPE_H264: format.startCodeSz = 4; // Fall-through @@ -476,6 +469,7 @@ static av_cold int init(AVCodecContext *avctx) case BC_MSUBTYPE_WMV3: case BC_MSUBTYPE_WMVA: case BC_MSUBTYPE_MPEG2VIDEO: + case BC_MSUBTYPE_DIVX: case BC_MSUBTYPE_DIVX311: format.pMetaData = avctx->extradata; format.metaDataSz = avctx->extradata_size; @@ -829,6 +823,17 @@ static inline CopyRet receive_frame(AVCodecContext *avctx, priv->last_picture = output.PicInfo.picture_number - 1; } + if (avctx->codec->id == AV_CODEC_ID_MPEG4 && + output.PicInfo.timeStamp == 0 && priv->bframe_bug) { + if (!priv->bframe_bug) { + av_log(avctx, AV_LOG_VERBOSE, + "CrystalHD: Not returning packed frame twice.\n"); + } + priv->last_picture++; + DtsReleaseOutputBuffs(dev, NULL, FALSE); + return RET_COPY_AGAIN; + } + print_frame_info(priv, &output); if (priv->last_picture + 1 < output.PicInfo.picture_number) { @@ -879,6 +884,22 @@ static int crystalhd_decode_packet(AVCodecContext *avctx, const AVPacket *avpkt) if (avpkt && avpkt->size) { int32_t tx_free = (int32_t)DtsTxFreeSize(dev); + if (!priv->bframe_bug && (avpkt->size == 6 || avpkt->size == 7)) { + /* + * Drop frames trigger the bug + */ + av_log(avctx, AV_LOG_WARNING, + "CrystalHD: Enabling work-around for packed b-frame bug\n"); + priv->bframe_bug = 1; + } else if (priv->bframe_bug && avpkt->size == 8) { + /* + * Delay frames don't trigger the bug + */ + av_log(avctx, AV_LOG_WARNING, + "CrystalHD: Disabling work-around for packed b-frame bug\n"); + priv->bframe_bug = 0; + } + if (priv->bsfc) { AVPacket filter_packet = { 0 }; From badce88fdf84b04704ada177a0811fe2c4b1a529 Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Sun, 9 Oct 2016 20:54:27 -0700 Subject: [PATCH 057/102] crystalhd: Remove trust_interlaced heuristic It seems that without all the other 1:1 heuristics, we don't have a fundamental problem trusting the interlaced flag on output pictures. That's a relief. --- libavcodec/crystalhd.c | 37 ++++--------------------------------- 1 file changed, 4 insertions(+), 33 deletions(-) diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c index c1ca066d2f3bd..d738ddb3beedb 100644 --- a/libavcodec/crystalhd.c +++ b/libavcodec/crystalhd.c @@ -561,7 +561,6 @@ static inline CopyRet copy_frame(AVCodecContext *avctx, { BC_STATUS ret; BC_DTS_STATUS decoder_status = { 0, }; - uint8_t trust_interlaced; uint8_t interlaced; CHDContext *priv = avctx->priv_data; @@ -611,29 +610,7 @@ static inline CopyRet copy_frame(AVCodecContext *avctx, } /* - * For most content, we can trust the interlaced flag returned - * by the hardware, but sometimes we can't. These are the - * conditions under which we can trust the flag: - * - * 1) It's not h.264 content - * 2) The UNKNOWN_SRC flag is not set - * 3) We know we're expecting a second field - * 4) The hardware reports this picture and the next picture - * have the same picture number. - * - * Note that there can still be interlaced content that will - * fail this check, if the hardware hasn't decoded the next - * picture or if there is a corruption in the stream. (In either - * case a 0 will be returned for the next picture number) - */ - trust_interlaced = avctx->codec->id != AV_CODEC_ID_H264 || - !(output->PicInfo.flags & VDEC_FLAG_UNKNOWN_SRC) || - priv->need_second_field || - (decoder_status.picNumFlags & ~0x40000000) == - output->PicInfo.picture_number; - - /* - * If we got a false negative for trust_interlaced on the first field, + * If we got a false negative for interlaced on the first field, * we will realise our mistake here when we see that the picture number is that * of the previous picture. We cannot recover the frame and should discard the * second field to keep the correct number of output frames. @@ -645,16 +622,10 @@ static inline CopyRet copy_frame(AVCodecContext *avctx, return RET_OK; } - interlaced = (output->PicInfo.flags & VDEC_FLAG_INTERLACED_SRC) && - trust_interlaced; - - if (!trust_interlaced && (decoder_status.picNumFlags & ~0x40000000) == 0) { - av_log(avctx, AV_LOG_VERBOSE, - "Next picture number unknown. Assuming progressive frame.\n"); - } + interlaced = output->PicInfo.flags & VDEC_FLAG_INTERLACED_SRC; - av_log(avctx, AV_LOG_VERBOSE, "Interlaced state: %d | trust_interlaced %d\n", - interlaced, trust_interlaced); + av_log(avctx, AV_LOG_VERBOSE, "Interlaced state: %d\n", + interlaced); if (priv->pic->data[0] && !priv->need_second_field) av_frame_unref(priv->pic); From 89ba55dc0dfa5495be6e68d13a60de44560129af Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Sun, 16 Oct 2016 11:01:40 -0700 Subject: [PATCH 058/102] crystalhd: We don't need the track the last picture number anymore This was needed to detect an interlaced failure case that doesn't happen with the new decode api. --- libavcodec/crystalhd.c | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c index d738ddb3beedb..3db0e17a8ddc4 100644 --- a/libavcodec/crystalhd.c +++ b/libavcodec/crystalhd.c @@ -133,8 +133,6 @@ typedef struct { uint8_t is_nal; uint8_t need_second_field; - uint64_t last_picture; - OpaqueList *head; OpaqueList *tail; @@ -310,7 +308,6 @@ static void flush(AVCodecContext *avctx) { CHDContext *priv = avctx->priv_data; - priv->last_picture = -1; priv->need_second_field = 0; av_frame_unref (priv->pic); @@ -446,7 +443,6 @@ static av_cold int init(AVCodecContext *avctx) priv = avctx->priv_data; priv->avctx = avctx; priv->is_nal = avctx->extradata_size > 0 && *(avctx->extradata) == 1; - priv->last_picture = -1; priv->pic = av_frame_alloc(); subtype = id2subtype(priv, avctx->codec->id); @@ -609,19 +605,6 @@ static inline CopyRet copy_frame(AVCodecContext *avctx, return RET_ERROR; } - /* - * If we got a false negative for interlaced on the first field, - * we will realise our mistake here when we see that the picture number is that - * of the previous picture. We cannot recover the frame and should discard the - * second field to keep the correct number of output frames. - */ - if (output->PicInfo.picture_number == priv->last_picture && !priv->need_second_field) { - av_log(avctx, AV_LOG_WARNING, - "Incorrectly guessed progressive frame. Discarding second field\n"); - /* Returning without providing a picture. */ - return RET_OK; - } - interlaced = output->PicInfo.flags & VDEC_FLAG_INTERLACED_SRC; av_log(avctx, AV_LOG_VERBOSE, "Interlaced state: %d\n", @@ -786,42 +769,19 @@ static inline CopyRet receive_frame(AVCodecContext *avctx, } else if (ret == BC_STS_SUCCESS) { int copy_ret = -1; if (output.PoutFlags & BC_POUT_FLAGS_PIB_VALID) { - if (priv->last_picture == -1) { - /* - * Init to one less, so that the incrementing code doesn't - * need to be special-cased. - */ - priv->last_picture = output.PicInfo.picture_number - 1; - } - if (avctx->codec->id == AV_CODEC_ID_MPEG4 && output.PicInfo.timeStamp == 0 && priv->bframe_bug) { if (!priv->bframe_bug) { av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: Not returning packed frame twice.\n"); } - priv->last_picture++; DtsReleaseOutputBuffs(dev, NULL, FALSE); return RET_COPY_AGAIN; } print_frame_info(priv, &output); - if (priv->last_picture + 1 < output.PicInfo.picture_number) { - av_log(avctx, AV_LOG_WARNING, - "CrystalHD: Picture Number discontinuity\n"); - /* - * XXX: I have no idea what the semantics of this situation - * are so I don't even know if we've lost frames or which - * ones. - */ - priv->last_picture = output.PicInfo.picture_number - 1; - } - copy_ret = copy_frame(avctx, &output, data, got_frame); - if (*got_frame > 0) { - priv->last_picture++; - } } else { /* * An invalid frame has been consumed. From 13dbf77b8192a75ac365c256a3c2da03cc2617fd Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Tue, 11 Oct 2016 21:00:17 -0700 Subject: [PATCH 059/102] crystalhd: Remove h.264 parser Now that we don't need to do ridiculous things to work out if a frame is interlaced or not, we don't need an extra h.264 parser. --- libavcodec/crystalhd.c | 55 +++--------------------------------------- 1 file changed, 4 insertions(+), 51 deletions(-) diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c index 3db0e17a8ddc4..b68701a7be1fe 100644 --- a/libavcodec/crystalhd.c +++ b/libavcodec/crystalhd.c @@ -83,7 +83,6 @@ #include #include "avcodec.h" -#include "h264dec.h" #include "internal.h" #include "libavutil/imgutils.h" #include "libavutil/intreadwrite.h" @@ -112,7 +111,6 @@ typedef struct OpaqueList { struct OpaqueList *next; uint64_t fake_timestamp; uint64_t reordered_opaque; - uint8_t pic_type; } OpaqueList; typedef struct { @@ -125,7 +123,6 @@ typedef struct { uint32_t orig_extradata_size; AVBSFContext *bsfc; - AVCodecParserContext *parser; uint8_t is_70012; uint8_t *sps_pps_buf; @@ -221,8 +218,7 @@ static inline void print_frame_info(CHDContext *priv, BC_DTS_PROC_OUT *output) * OpaqueList functions ****************************************************************************/ -static uint64_t opaque_list_push(CHDContext *priv, uint64_t reordered_opaque, - uint8_t pic_type) +static uint64_t opaque_list_push(CHDContext *priv, uint64_t reordered_opaque) { OpaqueList *newNode = av_mallocz(sizeof (OpaqueList)); if (!newNode) { @@ -239,7 +235,6 @@ static uint64_t opaque_list_push(CHDContext *priv, uint64_t reordered_opaque, } priv->tail = newNode; newNode->reordered_opaque = reordered_opaque; - newNode->pic_type = pic_type; return newNode->fake_timestamp; } @@ -340,7 +335,6 @@ static av_cold int uninit(AVCodecContext *avctx) priv->orig_extradata_size = 0; } - av_parser_close(priv->parser); if (priv->bsfc) { av_bsf_free(&priv->bsfc); } @@ -533,14 +527,6 @@ static av_cold int init(AVCodecContext *avctx) goto fail; } - if (avctx->codec->id == AV_CODEC_ID_H264) { - priv->parser = av_parser_init(avctx->codec->id); - if (!priv->parser) - av_log(avctx, AV_LOG_WARNING, - "Cannot open the h.264 parser! Interlaced h.264 content " - "will not be detected reliably.\n"); - priv->parser->flags = PARSER_FLAG_COMPLETE_FRAMES; - } av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: Init complete.\n"); return 0; @@ -561,7 +547,6 @@ static inline CopyRet copy_frame(AVCodecContext *avctx, CHDContext *priv = avctx->priv_data; int64_t pkt_pts = AV_NOPTS_VALUE; - uint8_t pic_type = 0; uint8_t bottom_field = (output->PicInfo.flags & VDEC_FLAG_BOTTOMFIELD) == VDEC_FLAG_BOTTOMFIELD; @@ -579,23 +564,18 @@ static inline CopyRet copy_frame(AVCodecContext *avctx, OpaqueList *node = opaque_list_pop(priv, output->PicInfo.timeStamp); if (node) { pkt_pts = node->reordered_opaque; - pic_type = node->pic_type; av_free(node); } else { /* * We will encounter a situation where a timestamp cannot be * popped if a second field is being returned. In this case, * each field has the same timestamp and the first one will - * cause it to be popped. To keep subsequent calculations - * simple, pic_type should be set a FIELD value - doesn't - * matter which, but I chose BOTTOM. + * cause it to be popped. We'll avoid overwriting the valid + * timestamp below. */ - pic_type = PICT_BOTTOM_FIELD; } av_log(avctx, AV_LOG_VERBOSE, "output \"pts\": %"PRIu64"\n", output->PicInfo.timeStamp); - av_log(avctx, AV_LOG_VERBOSE, "output picture type %d\n", - pic_type); } ret = DtsGetDriverStatus(priv->dev, &decoder_status); @@ -806,7 +786,6 @@ static int crystalhd_decode_packet(AVCodecContext *avctx, const AVPacket *avpkt) BC_STATUS bc_ret; CHDContext *priv = avctx->priv_data; HANDLE dev = priv->dev; - uint8_t pic_type = 0; AVPacket filtered_packet = { 0 }; int ret = 0; @@ -859,32 +838,6 @@ static int crystalhd_decode_packet(AVCodecContext *avctx, const AVPacket *avpkt) av_packet_unref(&filter_packet); } - if (priv->parser) { - uint8_t *pout; - int psize; - int index; - H264Context *h = priv->parser->priv_data; - - index = av_parser_parse2(priv->parser, avctx, &pout, &psize, - avpkt->data, avpkt->size, avpkt->pts, - avpkt->dts, 0); - if (index < 0) { - av_log(avctx, AV_LOG_WARNING, - "CrystalHD: Failed to parse h.264 packet to " - "detect interlacing.\n"); - } else if (index != avpkt->size) { - av_log(avctx, AV_LOG_WARNING, - "CrystalHD: Failed to parse h.264 packet " - "completely. Interlaced frames may be " - "incorrectly detected.\n"); - } else { - av_log(avctx, AV_LOG_VERBOSE, - "CrystalHD: parser picture type %d\n", - h->picture_structure); - pic_type = h->picture_structure; - } - } - if (avpkt->size < tx_free) { /* * Despite being notionally opaque, either libcrystalhd or @@ -896,7 +849,7 @@ static int crystalhd_decode_packet(AVCodecContext *avctx, const AVPacket *avpkt) * we know will not be mangled. */ int64_t safe_pts = avpkt->pts == AV_NOPTS_VALUE ? 0 : avpkt->pts; - uint64_t pts = opaque_list_push(priv, safe_pts, pic_type); + uint64_t pts = opaque_list_push(priv, safe_pts); if (!pts) { ret = AVERROR(ENOMEM); goto exit; From 0eb836942f5d6ff803e0374156ca21544e926e7c Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Sat, 15 Oct 2016 12:44:32 -0700 Subject: [PATCH 060/102] crystalhd: Keep NOPTS_VALUE so we know it's not there. --- libavcodec/crystalhd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c index b68701a7be1fe..4ac138cb2e6ad 100644 --- a/libavcodec/crystalhd.c +++ b/libavcodec/crystalhd.c @@ -848,8 +848,7 @@ static int crystalhd_decode_packet(AVCodecContext *avctx, const AVPacket *avpkt) * avoiding mangling so we need to build a mapping to values * we know will not be mangled. */ - int64_t safe_pts = avpkt->pts == AV_NOPTS_VALUE ? 0 : avpkt->pts; - uint64_t pts = opaque_list_push(priv, safe_pts); + uint64_t pts = opaque_list_push(priv, avpkt->pts); if (!pts) { ret = AVERROR(ENOMEM); goto exit; From 3019b4f6480a5d8c38e0e32ef75dabe6e0f3ae98 Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Tue, 11 Oct 2016 20:17:06 -0700 Subject: [PATCH 061/102] crystalhd: Loop for a frame internally where possible. It's not possible to return EAGAIN when we've passed input EOF and are in draining mode. If do return EAGAIN, we're saying there's no way to get any more output - which isn't true in many cases. So let's handled these cases in an internal loop as best we can. --- libavcodec/crystalhd.c | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c index 4ac138cb2e6ad..2d803ab46a61b 100644 --- a/libavcodec/crystalhd.c +++ b/libavcodec/crystalhd.c @@ -105,6 +105,7 @@ typedef enum { RET_ERROR = -1, RET_OK = 0, + RET_COPY_AGAIN = 1, } CopyRet; typedef struct OpaqueList { @@ -129,6 +130,7 @@ typedef struct { uint32_t sps_pps_size; uint8_t is_nal; uint8_t need_second_field; + uint8_t draining; OpaqueList *head; OpaqueList *tail; @@ -304,6 +306,7 @@ static void flush(AVCodecContext *avctx) CHDContext *priv = avctx->priv_data; priv->need_second_field = 0; + priv->draining = 0; av_frame_unref (priv->pic); @@ -438,6 +441,7 @@ static av_cold int init(AVCodecContext *avctx) priv->avctx = avctx; priv->is_nal = avctx->extradata_size > 0 && *(avctx->extradata) == 1; priv->pic = av_frame_alloc(); + priv->draining = 0; subtype = id2subtype(priv, avctx->codec->id); switch (subtype) { @@ -670,6 +674,8 @@ FF_ENABLE_DEPRECATION_WARNINGS if ((ret = av_frame_ref(data, priv->pic)) < 0) { return ret; } + } else { + return RET_COPY_AGAIN; } return RET_OK; @@ -745,7 +751,7 @@ static inline CopyRet receive_frame(AVCodecContext *avctx, avctx->sample_aspect_ratio = (AVRational) {221, 1}; break; } - return RET_OK; + return RET_COPY_AGAIN; } else if (ret == BC_STS_SUCCESS) { int copy_ret = -1; if (output.PoutFlags & BC_POUT_FLAGS_PIB_VALID) { @@ -768,13 +774,13 @@ static inline CopyRet receive_frame(AVCodecContext *avctx, */ av_log(avctx, AV_LOG_ERROR, "CrystalHD: ProcOutput succeeded with " "invalid PIB\n"); - copy_ret = RET_OK; + copy_ret = RET_COPY_AGAIN; } DtsReleaseOutputBuffs(dev, NULL, FALSE); return copy_ret; } else if (ret == BC_STS_BUSY) { - return RET_OK; + return RET_COPY_AGAIN; } else { av_log(avctx, AV_LOG_ERROR, "CrystalHD: ProcOutput failed %d\n", ret); return RET_ERROR; @@ -874,6 +880,7 @@ static int crystalhd_decode_packet(AVCodecContext *avctx, const AVPacket *avpkt) } } else { av_log(avctx, AV_LOG_INFO, "CrystalHD: No more input data\n"); + priv->draining = 1; ret = AVERROR_EOF; goto exit; } @@ -893,22 +900,27 @@ static int crystalhd_receive_frame(AVCodecContext *avctx, AVFrame *frame) av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: receive_frame\n"); - bc_ret = DtsGetDriverStatus(dev, &decoder_status); - if (bc_ret != BC_STS_SUCCESS) { - av_log(avctx, AV_LOG_ERROR, "CrystalHD: GetDriverStatus failed\n"); - return -1; - } + do { + bc_ret = DtsGetDriverStatus(dev, &decoder_status); + if (bc_ret != BC_STS_SUCCESS) { + av_log(avctx, AV_LOG_ERROR, "CrystalHD: GetDriverStatus failed\n"); + return -1; + } - if (decoder_status.ReadyListCount == 0) { - av_log(avctx, AV_LOG_INFO, "CrystalHD: Insufficient frames ready. Returning\n"); - return AVERROR(EAGAIN); - } + if (decoder_status.ReadyListCount == 0) { + av_log(avctx, AV_LOG_INFO, "CrystalHD: Insufficient frames ready. Returning\n"); + got_frame = 0; + rec_ret = RET_OK; + break; + } + + rec_ret = receive_frame(avctx, frame, &got_frame); + } while (rec_ret == RET_COPY_AGAIN); - rec_ret = receive_frame(avctx, frame, &got_frame); if (rec_ret == RET_ERROR) { return -1; } else if (got_frame == 0) { - return AVERROR(EAGAIN); + return priv->draining ? AVERROR_EOF : AVERROR(EAGAIN); } else { return 0; } From a07c07e7aa627578cc532657088d0f9d12207ab1 Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Sun, 16 Oct 2016 14:06:13 -0700 Subject: [PATCH 062/102] crystalhd: Simplify output frame handling The old code had to retain a partial frame across two calls in the case of separate interlaced fields. Now, we know that we'll get both fields within the same receive_frame call, and so we don't need to manage the frame as private state any more. --- libavcodec/crystalhd.c | 42 +++++++++++++++--------------------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c index 2d803ab46a61b..7cf2c75898e23 100644 --- a/libavcodec/crystalhd.c +++ b/libavcodec/crystalhd.c @@ -117,7 +117,6 @@ typedef struct OpaqueList { typedef struct { AVClass *av_class; AVCodecContext *avctx; - AVFrame *pic; HANDLE dev; uint8_t *orig_extradata; @@ -308,8 +307,6 @@ static void flush(AVCodecContext *avctx) priv->need_second_field = 0; priv->draining = 0; - av_frame_unref (priv->pic); - /* Flush mode 4 flushes all software and hardware buffers. */ DtsFlushInput(priv->dev, 4); } @@ -344,8 +341,6 @@ static av_cold int uninit(AVCodecContext *avctx) av_freep(&priv->sps_pps_buf); - av_frame_free (&priv->pic); - if (priv->head) { OpaqueList *node = priv->head; while (node) { @@ -440,7 +435,6 @@ static av_cold int init(AVCodecContext *avctx) priv = avctx->priv_data; priv->avctx = avctx; priv->is_nal = avctx->extradata_size > 0 && *(avctx->extradata) == 1; - priv->pic = av_frame_alloc(); priv->draining = 0; subtype = id2subtype(priv, avctx->codec->id); @@ -543,7 +537,7 @@ static av_cold int init(AVCodecContext *avctx) static inline CopyRet copy_frame(AVCodecContext *avctx, BC_DTS_PROC_OUT *output, - void *data, int *got_frame) + AVFrame *frame, int *got_frame) { BC_STATUS ret; BC_DTS_STATUS decoder_status = { 0, }; @@ -594,13 +588,10 @@ static inline CopyRet copy_frame(AVCodecContext *avctx, av_log(avctx, AV_LOG_VERBOSE, "Interlaced state: %d\n", interlaced); - if (priv->pic->data[0] && !priv->need_second_field) - av_frame_unref(priv->pic); - priv->need_second_field = interlaced && !priv->need_second_field; - if (!priv->pic->data[0]) { - if (ff_get_buffer(avctx, priv->pic, AV_GET_BUFFER_FLAG_REF) < 0) + if (!frame->data[0]) { + if (ff_get_buffer(avctx, frame, 0) < 0) return RET_ERROR; } @@ -618,8 +609,8 @@ static inline CopyRet copy_frame(AVCodecContext *avctx, sStride = bwidth; } - dStride = priv->pic->linesize[0]; - dst = priv->pic->data[0]; + dStride = frame->linesize[0]; + dst = frame->data[0]; av_log(priv->avctx, AV_LOG_VERBOSE, "CrystalHD: Copying out frame\n"); @@ -653,27 +644,24 @@ static inline CopyRet copy_frame(AVCodecContext *avctx, av_image_copy_plane(dst, dStride, src, sStride, bwidth, height); } - priv->pic->interlaced_frame = interlaced; + frame->interlaced_frame = interlaced; if (interlaced) - priv->pic->top_field_first = !bottom_first; + frame->top_field_first = !bottom_first; if (pkt_pts != AV_NOPTS_VALUE) { - priv->pic->pts = pkt_pts; + frame->pts = pkt_pts; #if FF_API_PKT_PTS FF_DISABLE_DEPRECATION_WARNINGS - priv->pic->pkt_pts = pkt_pts; + frame->pkt_pts = pkt_pts; FF_ENABLE_DEPRECATION_WARNINGS #endif } - av_frame_set_pkt_pos(priv->pic, -1); - av_frame_set_pkt_duration(priv->pic, 0); - av_frame_set_pkt_size(priv->pic, -1); + av_frame_set_pkt_pos(frame, -1); + av_frame_set_pkt_duration(frame, 0); + av_frame_set_pkt_size(frame, -1); if (!priv->need_second_field) { *got_frame = 1; - if ((ret = av_frame_ref(data, priv->pic)) < 0) { - return ret; - } } else { return RET_COPY_AGAIN; } @@ -683,7 +671,7 @@ FF_ENABLE_DEPRECATION_WARNINGS static inline CopyRet receive_frame(AVCodecContext *avctx, - void *data, int *got_frame) + AVFrame *frame, int *got_frame) { BC_STATUS ret; BC_DTS_PROC_OUT output = { @@ -767,7 +755,7 @@ static inline CopyRet receive_frame(AVCodecContext *avctx, print_frame_info(priv, &output); - copy_ret = copy_frame(avctx, &output, data, got_frame); + copy_ret = copy_frame(avctx, &output, frame, got_frame); } else { /* * An invalid frame has been consumed. @@ -945,7 +933,7 @@ static int crystalhd_receive_frame(AVCodecContext *avctx, AVFrame *frame) .send_packet = crystalhd_decode_packet, \ .receive_frame = crystalhd_receive_frame, \ .flush = flush, \ - .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING, \ + .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING, \ .pix_fmts = (const enum AVPixelFormat[]){AV_PIX_FMT_YUYV422, AV_PIX_FMT_NONE}, \ }; From d0a9af851ee8b5254c0354444cfbe6c59d92887e Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Sun, 16 Oct 2016 14:14:52 -0700 Subject: [PATCH 063/102] crystalhd: Update high level description We don't need to document the horrible hacks that we removed. --- libavcodec/crystalhd.c | 38 +++++--------------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c index 7cf2c75898e23..d85e3518cca05 100644 --- a/libavcodec/crystalhd.c +++ b/libavcodec/crystalhd.c @@ -34,39 +34,11 @@ * is not just a function of time, but also one of the dependency on additional * frames being fed into the decoder to satisfy the b-frame dependencies. * - * As such, a pipeline will build up that is roughly equivalent to the required - * DPB for the file being played. If that was all it took, things would still - * be simple - so, of course, it isn't. - * - * The hardware has a way of indicating that a picture is ready to be copied out, - * but this is unreliable - and sometimes the attempt will still fail so, based - * on testing, the code will wait until 3 pictures are ready before starting - * to copy out - and this has the effect of extending the pipeline. - * - * Finally, while it is tempting to say that once the decoder starts outputting - * frames, the software should never fail to return a frame from a decode(), - * this is a hard assertion to make, because the stream may switch between - * differently encoded content (number of b-frames, interlacing, etc) which - * might require a longer pipeline than before. If that happened, you could - * deadlock trying to retrieve a frame that can't be decoded without feeding - * in additional packets. - * - * As such, the code will return in the event that a picture cannot be copied - * out, leading to an increase in the length of the pipeline. This in turn, - * means we have to be sensitive to the time it takes to decode a picture; - * We do not want to give up just because the hardware needed a little more - * time to prepare the picture! For this reason, there are delays included - * in the decode() path that ensure that, under normal conditions, the hardware - * will only fail to return a frame if it really needs additional packets to - * complete the decoding. - * - * Finally, to be explicit, we do not want the pipeline to grow without bound - * for two reasons: 1) The hardware can only buffer a finite number of packets, - * and 2) The client application may not be able to cope with arbitrarily long - * delays in the video path relative to the audio path. For example. MPlayer - * can only handle a 20 picture delay (although this is arbitrary, and needs - * to be extended to fully support the CrystalHD where the delay could be up - * to 32 pictures - consider PAFF H.264 content with 16 b-frames). + * As such, the hardware can only be used effectively with a decode API that + * doesn't assume a 1:1 relationship between input packets and output frames. + * The new avcodec decode API is such an API (an m:n API) while the old one is + * 1:1. Consequently, we no longer support the old API, which allows us to avoid + * the vicious hacks that are required to approximate 1:1 operation. */ /***************************************************************************** From f84ae3f04aa074afeaeafe6b478d603ce46df55e Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Mon, 17 Oct 2016 20:26:51 +0200 Subject: [PATCH 064/102] avformat: close parser if codec changed The parser depends on the codec and thus must not be used with a different one. If it is, the 'avctx->codec_id == s->parser->codec_ids[0] ...' assert in av_parser_parse2 gets triggered. Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Cadhalpun --- libavformat/utils.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index 31572f3807c6b..56646464b680f 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -480,6 +480,12 @@ static int update_stream_avctx(AVFormatContext *s) if (!st->internal->need_context_update) continue; + /* close parser, because it depends on the codec */ + if (st->parser && st->internal->avctx->codec_id != st->codecpar->codec_id) { + av_parser_close(st->parser); + st->parser = NULL; + } + /* update internal codec context, for the parser */ ret = avcodec_parameters_to_context(st->internal->avctx, st->codecpar); if (ret < 0) @@ -1515,6 +1521,12 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) st->info->found_decoder = 0; } + /* close parser, because it depends on the codec */ + if (st->parser && st->internal->avctx->codec_id != st->codecpar->codec_id) { + av_parser_close(st->parser); + st->parser = NULL; + } + ret = avcodec_parameters_to_context(st->internal->avctx, st->codecpar); if (ret < 0) return ret; From 3932ccc472ad4f4d370dcfc1c2f574b0f3acb88c Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Wed, 2 Nov 2016 21:28:49 +0100 Subject: [PATCH 065/102] ppc: pixblockdsp: do unaligned block accesses correctly again This was broken by the following Libav commit: 4c387c7 ppc: dsputil: do unaligned block accesses correctly The following tests fail due to this: fate-checkasm fate-vsynth1-dnxhd-2k-hr-hq fate-vsynth1-dnxhd-edge1-hr fate-vsynth1-dnxhd-edge2-hr fate-vsynth1-dnxhd-edge3-hr fate-vsynth1-dnxhd-hr-sq-mov fate-vsynth1-dnxhd-hr-hq-mov fate-vsynth2-dnxhd-2k-hr-hq fate-vsynth2-dnxhd-edge1-hr fate-vsynth2-dnxhd-edge2-hr fate-vsynth2-dnxhd-edge3-hr fate-vsynth2-dnxhd-hr-sq-mov fate-vsynth2-dnxhd-hr-hq-mov fate-vsynth3-dnxhd-2k-hr-hq fate-vsynth3-dnxhd-edge1-hr fate-vsynth3-dnxhd-edge2-hr fate-vsynth3-dnxhd-edge3-hr fate-vsynth3-dnxhd-hr-sq-mov fate-vsynth3-dnxhd-hr-hq-mov Fixes trac ticket #5508. Reviewed-by: Carl Eugen Hoyos Signed-off-by: Andreas Cadhalpun --- libavcodec/ppc/pixblockdsp.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/libavcodec/ppc/pixblockdsp.c b/libavcodec/ppc/pixblockdsp.c index 84aa562bb67fc..f3a5050469bad 100644 --- a/libavcodec/ppc/pixblockdsp.c +++ b/libavcodec/ppc/pixblockdsp.c @@ -67,10 +67,10 @@ static void get_pixels_altivec(int16_t *restrict block, const uint8_t *pixels, ptrdiff_t line_size) { int i; - vec_u8 perm = vec_lvsl(0, pixels); const vec_u8 zero = (const vec_u8)vec_splat_u8(0); for (i = 0; i < 8; i++) { + vec_u8 perm = vec_lvsl(0, pixels); /* Read potentially unaligned pixels. * We're reading 16 pixels, and actually only want 8, * but we simply ignore the extras. */ @@ -157,8 +157,7 @@ static void diff_pixels_altivec(int16_t *restrict block, const uint8_t *s1, const uint8_t *s2, int stride) { int i; - vec_u8 perm1 = vec_lvsl(0, s1); - vec_u8 perm2 = vec_lvsl(0, s2); + vec_u8 perm; const vec_u8 zero = (const vec_u8)vec_splat_u8(0); vec_s16 shorts1, shorts2; @@ -166,17 +165,19 @@ static void diff_pixels_altivec(int16_t *restrict block, const uint8_t *s1, /* Read potentially unaligned pixels. * We're reading 16 pixels, and actually only want 8, * but we simply ignore the extras. */ + perm = vec_lvsl(0, s1); vec_u8 pixl = vec_ld(0, s1); vec_u8 pixr = vec_ld(15, s1); - vec_u8 bytes = vec_perm(pixl, pixr, perm1); + vec_u8 bytes = vec_perm(pixl, pixr, perm); // Convert the bytes into shorts. shorts1 = (vec_s16)vec_mergeh(zero, bytes); // Do the same for the second block of pixels. + perm = vec_lvsl(0, s2); pixl = vec_ld(0, s2); pixr = vec_ld(15, s2); - bytes = vec_perm(pixl, pixr, perm2); + bytes = vec_perm(pixl, pixr, perm); // Convert the bytes into shorts. shorts2 = (vec_s16)vec_mergeh(zero, bytes); @@ -197,17 +198,19 @@ static void diff_pixels_altivec(int16_t *restrict block, const uint8_t *s1, /* Read potentially unaligned pixels. * We're reading 16 pixels, and actually only want 8, * but we simply ignore the extras. */ + perm = vec_lvsl(0, s1); pixl = vec_ld(0, s1); pixr = vec_ld(15, s1); - bytes = vec_perm(pixl, pixr, perm1); + bytes = vec_perm(pixl, pixr, perm); // Convert the bytes into shorts. shorts1 = (vec_s16)vec_mergeh(zero, bytes); // Do the same for the second block of pixels. + perm = vec_lvsl(0, s2); pixl = vec_ld(0, s2); pixr = vec_ld(15, s2); - bytes = vec_perm(pixl, pixr, perm2); + bytes = vec_perm(pixl, pixr, perm); // Convert the bytes into shorts. shorts2 = (vec_s16)vec_mergeh(zero, bytes); From 31d657130b02b151a2fe6739f782d9d504b2cfda Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Thu, 3 Nov 2016 16:20:59 +0100 Subject: [PATCH 066/102] ffmpeg: fix width/height overrides for sub2video processing --- ffmpeg_filter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c index 38dfe5c398db3..5a0e85e3c0e38 100644 --- a/ffmpeg_filter.c +++ b/ffmpeg_filter.c @@ -692,8 +692,8 @@ static int sub2video_prepare(InputStream *ist, InputFilter *ifilter) } av_log(avf, AV_LOG_INFO, "sub2video: using %dx%d canvas\n", w, h); } - ist->sub2video.w = ist->resample_width = w; - ist->sub2video.h = ist->resample_height = h; + ist->sub2video.w = ist->resample_width = ifilter->width = w; + ist->sub2video.h = ist->resample_height = ifilter->height = h; /* rectangles are AV_PIX_FMT_PAL8, but we have no guarantee that the palettes for all rectangles are identical or compatible */ From 067910ed134461fd3afc42c82a401e952bd2172f Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Wed, 2 Nov 2016 11:48:57 -0400 Subject: [PATCH 067/102] hevc: Move hevc_decode_extradata before frame decoding Avoids a forward-declaration in the following commit. Signed-off-by: Vittorio Giovara Signed-off-by: Michael Niedermayer --- libavcodec/hevc.c | 148 +++++++++++++++++++++++----------------------- 1 file changed, 74 insertions(+), 74 deletions(-) diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c index 764e0938bbd4e..29e0d49891b8d 100644 --- a/libavcodec/hevc.c +++ b/libavcodec/hevc.c @@ -2973,6 +2973,80 @@ static int verify_md5(HEVCContext *s, AVFrame *frame) return 0; } +static int hevc_decode_extradata(HEVCContext *s) +{ + AVCodecContext *avctx = s->avctx; + GetByteContext gb; + int ret, i; + + bytestream2_init(&gb, avctx->extradata, avctx->extradata_size); + + if (avctx->extradata_size > 3 && + (avctx->extradata[0] || avctx->extradata[1] || + avctx->extradata[2] > 1)) { + /* It seems the extradata is encoded as hvcC format. + * Temporarily, we support configurationVersion==0 until 14496-15 3rd + * is finalized. When finalized, configurationVersion will be 1 and we + * can recognize hvcC by checking if avctx->extradata[0]==1 or not. */ + int i, j, num_arrays, nal_len_size; + + s->is_nalff = 1; + + bytestream2_skip(&gb, 21); + nal_len_size = (bytestream2_get_byte(&gb) & 3) + 1; + num_arrays = bytestream2_get_byte(&gb); + + /* nal units in the hvcC always have length coded with 2 bytes, + * so put a fake nal_length_size = 2 while parsing them */ + s->nal_length_size = 2; + + /* Decode nal units from hvcC. */ + for (i = 0; i < num_arrays; i++) { + int type = bytestream2_get_byte(&gb) & 0x3f; + int cnt = bytestream2_get_be16(&gb); + + for (j = 0; j < cnt; j++) { + // +2 for the nal size field + int nalsize = bytestream2_peek_be16(&gb) + 2; + if (bytestream2_get_bytes_left(&gb) < nalsize) { + av_log(s->avctx, AV_LOG_ERROR, + "Invalid NAL unit size in extradata.\n"); + return AVERROR_INVALIDDATA; + } + + ret = decode_nal_units(s, gb.buffer, nalsize); + if (ret < 0) { + av_log(avctx, AV_LOG_ERROR, + "Decoding nal unit %d %d from hvcC failed\n", + type, i); + return ret; + } + bytestream2_skip(&gb, nalsize); + } + } + + /* Now store right nal length size, that will be used to parse + * all other nals */ + s->nal_length_size = nal_len_size; + } else { + s->is_nalff = 0; + ret = decode_nal_units(s, avctx->extradata, avctx->extradata_size); + if (ret < 0) + return ret; + } + + /* export stream parameters from the first SPS */ + for (i = 0; i < FF_ARRAY_ELEMS(s->ps.sps_list); i++) { + if (s->ps.sps_list[i]) { + const HEVCSPS *sps = (const HEVCSPS*)s->ps.sps_list[i]->data; + export_stream_params(s->avctx, &s->ps, sps); + break; + } + } + + return 0; +} + static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output, AVPacket *avpkt) { @@ -3243,80 +3317,6 @@ static int hevc_update_thread_context(AVCodecContext *dst, return 0; } -static int hevc_decode_extradata(HEVCContext *s) -{ - AVCodecContext *avctx = s->avctx; - GetByteContext gb; - int ret, i; - - bytestream2_init(&gb, avctx->extradata, avctx->extradata_size); - - if (avctx->extradata_size > 3 && - (avctx->extradata[0] || avctx->extradata[1] || - avctx->extradata[2] > 1)) { - /* It seems the extradata is encoded as hvcC format. - * Temporarily, we support configurationVersion==0 until 14496-15 3rd - * is finalized. When finalized, configurationVersion will be 1 and we - * can recognize hvcC by checking if avctx->extradata[0]==1 or not. */ - int i, j, num_arrays, nal_len_size; - - s->is_nalff = 1; - - bytestream2_skip(&gb, 21); - nal_len_size = (bytestream2_get_byte(&gb) & 3) + 1; - num_arrays = bytestream2_get_byte(&gb); - - /* nal units in the hvcC always have length coded with 2 bytes, - * so put a fake nal_length_size = 2 while parsing them */ - s->nal_length_size = 2; - - /* Decode nal units from hvcC. */ - for (i = 0; i < num_arrays; i++) { - int type = bytestream2_get_byte(&gb) & 0x3f; - int cnt = bytestream2_get_be16(&gb); - - for (j = 0; j < cnt; j++) { - // +2 for the nal size field - int nalsize = bytestream2_peek_be16(&gb) + 2; - if (bytestream2_get_bytes_left(&gb) < nalsize) { - av_log(s->avctx, AV_LOG_ERROR, - "Invalid NAL unit size in extradata.\n"); - return AVERROR_INVALIDDATA; - } - - ret = decode_nal_units(s, gb.buffer, nalsize); - if (ret < 0) { - av_log(avctx, AV_LOG_ERROR, - "Decoding nal unit %d %d from hvcC failed\n", - type, i); - return ret; - } - bytestream2_skip(&gb, nalsize); - } - } - - /* Now store right nal length size, that will be used to parse - * all other nals */ - s->nal_length_size = nal_len_size; - } else { - s->is_nalff = 0; - ret = decode_nal_units(s, avctx->extradata, avctx->extradata_size); - if (ret < 0) - return ret; - } - - /* export stream parameters from the first SPS */ - for (i = 0; i < FF_ARRAY_ELEMS(s->ps.sps_list); i++) { - if (s->ps.sps_list[i]) { - const HEVCSPS *sps = (const HEVCSPS*)s->ps.sps_list[i]->data; - export_stream_params(s->avctx, &s->ps, sps); - break; - } - } - - return 0; -} - static av_cold int hevc_decode_init(AVCodecContext *avctx) { HEVCContext *s = avctx->priv_data; From 4abe1ff08f1fb2a909c4a99bd9e44a81e2c3cc3d Mon Sep 17 00:00:00 2001 From: Sasi Inguva Date: Wed, 26 Oct 2016 11:31:03 -0700 Subject: [PATCH 068/102] lavf/mov.c: Use the first sidx for tracks without sidx. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to spec ISO_IEC_15444_12 "For any media stream for which no segment index is present, referred to as non‐indexed stream, the media stream associated with the first Segment Index box in the segment serves as a reference stream in a sense that it also describes the subsegments for any non‐indexed media stream." Signed-off-by: Sasi Inguva Reviewed-by: Derek Buitenhuis Signed-off-by: Michael Niedermayer --- libavformat/isom.h | 1 + libavformat/mov.c | 25 ++++++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/libavformat/isom.h b/libavformat/isom.h index 90380578207a6..d6845029d18d3 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -179,6 +179,7 @@ typedef struct MOVStreamContext { int32_t *display_matrix; uint32_t format; + int has_sidx; // If there is an sidx entry for this stream. struct { int use_subsamples; uint8_t* auxiliary_info; diff --git a/libavformat/mov.c b/libavformat/mov.c index 4222088315628..9179b5865ac8e 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -4202,7 +4202,8 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom) uint8_t version; unsigned i, track_id; AVStream *st = NULL; - MOVStreamContext *sc; + AVStream *ref_st; + MOVStreamContext *sc, *ref_sc; MOVFragmentIndex *index = NULL; MOVFragmentIndex **tmp; AVRational timescale; @@ -4284,9 +4285,26 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom) c->fragment_index_data = tmp; c->fragment_index_data[c->fragment_index_count++] = index; + sc->has_sidx = 1; + + if (offset == avio_size(pb)) { + for (i = 0; i < c->fc->nb_streams; i++) { + if (c->fc->streams[i]->id == c->fragment_index_data[0]->track_id) { + ref_st = c->fc->streams[i]; + ref_sc = ref_st->priv_data; + break; + } + } + for (i = 0; i < c->fc->nb_streams; i++) { + st = c->fc->streams[i]; + sc = st->priv_data; + if (!sc->has_sidx) { + st->duration = sc->track_end = av_rescale(ref_st->duration, sc->time_scale, ref_sc->time_scale); + } + } - if (offset == avio_size(pb)) c->fragment_index_complete = 1; + } return 0; } @@ -5847,13 +5865,14 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) static int mov_seek_fragment(AVFormatContext *s, AVStream *st, int64_t timestamp) { MOVContext *mov = s->priv_data; + MOVStreamContext *sc = st->priv_data; int i, j; if (!mov->fragment_index_complete) return 0; for (i = 0; i < mov->fragment_index_count; i++) { - if (mov->fragment_index_data[i]->track_id == st->id) { + if (mov->fragment_index_data[i]->track_id == st->id || !sc->has_sidx) { MOVFragmentIndex *index = mov->fragment_index_data[i]; for (j = index->item_count - 1; j >= 0; j--) { if (index->items[j].time <= timestamp) { From 0bd1be65e88d6a4f367e698d7a2b105424eb1905 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Sun, 23 Oct 2016 13:57:41 +0200 Subject: [PATCH 069/102] lavd/xcbgrab: do not try to create refcounted packets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The framework will allocate a buffer and copy the data to it, that takes time. But it avoids constently creating and destroyng the shared memory segment, and that saves more time. On my setup, from ~200 to ~300 FPS at full screen (1920×1200), from ~1400 to ~3300 at smaller size (640×480), similar to legacy x11grab and confirmed by others. Plus, shared memory segments are a scarce resource, allocating potentially many is a bad idea. Note: if the application were to drop all references to the buffer before the next call to av_read_frame(), then passing the shared memory segment as a refcounted buffer would be even more efficient, but it is hard to guarantee, and it does not happen with the ffmpeg command-line tool. Using a small number of preallocated buffers and resorting to a copy when the pool is exhausted would be a solution to get the better of both worlds. --- libavdevice/xcbgrab.c | 65 +++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c index 9da46c8e0dae1..702e66c71f870 100644 --- a/libavdevice/xcbgrab.c +++ b/libavdevice/xcbgrab.c @@ -49,6 +49,8 @@ typedef struct XCBGrabContext { const AVClass *class; + uint8_t *buffer; + xcb_connection_t *conn; xcb_screen_t *screen; xcb_window_t window; @@ -219,22 +221,16 @@ static int check_shm(xcb_connection_t *conn) return 0; } -static void dealloc_shm(void *unused, uint8_t *data) -{ - shmdt(data); -} - -static int xcbgrab_frame_shm(AVFormatContext *s, AVPacket *pkt) +static int allocate_shm(AVFormatContext *s) { XCBGrabContext *c = s->priv_data; - xcb_shm_get_image_cookie_t iq; - xcb_shm_get_image_reply_t *img; - xcb_drawable_t drawable = c->screen->root; - uint8_t *data; int size = c->frame_size + AV_INPUT_BUFFER_PADDING_SIZE; - int id = shmget(IPC_PRIVATE, size, IPC_CREAT | 0777); - xcb_generic_error_t *e = NULL; + uint8_t *data; + int id; + if (c->buffer) + return 0; + id = shmget(IPC_PRIVATE, size, IPC_CREAT | 0777); if (id == -1) { char errbuf[1024]; int err = AVERROR(errno); @@ -243,15 +239,31 @@ static int xcbgrab_frame_shm(AVFormatContext *s, AVPacket *pkt) size, errbuf); return err; } - xcb_shm_attach(c->conn, c->segment, id, 0); + data = shmat(id, NULL, 0); + shmctl(id, IPC_RMID, 0); + if ((intptr_t)data == -1 || !data) + return AVERROR(errno); + c->buffer = data; + return 0; +} + +static int xcbgrab_frame_shm(AVFormatContext *s, AVPacket *pkt) +{ + XCBGrabContext *c = s->priv_data; + xcb_shm_get_image_cookie_t iq; + xcb_shm_get_image_reply_t *img; + xcb_drawable_t drawable = c->screen->root; + xcb_generic_error_t *e = NULL; + int ret; + + ret = allocate_shm(s); + if (ret < 0) + return ret; iq = xcb_shm_get_image(c->conn, drawable, c->x, c->y, c->width, c->height, ~0, XCB_IMAGE_FORMAT_Z_PIXMAP, c->segment, 0); - - xcb_shm_detach(c->conn, c->segment); - img = xcb_shm_get_image_reply(c->conn, iq, &e); xcb_flush(c->conn); @@ -264,25 +276,12 @@ static int xcbgrab_frame_shm(AVFormatContext *s, AVPacket *pkt) e->response_type, e->error_code, e->sequence, e->resource_id, e->minor_code, e->major_code); - shmctl(id, IPC_RMID, 0); return AVERROR(EACCES); } free(img); - data = shmat(id, NULL, 0); - shmctl(id, IPC_RMID, 0); - - if ((intptr_t)data == -1) - return AVERROR(errno); - - pkt->buf = av_buffer_create(data, size, dealloc_shm, NULL, 0); - if (!pkt->buf) { - shmdt(data); - return AVERROR(ENOMEM); - } - - pkt->data = pkt->buf->data; + pkt->data = c->buffer; pkt->size = c->frame_size; return 0; @@ -436,6 +435,12 @@ static av_cold int xcbgrab_read_close(AVFormatContext *s) { XCBGrabContext *ctx = s->priv_data; +#if CONFIG_LIBXCB_SHM + if (ctx->buffer) { + shmdt(ctx->buffer); + } +#endif + xcb_disconnect(ctx->conn); return 0; From cee1f4c06986941bd31cc19f4333d436394aa6f9 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 3 Nov 2016 11:30:50 +0100 Subject: [PATCH 070/102] avcodec/ac3dec: Check expacc this is somewhat a magic number, which can be understood from reading section "7.1.2 Exponent Strategy" of the ac3 specification, in short: Three exponents each represented as number 0-4 are grouped together and base-5 encoded, so the maximal correct value is 25*4 + 5*4 + 4 = 124. Reviewed-by: Andreas Cadhalpun Signed-off-by: Michael Niedermayer --- libavcodec/ac3dec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index a95c2049b52cd..499971acce81a 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -426,6 +426,10 @@ static int decode_exponents(AC3DecodeContext *s, group_size = exp_strategy + (exp_strategy == EXP_D45); for (grp = 0, i = 0; grp < ngrps; grp++) { expacc = get_bits(gbc, 7); + if (expacc >= 125) { + av_log(s->avctx, AV_LOG_ERROR, "expacc %d is out-of-range\n", expacc); + return AVERROR_INVALIDDATA; + } dexp[i++] = ungroup_3_in_7_bits_tab[expacc][0]; dexp[i++] = ungroup_3_in_7_bits_tab[expacc][1]; dexp[i++] = ungroup_3_in_7_bits_tab[expacc][2]; From 11f24e71ff2b598d973fd24bcf950eebaea9b3e6 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 3 Nov 2016 14:55:56 +0100 Subject: [PATCH 071/102] ffmpeg: Fix bsf corrupting merged side data Signed-off-by: Michael Niedermayer --- ffmpeg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ffmpeg.c b/ffmpeg.c index 52c655f2d1687..980987604f082 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -790,6 +790,7 @@ static void output_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost) if (ost->nb_bitstream_filters) { int idx; + av_packet_split_side_data(pkt); ret = av_bsf_send_packet(ost->bsf_ctx[0], pkt); if (ret < 0) goto finish; From 8a8902f2213b28a8dab1520bd42e88e5073f1f59 Mon Sep 17 00:00:00 2001 From: Derek Buitenhuis Date: Wed, 2 Nov 2016 14:37:25 +0000 Subject: [PATCH 072/102] libx265: Add option to force IDR frames This is in the same the same vein as c981b1145a857c8f962c93b8eecb1c613b20ffe9. Signed-off-by: Derek Buitenhuis Signed-off-by: Michael Niedermayer --- libavcodec/libx265.c | 5 ++++- libavcodec/version.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index d25be70ffd750..f9b287eb6609b 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -42,6 +42,7 @@ typedef struct libx265Context { const x265_api *api; float crf; + int forced_idr; char *preset; char *tune; char *x265_opts; @@ -273,7 +274,8 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, x265pic.pts = pic->pts; x265pic.bitDepth = av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth; - x265pic.sliceType = pic->pict_type == AV_PICTURE_TYPE_I ? X265_TYPE_I : + x265pic.sliceType = pic->pict_type == AV_PICTURE_TYPE_I ? + (ctx->forced_idr ? X265_TYPE_IDR : X265_TYPE_I) : pic->pict_type == AV_PICTURE_TYPE_P ? X265_TYPE_P : pic->pict_type == AV_PICTURE_TYPE_B ? X265_TYPE_B : X265_TYPE_AUTO; @@ -382,6 +384,7 @@ static av_cold void libx265_encode_init_csp(AVCodec *codec) #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { { "crf", "set the x265 crf", OFFSET(crf), AV_OPT_TYPE_FLOAT, { .dbl = -1 }, -1, FLT_MAX, VE }, + { "forced-idr", "if forcing keyframes, force them as IDR frames", OFFSET(forced_idr),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, { "preset", "set the x265 preset", OFFSET(preset), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, { "tune", "set the x265 tune parameter", OFFSET(tune), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, { "x265-params", "set the x265 configuration using a :-separated list of key=value parameters", OFFSET(x265_opts), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, diff --git a/libavcodec/version.h b/libavcodec/version.h index f7e2561c69d80..9799cfe137e8b 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 57 #define LIBAVCODEC_VERSION_MINOR 66 -#define LIBAVCODEC_VERSION_MICRO 100 +#define LIBAVCODEC_VERSION_MICRO 101 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ From b4e9252ae3d1094b3573299001684ae35d5a5d4f Mon Sep 17 00:00:00 2001 From: Muhammad Faiz Date: Thu, 3 Nov 2016 08:11:27 +0700 Subject: [PATCH 073/102] avfilter/af_firequalizer: add fft2 option 2-channels convolution using complex fft improves speed significantly not sure if it should be enabled by default so disable it by default Signed-off-by: Muhammad Faiz --- doc/filters.texi | 4 ++ libavfilter/af_firequalizer.c | 80 ++++++++++++++++++++++++++++++++- tests/filtergraphs/firequalizer | 8 ++-- 3 files changed, 88 insertions(+), 4 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 867b9324ece85..5bced37c4daed 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -2585,6 +2585,10 @@ Set file for dumping, suitable for gnuplot. @item dumpscale Set scale for dumpfile. Acceptable values are same with scale option. Default is linlog. + +@item fft2 +Enable 2-channel convolution using complex FFT. This improves speed significantly. +Default is disabled. @end table @subsection Examples diff --git a/libavfilter/af_firequalizer.c b/libavfilter/af_firequalizer.c index 4988717cd8b84..5c6fd542ae517 100644 --- a/libavfilter/af_firequalizer.c +++ b/libavfilter/af_firequalizer.c @@ -69,6 +69,7 @@ typedef struct { RDFTContext *analysis_irdft; RDFTContext *rdft; RDFTContext *irdft; + FFTContext *fft_ctx; int analysis_rdft_len; int rdft_len; @@ -97,6 +98,7 @@ typedef struct { int scale; char *dumpfile; int dumpscale; + int fft2; int nb_gain_entry; int gain_entry_err; @@ -132,6 +134,7 @@ static const AVOption firequalizer_options[] = { { "loglog", "logarithmic-freq logarithmic-gain", 0, AV_OPT_TYPE_CONST, { .i64 = SCALE_LOGLOG }, 0, 0, FLAGS, "scale" }, { "dumpfile", "set dump file", OFFSET(dumpfile), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, FLAGS }, { "dumpscale", "set dump scale", OFFSET(dumpscale), AV_OPT_TYPE_INT, { .i64 = SCALE_LINLOG }, 0, NB_SCALE-1, FLAGS, "scale" }, + { "fft2", "set 2-channels fft", OFFSET(fft2), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS }, { NULL } }; @@ -143,7 +146,9 @@ static void common_uninit(FIREqualizerContext *s) av_rdft_end(s->analysis_irdft); av_rdft_end(s->rdft); av_rdft_end(s->irdft); + av_fft_end(s->fft_ctx); s->analysis_rdft = s->analysis_irdft = s->rdft = s->irdft = NULL; + s->fft_ctx = NULL; av_freep(&s->analysis_buf); av_freep(&s->dump_buf); @@ -230,6 +235,70 @@ static void fast_convolute(FIREqualizerContext *s, const float *kernel_buf, floa } } +static void fast_convolute2(FIREqualizerContext *s, const float *kernel_buf, FFTComplex *conv_buf, + OverlapIndex *idx, float *data0, float *data1, int nsamples) +{ + if (nsamples <= s->nsamples_max) { + FFTComplex *buf = conv_buf + idx->buf_idx * s->rdft_len; + FFTComplex *obuf = conv_buf + !idx->buf_idx * s->rdft_len + idx->overlap_idx; + int center = s->fir_len/2; + int k; + float tmp; + + memset(buf, 0, center * sizeof(*buf)); + for (k = 0; k < nsamples; k++) { + buf[center+k].re = data0[k]; + buf[center+k].im = data1[k]; + } + memset(buf + center + nsamples, 0, (s->rdft_len - nsamples - center) * sizeof(*buf)); + av_fft_permute(s->fft_ctx, buf); + av_fft_calc(s->fft_ctx, buf); + + /* swap re <-> im, do backward fft using forward fft_ctx */ + /* normalize with 0.5f */ + tmp = buf[0].re; + buf[0].re = 0.5f * kernel_buf[0] * buf[0].im; + buf[0].im = 0.5f * kernel_buf[0] * tmp; + for (k = 1; k < s->rdft_len/2; k++) { + int m = s->rdft_len - k; + tmp = buf[k].re; + buf[k].re = 0.5f * kernel_buf[k] * buf[k].im; + buf[k].im = 0.5f * kernel_buf[k] * tmp; + tmp = buf[m].re; + buf[m].re = 0.5f * kernel_buf[k] * buf[m].im; + buf[m].im = 0.5f * kernel_buf[k] * tmp; + } + tmp = buf[k].re; + buf[k].re = 0.5f * kernel_buf[k] * buf[k].im; + buf[k].im = 0.5f * kernel_buf[k] * tmp; + + av_fft_permute(s->fft_ctx, buf); + av_fft_calc(s->fft_ctx, buf); + + for (k = 0; k < s->rdft_len - idx->overlap_idx; k++) { + buf[k].re += obuf[k].re; + buf[k].im += obuf[k].im; + } + + /* swapped re <-> im */ + for (k = 0; k < nsamples; k++) { + data0[k] = buf[k].im; + data1[k] = buf[k].re; + } + idx->buf_idx = !idx->buf_idx; + idx->overlap_idx = nsamples; + } else { + while (nsamples > s->nsamples_max * 2) { + fast_convolute2(s, kernel_buf, conv_buf, idx, data0, data1, s->nsamples_max); + data0 += s->nsamples_max; + data1 += s->nsamples_max; + nsamples -= s->nsamples_max; + } + fast_convolute2(s, kernel_buf, conv_buf, idx, data0, data1, nsamples/2); + fast_convolute2(s, kernel_buf, conv_buf, idx, data0 + nsamples/2, data1 + nsamples/2, nsamples - nsamples/2); + } +} + static void dump_fir(AVFilterContext *ctx, FILE *fp, int ch) { FIREqualizerContext *s = ctx->priv; @@ -598,6 +667,9 @@ static int config_input(AVFilterLink *inlink) if (!(s->rdft = av_rdft_init(rdft_bits, DFT_R2C)) || !(s->irdft = av_rdft_init(rdft_bits, IDFT_C2R))) return AVERROR(ENOMEM); + if (s->fft2 && !s->multi && inlink->channels > 1 && !(s->fft_ctx = av_fft_init(rdft_bits, 0))) + return AVERROR(ENOMEM); + for ( ; rdft_bits <= RDFT_BITS_MAX; rdft_bits++) { s->analysis_rdft_len = 1 << rdft_bits; if (inlink->sample_rate <= s->accuracy * s->analysis_rdft_len) @@ -640,7 +712,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) FIREqualizerContext *s = ctx->priv; int ch; - for (ch = 0; ch < inlink->channels; ch++) { + for (ch = 0; ch + 1 < inlink->channels && s->fft_ctx; ch += 2) { + fast_convolute2(s, s->kernel_buf, (FFTComplex *)(s->conv_buf + 2 * ch * s->rdft_len), + s->conv_idx + ch, (float *) frame->extended_data[ch], + (float *) frame->extended_data[ch+1], frame->nb_samples); + } + + for ( ; ch < inlink->channels; ch++) { fast_convolute(s, s->kernel_buf + (s->multi ? ch * s->rdft_len : 0), s->conv_buf + 2 * ch * s->rdft_len, s->conv_idx + ch, (float *) frame->extended_data[ch], frame->nb_samples); diff --git a/tests/filtergraphs/firequalizer b/tests/filtergraphs/firequalizer index ee432e287fbd5..777dfddc37c45 100644 --- a/tests/filtergraphs/firequalizer +++ b/tests/filtergraphs/firequalizer @@ -1,4 +1,5 @@ firequalizer = + fft2 = on: gain = 'sin(0.001*f) - 1': delay = 0.05, @@ -10,14 +11,15 @@ firequalizer = zero_phase = on: wfunc = nuttall, +firequalizer = + fft2 = on: + gain_entry = 'entry(1000, 0); entry(5000, 0.1); entry(10000, 0.2)', + firequalizer = gain = 'if (ch, -0.3 * sin(0.001*f), -0.8 * sin(0.001*f)) - 1': delay = 0.05: multi = on, -firequalizer = - gain_entry = 'entry(1000, 0); entry(5000, 0.1); entry(10000, 0.2)', - firequalizer = gain_entry = 'entry(1000, 0.2); entry(5000, 0.1); entry(10000, 0)', From 5a4935c012fd3ca7cc0720897cf00c5759307ced Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 4 Nov 2016 00:16:51 +0100 Subject: [PATCH 074/102] ffmpeg: Warn if thousands of frames are duplicated. Fixes ticket #5193. --- ffmpeg.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ffmpeg.c b/ffmpeg.c index 980987604f082..28daf5f6749cd 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -126,6 +126,7 @@ static int64_t getmaxrss(void); static int run_as_daemon = 0; static int nb_frames_dup = 0; +static unsigned dup_warning = 1000; static int nb_frames_drop = 0; static int64_t decode_error_stat[2]; @@ -1136,6 +1137,10 @@ static void do_video_out(OutputFile *of, } nb_frames_dup += nb_frames - (nb0_frames && ost->last_dropped) - (nb_frames > nb0_frames); av_log(NULL, AV_LOG_VERBOSE, "*** %d dup!\n", nb_frames - 1); + if (nb_frames_dup > dup_warning) { + av_log(NULL, AV_LOG_WARNING, "More than %d frames duplicated\n", dup_warning); + dup_warning *= 10; + } } ost->last_dropped = nb_frames == nb0_frames && next_picture; From db23fde7849aba272509345b63463494582d9530 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 4 Nov 2016 12:23:47 +0100 Subject: [PATCH 075/102] lavf/mux: Add missing CR/LF to error messages. --- libavformat/mux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/mux.c b/libavformat/mux.c index 06d87dec7fb25..2dac381fcc3d5 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -891,7 +891,7 @@ static int do_packet_auto_bsf(AVFormatContext *s, AVPacket *pkt) { // flush each stream's BSF chain on write_trailer. if ((ret = av_bsf_send_packet(ctx, pkt)) < 0) { av_log(ctx, AV_LOG_ERROR, - "Failed to send packet to filter %s for stream %d", + "Failed to send packet to filter %s for stream %d\n", ctx->filter->name, pkt->stream_index); return ret; } @@ -902,7 +902,7 @@ static int do_packet_auto_bsf(AVFormatContext *s, AVPacket *pkt) { if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) return 0; av_log(ctx, AV_LOG_ERROR, - "Failed to send packet to filter %s for stream %d", + "Failed to send packet to filter %s for stream %d\n", ctx->filter->name, pkt->stream_index); return ret; } From fb240a6276fa36fe120aadd67b4ca774e354f22b Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 14 Jul 2016 12:52:20 +0200 Subject: [PATCH 076/102] qsvenc: do not re-execute encoding on all positive status codes It should only be done for DEVICE_BUSY/IN_EXECUTION (cherry picked from commit 0956fd460681e8ccbdae19f135f0d3970bf95c2f) Fixes ticket #5924. --- libavcodec/qsvenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 7445d5b1220e3..ac443c1a26541 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -982,7 +982,7 @@ static int encode_frame(AVCodecContext *avctx, QSVEncContext *q, ret = MFXVideoENCODE_EncodeFrameAsync(q->session, enc_ctrl, surf, bs, sync); if (ret == MFX_WRN_DEVICE_BUSY) av_usleep(500); - } while (ret > 0); + } while (ret == MFX_WRN_DEVICE_BUSY || ret == MFX_WRN_IN_EXECUTION); if (ret < 0) { av_packet_unref(&new_pkt); From 92280f86b4065be34f52531c73068bbe7f33febd Mon Sep 17 00:00:00 2001 From: Tom Butterworth Date: Fri, 4 Nov 2016 13:57:18 +0000 Subject: [PATCH 077/102] avcodec/hap: consistent name for codec "Vidvox Hap", not "Vidvox Hap encoder" or "Vidvox Hap decoder". Fixes bad name in "ffmpeg -codecs", matches other codec naming. Signed-off-by: Paul B Mahol --- libavcodec/codec_desc.c | 2 +- libavcodec/hapdec.c | 2 +- libavcodec/hapenc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 2612215b66986..9dbe2dc7eaff4 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -1273,7 +1273,7 @@ static const AVCodecDescriptor codec_descriptors[] = { .id = AV_CODEC_ID_HAP, .type = AVMEDIA_TYPE_VIDEO, .name = "hap", - .long_name = NULL_IF_CONFIG_SMALL("Vidvox Hap decoder"), + .long_name = NULL_IF_CONFIG_SMALL("Vidvox Hap"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c index f1d44cda24b51..a1cb0c76aaa91 100644 --- a/libavcodec/hapdec.c +++ b/libavcodec/hapdec.c @@ -426,7 +426,7 @@ static av_cold int hap_close(AVCodecContext *avctx) AVCodec ff_hap_decoder = { .name = "hap", - .long_name = NULL_IF_CONFIG_SMALL("Vidvox Hap decoder"), + .long_name = NULL_IF_CONFIG_SMALL("Vidvox Hap"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_HAP, .init = hap_init, diff --git a/libavcodec/hapenc.c b/libavcodec/hapenc.c index c09a639932502..076923b87d28c 100644 --- a/libavcodec/hapenc.c +++ b/libavcodec/hapenc.c @@ -318,7 +318,7 @@ static const AVClass hapenc_class = { AVCodec ff_hap_encoder = { .name = "hap", - .long_name = NULL_IF_CONFIG_SMALL("Vidvox Hap encoder"), + .long_name = NULL_IF_CONFIG_SMALL("Vidvox Hap"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_HAP, .priv_data_size = sizeof(HapContext), From 8a4ea9644833d43fdfe8579c0cb569f8a0930206 Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Fri, 4 Nov 2016 18:59:31 +0100 Subject: [PATCH 078/102] diracdec: use correct buffer for slice_params_buf realloc This fixes a double-free detected by AddressSanitizer. The problem was introduced in commit dcad4677d637cd2f701917e38361fa96b8c9a418. Reviewed-by: Rostislav Pehlivanov Signed-off-by: Andreas Cadhalpun --- libavcodec/diracdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index b183fad584f03..5c669ffdee9b2 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -907,7 +907,7 @@ static int decode_lowdelay(DiracContext *s) int slice_num = 0; if (s->slice_params_num_buf != (s->num_x * s->num_y)) { - s->slice_params_buf = av_realloc_f(s->thread_buf, s->num_x * s->num_y, sizeof(DiracSlice)); + s->slice_params_buf = av_realloc_f(s->slice_params_buf, s->num_x * s->num_y, sizeof(DiracSlice)); if (!s->slice_params_buf) { av_log(s->avctx, AV_LOG_ERROR, "slice params buffer allocation failure\n"); return AVERROR(ENOMEM); From 24d20496d2e6e1df6456c5231d892269dd1fcf38 Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Fri, 4 Nov 2016 19:00:01 +0100 Subject: [PATCH 079/102] diracdec: clear slice_params_num_buf on allocation failure Otherwise it can be non-zero next time decode_lowdelay is called, causing slice_params_buf not to be allocated, leading to a NULL pointer dereference. The problem was introduced in commit dcad4677d637cd2f701917e38361fa96b8c9a418. Reviewed-by: Rostislav Pehlivanov Signed-off-by: Andreas Cadhalpun --- libavcodec/diracdec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index 5c669ffdee9b2..bb314d0df655f 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -910,6 +910,7 @@ static int decode_lowdelay(DiracContext *s) s->slice_params_buf = av_realloc_f(s->slice_params_buf, s->num_x * s->num_y, sizeof(DiracSlice)); if (!s->slice_params_buf) { av_log(s->avctx, AV_LOG_ERROR, "slice params buffer allocation failure\n"); + s->slice_params_num_buf = 0; return AVERROR(ENOMEM); } s->slice_params_num_buf = s->num_x * s->num_y; From db79dedb1ae5dd38432eee3f09155e26f3f2d95a Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Fri, 4 Nov 2016 19:00:17 +0100 Subject: [PATCH 080/102] diracdec: check return code of get_buffer_with_edge If it fails, buffers aren't allocated, causing NULL pointer dereferencing. Reviewed-by: Rostislav Pehlivanov Signed-off-by: Andreas Cadhalpun --- libavcodec/diracdec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index bb314d0df655f..e0604af103847 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -1975,7 +1975,9 @@ static int dirac_decode_picture_header(DiracContext *s) for (j = 0; j < MAX_FRAMES; j++) if (!s->all_frames[j].avframe->data[0]) { s->ref_pics[i] = &s->all_frames[j]; - get_buffer_with_edge(s->avctx, s->ref_pics[i]->avframe, AV_GET_BUFFER_FLAG_REF); + ret = get_buffer_with_edge(s->avctx, s->ref_pics[i]->avframe, AV_GET_BUFFER_FLAG_REF); + if (ret < 0) + return ret; break; } From fba2a8a254997e0db39a30438e96e5f3e44c669a Mon Sep 17 00:00:00 2001 From: James Almer Date: Fri, 4 Nov 2016 12:48:20 -0300 Subject: [PATCH 081/102] avformat/mux: split side data earlier in av_write_frame and av_interleaved_write_frame Similarly, merge it back before returning. Fixes ticket #5927. Reviewed-by: Michael Niedermayer Signed-off-by: James Almer --- libavformat/mux.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/libavformat/mux.c b/libavformat/mux.c index 2dac381fcc3d5..816e8567ce82f 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -692,7 +692,7 @@ FF_ENABLE_DEPRECATION_WARNINGS */ static int write_packet(AVFormatContext *s, AVPacket *pkt) { - int ret, did_split; + int ret; int64_t pts_backup, dts_backup; pts_backup = pkt->pts; @@ -755,8 +755,6 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) } } - did_split = av_packet_split_side_data(pkt); - if (!s->internal->header_written) { ret = s->internal->write_header_ret ? s->internal->write_header_ret : write_header_internal(s); if (ret < 0) @@ -780,9 +778,6 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) } fail: - if (did_split) - av_packet_merge_side_data(pkt); - if (ret < 0) { pkt->pts = pts_backup; pkt->dts = dts_backup; @@ -918,7 +913,7 @@ static int do_packet_auto_bsf(AVFormatContext *s, AVPacket *pkt) { int av_write_frame(AVFormatContext *s, AVPacket *pkt) { - int ret; + int ret, did_split = 0; ret = prepare_input_packet(s, pkt); if (ret < 0) @@ -939,7 +934,8 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt) return ret; } return 1; - } + } else + did_split = av_packet_split_side_data(pkt); ret = do_packet_auto_bsf(s, pkt); if (ret <= 0) @@ -958,6 +954,10 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt) if (ret >= 0) s->streams[pkt->stream_index]->nb_frames++; + + if (did_split) + av_packet_merge_side_data(pkt); + return ret; } @@ -1224,7 +1224,7 @@ static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, in int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt) { - int ret, flush = 0; + int ret, did_split = 0, flush = 0; ret = prepare_input_packet(s, pkt); if (ret < 0) @@ -1233,6 +1233,8 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt) if (pkt) { AVStream *st = s->streams[pkt->stream_index]; + did_split = av_packet_split_side_data(pkt); + ret = do_packet_auto_bsf(s, pkt); if (ret == 0) return 0; @@ -1280,6 +1282,9 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt) return s->pb->error; } fail: + if (did_split) + av_packet_merge_side_data(pkt); + av_packet_unref(pkt); return ret; } From c06d9234101646d4bf3d239e4fba629a3e4e981f Mon Sep 17 00:00:00 2001 From: Thomas Garnier Date: Fri, 28 Oct 2016 23:02:21 +0200 Subject: [PATCH 082/102] doc/examples: add fuzz target for individual ffmpeg APIs for in-process fuzzing with libFuzzer, AFL, and similar fuzzing engines. Signed-off-by: Michael Niedermayer --- doc/examples/decoder_targeted.c | 201 ++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 doc/examples/decoder_targeted.c diff --git a/doc/examples/decoder_targeted.c b/doc/examples/decoder_targeted.c new file mode 100644 index 0000000000000..f254f603ee848 --- /dev/null +++ b/doc/examples/decoder_targeted.c @@ -0,0 +1,201 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* Targeted fuzzer that targets specific codecs depending on two + compile-time flags. + INSTRUCTIONS: + + * Get the very fresh clang, e.g. see http://libfuzzer.info#versions + * Get and build libFuzzer: + svn co http://llvm.org/svn/llvm-project/llvm/trunk/lib/Fuzzer + ./Fuzzer/build.sh + * build ffmpeg for fuzzing: + FLAGS="-fsanitize=address -fsanitize-coverage=trace-pc-guard,trace-cmp -g" CC="clang $FLAGS" CXX="clang++ $FLAGS" ./configure --disable-yasm + make clean && make -j + * build the fuzz target. + Choose the value of FFMPEG_CODEC (e.g. AV_CODEC_ID_DVD_SUBTITLE) and + choose one of FUZZ_FFMPEG_VIDEO, FUZZ_FFMPEG_AUDIO, FUZZ_FFMPEG_SUBTITLE. + clang -fsanitize=address -fsanitize-coverage=trace-pc-guard,trace-cmp doc/examples/decoder_targeted.c -o decoder_targeted -I. -DFFMPEG_CODEC=AV_CODEC_ID_MPEG1VIDEO -DFUZZ_FFMPEG_VIDEO ../../libfuzzer/libFuzzer.a -Llibavcodec -Llibavdevice -Llibavfilter -Llibavformat -Llibavresample -Llibavutil -Llibpostproc -Llibswscale -Llibswresample -Wl,--as-needed -Wl,-z,noexecstack -Wl,--warn-common -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample -lavdevice -lavfilter -lavformat -lavcodec -lswresample -lswscale -lavutil -ldl -lxcb -lxcb-shm -lxcb -lxcb-xfixes -lxcb -lxcb-shape -lxcb -lX11 -lasound -lm -lbz2 -lz -pthread + * create a corpus directory and put some samples there (empty dir is ok too): + mkdir CORPUS && cp some-files CORPUS + + * Run fuzzing: + ./decoder_targeted -max_len=100000 CORPUS + + More info: + http://libfuzzer.info + http://tutorial.libfuzzer.info + https://github.com/google/oss-fuzz + http://lcamtuf.coredump.cx/afl/ + https://security.googleblog.com/2016/08/guided-in-process-fuzzing-of-chrome.html +*/ + +#include "libavutil/avassert.h" + +#include "libavcodec/avcodec.h" +#include "libavformat/avformat.h" + +static void error(const char *err) +{ + fprintf(stderr, "%s", err); + exit(1); +} + +static AVCodec *c = NULL; +static AVCodec *AVCodecInitialize(enum AVCodecID codec_id) +{ + AVCodec *res; + av_register_all(); + av_log_set_level(AV_LOG_PANIC); + res = avcodec_find_decoder(codec_id); + if (!res) + error("Failed to find decoder"); + return res; +} + +#if defined(FUZZ_FFMPEG_VIDEO) +#define decode_handler avcodec_decode_video2 +#elif defined(FUZZ_FFMPEG_AUDIO) +#define decode_handler avcodec_decode_audio4 +#elif defined(FUZZ_FFMPEG_SUBTITLE) +static int subtitle_handler(AVCodecContext *avctx, void *frame, + int *got_sub_ptr, AVPacket *avpkt) +{ + AVSubtitle sub; + int ret = avcodec_decode_subtitle2(avctx, &sub, got_sub_ptr, avpkt); + if (ret >= 0 && *got_sub_ptr) + avsubtitle_free(&sub); + return ret; +} + +#define decode_handler subtitle_handler +#else +#error "Specify encoder type" // To catch mistakes +#endif + +// Class to handle buffer allocation and resize for each frame +typedef struct FuzzDataBuffer { + size_t size_; + uint8_t *data_; +} FuzzDataBuffer; + +void FDBCreate(FuzzDataBuffer *FDB) { + FDB->size_ = 0x1000; + FDB->data_ = av_malloc(FDB->size_); + if (!FDB->data_) + error("Failed memory allocation"); +} + +void FDBDesroy(FuzzDataBuffer *FDB) { av_free(FDB->data_); } + +void FDBRealloc(FuzzDataBuffer *FDB, size_t size) { + size_t needed = size + FF_INPUT_BUFFER_PADDING_SIZE; + av_assert0(needed > size); + if (needed > FDB->size_) { + av_free(FDB->data_); + FDB->size_ = needed; + FDB->data_ = av_malloc(FDB->size_); + if (!FDB->data_) + error("Failed memory allocation"); + } +} + +void FDBPrepare(FuzzDataBuffer *FDB, AVPacket *dst, const uint8_t *data, + size_t size) +{ + FDBRealloc(FDB, size); + memcpy(FDB->data_, data, size); + size_t padd = FDB->size_ - size; + if (padd > FF_INPUT_BUFFER_PADDING_SIZE) + padd = FF_INPUT_BUFFER_PADDING_SIZE; + memset(FDB->data_ + size, 0, padd); + av_init_packet(dst); + dst->data = FDB->data_; + dst->size = size; +} + +// Ensure we don't loop forever +const uint32_t maxiteration = 8096; + +static const uint64_t FUZZ_TAG = 0x4741542D5A5A5546ULL; + +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + const uint64_t fuzz_tag = FUZZ_TAG; + FuzzDataBuffer buffer; + const uint8_t *last = data; + const uint8_t *end = data + size; + uint32_t it = 0; + + if (!c) + c = AVCodecInitialize(FFMPEG_CODEC); // Done once. + + AVCodecContext* ctx = avcodec_alloc_context3(NULL); + if (!ctx) + error("Failed memory allocation"); + int res = avcodec_open2(ctx, c, NULL); + if (res < 0) + return res; + + FDBCreate(&buffer); + int got_frame; + AVFrame *frame = av_frame_alloc(); + if (!frame) + error("Failed memory allocation"); + + // Read very simple container + AVPacket avpkt; + while (data < end && it < maxiteration) { + // Search for the TAG + while (data + sizeof(fuzz_tag) < end) { + if (data[0] == (fuzz_tag & 0xFF) && *(const uint64_t *)(data) == fuzz_tag) + break; + data++; + } + if (data + sizeof(fuzz_tag) > end) + data = end; + + FDBPrepare(&buffer, &avpkt, last, data - last); + data += sizeof(fuzz_tag); + last = data; + + // Iterate through all data + while (avpkt.size > 0 && it++ < maxiteration) { + av_frame_unref(frame); + int ret = decode_handler(ctx, frame, &got_frame, &avpkt); + if (ret <= 0 || ret > avpkt.size) + break; + avpkt.data += ret; + avpkt.size -= ret; + } + } + + av_init_packet(&avpkt); + avpkt.data = NULL; + avpkt.size = 0; + + do { + got_frame = 0; + decode_handler(ctx, frame, &got_frame, &avpkt); + } while (got_frame == 1 && it++ < maxiteration); + + av_frame_free(&frame); + avcodec_free_context(&ctx); + av_freep(&ctx); + FDBDesroy(&buffer); + return 0; +} From 222f59afd1cf900aaf4ac42ad9d5fc445d554d6a Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sat, 5 Nov 2016 00:41:16 +0100 Subject: [PATCH 083/102] lavf/movenc: Do not print an error when muxing gray8 rawvideo. This was fixed in 9a2778082121ea44d06a2f00f822ea99109c7fd8 --- libavformat/movenc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 6228192f98906..efa050ee44d98 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1427,6 +1427,7 @@ static int mov_get_rawvideo_codec_tag(AVFormatContext *s, MOVTrack *track) track->par->bits_per_coded_sample); if (tag == MKTAG('r','a','w',' ') && track->par->format != pix_fmt && + track->par->format != AV_PIX_FMT_GRAY8 && track->par->format != AV_PIX_FMT_NONE) av_log(s, AV_LOG_ERROR, "%s rawvideo cannot be written to mov, output file will be unreadable\n", av_get_pix_fmt_name(track->par->format)); From 6005c7e656962b4c6d13fe877828b4d24bf2974b Mon Sep 17 00:00:00 2001 From: James Almer Date: Fri, 4 Nov 2016 21:58:49 -0300 Subject: [PATCH 084/102] Revert "avformat/mux: split side data earlier in av_write_frame and av_interleaved_write_frame" This reverts commit fba2a8a254997e0db39a30438e96e5f3e44c669a. The changes were right for av_write_frame() but not for av_interleaved_write_frame(). The following commit will fix this in a simpler way. Signed-off-by: James Almer --- libavformat/mux.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/libavformat/mux.c b/libavformat/mux.c index 816e8567ce82f..2dac381fcc3d5 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -692,7 +692,7 @@ FF_ENABLE_DEPRECATION_WARNINGS */ static int write_packet(AVFormatContext *s, AVPacket *pkt) { - int ret; + int ret, did_split; int64_t pts_backup, dts_backup; pts_backup = pkt->pts; @@ -755,6 +755,8 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) } } + did_split = av_packet_split_side_data(pkt); + if (!s->internal->header_written) { ret = s->internal->write_header_ret ? s->internal->write_header_ret : write_header_internal(s); if (ret < 0) @@ -778,6 +780,9 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) } fail: + if (did_split) + av_packet_merge_side_data(pkt); + if (ret < 0) { pkt->pts = pts_backup; pkt->dts = dts_backup; @@ -913,7 +918,7 @@ static int do_packet_auto_bsf(AVFormatContext *s, AVPacket *pkt) { int av_write_frame(AVFormatContext *s, AVPacket *pkt) { - int ret, did_split = 0; + int ret; ret = prepare_input_packet(s, pkt); if (ret < 0) @@ -934,8 +939,7 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt) return ret; } return 1; - } else - did_split = av_packet_split_side_data(pkt); + } ret = do_packet_auto_bsf(s, pkt); if (ret <= 0) @@ -954,10 +958,6 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt) if (ret >= 0) s->streams[pkt->stream_index]->nb_frames++; - - if (did_split) - av_packet_merge_side_data(pkt); - return ret; } @@ -1224,7 +1224,7 @@ static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, in int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt) { - int ret, did_split = 0, flush = 0; + int ret, flush = 0; ret = prepare_input_packet(s, pkt); if (ret < 0) @@ -1233,8 +1233,6 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt) if (pkt) { AVStream *st = s->streams[pkt->stream_index]; - did_split = av_packet_split_side_data(pkt); - ret = do_packet_auto_bsf(s, pkt); if (ret == 0) return 0; @@ -1282,9 +1280,6 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt) return s->pb->error; } fail: - if (did_split) - av_packet_merge_side_data(pkt); - av_packet_unref(pkt); return ret; } From 9e588125193115189b5a609eef6af678a55f6ecf Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 4 Nov 2016 13:43:45 +0100 Subject: [PATCH 085/102] avformat/mux: split side data before internal auto BSF The bitstream filters do not work with merged in side data This leaves the input packet split if it is being split. Signed-off-by: Michael Niedermayer Signed-off-by: James Almer --- libavformat/mux.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/mux.c b/libavformat/mux.c index 2dac381fcc3d5..0d285f4a59558 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -878,6 +878,9 @@ static int do_packet_auto_bsf(AVFormatContext *s, AVPacket *pkt) { } } + if (st->internal->nb_bsfcs) + av_packet_split_side_data(pkt); + for (i = 0; i < st->internal->nb_bsfcs; i++) { AVBSFContext *ctx = st->internal->bsfcs[i]; if (i > 0) { From 7e603fb322d19f433723e95538f1b867b15ebf40 Mon Sep 17 00:00:00 2001 From: James Almer Date: Fri, 4 Nov 2016 17:38:53 -0300 Subject: [PATCH 086/102] fate: add bsf tests for ticket 5927 Tested-by: Michael Niedermayer Signed-off-by: James Almer --- tests/fate/ffmpeg.mak | 6 ++++++ tests/ref/fate/h264_mp4toannexb_ticket5927 | 21 ++++++++++++++++++++ tests/ref/fate/h264_mp4toannexb_ticket5927_2 | 21 ++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 tests/ref/fate/h264_mp4toannexb_ticket5927 create mode 100644 tests/ref/fate/h264_mp4toannexb_ticket5927_2 diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak index b58a46dab3c5d..244f63dc5b0cf 100644 --- a/tests/fate/ffmpeg.mak +++ b/tests/fate/ffmpeg.mak @@ -99,6 +99,12 @@ fate-h264_mp4toannexb_ticket2991: $(TARGET_SAMPLES)/h264/wwwq_cut.mp4 fate-h264_mp4toannexb_ticket2991: CMD = transcode "mp4" $(TARGET_SAMPLES)/h264/wwwq_cut.mp4\ h264 "-c:v copy -bsf:v h264_mp4toannexb" "-codec copy" +FATE_SAMPLES_FFMPEG-$(call ALLYES, MOV_DEMUXER H264_MUXER H264_MP4TOANNEXB_BSF) += fate-h264_mp4toannexb_ticket5927 fate-h264_mp4toannexb_ticket5927_2 +fate-h264_mp4toannexb_ticket5927: CMD = transcode "mp4" $(TARGET_SAMPLES)/h264/thezerotheorem-cut.mp4 \ + h264 "-c:v copy -bsf:v h264_mp4toannexb -an" "-c:v copy" +fate-h264_mp4toannexb_ticket5927_2: CMD = transcode "mp4" $(TARGET_SAMPLES)/h264/thezerotheorem-cut.mp4 \ + h264 "-c:v copy -an" "-c:v copy" + FATE_SAMPLES_FFMPEG-$(call ALLYES, MPEGPS_DEMUXER AVI_MUXER REMOVE_EXTRADATA_BSF) += fate-ffmpeg-bsf-remove-k fate-ffmpeg-bsf-remove-r fate-ffmpeg-bsf-remove-e fate-ffmpeg-bsf-remove-k: $(TARGET_SAMPLES)/mpeg2/matrixbench_mpeg2.lq1.mpg fate-ffmpeg-bsf-remove-k: CMD = transcode "mpeg" $(TARGET_SAMPLES)/mpeg2/matrixbench_mpeg2.lq1.mpg\ diff --git a/tests/ref/fate/h264_mp4toannexb_ticket5927 b/tests/ref/fate/h264_mp4toannexb_ticket5927 new file mode 100644 index 0000000000000..60a1deb8e1972 --- /dev/null +++ b/tests/ref/fate/h264_mp4toannexb_ticket5927 @@ -0,0 +1,21 @@ +a3b02fd09392e01619cebc959d4d9ff2 *tests/data/fate/h264_mp4toannexb_ticket5927.h264 +595583 tests/data/fate/h264_mp4toannexb_ticket5927.h264 +#extradata 0: 59, 0xf10e1136 +#tb 0: 1/1200000 +#media_type 0: video +#codec_id 0: h264 +#dimensions 0: 1920x1080 +#sar 0: 0/1 +0, -48000, -9223372036854775808, 48000, 247993, 0x1ce821ea +0, 0, -9223372036854775808, 48000, 43354, 0xa05dca6f, F=0x0 +0, 48000, -9223372036854775808, 48000, 11423, 0x5e8086dd, F=0x0 +0, 96000, -9223372036854775808, 48000, 50798, 0x145fbe4f, F=0x0 +0, 144000, -9223372036854775808, 48000, 12567, 0x1e3d5304, F=0x0 +0, 192000, -9223372036854775808, 48000, 52444, 0x1a6c1a64, F=0x0 +0, 240000, -9223372036854775808, 48000, 12575, 0x2fff484b, F=0x0 +0, 288000, -9223372036854775808, 48000, 54025, 0xb3bf0ce6, F=0x0 +0, 336000, -9223372036854775808, 48000, 13539, 0xfdb16c57, F=0x0 +0, 384000, -9223372036854775808, 48000, 54483, 0xefead99f, F=0x0 +0, 432000, -9223372036854775808, 48000, 13705, 0x23cd27e8, F=0x0 +0, 480000, -9223372036854775808, 48000, 22308, 0x4093b5af, F=0x0 +0, 528000, -9223372036854775808, 48000, 6369, 0x858b2aa1 diff --git a/tests/ref/fate/h264_mp4toannexb_ticket5927_2 b/tests/ref/fate/h264_mp4toannexb_ticket5927_2 new file mode 100644 index 0000000000000..b5f11e3432e5c --- /dev/null +++ b/tests/ref/fate/h264_mp4toannexb_ticket5927_2 @@ -0,0 +1,21 @@ +a3b02fd09392e01619cebc959d4d9ff2 *tests/data/fate/h264_mp4toannexb_ticket5927_2.h264 +595583 tests/data/fate/h264_mp4toannexb_ticket5927_2.h264 +#extradata 0: 59, 0xf10e1136 +#tb 0: 1/1200000 +#media_type 0: video +#codec_id 0: h264 +#dimensions 0: 1920x1080 +#sar 0: 0/1 +0, -48000, -9223372036854775808, 48000, 247993, 0x1ce821ea +0, 0, -9223372036854775808, 48000, 43354, 0xa05dca6f, F=0x0 +0, 48000, -9223372036854775808, 48000, 11423, 0x5e8086dd, F=0x0 +0, 96000, -9223372036854775808, 48000, 50798, 0x145fbe4f, F=0x0 +0, 144000, -9223372036854775808, 48000, 12567, 0x1e3d5304, F=0x0 +0, 192000, -9223372036854775808, 48000, 52444, 0x1a6c1a64, F=0x0 +0, 240000, -9223372036854775808, 48000, 12575, 0x2fff484b, F=0x0 +0, 288000, -9223372036854775808, 48000, 54025, 0xb3bf0ce6, F=0x0 +0, 336000, -9223372036854775808, 48000, 13539, 0xfdb16c57, F=0x0 +0, 384000, -9223372036854775808, 48000, 54483, 0xefead99f, F=0x0 +0, 432000, -9223372036854775808, 48000, 13705, 0x23cd27e8, F=0x0 +0, 480000, -9223372036854775808, 48000, 22308, 0x4093b5af, F=0x0 +0, 528000, -9223372036854775808, 48000, 6369, 0x858b2aa1 From 51e329918dc1826de7451541cb15bef3b9bfe138 Mon Sep 17 00:00:00 2001 From: James Almer Date: Thu, 3 Nov 2016 22:34:58 -0300 Subject: [PATCH 087/102] avcodec/rawdec: check for side data before checking its size Fixes valgrind warnings about usage of uninitialized values. Reviewed-by: Michael Niedermayer Signed-off-by: James Almer --- libavcodec/rawdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c index 45cf27fa20853..e53eb2eacc800 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -369,7 +369,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, &pal_size); int ret; - if (pal_size != AVPALETTE_SIZE) { + if (pal && pal_size != AVPALETTE_SIZE) { av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", pal_size); pal = NULL; } From 55061bbc558e22db04a40e4efed46d9c15b124b6 Mon Sep 17 00:00:00 2001 From: James Almer Date: Sat, 5 Nov 2016 00:04:27 -0300 Subject: [PATCH 088/102] ffmpeg: don't overwrite av_bsf_receive_packet return value before checking it Reviewed-by: Michael Niedermayer Signed-off-by: James Almer --- ffmpeg.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index 28daf5f6749cd..067ef1dab5cc1 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -800,6 +800,12 @@ static void output_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost) while (idx) { /* get a packet from the previous filter up the chain */ ret = av_bsf_receive_packet(ost->bsf_ctx[idx - 1], pkt); + if (ret == AVERROR(EAGAIN)) { + ret = 0; + idx--; + continue; + } else if (ret < 0) + goto finish; /* HACK! - aac_adtstoasc updates extradata after filtering the first frame when * the api states this shouldn't happen after init(). Propagate it here to the * muxer and to the next filters in the chain to workaround this. @@ -811,12 +817,6 @@ static void output_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost) goto finish; ost->bsf_extradata_updated[idx - 1] |= 1; } - if (ret == AVERROR(EAGAIN)) { - ret = 0; - idx--; - continue; - } else if (ret < 0) - goto finish; /* send it to the next filter down the chain or to the muxer */ if (idx < ost->nb_bitstream_filters) { From 85553b42f92457a581e13edbd3e2c2e6136931eb Mon Sep 17 00:00:00 2001 From: Matt Oliver Date: Sun, 30 Oct 2016 00:08:41 +1100 Subject: [PATCH 089/102] compat/w32dlfcn.h: Add safe win32 dlopen/dlclose/dlsym functions. Signed-off-by: Matt Oliver --- compat/w32dlfcn.h | 83 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 compat/w32dlfcn.h diff --git a/compat/w32dlfcn.h b/compat/w32dlfcn.h new file mode 100644 index 0000000000000..bc9bb8c9f51e8 --- /dev/null +++ b/compat/w32dlfcn.h @@ -0,0 +1,83 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef COMPAT_W32DLFCN_H +#define COMPAT_W32DLFCN_H + +#ifdef _WIN32 +#include +#if _WIN32_WINNT < 0x0602 +#include "libavutil/wchar_filename.h" +#endif +/** + * Safe function used to open dynamic libs. This attempts to improve program security + * by removing the current directory from the dll search path. Only dll's found in the + * executable or system directory are allowed to be loaded. + * @param name The dynamic lib name. + * @return A handle to the opened lib. + */ +static inline HMODULE win32_dlopen(const char *name) +{ +#if _WIN32_WINNT < 0x0602 + // Need to check if KB2533623 is available + if (!GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "SetDefaultDllDirectories")) { + HMODULE module = NULL; + wchar_t *path = NULL, *name_w = NULL; + DWORD pathlen; + if (utf8towchar(name, &name_w)) + goto exit; + path = (wchar_t *)av_mallocz_array(MAX_PATH, sizeof(wchar_t)); + // Try local directory first + pathlen = GetModuleFileNameW(NULL, path, MAX_PATH); + pathlen = wcsrchr(path, '\\') - path; + if (pathlen == 0 || pathlen + wcslen(name_w) + 2 > MAX_PATH) + goto exit; + path[pathlen] = '\\'; + wcscpy(path + pathlen + 1, name_w); + module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + if (module == NULL) { + // Next try System32 directory + pathlen = GetSystemDirectoryW(path, MAX_PATH); + if (pathlen == 0 || pathlen + wcslen(name_w) + 2 > MAX_PATH) + goto exit; + path[pathlen] = '\\'; + wcscpy(path + pathlen + 1, name_w); + module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + } +exit: + av_free(path); + av_free(name_w); + return module; + } +#endif +#ifndef LOAD_LIBRARY_SEARCH_APPLICATION_DIR +# define LOAD_LIBRARY_SEARCH_APPLICATION_DIR 0x00000200 +#endif +#ifndef LOAD_LIBRARY_SEARCH_SYSTEM32 +# define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800 +#endif + return LoadLibraryExA(name, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32); +} +#define dlopen(name, flags) win32_dlopen(name) +#define dlclose FreeLibrary +#define dlsym GetProcAddress +#else +#include +#endif + +#endif /* COMPAT_W32DLFCN_H */ From 85db1f97eb506b7b0fd876f428872b89f967cc53 Mon Sep 17 00:00:00 2001 From: Matt Oliver Date: Sat, 29 Oct 2016 18:25:05 +1100 Subject: [PATCH 090/102] avutil/hwcontext_dxva.c: Use new safe dlopen code. Signed-off-by: Matt Oliver --- libavutil/hwcontext_dxva2.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavutil/hwcontext_dxva2.c b/libavutil/hwcontext_dxva2.c index e79254bb34737..40a4a27ae1228 100644 --- a/libavutil/hwcontext_dxva2.c +++ b/libavutil/hwcontext_dxva2.c @@ -37,6 +37,7 @@ #include "imgutils.h" #include "pixdesc.h" #include "pixfmt.h" +#include "compat/w32dlfcn.h" typedef IDirect3D9* WINAPI pDirect3DCreate9(UINT); typedef HRESULT WINAPI pCreateDeviceManager9(UINT *, IDirect3DDeviceManager9 **); @@ -318,10 +319,10 @@ static void dxva2_device_free(AVHWDeviceContext *ctx) IDirect3D9_Release(priv->d3d9); if (priv->d3dlib) - FreeLibrary(priv->d3dlib); + dlclose(priv->d3dlib); if (priv->dxva2lib) - FreeLibrary(priv->dxva2lib); + dlclose(priv->dxva2lib); av_freep(&ctx->user_opaque); } @@ -352,24 +353,24 @@ static int dxva2_device_create(AVHWDeviceContext *ctx, const char *device, priv->device_handle = INVALID_HANDLE_VALUE; - priv->d3dlib = LoadLibrary("d3d9.dll"); + priv->d3dlib = dlopen("d3d9.dll", 0); if (!priv->d3dlib) { av_log(ctx, AV_LOG_ERROR, "Failed to load D3D9 library\n"); return AVERROR_UNKNOWN; } - priv->dxva2lib = LoadLibrary("dxva2.dll"); + priv->dxva2lib = dlopen("dxva2.dll", 0); if (!priv->dxva2lib) { av_log(ctx, AV_LOG_ERROR, "Failed to load DXVA2 library\n"); return AVERROR_UNKNOWN; } - createD3D = (pDirect3DCreate9 *)GetProcAddress(priv->d3dlib, "Direct3DCreate9"); + createD3D = (pDirect3DCreate9 *)dlsym(priv->d3dlib, "Direct3DCreate9"); if (!createD3D) { av_log(ctx, AV_LOG_ERROR, "Failed to locate Direct3DCreate9\n"); return AVERROR_UNKNOWN; } - createDeviceManager = (pCreateDeviceManager9 *)GetProcAddress(priv->dxva2lib, - "DXVA2CreateDirect3DDeviceManager9"); + createDeviceManager = (pCreateDeviceManager9 *)dlsym(priv->dxva2lib, + "DXVA2CreateDirect3DDeviceManager9"); if (!createDeviceManager) { av_log(ctx, AV_LOG_ERROR, "Failed to locate DXVA2CreateDirect3DDeviceManager9\n"); return AVERROR_UNKNOWN; From d6f85ec2700e40b3ec864d5ee405b7e257778e1f Mon Sep 17 00:00:00 2001 From: Matt Oliver Date: Mon, 31 Oct 2016 14:30:43 +1100 Subject: [PATCH 091/102] avformat/avisynth.c: Use new safe dlopen code. Signed-off-by: Matt Oliver --- configure | 9 ++++----- libavformat/Makefile | 2 +- libavformat/avisynth.c | 14 +++++--------- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/configure b/configure index d2ab550022ab7..87b06f1c5a435 100755 --- a/configure +++ b/configure @@ -2753,6 +2753,9 @@ ac3_at_decoder_select="ac3_parser" adpcm_ima_qt_at_decoder_deps="audiotoolbox" alac_at_decoder_deps="audiotoolbox" amr_nb_at_decoder_deps="audiotoolbox" +avisynth_deps_any="dlopen LoadLibrary" +avisynth_demuxer_deps="avisynth" +avisynth_demuxer_select="riffdec" eac3_at_decoder_deps="audiotoolbox" eac3_at_decoder_select="ac3_parser" gsm_ms_at_decoder_deps="audiotoolbox" @@ -2846,8 +2849,6 @@ asf_muxer_select="riffenc" asf_stream_muxer_select="asf_muxer" avi_demuxer_select="iso_media riffdec exif" avi_muxer_select="riffenc" -avisynth_demuxer_deps="avisynth" -avisynth_demuxer_select="riffdec" caf_demuxer_select="iso_media riffdec" dash_muxer_select="mp4_muxer" dirac_demuxer_select="dirac_parser" @@ -5414,6 +5415,7 @@ elif check_func dlopen -ldl && check_func dlsym -ldl; then ldl=-ldl fi +avisynth_demuxer_extralibs='$ldl' decklink_outdev_extralibs="$decklink_outdev_extralibs $ldl" decklink_indev_extralibs="$decklink_indev_extralibs $ldl" frei0r_filter_extralibs='$ldl' @@ -5661,9 +5663,6 @@ fi enabled avfoundation_indev && { check_header_objcc AVFoundation/AVFoundation.h || disable avfoundation_indev; } enabled avfoundation_indev && { check_lib2 CoreGraphics/CoreGraphics.h CGGetActiveDisplayList -framework CoreGraphics || check_lib2 ApplicationServices/ApplicationServices.h CGGetActiveDisplayList -framework ApplicationServices; } -enabled avisynth && { { check_lib2 "windows.h" LoadLibrary; } || - { check_lib2 "dlfcn.h" dlopen -ldl; } || - die "ERROR: LoadLibrary/dlopen not found for avisynth"; } enabled cuda && { check_lib cuda.h cuInit -lcuda || die "ERROR: CUDA not found"; } enabled cuvid && { add_cflags -I$source_path; diff --git a/libavformat/Makefile b/libavformat/Makefile index 5d827d31487c0..c9defe7517195 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -106,7 +106,7 @@ OBJS-$(CONFIG_AU_DEMUXER) += au.o pcm.o OBJS-$(CONFIG_AU_MUXER) += au.o rawenc.o OBJS-$(CONFIG_AVI_DEMUXER) += avidec.o OBJS-$(CONFIG_AVI_MUXER) += avienc.o mpegtsenc.o avlanguage.o rawutils.o -OBJS-$(CONFIG_AVISYNTH) += avisynth.o +OBJS-$(CONFIG_AVISYNTH_DEMUXER) += avisynth.o OBJS-$(CONFIG_AVM2_MUXER) += swfenc.o swf.o OBJS-$(CONFIG_AVR_DEMUXER) += avr.o pcm.o OBJS-$(CONFIG_AVS_DEMUXER) += avs.o voc_packet.o vocdec.o voc.o diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 1acc44f4c5256..514cb99f49a76 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -29,7 +29,7 @@ /* Platform-specific directives for AviSynth vs AvxSynth. */ #ifdef _WIN32 - #include + #include "compat/w32dlfcn.h" #undef EXTERN_C #include "compat/avisynth/avisynth_c.h" #define AVISYNTH_LIB "avisynth" @@ -39,10 +39,6 @@ #include "compat/avisynth/avxsynth_c.h" #define AVISYNTH_NAME "libavxsynth" #define AVISYNTH_LIB AVISYNTH_NAME SLIBSUF - - #define LoadLibrary(x) dlopen(x, RTLD_NOW | RTLD_LOCAL) - #define GetProcAddress dlsym - #define FreeLibrary dlclose #endif typedef struct AviSynthLibrary { @@ -118,13 +114,13 @@ static av_cold void avisynth_atexit_handler(void); static av_cold int avisynth_load_library(void) { - avs_library.library = LoadLibrary(AVISYNTH_LIB); + avs_library.library = dlopen(AVISYNTH_LIB, RTLD_NOW | RTLD_LOCAL); if (!avs_library.library) return AVERROR_UNKNOWN; #define LOAD_AVS_FUNC(name, continue_on_fail) \ avs_library.name = \ - (void *)GetProcAddress(avs_library.library, #name); \ + (void *)dlsym(avs_library.library, #name); \ if (!continue_on_fail && !avs_library.name) \ goto fail; @@ -157,7 +153,7 @@ static av_cold int avisynth_load_library(void) return 0; fail: - FreeLibrary(avs_library.library); + dlclose(avs_library.library); return AVERROR_UNKNOWN; } @@ -225,7 +221,7 @@ static av_cold void avisynth_atexit_handler(void) avisynth_context_destroy(avs); avs = next; } - FreeLibrary(avs_library.library); + dlclose(avs_library.library); avs_atexit_called = 1; } From 6ead033bca9accd56f188cc004b4c4b18d616aa7 Mon Sep 17 00:00:00 2001 From: Matt Oliver Date: Sat, 29 Oct 2016 18:25:36 +1100 Subject: [PATCH 092/102] avcodec/nvenc.c: Use new safe dlopen code. Signed-off-by: Matt Oliver --- libavcodec/nvenc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 2505c3d1e3f67..a3a2ef587299b 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -34,11 +34,7 @@ #endif #if defined(_WIN32) -#include - -#define dlopen(filename, flags) LoadLibrary(TEXT(filename)) -#define dlsym(handle, symbol) GetProcAddress(handle, symbol) -#define dlclose(handle) FreeLibrary(handle) +#include "compat/w32dlfcn.h" #else #include #endif From 5dc237aaaab6cfd1f573d4cc4751683df7c41933 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 5 Nov 2016 01:36:53 +0100 Subject: [PATCH 093/102] fate: add zombie test This test tests some odd sample with odd aspect ratio Signed-off-by: Michael Niedermayer --- tests/fate/mov.mak | 4 ++ tests/ref/fate/mov-zombie | 134 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 tests/ref/fate/mov-zombie diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak index 6b7983223c0dd..6760f0837dbd4 100644 --- a/tests/fate/mov.mak +++ b/tests/fate/mov.mak @@ -5,6 +5,7 @@ FATE_MOV = fate-mov-3elist \ fate-mov-elist-starts-ctts-2ndsample \ fate-mov-1elist-ends-last-bframe \ fate-mov-2elist-elist1-ends-bframe \ + fate-mov-zombie \ fate-mov-aac-2048-priming FATE_SAMPLES_AVCONV += $(FATE_MOV) @@ -30,3 +31,6 @@ fate-mov-2elist-elist1-ends-bframe: CMD = framemd5 -i $(TARGET_SAMPLES)/mov/mov- fate-mov-aac-2048-priming: ffprobe$(PROGSSUF)$(EXESUF) fate-mov-aac-2048-priming: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_packets -print_format compact $(TARGET_SAMPLES)/mov/aac-2048-priming.mov + +fate-mov-zombie: ffprobe$(PROGSSUF)$(EXESUF) +fate-mov-zombie: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_streams -show_packets -show_format -show_frames -bitexact -print_format compact $(TARGET_SAMPLES)/mov/white_zombie_scrunch-part.mov diff --git a/tests/ref/fate/mov-zombie b/tests/ref/fate/mov-zombie new file mode 100644 index 0000000000000..a6b4acad519f0 --- /dev/null +++ b/tests/ref/fate/mov-zombie @@ -0,0 +1,134 @@ +packet|codec_type=video|stream_index=0|pts=0|pts_time=0.000000|dts=-3004|dts_time=-0.033378|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=4133|pos=11309|flags=K_ +frame|media_type=video|stream_index=0|key_frame=1|pkt_pts=0|pkt_pts_time=0.000000|pkt_dts=-3004|pkt_dts_time=-0.033378|best_effort_timestamp=0|best_effort_timestamp_time=0.000000|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=11309|pkt_size=4133|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=5440|pts_time=0.060444|dts=-567|dts_time=-0.006300|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1077|pos=15442|flags=__ +packet|codec_type=video|stream_index=0|pts=2437|pts_time=0.027078|dts=2436|dts_time=0.027067|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=355|pos=16519|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=2437|pkt_pts_time=0.027078|pkt_dts=2436|pkt_dts_time=0.027067|best_effort_timestamp=2437|best_effort_timestamp_time=0.027078|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=16519|pkt_size=355|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=2|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=11446|pts_time=0.127178|dts=5439|dts_time=0.060433|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1110|pos=16874|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=5440|pkt_pts_time=0.060444|pkt_dts=5439|pkt_dts_time=0.060433|best_effort_timestamp=5440|best_effort_timestamp_time=0.060444|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=15442|pkt_size=1077|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=1|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=8443|pts_time=0.093811|dts=8442|dts_time=0.093800|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=430|pos=17984|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=8443|pkt_pts_time=0.093811|pkt_dts=8442|pkt_dts_time=0.093800|best_effort_timestamp=8443|best_effort_timestamp_time=0.093811|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=17984|pkt_size=430|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=4|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=17452|pts_time=0.193911|dts=11445|dts_time=0.127167|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1485|pos=18414|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=11446|pkt_pts_time=0.127178|pkt_dts=11445|pkt_dts_time=0.127167|best_effort_timestamp=11446|best_effort_timestamp_time=0.127178|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=16874|pkt_size=1110|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=3|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=14449|pts_time=0.160544|dts=14448|dts_time=0.160533|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1005|pos=19899|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=14449|pkt_pts_time=0.160544|pkt_dts=14448|pkt_dts_time=0.160533|best_effort_timestamp=14449|best_effort_timestamp_time=0.160544|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=19899|pkt_size=1005|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=6|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=23458|pts_time=0.260644|dts=17451|dts_time=0.193900|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1976|pos=20904|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=17452|pkt_pts_time=0.193911|pkt_dts=17451|pkt_dts_time=0.193900|best_effort_timestamp=17452|best_effort_timestamp_time=0.193911|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=18414|pkt_size=1485|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=5|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=20455|pts_time=0.227278|dts=20454|dts_time=0.227267|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=904|pos=22880|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=20455|pkt_pts_time=0.227278|pkt_dts=20454|pkt_dts_time=0.227267|best_effort_timestamp=20455|best_effort_timestamp_time=0.227278|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=22880|pkt_size=904|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=8|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=29464|pts_time=0.327378|dts=23457|dts_time=0.260633|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1254|pos=23784|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=23458|pkt_pts_time=0.260644|pkt_dts=23457|pkt_dts_time=0.260633|best_effort_timestamp=23458|best_effort_timestamp_time=0.260644|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=20904|pkt_size=1976|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=7|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=26461|pts_time=0.294011|dts=26460|dts_time=0.294000|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=700|pos=25038|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=26461|pkt_pts_time=0.294011|pkt_dts=26460|pkt_dts_time=0.294000|best_effort_timestamp=26461|best_effort_timestamp_time=0.294011|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=25038|pkt_size=700|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=10|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=35470|pts_time=0.394111|dts=29463|dts_time=0.327367|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1311|pos=25738|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=29464|pkt_pts_time=0.327378|pkt_dts=29463|pkt_dts_time=0.327367|best_effort_timestamp=29464|best_effort_timestamp_time=0.327378|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=23784|pkt_size=1254|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=9|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=32467|pts_time=0.360744|dts=32466|dts_time=0.360733|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=631|pos=27049|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=32467|pkt_pts_time=0.360744|pkt_dts=32466|pkt_dts_time=0.360733|best_effort_timestamp=32467|best_effort_timestamp_time=0.360744|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=27049|pkt_size=631|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=12|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=41476|pts_time=0.460844|dts=35469|dts_time=0.394100|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1296|pos=27680|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=35470|pkt_pts_time=0.394111|pkt_dts=35469|pkt_dts_time=0.394100|best_effort_timestamp=35470|best_effort_timestamp_time=0.394111|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=25738|pkt_size=1311|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=11|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=38473|pts_time=0.427478|dts=38472|dts_time=0.427467|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=466|pos=28976|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=38473|pkt_pts_time=0.427478|pkt_dts=38472|pkt_dts_time=0.427467|best_effort_timestamp=38473|best_effort_timestamp_time=0.427478|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=28976|pkt_size=466|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=14|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=47482|pts_time=0.527578|dts=41475|dts_time=0.460833|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1638|pos=29442|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=41476|pkt_pts_time=0.460844|pkt_dts=41475|pkt_dts_time=0.460833|best_effort_timestamp=41476|best_effort_timestamp_time=0.460844|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=27680|pkt_size=1296|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=13|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=44479|pts_time=0.494211|dts=44478|dts_time=0.494200|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=907|pos=31080|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=44479|pkt_pts_time=0.494211|pkt_dts=44478|pkt_dts_time=0.494200|best_effort_timestamp=44479|best_effort_timestamp_time=0.494211|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=31080|pkt_size=907|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=16|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=53488|pts_time=0.594311|dts=47481|dts_time=0.527567|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1362|pos=31987|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=47482|pkt_pts_time=0.527578|pkt_dts=47481|pkt_dts_time=0.527567|best_effort_timestamp=47482|best_effort_timestamp_time=0.527578|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=29442|pkt_size=1638|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=15|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=50485|pts_time=0.560944|dts=50484|dts_time=0.560933|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=682|pos=33349|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=50485|pkt_pts_time=0.560944|pkt_dts=50484|pkt_dts_time=0.560933|best_effort_timestamp=50485|best_effort_timestamp_time=0.560944|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=33349|pkt_size=682|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=18|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=59494|pts_time=0.661044|dts=53487|dts_time=0.594300|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=2917|pos=34031|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=53488|pkt_pts_time=0.594311|pkt_dts=53487|pkt_dts_time=0.594300|best_effort_timestamp=53488|best_effort_timestamp_time=0.594311|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=31987|pkt_size=1362|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=17|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=56491|pts_time=0.627678|dts=56490|dts_time=0.627667|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1174|pos=36948|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=56491|pkt_pts_time=0.627678|pkt_dts=56490|pkt_dts_time=0.627667|best_effort_timestamp=56491|best_effort_timestamp_time=0.627678|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=36948|pkt_size=1174|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=20|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=65500|pts_time=0.727778|dts=59493|dts_time=0.661033|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1748|pos=38122|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=59494|pkt_pts_time=0.661044|pkt_dts=59493|pkt_dts_time=0.661033|best_effort_timestamp=59494|best_effort_timestamp_time=0.661044|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=34031|pkt_size=2917|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=19|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=62497|pts_time=0.694411|dts=62496|dts_time=0.694400|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=926|pos=39870|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=62497|pkt_pts_time=0.694411|pkt_dts=62496|pkt_dts_time=0.694400|best_effort_timestamp=62497|best_effort_timestamp_time=0.694411|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=39870|pkt_size=926|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=22|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=68503|pts_time=0.761144|dts=65499|dts_time=0.727767|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=918|pos=40796|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=65500|pkt_pts_time=0.727778|pkt_dts=65499|pkt_dts_time=0.727767|best_effort_timestamp=65500|best_effort_timestamp_time=0.727778|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=38122|pkt_size=1748|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=21|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=71506|pts_time=0.794511|dts=68502|dts_time=0.761133|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=3846|pos=41714|flags=K_ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=68503|pkt_pts_time=0.761144|pkt_dts=68502|pkt_dts_time=0.761133|best_effort_timestamp=68503|best_effort_timestamp_time=0.761144|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=40796|pkt_size=918|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=23|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=77512|pts_time=0.861244|dts=71505|dts_time=0.794500|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1932|pos=45560|flags=__ +frame|media_type=video|stream_index=0|key_frame=1|pkt_pts=71506|pkt_pts_time=0.794511|pkt_dts=71505|pkt_dts_time=0.794500|best_effort_timestamp=71506|best_effort_timestamp_time=0.794511|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=41714|pkt_size=3846|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=I|coded_picture_number=24|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=74509|pts_time=0.827878|dts=74508|dts_time=0.827867|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1159|pos=47492|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=74509|pkt_pts_time=0.827878|pkt_dts=74508|pkt_dts_time=0.827867|best_effort_timestamp=74509|best_effort_timestamp_time=0.827878|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=47492|pkt_size=1159|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=26|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=83518|pts_time=0.927978|dts=77511|dts_time=0.861233|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1522|pos=48651|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=77512|pkt_pts_time=0.861244|pkt_dts=77511|pkt_dts_time=0.861233|best_effort_timestamp=77512|best_effort_timestamp_time=0.861244|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=45560|pkt_size=1932|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=25|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=80515|pts_time=0.894611|dts=80514|dts_time=0.894600|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=719|pos=50173|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=80515|pkt_pts_time=0.894611|pkt_dts=80514|pkt_dts_time=0.894600|best_effort_timestamp=80515|best_effort_timestamp_time=0.894611|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=50173|pkt_size=719|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=28|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=89524|pts_time=0.994711|dts=83517|dts_time=0.927967|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1700|pos=50892|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=83518|pkt_pts_time=0.927978|pkt_dts=83517|pkt_dts_time=0.927967|best_effort_timestamp=83518|best_effort_timestamp_time=0.927978|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=48651|pkt_size=1522|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=27|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=86521|pts_time=0.961344|dts=86520|dts_time=0.961333|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1099|pos=52592|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=86521|pkt_pts_time=0.961344|pkt_dts=86520|pkt_dts_time=0.961333|best_effort_timestamp=86521|best_effort_timestamp_time=0.961344|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=52592|pkt_size=1099|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=30|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=95530|pts_time=1.061444|dts=89523|dts_time=0.994700|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=2558|pos=53691|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=89524|pkt_pts_time=0.994711|pkt_dts=89523|pkt_dts_time=0.994700|best_effort_timestamp=89524|best_effort_timestamp_time=0.994711|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=50892|pkt_size=1700|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=29|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=92527|pts_time=1.028078|dts=92526|dts_time=1.028067|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1008|pos=56249|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=92527|pkt_pts_time=1.028078|pkt_dts=92526|pkt_dts_time=1.028067|best_effort_timestamp=92527|best_effort_timestamp_time=1.028078|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=56249|pkt_size=1008|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=32|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=101536|pts_time=1.128178|dts=95529|dts_time=1.061433|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1236|pos=57257|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=95530|pkt_pts_time=1.061444|pkt_dts=95529|pkt_dts_time=1.061433|best_effort_timestamp=95530|best_effort_timestamp_time=1.061444|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=53691|pkt_size=2558|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=31|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=98533|pts_time=1.094811|dts=98532|dts_time=1.094800|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=607|pos=58493|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=98533|pkt_pts_time=1.094811|pkt_dts=98532|pkt_dts_time=1.094800|best_effort_timestamp=98533|best_effort_timestamp_time=1.094811|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=58493|pkt_size=607|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=34|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=107542|pts_time=1.194911|dts=101535|dts_time=1.128167|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1883|pos=59100|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=101536|pkt_pts_time=1.128178|pkt_dts=101535|pkt_dts_time=1.128167|best_effort_timestamp=101536|best_effort_timestamp_time=1.128178|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=57257|pkt_size=1236|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=33|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=104539|pts_time=1.161544|dts=104538|dts_time=1.161533|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=893|pos=60983|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=104539|pkt_pts_time=1.161544|pkt_dts=104538|pkt_dts_time=1.161533|best_effort_timestamp=104539|best_effort_timestamp_time=1.161544|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=60983|pkt_size=893|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=36|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=113548|pts_time=1.261644|dts=107541|dts_time=1.194900|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1305|pos=61876|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=107542|pkt_pts_time=1.194911|pkt_dts=107541|pkt_dts_time=1.194900|best_effort_timestamp=107542|best_effort_timestamp_time=1.194911|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=59100|pkt_size=1883|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=35|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=110545|pts_time=1.228278|dts=110544|dts_time=1.228267|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=472|pos=63181|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=110545|pkt_pts_time=1.228278|pkt_dts=110544|pkt_dts_time=1.228267|best_effort_timestamp=110545|best_effort_timestamp_time=1.228278|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=63181|pkt_size=472|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=38|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=119554|pts_time=1.328378|dts=113547|dts_time=1.261633|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1411|pos=63653|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=113548|pkt_pts_time=1.261644|pkt_dts=113547|pkt_dts_time=1.261633|best_effort_timestamp=113548|best_effort_timestamp_time=1.261644|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=61876|pkt_size=1305|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=37|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=116551|pts_time=1.295011|dts=116550|dts_time=1.295000|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=616|pos=65064|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=116551|pkt_pts_time=1.295011|pkt_dts=116550|pkt_dts_time=1.295000|best_effort_timestamp=116551|best_effort_timestamp_time=1.295011|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=65064|pkt_size=616|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=40|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=125560|pts_time=1.395111|dts=119553|dts_time=1.328367|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1291|pos=65680|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=119554|pkt_pts_time=1.328378|pkt_dts=119553|pkt_dts_time=1.328367|best_effort_timestamp=119554|best_effort_timestamp_time=1.328378|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=63653|pkt_size=1411|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=39|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=122557|pts_time=1.361744|dts=122556|dts_time=1.361733|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=470|pos=66971|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=122557|pkt_pts_time=1.361744|pkt_dts=122556|pkt_dts_time=1.361733|best_effort_timestamp=122557|best_effort_timestamp_time=1.361744|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=66971|pkt_size=470|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=42|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=131566|pts_time=1.461844|dts=125559|dts_time=1.395100|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1977|pos=67441|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=125560|pkt_pts_time=1.395111|pkt_dts=125559|pkt_dts_time=1.395100|best_effort_timestamp=125560|best_effort_timestamp_time=1.395111|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=65680|pkt_size=1291|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=41|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=128563|pts_time=1.428478|dts=128562|dts_time=1.428467|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=436|pos=69418|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=128563|pkt_pts_time=1.428478|pkt_dts=128562|pkt_dts_time=1.428467|best_effort_timestamp=128563|best_effort_timestamp_time=1.428478|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=69418|pkt_size=436|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=44|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=137572|pts_time=1.528578|dts=131565|dts_time=1.461833|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=2566|pos=69854|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=131566|pkt_pts_time=1.461844|pkt_dts=131565|pkt_dts_time=1.461833|best_effort_timestamp=131566|best_effort_timestamp_time=1.461844|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=67441|pkt_size=1977|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=43|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=134569|pts_time=1.495211|dts=134568|dts_time=1.495200|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=886|pos=72420|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=134569|pkt_pts_time=1.495211|pkt_dts=134568|pkt_dts_time=1.495200|best_effort_timestamp=134569|best_effort_timestamp_time=1.495211|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=72420|pkt_size=886|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=46|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=140575|pts_time=1.561944|dts=137571|dts_time=1.528567|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1330|pos=73306|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=137572|pkt_pts_time=1.528578|pkt_dts=137571|pkt_dts_time=1.528567|best_effort_timestamp=137572|best_effort_timestamp_time=1.528578|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=69854|pkt_size=2566|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=45|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=143578|pts_time=1.595311|dts=140574|dts_time=1.561933|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=2227|pos=74636|flags=K_ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=140575|pkt_pts_time=1.561944|pkt_dts=140574|pkt_dts_time=1.561933|best_effort_timestamp=140575|best_effort_timestamp_time=1.561944|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=73306|pkt_size=1330|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=47|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=149584|pts_time=1.662044|dts=143577|dts_time=1.595300|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=2210|pos=76863|flags=__ +frame|media_type=video|stream_index=0|key_frame=1|pkt_pts=143578|pkt_pts_time=1.595311|pkt_dts=143577|pkt_dts_time=1.595300|best_effort_timestamp=143578|best_effort_timestamp_time=1.595311|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=74636|pkt_size=2227|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=I|coded_picture_number=48|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=146581|pts_time=1.628678|dts=146580|dts_time=1.628667|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1498|pos=79073|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=146581|pkt_pts_time=1.628678|pkt_dts=146580|pkt_dts_time=1.628667|best_effort_timestamp=146581|best_effort_timestamp_time=1.628678|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=79073|pkt_size=1498|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=50|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=155590|pts_time=1.728778|dts=149583|dts_time=1.662033|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1721|pos=80571|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=149584|pkt_pts_time=1.662044|pkt_dts=149583|pkt_dts_time=1.662033|best_effort_timestamp=149584|best_effort_timestamp_time=1.662044|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=76863|pkt_size=2210|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=49|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=152587|pts_time=1.695411|dts=152586|dts_time=1.695400|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1238|pos=82292|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=152587|pkt_pts_time=1.695411|pkt_dts=152586|pkt_dts_time=1.695400|best_effort_timestamp=152587|best_effort_timestamp_time=1.695411|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=82292|pkt_size=1238|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=52|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=161596|pts_time=1.795511|dts=155589|dts_time=1.728767|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1753|pos=83530|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=155590|pkt_pts_time=1.728778|pkt_dts=155589|pkt_dts_time=1.728767|best_effort_timestamp=155590|best_effort_timestamp_time=1.728778|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=80571|pkt_size=1721|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=51|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=158593|pts_time=1.762144|dts=158592|dts_time=1.762133|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1014|pos=85283|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=158593|pkt_pts_time=1.762144|pkt_dts=158592|pkt_dts_time=1.762133|best_effort_timestamp=158593|best_effort_timestamp_time=1.762144|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=85283|pkt_size=1014|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=54|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=167602|pts_time=1.862244|dts=161595|dts_time=1.795500|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=2408|pos=86297|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=161596|pkt_pts_time=1.795511|pkt_dts=161595|pkt_dts_time=1.795500|best_effort_timestamp=161596|best_effort_timestamp_time=1.795511|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=83530|pkt_size=1753|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=53|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=164599|pts_time=1.828878|dts=164598|dts_time=1.828867|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1727|pos=88705|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=164599|pkt_pts_time=1.828878|pkt_dts=164598|pkt_dts_time=1.828867|best_effort_timestamp=164599|best_effort_timestamp_time=1.828878|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=88705|pkt_size=1727|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=56|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=173608|pts_time=1.928978|dts=167601|dts_time=1.862233|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1504|pos=90432|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=167602|pkt_pts_time=1.862244|pkt_dts=167601|pkt_dts_time=1.862233|best_effort_timestamp=167602|best_effort_timestamp_time=1.862244|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=86297|pkt_size=2408|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=55|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=170605|pts_time=1.895611|dts=170604|dts_time=1.895600|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=957|pos=91936|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=170605|pkt_pts_time=1.895611|pkt_dts=170604|pkt_dts_time=1.895600|best_effort_timestamp=170605|best_effort_timestamp_time=1.895611|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=91936|pkt_size=957|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=58|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=179614|pts_time=1.995711|dts=173607|dts_time=1.928967|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1890|pos=92893|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=173608|pkt_pts_time=1.928978|pkt_dts=173607|pkt_dts_time=1.928967|best_effort_timestamp=173608|best_effort_timestamp_time=1.928978|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=90432|pkt_size=1504|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=57|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=176611|pts_time=1.962344|dts=176610|dts_time=1.962333|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1239|pos=94783|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=176611|pkt_pts_time=1.962344|pkt_dts=176610|pkt_dts_time=1.962333|best_effort_timestamp=176611|best_effort_timestamp_time=1.962344|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=94783|pkt_size=1239|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=60|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=185620|pts_time=2.062444|dts=179613|dts_time=1.995700|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1856|pos=96022|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=179614|pkt_pts_time=1.995711|pkt_dts=179613|pkt_dts_time=1.995700|best_effort_timestamp=179614|best_effort_timestamp_time=1.995711|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=92893|pkt_size=1890|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=59|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=182617|pts_time=2.029078|dts=182616|dts_time=2.029067|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1302|pos=97878|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=182617|pkt_pts_time=2.029078|pkt_dts=182616|pkt_dts_time=2.029067|best_effort_timestamp=182617|best_effort_timestamp_time=2.029078|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=97878|pkt_size=1302|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=62|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=191626|pts_time=2.129178|dts=185619|dts_time=2.062433|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=1666|pos=99180|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=185620|pkt_pts_time=2.062444|pkt_dts=185619|pkt_dts_time=2.062433|best_effort_timestamp=185620|best_effort_timestamp_time=2.062444|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=96022|pkt_size=1856|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=61|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=188623|pts_time=2.095811|dts=188622|dts_time=2.095800|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=974|pos=100846|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=188623|pkt_pts_time=2.095811|pkt_dts=188622|pkt_dts_time=2.095800|best_effort_timestamp=188623|best_effort_timestamp_time=2.095811|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=100846|pkt_size=974|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=B|coded_picture_number=64|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +packet|codec_type=video|stream_index=0|pts=197632|pts_time=2.195911|dts=191625|dts_time=2.129167|duration=3003|duration_time=0.033367|convergence_duration=N/A|convergence_duration_time=N/A|size=580|pos=101820|flags=__ +frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=191626|pkt_pts_time=2.129178|pkt_dts=N/A|pkt_dts_time=N/A|best_effort_timestamp=191626|best_effort_timestamp_time=2.129178|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=99180|pkt_size=1666|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=63|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 +stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_time_base=212521/12744000|codec_tag_string=avc1|codec_tag=0x31637661|width=160|height=240|coded_width=160|coded_height=240|has_b_frames=0|sample_aspect_ratio=2:1|display_aspect_ratio=4:3|pix_fmt=yuv420p|level=12|color_range=tv|color_space=smpte170m|color_transfer=bt709|color_primaries=smpte170m|chroma_location=topleft|field_order=unknown|timecode=N/A|refs=2|is_avc=true|nal_length_size=4|id=N/A|r_frame_rate=30000/1001|avg_frame_rate=6372000/212521|time_base=1/90000|start_pts=0|start_time=0.000000|duration_ts=2125200|duration=23.613333|bit_rate=333874|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=708|nb_read_frames=65|nb_read_packets=66|disposition:default=1|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|tag:rotate=0|tag:creation_time=2008-05-12T20:59:27.000000Z|tag:language=eng|tag:handler_name=Apple Alias Data Handler|tag:encoder=H.264 +side_data|side_data_type=Display Matrix|side_data_size=36|displaymatrix=\n00000000: 131072 0 0\n00000001: 0 65536 0\n00000002: 0 0 1073741824\n|rotation=0 +format|filename=/home/michael/fatesamples/fate/fate-suite//mov/white_zombie_scrunch-part.mov|nb_streams=1|nb_programs=0|format_name=mov,mp4,m4a,3gp,3g2,mj2|start_time=0.000000|duration=23.613333|size=102400|bit_rate=34692|probe_score=100|tag:major_brand=qt |tag:minor_version=537199360|tag:compatible_brands=qt |tag:creation_time=2008-05-12T20:59:26.000000Z From 26e9efab1eccc83de11032cf76c50ff17d531b46 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 5 Nov 2016 15:25:44 +0100 Subject: [PATCH 094/102] fate: Remove show_formats for fate-mov-zombie test This includes the absolute path Found-by: jamrial Signed-off-by: Michael Niedermayer --- tests/fate/mov.mak | 2 +- tests/ref/fate/mov-zombie | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak index 6760f0837dbd4..30e441d29cee9 100644 --- a/tests/fate/mov.mak +++ b/tests/fate/mov.mak @@ -33,4 +33,4 @@ fate-mov-aac-2048-priming: ffprobe$(PROGSSUF)$(EXESUF) fate-mov-aac-2048-priming: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_packets -print_format compact $(TARGET_SAMPLES)/mov/aac-2048-priming.mov fate-mov-zombie: ffprobe$(PROGSSUF)$(EXESUF) -fate-mov-zombie: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_streams -show_packets -show_format -show_frames -bitexact -print_format compact $(TARGET_SAMPLES)/mov/white_zombie_scrunch-part.mov +fate-mov-zombie: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_streams -show_packets -show_frames -bitexact -print_format compact $(TARGET_SAMPLES)/mov/white_zombie_scrunch-part.mov diff --git a/tests/ref/fate/mov-zombie b/tests/ref/fate/mov-zombie index a6b4acad519f0..42e3a6f29e230 100644 --- a/tests/ref/fate/mov-zombie +++ b/tests/ref/fate/mov-zombie @@ -131,4 +131,3 @@ packet|codec_type=video|stream_index=0|pts=197632|pts_time=2.195911|dts=191625|d frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=191626|pkt_pts_time=2.129178|pkt_dts=N/A|pkt_dts_time=N/A|best_effort_timestamp=191626|best_effort_timestamp_time=2.129178|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=99180|pkt_size=1666|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=63|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0 stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_time_base=212521/12744000|codec_tag_string=avc1|codec_tag=0x31637661|width=160|height=240|coded_width=160|coded_height=240|has_b_frames=0|sample_aspect_ratio=2:1|display_aspect_ratio=4:3|pix_fmt=yuv420p|level=12|color_range=tv|color_space=smpte170m|color_transfer=bt709|color_primaries=smpte170m|chroma_location=topleft|field_order=unknown|timecode=N/A|refs=2|is_avc=true|nal_length_size=4|id=N/A|r_frame_rate=30000/1001|avg_frame_rate=6372000/212521|time_base=1/90000|start_pts=0|start_time=0.000000|duration_ts=2125200|duration=23.613333|bit_rate=333874|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=708|nb_read_frames=65|nb_read_packets=66|disposition:default=1|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|tag:rotate=0|tag:creation_time=2008-05-12T20:59:27.000000Z|tag:language=eng|tag:handler_name=Apple Alias Data Handler|tag:encoder=H.264 side_data|side_data_type=Display Matrix|side_data_size=36|displaymatrix=\n00000000: 131072 0 0\n00000001: 0 65536 0\n00000002: 0 0 1073741824\n|rotation=0 -format|filename=/home/michael/fatesamples/fate/fate-suite//mov/white_zombie_scrunch-part.mov|nb_streams=1|nb_programs=0|format_name=mov,mp4,m4a,3gp,3g2,mj2|start_time=0.000000|duration=23.613333|size=102400|bit_rate=34692|probe_score=100|tag:major_brand=qt |tag:minor_version=537199360|tag:compatible_brands=qt |tag:creation_time=2008-05-12T20:59:26.000000Z From 7746103227195b4d106ce6090d17dc6fd36de683 Mon Sep 17 00:00:00 2001 From: Timur Aydin Date: Sat, 5 Nov 2016 01:15:44 +0300 Subject: [PATCH 095/102] avformat/rtpdec: Add support for 24 bit RTSP audio playback When ffplay is used to play from the RTSP URL that serves 24 bit audio content, ffplay fails to recognize the audio codec format. The attached patch adds support for playing 24 bit audio content over RTSP by defining a dynamic payload handler for "L24". Signed-off-by: Michael Niedermayer --- libavformat/rtpdec.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c index 51feeeaad3fa0..53cdad739695b 100644 --- a/libavformat/rtpdec.c +++ b/libavformat/rtpdec.c @@ -33,6 +33,12 @@ #define MIN_FEEDBACK_INTERVAL 200000 /* 200 ms in us */ +static RTPDynamicProtocolHandler l24_dynamic_handler = { + .enc_name = "L24", + .codec_type = AVMEDIA_TYPE_AUDIO, + .codec_id = AV_CODEC_ID_PCM_S24BE, +}; + static RTPDynamicProtocolHandler gsm_dynamic_handler = { .enc_name = "GSM", .codec_type = AVMEDIA_TYPE_AUDIO, @@ -115,6 +121,7 @@ void ff_register_rtp_dynamic_payload_handlers(void) ff_register_dynamic_payload_handler(&ff_vp8_dynamic_handler); ff_register_dynamic_payload_handler(&ff_vp9_dynamic_handler); ff_register_dynamic_payload_handler(&gsm_dynamic_handler); + ff_register_dynamic_payload_handler(&l24_dynamic_handler); ff_register_dynamic_payload_handler(&opus_dynamic_handler); ff_register_dynamic_payload_handler(&realmedia_mp3_dynamic_handler); ff_register_dynamic_payload_handler(&speex_dynamic_handler); From c0f6eff6a7edaa38a9ea4865ffc2ad36539d9d48 Mon Sep 17 00:00:00 2001 From: liu jc Date: Wed, 24 Aug 2016 10:46:41 +0000 Subject: [PATCH 096/102] avformat/tcp: workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve port number. Signed-off-by: liujingchao Signed-off-by: Michael Niedermayer --- libavformat/tcp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavformat/tcp.c b/libavformat/tcp.c index c1054799c449b..fd10a56eff9ac 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -122,6 +122,14 @@ static int tcp_open(URLContext *h, const char *uri, int flags) cur_ai = ai; restart: + // workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve port number. + if (cur_ai->ai_family == AF_INET6){ + struct sockaddr_in6 * sockaddr_v6 = (struct sockaddr_in6 *)cur_ai->ai_addr; + if (!sockaddr_v6->sin6_port){ + sockaddr_v6->sin6_port = htons(port); + } + } + fd = ff_socket(cur_ai->ai_family, cur_ai->ai_socktype, cur_ai->ai_protocol); From bb6a7b6f75ac544c956e3eefee297700ef4d3468 Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Fri, 4 Nov 2016 22:58:49 +0100 Subject: [PATCH 097/102] lzf: update pointer p after realloc This fixes heap-use-after-free detected by AddressSanitizer. Reviewed-by: Luca Barbato Signed-off-by: Andreas Cadhalpun --- libavcodec/lzf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/lzf.c b/libavcodec/lzf.c index 409a7ffdd39e4..5b7526ef1854e 100644 --- a/libavcodec/lzf.c +++ b/libavcodec/lzf.c @@ -53,6 +53,7 @@ int ff_lzf_uncompress(GetByteContext *gb, uint8_t **buf, int64_t *size) ret = av_reallocp(buf, *size); if (ret < 0) return ret; + p = *buf + len; } bytestream2_get_buffer(gb, p, s); @@ -75,6 +76,7 @@ int ff_lzf_uncompress(GetByteContext *gb, uint8_t **buf, int64_t *size) ret = av_reallocp(buf, *size); if (ret < 0) return ret; + p = *buf + len; } av_memcpy_backptr(p, off, l); From 0efb6106118c17308b3fdc3190f5e5bf84b01d5c Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Sat, 5 Nov 2016 00:17:53 +0100 Subject: [PATCH 098/102] mxfdec: fix NULL pointer dereference Metadata streams have priv_data set to NULL. Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Cadhalpun --- libavformat/mxfdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index d2166ee5a19b6..a1a79ceb51d8a 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -391,7 +391,7 @@ static int mxf_get_stream_index(AVFormatContext *s, KLVPacket *klv) for (i = 0; i < s->nb_streams; i++) { MXFTrack *track = s->streams[i]->priv_data; /* SMPTE 379M 7.3 */ - if (!memcmp(klv->key + sizeof(mxf_essence_element_key), track->track_number, sizeof(track->track_number))) + if (track && !memcmp(klv->key + sizeof(mxf_essence_element_key), track->track_number, sizeof(track->track_number))) return i; } /* return 0 if only one stream, for OP Atom files with 0 as track number */ From 9ea69f48089254c4c5bda1851d6e297c68ec46fe Mon Sep 17 00:00:00 2001 From: James Almer Date: Thu, 15 Sep 2016 23:05:29 -0300 Subject: [PATCH 099/102] avutil/softfloat_ieee754: make all functions inline Removes "defined but not used" warnings Reviewed-by: Michael Niedermayer Signed-off-by: James Almer --- libavutil/softfloat_ieee754.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavutil/softfloat_ieee754.h b/libavutil/softfloat_ieee754.h index f82397b2e3236..b8957fb0a9186 100644 --- a/libavutil/softfloat_ieee754.h +++ b/libavutil/softfloat_ieee754.h @@ -38,7 +38,7 @@ static const SoftFloat_IEEE754 FLOAT_1 = {0, 0, 0}; /** Normalize the softfloat as defined by IEEE 754 single-recision floating * point specification */ -static SoftFloat_IEEE754 av_normalize_sf_ieee754(SoftFloat_IEEE754 sf) { +static inline SoftFloat_IEEE754 av_normalize_sf_ieee754(SoftFloat_IEEE754 sf) { while( sf.mant >= 0x1000000UL ) { sf.exp++; sf.mant >>= 1; @@ -50,7 +50,7 @@ static SoftFloat_IEEE754 av_normalize_sf_ieee754(SoftFloat_IEEE754 sf) { /** Convert integer to softfloat. * @return softfloat with value n * 2^e */ -static SoftFloat_IEEE754 av_int2sf_ieee754(int64_t n, int e) { +static inline SoftFloat_IEEE754 av_int2sf_ieee754(int64_t n, int e) { int sign = 0; if (n < 0) { @@ -63,13 +63,13 @@ static SoftFloat_IEEE754 av_int2sf_ieee754(int64_t n, int e) { /** Make a softfloat out of the bitstream. Assumes the bits are in the form as defined * by the IEEE 754 spec. */ -static SoftFloat_IEEE754 av_bits2sf_ieee754(uint32_t n) { +static inline SoftFloat_IEEE754 av_bits2sf_ieee754(uint32_t n) { return ((SoftFloat_IEEE754) { (n & 0x80000000UL), (n & 0x7FFFFFUL), (n & 0x7F800000UL) }); } /** Convert the softfloat to integer */ -static int av_sf2int_ieee754(SoftFloat_IEEE754 a) { +static inline int av_sf2int_ieee754(SoftFloat_IEEE754 a) { if(a.exp >= 0) return a.mant << a.exp ; else return a.mant >>(-a.exp); } @@ -77,7 +77,7 @@ static int av_sf2int_ieee754(SoftFloat_IEEE754 a) { /** Divide a by b. b should not be zero. * @return normalized result */ -static SoftFloat_IEEE754 av_div_sf_ieee754(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b) { +static inline SoftFloat_IEEE754 av_div_sf_ieee754(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b) { int32_t mant, exp, sign; a = av_normalize_sf_ieee754(a); b = av_normalize_sf_ieee754(b); @@ -90,7 +90,7 @@ static SoftFloat_IEEE754 av_div_sf_ieee754(SoftFloat_IEEE754 a, SoftFloat_IEEE75 /** Multiply a with b * #return normalized result */ -static SoftFloat_IEEE754 av_mul_sf_ieee754(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b) { +static inline SoftFloat_IEEE754 av_mul_sf_ieee754(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b) { int32_t sign, mant, exp; a = av_normalize_sf_ieee754(a); b = av_normalize_sf_ieee754(b); @@ -103,7 +103,7 @@ static SoftFloat_IEEE754 av_mul_sf_ieee754(SoftFloat_IEEE754 a, SoftFloat_IEEE75 /** Compare a with b strictly * @returns 1 if the a and b are equal, 0 otherwise. */ -static int av_cmp_sf_ieee754(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b) { +static inline int av_cmp_sf_ieee754(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b) { a = av_normalize_sf_ieee754(a); b = av_normalize_sf_ieee754(b); if (a.sign != b.sign) return 0; From c3e0755663a8441795b916a6689e8bf920cb89b3 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 5 Nov 2016 19:38:15 +0100 Subject: [PATCH 100/102] MAINTAINERS: Replace QSV maintainer Ivan has a shortage of time to take care of QSV, Mark agreed to take over. Signed-off-by: Michael Niedermayer --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index d0457a6bc9bf1..43ccec71a0910 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -214,7 +214,7 @@ Codecs: ptx.c Ivo van Poorten qcelp* Reynaldo H. Verdejo Pinochet qdm2.c, qdm2data.h Roberto Togni - qsv* Ivan Uskov + qsv* Mark Thompson qtrle.c Mike Melanson ra144.c, ra144.h, ra288.c, ra288.h Roberto Togni resample2.c Michael Niedermayer From e8a39f584a97fa81919393596b7ab6ac23783a9b Mon Sep 17 00:00:00 2001 From: James Almer Date: Wed, 28 Sep 2016 20:55:18 -0300 Subject: [PATCH 101/102] avformat/framehash: also print channel layout as a string This should be more useful for users since numerical values for channel layout can be confusing and unintuitive. Reviewed-by: Michael Niedermayer Signed-off-by: James Almer --- libavformat/framehash.c | 3 +++ tests/ref/fate/8bps | 1 + tests/ref/fate/adpcm-4xm | 1 + tests/ref/fate/adpcm-afc | 1 + tests/ref/fate/adpcm-dtk | 1 + tests/ref/fate/adpcm-ea-1 | 1 + tests/ref/fate/adpcm-ea-2 | 1 + tests/ref/fate/adpcm-ea-maxis-xa | 1 + tests/ref/fate/adpcm-ea-r1 | 1 + tests/ref/fate/adpcm-ima-amv | 1 + tests/ref/fate/adpcm-ima-ea-eacs | 1 + tests/ref/fate/adpcm-ima-ea-sead | 1 + tests/ref/fate/adpcm-ima-smjpeg | 1 + tests/ref/fate/adpcm-ima-ws | 1 + tests/ref/fate/adpcm-ms-mono | 1 + tests/ref/fate/adpcm-thp | 1 + tests/ref/fate/adpcm-vima | 1 + tests/ref/fate/adpcm-xa | 1 + tests/ref/fate/adtstoasc_ticket3715 | 1 + tests/ref/fate/armovie-escape124 | 1 + tests/ref/fate/bethsoft-vid | 1 + tests/ref/fate/bfi | 1 + tests/ref/fate/bmv-audio | 1 + tests/ref/fate/cdxl-demux | 1 + tests/ref/fate/copy-psp | 1 + tests/ref/fate/copy-trac236 | 1 + tests/ref/fate/copy-trac4914 | 1 + tests/ref/fate/copy-trac4914-avi | 1 + tests/ref/fate/corepng | 1 + tests/ref/fate/creatureshock-avs | 1 + tests/ref/fate/cyberia-c93 | 1 + tests/ref/fate/d-cinema-demux | 1 + tests/ref/fate/dca-xll_51_16_192_768_0 | 1 + tests/ref/fate/dca-xll_51_16_192_768_0-dmix_2 | 1 + tests/ref/fate/dca-xll_51_16_192_768_0-dmix_6 | 1 + tests/ref/fate/dca-xll_51_16_192_768_1 | 1 + tests/ref/fate/dca-xll_51_16_192_768_1-dmix_2 | 1 + tests/ref/fate/dca-xll_51_16_192_768_1-dmix_6 | 1 + tests/ref/fate/dca-xll_51_24_48_768 | 1 + tests/ref/fate/dca-xll_51_24_48_768-dmix_2 | 1 + tests/ref/fate/dca-xll_51_24_48_768-dmix_6 | 1 + tests/ref/fate/dca-xll_51_24_48_none | 1 + tests/ref/fate/dca-xll_51_24_48_none-dmix_2 | 1 + tests/ref/fate/dca-xll_51_24_48_none-dmix_6 | 1 + tests/ref/fate/dca-xll_71_24_48_768_0 | 1 + tests/ref/fate/dca-xll_71_24_48_768_0-dmix_2 | 1 + tests/ref/fate/dca-xll_71_24_48_768_0-dmix_6 | 1 + tests/ref/fate/dca-xll_71_24_48_768_1 | 1 + tests/ref/fate/dca-xll_71_24_48_768_1-dmix_2 | 1 + tests/ref/fate/dca-xll_71_24_48_768_1-dmix_6 | 1 + tests/ref/fate/dca-xll_71_24_96_768 | 1 + tests/ref/fate/dca-xll_71_24_96_768-dmix_2 | 1 + tests/ref/fate/dca-xll_71_24_96_768-dmix_6 | 1 + tests/ref/fate/dca-xll_x96_51_24_96_1509 | 1 + tests/ref/fate/dca-xll_x96_51_24_96_1509-dmix_2 | 1 + tests/ref/fate/dca-xll_x96_51_24_96_1509-dmix_6 | 1 + tests/ref/fate/dca-xll_xch_61_24_48_768 | 1 + tests/ref/fate/dca-xll_xch_61_24_48_768-dmix_2 | 1 + tests/ref/fate/dca-xll_xch_61_24_48_768-dmix_6 | 1 + tests/ref/fate/dcinema-encode | 1 + tests/ref/fate/delphine-cin-audio | 1 + tests/ref/fate/dpcm-idroq | 1 + tests/ref/fate/dpcm-interplay | 1 + tests/ref/fate/dss-lp | 1 + tests/ref/fate/dss-sp | 1 + tests/ref/fate/ffmpeg-filter_colorkey | 1 + tests/ref/fate/filter-acrossfade | 1 + tests/ref/fate/filter-adelay | 1 + tests/ref/fate/filter-aecho | 1 + tests/ref/fate/filter-aemphasis-50fm | 1 + tests/ref/fate/filter-aemphasis-75kf | 1 + tests/ref/fate/filter-afade-esin | 1 + tests/ref/fate/filter-afade-exp | 1 + tests/ref/fate/filter-afade-hsin | 1 + tests/ref/fate/filter-afade-iqsin | 1 + tests/ref/fate/filter-afade-log | 1 + tests/ref/fate/filter-afade-qsin | 1 + tests/ref/fate/filter-agate | 1 + tests/ref/fate/filter-alimiter | 1 + tests/ref/fate/filter-amerge | 1 + tests/ref/fate/filter-anequalizer | 1 + tests/ref/fate/filter-apad | 1 + tests/ref/fate/filter-asetnsamples | 1 + tests/ref/fate/filter-asetrate | 1 + tests/ref/fate/filter-atrim-duration | 1 + tests/ref/fate/filter-atrim-mixed | 1 + tests/ref/fate/filter-atrim-samples | 1 + tests/ref/fate/filter-atrim-time | 1 + tests/ref/fate/filter-chorus | 1 + tests/ref/fate/filter-compand | 1 + tests/ref/fate/filter-concat | 1 + tests/ref/fate/filter-dcshift | 1 + tests/ref/fate/filter-earwax | 1 + tests/ref/fate/filter-extrastereo | 1 + tests/ref/fate/filter-hls | 1 + tests/ref/fate/filter-hls-append | 1 + tests/ref/fate/filter-meta-4560-rotate0 | 1 + tests/ref/fate/filter-overlay-dvdsub-2397 | 1 + tests/ref/fate/filter-silenceremove | 1 + tests/ref/fate/filter-stereotools | 1 + tests/ref/fate/filter-tremolo | 1 + tests/ref/fate/flv-demux | 1 + tests/ref/fate/g722-encode | 1 + tests/ref/fate/g722dec-1 | 1 + tests/ref/fate/g723_1-dec-1 | 1 + tests/ref/fate/g723_1-dec-2 | 1 + tests/ref/fate/g723_1-dec-3 | 1 + tests/ref/fate/g723_1-dec-4 | 1 + tests/ref/fate/g723_1-dec-5 | 1 + tests/ref/fate/g723_1-dec-6 | 1 + tests/ref/fate/g723_1-dec-7 | 1 + tests/ref/fate/g723_1-dec-8 | 1 + tests/ref/fate/g726-encode-2bit | 1 + tests/ref/fate/g726-encode-3bit | 1 + tests/ref/fate/g726-encode-4bit | 1 + tests/ref/fate/g726-encode-5bit | 1 + tests/ref/fate/gapless-mp3 | 6 +++--- tests/ref/fate/gsm-ms | 1 + tests/ref/fate/gsm-toast | 1 + tests/ref/fate/h264-skip-nointra | 1 + tests/ref/fate/h264-skip-nokey | 1 + tests/ref/fate/h264-xavc-4389 | 1 + tests/ref/fate/id-cin-video | 1 + tests/ref/fate/jv-demux | 1 + tests/ref/fate/lmlm4-demux | 1 + tests/ref/fate/maxis-xa | 1 + tests/ref/fate/mkv | 1 + tests/ref/fate/mkv-1242 | 1 + tests/ref/fate/mov-mp3-demux | 1 + tests/ref/fate/mtv | 1 + tests/ref/fate/mxf-demux | 1 + tests/ref/fate/nsv-demux | 1 + tests/ref/fate/oggopus-demux | 1 + tests/ref/fate/on2avc | 1 + tests/ref/fate/paf-audio | 1 + tests/ref/fate/paf-demux | 1 + tests/ref/fate/pcm-planar | 1 + tests/ref/fate/pcm_dvd | 1 + tests/ref/fate/pmp-demux | 1 + tests/ref/fate/prores-gray | 1 + tests/ref/fate/prores-transparency | 1 + tests/ref/fate/prores-transparency_skip | 1 + tests/ref/fate/psx-str-demux | 1 + tests/ref/fate/pva-demux | 1 + tests/ref/fate/ra3-144 | 1 + tests/ref/fate/redcode-demux | 1 + tests/ref/fate/segment-adts-to-mkv-header-000 | 1 + tests/ref/fate/segment-adts-to-mkv-header-001 | 1 + tests/ref/fate/segment-adts-to-mkv-header-002 | 1 + tests/ref/fate/segment-adts-to-mkv-header-all | 1 + tests/ref/fate/sierra-vmd-audio | 1 + tests/ref/fate/siff-demux | 1 + tests/ref/fate/smacker-audio | 1 + tests/ref/fate/smjpeg-demux | 1 + tests/ref/fate/sp5x | 1 + tests/ref/fate/tiertex-seq | 1 + tests/ref/fate/tmv | 1 + tests/ref/fate/ts-demux | 1 + tests/ref/fate/ts-opus-demux | 1 + tests/ref/fate/tscc-15bit | 1 + tests/ref/fate/vqf-demux | 2 +- tests/ref/fate/wav-ac3 | 1 + tests/ref/fate/wc3movie-xan | 1 + tests/ref/fate/westwood-aud | 1 + tests/ref/fate/wmv8-drm-nodec | 1 + tests/ref/fate/wtv-demux | 1 + tests/ref/fate/xmv-demux | 1 + 167 files changed, 171 insertions(+), 4 deletions(-) diff --git a/libavformat/framehash.c b/libavformat/framehash.c index 4c5499ea7bccc..3ae9092c61de5 100644 --- a/libavformat/framehash.c +++ b/libavformat/framehash.c @@ -29,13 +29,16 @@ int ff_framehash_write_header(AVFormatContext *s) for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; AVCodecParameters *avctx = st->codecpar; + char buf[256] = { 0 }; avio_printf(s->pb, "#tb %d: %d/%d\n", i, st->time_base.num, st->time_base.den); avio_printf(s->pb, "#media_type %d: %s\n", i, av_get_media_type_string(avctx->codec_type)); avio_printf(s->pb, "#codec_id %d: %s\n", i, avcodec_get_name(avctx->codec_id)); switch (avctx->codec_type) { case AVMEDIA_TYPE_AUDIO: + av_get_channel_layout_string(buf, sizeof(buf), avctx->channels, avctx->channel_layout); avio_printf(s->pb, "#sample_rate %d: %d\n", i,avctx->sample_rate); avio_printf(s->pb, "#channel_layout %d: %"PRIx64"\n", i,avctx->channel_layout); + avio_printf(s->pb, "#channel_layout_name %d: %s\n", i, buf); break; case AVMEDIA_TYPE_VIDEO: avio_printf(s->pb, "#dimensions %d: %dx%d\n", i, avctx->width, avctx->height); diff --git a/tests/ref/fate/8bps b/tests/ref/fate/8bps index c6287ffae049a..dab2b908db809 100644 --- a/tests/ref/fate/8bps +++ b/tests/ref/fate/8bps @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 22050 #channel_layout 1: 4 +#channel_layout_name 1: mono 0, 0, 0, 1, 259200, 0x7e91df07 1, 0, 0, 1024, 2048, 0x3d042426 1, 1024, 1024, 1024, 2048, 0x5bcae456 diff --git a/tests/ref/fate/adpcm-4xm b/tests/ref/fate/adpcm-4xm index cb725e5d97eb4..cfde412da8056 100644 --- a/tests/ref/fate/adpcm-4xm +++ b/tests/ref/fate/adpcm-4xm @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 22050 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1472, 5888, 0x9086e310 0, 1476, 1476, 1472, 5888, 0xac8491f5 0, 2952, 2952, 1472, 5888, 0xc9a08b6b diff --git a/tests/ref/fate/adpcm-afc b/tests/ref/fate/adpcm-afc index 0cf61a98b6d9d..6d8e7324541a2 100644 --- a/tests/ref/fate/adpcm-afc +++ b/tests/ref/fate/adpcm-afc @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 17920, 71680, 0x52373bc9 0, 17920, 17920, 17920, 71680, 0x1f854b27 0, 35840, 35840, 17920, 71680, 0x3d265a6d diff --git a/tests/ref/fate/adpcm-dtk b/tests/ref/fate/adpcm-dtk index acdf0333b2094..f3ade6d5054b4 100644 --- a/tests/ref/fate/adpcm-dtk +++ b/tests/ref/fate/adpcm-dtk @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 48000 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 896, 3584, 0xdae789d5 0, 896, 896, 896, 3584, 0x168ed9b6 0, 1792, 1792, 896, 3584, 0x8920c8d5 diff --git a/tests/ref/fate/adpcm-ea-1 b/tests/ref/fate/adpcm-ea-1 index fa9906c09cbf9..76be8e8511a5d 100644 --- a/tests/ref/fate/adpcm-ea-1 +++ b/tests/ref/fate/adpcm-ea-1 @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 22050 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1484, 5936, 0x00000000 0, 1484, 1484, 1456, 5824, 0x00000000 0, 2940, 2940, 1484, 5936, 0x00000000 diff --git a/tests/ref/fate/adpcm-ea-2 b/tests/ref/fate/adpcm-ea-2 index 4743e3d6cd4d9..91440874a0e9f 100644 --- a/tests/ref/fate/adpcm-ea-2 +++ b/tests/ref/fate/adpcm-ea-2 @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 22050 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1484, 5936, 0xea261a29 0, 1484, 1484, 1456, 5824, 0x253df061 0, 2940, 2940, 1484, 5936, 0x603a5bd7 diff --git a/tests/ref/fate/adpcm-ea-maxis-xa b/tests/ref/fate/adpcm-ea-maxis-xa index b300c320ad905..c919a67545716 100644 --- a/tests/ref/fate/adpcm-ea-maxis-xa +++ b/tests/ref/fate/adpcm-ea-maxis-xa @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 22050 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 28, 112, 0x291d1be4 0, 28, 28, 28, 112, 0xf08d33cc 0, 56, 56, 28, 112, 0x5b1521de diff --git a/tests/ref/fate/adpcm-ea-r1 b/tests/ref/fate/adpcm-ea-r1 index 2208eb0cb8c75..4e5fb6788f1b8 100644 --- a/tests/ref/fate/adpcm-ea-r1 +++ b/tests/ref/fate/adpcm-ea-r1 @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 48000 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1624, 6496, 0x00000000 0, 1624, 1624, 1596, 6384, 0x00000000 0, 3220, 3220, 1596, 6384, 0x00000000 diff --git a/tests/ref/fate/adpcm-ima-amv b/tests/ref/fate/adpcm-ima-amv index def9279099b7a..eb174dfa810d6 100644 --- a/tests/ref/fate/adpcm-ima-amv +++ b/tests/ref/fate/adpcm-ima-amv @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 22050 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 1378, 2756, 0x0af35034 0, 1378, 1378, 1378, 2756, 0x8462443f 0, 2756, 2756, 1378, 2756, 0x9f493ba6 diff --git a/tests/ref/fate/adpcm-ima-ea-eacs b/tests/ref/fate/adpcm-ima-ea-eacs index d5ea2e53089fd..fcfcbeb175359 100644 --- a/tests/ref/fate/adpcm-ima-ea-eacs +++ b/tests/ref/fate/adpcm-ima-ea-eacs @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 22050 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1468, 5872, 0x00000000 0, 1468, 1468, 1468, 5872, 0x00000000 0, 2936, 2936, 1468, 5872, 0x00000000 diff --git a/tests/ref/fate/adpcm-ima-ea-sead b/tests/ref/fate/adpcm-ima-ea-sead index 563bb49f58c0e..2d52efe3c0b6d 100644 --- a/tests/ref/fate/adpcm-ima-ea-sead +++ b/tests/ref/fate/adpcm-ima-ea-sead @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 22050 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 736, 2944, 0x00000000 0, 736, 736, 1472, 5888, 0x5ae3c2a4 0, 2208, 2208, 1472, 5888, 0x158fbcb4 diff --git a/tests/ref/fate/adpcm-ima-smjpeg b/tests/ref/fate/adpcm-ima-smjpeg index f88520d9a6ebc..d56014ea013f4 100644 --- a/tests/ref/fate/adpcm-ima-smjpeg +++ b/tests/ref/fate/adpcm-ima-smjpeg @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 22050 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 512, 1024, 0x00000000 0, 512, 512, 512, 1024, 0x00000000 0, 1024, 1024, 512, 1024, 0xed2d3f6b diff --git a/tests/ref/fate/adpcm-ima-ws b/tests/ref/fate/adpcm-ima-ws index 0e41e1eb0c225..d1e6b615dcd4a 100644 --- a/tests/ref/fate/adpcm-ima-ws +++ b/tests/ref/fate/adpcm-ima-ws @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 22050 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 11024, 22048, 0x0665d7f4 0, 11024, 11024, 1470, 2940, 0x0f3c64cb 0, 12494, 12494, 1470, 2940, 0xc90b9e78 diff --git a/tests/ref/fate/adpcm-ms-mono b/tests/ref/fate/adpcm-ms-mono index 254dc8a5864f5..e3f217d18ec6b 100644 --- a/tests/ref/fate/adpcm-ms-mono +++ b/tests/ref/fate/adpcm-ms-mono @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 11025 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 500, 1000, 0x64cd9403 0, 500, 500, 500, 1000, 0xa4ef8a9d 0, 1000, 1000, 500, 1000, 0x75c19868 diff --git a/tests/ref/fate/adpcm-thp b/tests/ref/fate/adpcm-thp index ff49303980e8b..592c6610adf74 100644 --- a/tests/ref/fate/adpcm-thp +++ b/tests/ref/fate/adpcm-thp @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 32000 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1078, 4312, 0x469714f6 0, 1078, 1078, 1064, 4256, 0x6ca28f25 0, 2142, 2142, 1078, 4312, 0xd466f806 diff --git a/tests/ref/fate/adpcm-vima b/tests/ref/fate/adpcm-vima index 5bc62c39e9955..b22f128be5d4c 100644 --- a/tests/ref/fate/adpcm-vima +++ b/tests/ref/fate/adpcm-vima @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 22050 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 73500, 294000, 0x37d439ee 0, 73500, 73500, 1470, 5880, 0xe524b177 0, 74970, 74970, 1470, 5880, 0x9e784af1 diff --git a/tests/ref/fate/adpcm-xa b/tests/ref/fate/adpcm-xa index e3652278409d9..15b62ec4a5b3c 100644 --- a/tests/ref/fate/adpcm-xa +++ b/tests/ref/fate/adpcm-xa @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 37800 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 2016, 8064, 0xa307ed8c 0, 2016, 2016, 2016, 8064, 0xd2551927 0, 4032, 4032, 2016, 8064, 0x3264a799 diff --git a/tests/ref/fate/adtstoasc_ticket3715 b/tests/ref/fate/adtstoasc_ticket3715 index ff8e8abdbb1a3..949b565c2fa73 100644 --- a/tests/ref/fate/adtstoasc_ticket3715 +++ b/tests/ref/fate/adtstoasc_ticket3715 @@ -6,6 +6,7 @@ ef8ce3cbd1d86113e7c991a816086068 *tests/data/fate/adtstoasc_ticket3715.mov #codec_id 0: aac #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 371, 0x14b11a4f 0, 1024, 1024, 1024, 402, 0x2f00c487 0, 2048, 2048, 1024, 403, 0x1959c0d4 diff --git a/tests/ref/fate/armovie-escape124 b/tests/ref/fate/armovie-escape124 index 5c8f0519b1393..398ff767b65b9 100644 --- a/tests/ref/fate/armovie-escape124 +++ b/tests/ref/fate/armovie-escape124 @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 44100 #channel_layout 1: 3 +#channel_layout_name 1: stereo 0, 0, 0, 1, 230400, 0xd133e177 1, 0, 0, 44100, 176400, 0xdd61578c 0, 1, 1, 1, 230400, 0xe3501bb2 diff --git a/tests/ref/fate/bethsoft-vid b/tests/ref/fate/bethsoft-vid index ccb0d377a32f1..25a62ae5158b3 100644 --- a/tests/ref/fate/bethsoft-vid +++ b/tests/ref/fate/bethsoft-vid @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 11111 #channel_layout 1: 4 +#channel_layout_name 1: mono 0, 0, 0, 1, 192000, 0x00000000 1, 0, 0, 740, 1480, 0x00000000 1, 740, 740, 740, 1480, 0x20a92bd4 diff --git a/tests/ref/fate/bfi b/tests/ref/fate/bfi index 807615c88c479..277c93543e568 100644 --- a/tests/ref/fate/bfi +++ b/tests/ref/fate/bfi @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 11025 #channel_layout 1: 4 +#channel_layout_name 1: mono 0, 0, 0, 1, 134400, 0xc218b00c 1, 0, 0, 8884, 17768, 0x07df135c 0, 1, 1, 1, 134400, 0x114daf7c diff --git a/tests/ref/fate/bmv-audio b/tests/ref/fate/bmv-audio index 62f9c5e56ef9b..6e1a4c2fe9e05 100644 --- a/tests/ref/fate/bmv-audio +++ b/tests/ref/fate/bmv-audio @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 22050 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1856, 7424, 0x18540b36 0, 1856, 1856, 1824, 7296, 0x5acd2484 0, 3680, 3680, 1856, 7424, 0xa1bc5c5a diff --git a/tests/ref/fate/cdxl-demux b/tests/ref/fate/cdxl-demux index 828b2c91fa76e..f1334755aad96 100644 --- a/tests/ref/fate/cdxl-demux +++ b/tests/ref/fate/cdxl-demux @@ -8,6 +8,7 @@ #codec_id 1: pcm_s8 #sample_rate 1: 11025 #channel_layout 1: 4 +#channel_layout_name 1: mono 0, 0, 0, 1884, 22688, 0xc954a244 1, 0, 0, 1884, 1884, 0x06925e3e 0, 1884, 1884, 1884, 22688, 0x3ee4a304 diff --git a/tests/ref/fate/copy-psp b/tests/ref/fate/copy-psp index 7089f489376b2..6603d3ff266f2 100644 --- a/tests/ref/fate/copy-psp +++ b/tests/ref/fate/copy-psp @@ -12,6 +12,7 @@ #codec_id 1: aac #sample_rate 1: 48000 #channel_layout 1: 3 +#channel_layout_name 1: stereo 0, 0, 0, 3003, 37084, 0x021a0d3f 1, 0, 0, 1024, 10, 0x0e270398 1, 1024, 1024, 1025, 10, 0x0f4703b8 diff --git a/tests/ref/fate/copy-trac236 b/tests/ref/fate/copy-trac236 index 167446c27eaca..c5240ca3d37e4 100644 --- a/tests/ref/fate/copy-trac236 +++ b/tests/ref/fate/copy-trac236 @@ -10,6 +10,7 @@ d6e3d97b522ce881ed29c5da74cc7e63 *tests/data/fate/copy-trac236.mov #codec_id 1: pcm_s16le #sample_rate 1: 48000 #channel_layout 1: 3 +#channel_layout_name 1: stereo 0, 0, 0, 1, 518400, 0x81ab2140 1, 0, 0, 1024, 4096, 0x67dc99a3 1, 1024, 1024, 1024, 4096, 0xf115a681 diff --git a/tests/ref/fate/copy-trac4914 b/tests/ref/fate/copy-trac4914 index 3a6eee4dd2350..ef06b8f816a00 100644 --- a/tests/ref/fate/copy-trac4914 +++ b/tests/ref/fate/copy-trac4914 @@ -10,6 +10,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 48000 #channel_layout 1: 3 +#channel_layout_name 1: stereo 0, 0, 0, 1, 259200, 0xf36957da 1, 0, 0, 1602, 6408, 0x1dd7b37c 0, 1, 1, 1, 259200, 0x29a1f586 diff --git a/tests/ref/fate/copy-trac4914-avi b/tests/ref/fate/copy-trac4914-avi index e02744d7d4755..0358ead6b80f8 100644 --- a/tests/ref/fate/copy-trac4914-avi +++ b/tests/ref/fate/copy-trac4914-avi @@ -10,6 +10,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 48000 #channel_layout 1: 3 +#channel_layout_name 1: stereo 1, 0, 0, 1152, 4608, 0xb24f5c9d 1, 1152, 1152, 1152, 4608, 0xe2da5c32 1, 2304, 2304, 1152, 4608, 0xd76023d9 diff --git a/tests/ref/fate/corepng b/tests/ref/fate/corepng index 4c106ed410f2e..74bb920108020 100644 --- a/tests/ref/fate/corepng +++ b/tests/ref/fate/corepng @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 11025 #channel_layout 1: 4 +#channel_layout_name 1: mono 0, 0, 0, 1, 230400, 0x03e25ead 1, 0, 0, 5513, 11026, 0x27ad637c 0, 1, 1, 1, 230400, 0x0a520ffd diff --git a/tests/ref/fate/creatureshock-avs b/tests/ref/fate/creatureshock-avs index 82460b243f1ff..c8e08c9ff79ea 100644 --- a/tests/ref/fate/creatureshock-avs +++ b/tests/ref/fate/creatureshock-avs @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 22222 #channel_layout 1: 4 +#channel_layout_name 1: mono 0, 0, 0, 1, 188892, 0x9f47a5ec 1, 0, 0, 8186, 16372, 0xfaaab59d 0, 1, 1, 1, 188892, 0xdece0269 diff --git a/tests/ref/fate/cyberia-c93 b/tests/ref/fate/cyberia-c93 index 5eb433649bec2..e7a5b5a08d9c4 100644 --- a/tests/ref/fate/cyberia-c93 +++ b/tests/ref/fate/cyberia-c93 @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 16129 #channel_layout 1: 4 +#channel_layout_name 1: mono 0, 0, 0, 1, 184320, 0x8433f0f8 1, 0, 0, 14184, 28368, 0xaacc96a5 0, 1, 1, 1, 184320, 0xd0d480f7 diff --git a/tests/ref/fate/d-cinema-demux b/tests/ref/fate/d-cinema-demux index 8e747de2a1c8d..74d00f7bb2668 100644 --- a/tests/ref/fate/d-cinema-demux +++ b/tests/ref/fate/d-cinema-demux @@ -3,6 +3,7 @@ #codec_id 0: pcm_s24daud #sample_rate 0: 96000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) 0, 0, 0, 1875, 36000, 0xd592781d 0, 1875, 1875, 1875, 36000, 0xd592781d 0, 3750, 3750, 1875, 36000, 0xd592781d diff --git a/tests/ref/fate/dca-xll_51_16_192_768_0 b/tests/ref/fate/dca-xll_51_16_192_768_0 index acbae84ffe5d0..6e62c616e29f6 100644 --- a/tests/ref/fate/dca-xll_51_16_192_768_0 +++ b/tests/ref/fate/dca-xll_51_16_192_768_0 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 192000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) #stream#, dts, pts, duration, size, hash 0, 0, 0, 2048, 24576, 91ff0dac5df86e798bfef5e573536b08 0, 2048, 2048, 2048, 24576, 91ff0dac5df86e798bfef5e573536b08 diff --git a/tests/ref/fate/dca-xll_51_16_192_768_0-dmix_2 b/tests/ref/fate/dca-xll_51_16_192_768_0-dmix_2 index acbae84ffe5d0..6e62c616e29f6 100644 --- a/tests/ref/fate/dca-xll_51_16_192_768_0-dmix_2 +++ b/tests/ref/fate/dca-xll_51_16_192_768_0-dmix_2 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 192000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) #stream#, dts, pts, duration, size, hash 0, 0, 0, 2048, 24576, 91ff0dac5df86e798bfef5e573536b08 0, 2048, 2048, 2048, 24576, 91ff0dac5df86e798bfef5e573536b08 diff --git a/tests/ref/fate/dca-xll_51_16_192_768_0-dmix_6 b/tests/ref/fate/dca-xll_51_16_192_768_0-dmix_6 index acbae84ffe5d0..6e62c616e29f6 100644 --- a/tests/ref/fate/dca-xll_51_16_192_768_0-dmix_6 +++ b/tests/ref/fate/dca-xll_51_16_192_768_0-dmix_6 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 192000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) #stream#, dts, pts, duration, size, hash 0, 0, 0, 2048, 24576, 91ff0dac5df86e798bfef5e573536b08 0, 2048, 2048, 2048, 24576, 91ff0dac5df86e798bfef5e573536b08 diff --git a/tests/ref/fate/dca-xll_51_16_192_768_1 b/tests/ref/fate/dca-xll_51_16_192_768_1 index acbae84ffe5d0..6e62c616e29f6 100644 --- a/tests/ref/fate/dca-xll_51_16_192_768_1 +++ b/tests/ref/fate/dca-xll_51_16_192_768_1 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 192000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) #stream#, dts, pts, duration, size, hash 0, 0, 0, 2048, 24576, 91ff0dac5df86e798bfef5e573536b08 0, 2048, 2048, 2048, 24576, 91ff0dac5df86e798bfef5e573536b08 diff --git a/tests/ref/fate/dca-xll_51_16_192_768_1-dmix_2 b/tests/ref/fate/dca-xll_51_16_192_768_1-dmix_2 index 3486971ce602e..17896a7cca6dc 100644 --- a/tests/ref/fate/dca-xll_51_16_192_768_1-dmix_2 +++ b/tests/ref/fate/dca-xll_51_16_192_768_1-dmix_2 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 192000 #channel_layout 0: 3 +#channel_layout_name 0: stereo #stream#, dts, pts, duration, size, hash 0, 0, 0, 2048, 8192, 0829f71740aab1ab98b33eae21dee122 0, 2048, 2048, 2048, 8192, c8ca1cff44674809d464ec39cf1bd1e9 diff --git a/tests/ref/fate/dca-xll_51_16_192_768_1-dmix_6 b/tests/ref/fate/dca-xll_51_16_192_768_1-dmix_6 index acbae84ffe5d0..6e62c616e29f6 100644 --- a/tests/ref/fate/dca-xll_51_16_192_768_1-dmix_6 +++ b/tests/ref/fate/dca-xll_51_16_192_768_1-dmix_6 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 192000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) #stream#, dts, pts, duration, size, hash 0, 0, 0, 2048, 24576, 91ff0dac5df86e798bfef5e573536b08 0, 2048, 2048, 2048, 24576, 91ff0dac5df86e798bfef5e573536b08 diff --git a/tests/ref/fate/dca-xll_51_24_48_768 b/tests/ref/fate/dca-xll_51_24_48_768 index 8e7be8b2fc102..2d10583b49a2a 100644 --- a/tests/ref/fate/dca-xll_51_24_48_768 +++ b/tests/ref/fate/dca-xll_51_24_48_768 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s24le #sample_rate 0: 48000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) #stream#, dts, pts, duration, size, hash 0, 0, 0, 512, 9216, 13a95890b5f0947d6f058ca9c30a3e01 0, 512, 512, 512, 9216, 13a95890b5f0947d6f058ca9c30a3e01 diff --git a/tests/ref/fate/dca-xll_51_24_48_768-dmix_2 b/tests/ref/fate/dca-xll_51_24_48_768-dmix_2 index 5f576192cc75a..be22d7d98ec4e 100644 --- a/tests/ref/fate/dca-xll_51_24_48_768-dmix_2 +++ b/tests/ref/fate/dca-xll_51_24_48_768-dmix_2 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s24le #sample_rate 0: 48000 #channel_layout 0: 3 +#channel_layout_name 0: stereo #stream#, dts, pts, duration, size, hash 0, 0, 0, 512, 3072, d2a70550489de356a2cd6bfc40711204 0, 512, 512, 512, 3072, d2a70550489de356a2cd6bfc40711204 diff --git a/tests/ref/fate/dca-xll_51_24_48_768-dmix_6 b/tests/ref/fate/dca-xll_51_24_48_768-dmix_6 index 8e7be8b2fc102..2d10583b49a2a 100644 --- a/tests/ref/fate/dca-xll_51_24_48_768-dmix_6 +++ b/tests/ref/fate/dca-xll_51_24_48_768-dmix_6 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s24le #sample_rate 0: 48000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) #stream#, dts, pts, duration, size, hash 0, 0, 0, 512, 9216, 13a95890b5f0947d6f058ca9c30a3e01 0, 512, 512, 512, 9216, 13a95890b5f0947d6f058ca9c30a3e01 diff --git a/tests/ref/fate/dca-xll_51_24_48_none b/tests/ref/fate/dca-xll_51_24_48_none index a1994e7dfefc2..17cfd0edb2985 100644 --- a/tests/ref/fate/dca-xll_51_24_48_none +++ b/tests/ref/fate/dca-xll_51_24_48_none @@ -6,6 +6,7 @@ #codec_id 0: pcm_s24le #sample_rate 0: 48000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) #stream#, dts, pts, duration, size, hash 0, 0, 0, 1024, 18432, f9debe3f07be68533bf0295e3d2ba68a 0, 1024, 1024, 1024, 18432, 6707daa7724fdc552869e522a7936f26 diff --git a/tests/ref/fate/dca-xll_51_24_48_none-dmix_2 b/tests/ref/fate/dca-xll_51_24_48_none-dmix_2 index a1994e7dfefc2..17cfd0edb2985 100644 --- a/tests/ref/fate/dca-xll_51_24_48_none-dmix_2 +++ b/tests/ref/fate/dca-xll_51_24_48_none-dmix_2 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s24le #sample_rate 0: 48000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) #stream#, dts, pts, duration, size, hash 0, 0, 0, 1024, 18432, f9debe3f07be68533bf0295e3d2ba68a 0, 1024, 1024, 1024, 18432, 6707daa7724fdc552869e522a7936f26 diff --git a/tests/ref/fate/dca-xll_51_24_48_none-dmix_6 b/tests/ref/fate/dca-xll_51_24_48_none-dmix_6 index a1994e7dfefc2..17cfd0edb2985 100644 --- a/tests/ref/fate/dca-xll_51_24_48_none-dmix_6 +++ b/tests/ref/fate/dca-xll_51_24_48_none-dmix_6 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s24le #sample_rate 0: 48000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) #stream#, dts, pts, duration, size, hash 0, 0, 0, 1024, 18432, f9debe3f07be68533bf0295e3d2ba68a 0, 1024, 1024, 1024, 18432, 6707daa7724fdc552869e522a7936f26 diff --git a/tests/ref/fate/dca-xll_71_24_48_768_0 b/tests/ref/fate/dca-xll_71_24_48_768_0 index 387b07e2ff5c9..a295d41a92112 100644 --- a/tests/ref/fate/dca-xll_71_24_48_768_0 +++ b/tests/ref/fate/dca-xll_71_24_48_768_0 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s24le #sample_rate 0: 48000 #channel_layout 0: 63f +#channel_layout_name 0: 7.1 #stream#, dts, pts, duration, size, hash 0, 0, 0, 512, 12288, ca9f8c8eb1b9b311cb79999fa376c7f0 0, 512, 512, 512, 12288, 4072783b8efb99a9e5817067d68f61c6 diff --git a/tests/ref/fate/dca-xll_71_24_48_768_0-dmix_2 b/tests/ref/fate/dca-xll_71_24_48_768_0-dmix_2 index e1169e10832ee..f9b7b655a5c46 100644 --- a/tests/ref/fate/dca-xll_71_24_48_768_0-dmix_2 +++ b/tests/ref/fate/dca-xll_71_24_48_768_0-dmix_2 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s24le #sample_rate 0: 48000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) #stream#, dts, pts, duration, size, hash 0, 0, 0, 512, 9216, a2b724b146069938f0e2cb82490dea54 0, 512, 512, 512, 9216, 13a95890b5f0947d6f058ca9c30a3e01 diff --git a/tests/ref/fate/dca-xll_71_24_48_768_0-dmix_6 b/tests/ref/fate/dca-xll_71_24_48_768_0-dmix_6 index e1169e10832ee..f9b7b655a5c46 100644 --- a/tests/ref/fate/dca-xll_71_24_48_768_0-dmix_6 +++ b/tests/ref/fate/dca-xll_71_24_48_768_0-dmix_6 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s24le #sample_rate 0: 48000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) #stream#, dts, pts, duration, size, hash 0, 0, 0, 512, 9216, a2b724b146069938f0e2cb82490dea54 0, 512, 512, 512, 9216, 13a95890b5f0947d6f058ca9c30a3e01 diff --git a/tests/ref/fate/dca-xll_71_24_48_768_1 b/tests/ref/fate/dca-xll_71_24_48_768_1 index 387b07e2ff5c9..a295d41a92112 100644 --- a/tests/ref/fate/dca-xll_71_24_48_768_1 +++ b/tests/ref/fate/dca-xll_71_24_48_768_1 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s24le #sample_rate 0: 48000 #channel_layout 0: 63f +#channel_layout_name 0: 7.1 #stream#, dts, pts, duration, size, hash 0, 0, 0, 512, 12288, ca9f8c8eb1b9b311cb79999fa376c7f0 0, 512, 512, 512, 12288, 4072783b8efb99a9e5817067d68f61c6 diff --git a/tests/ref/fate/dca-xll_71_24_48_768_1-dmix_2 b/tests/ref/fate/dca-xll_71_24_48_768_1-dmix_2 index 44bc5a038a989..5b01746258400 100644 --- a/tests/ref/fate/dca-xll_71_24_48_768_1-dmix_2 +++ b/tests/ref/fate/dca-xll_71_24_48_768_1-dmix_2 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s24le #sample_rate 0: 48000 #channel_layout 0: 3 +#channel_layout_name 0: stereo #stream#, dts, pts, duration, size, hash 0, 0, 0, 512, 3072, d2a70550489de356a2cd6bfc40711204 0, 512, 512, 512, 3072, d2a70550489de356a2cd6bfc40711204 diff --git a/tests/ref/fate/dca-xll_71_24_48_768_1-dmix_6 b/tests/ref/fate/dca-xll_71_24_48_768_1-dmix_6 index ef6a1130b31a4..246b5e01333b9 100644 --- a/tests/ref/fate/dca-xll_71_24_48_768_1-dmix_6 +++ b/tests/ref/fate/dca-xll_71_24_48_768_1-dmix_6 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s24le #sample_rate 0: 48000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) #stream#, dts, pts, duration, size, hash 0, 0, 0, 512, 9216, a2b724b146069938f0e2cb82490dea54 0, 512, 512, 512, 9216, 13a95890b5f0947d6f058ca9c30a3e01 diff --git a/tests/ref/fate/dca-xll_71_24_96_768 b/tests/ref/fate/dca-xll_71_24_96_768 index a2a02e0212234..418b4b136d569 100644 --- a/tests/ref/fate/dca-xll_71_24_96_768 +++ b/tests/ref/fate/dca-xll_71_24_96_768 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s24le #sample_rate 0: 96000 #channel_layout 0: 63f +#channel_layout_name 0: 7.1 #stream#, dts, pts, duration, size, hash 0, 0, 0, 1024, 24576, 0b24a527d66f2b0cab97f37e4cd79987 0, 1024, 1024, 1024, 24576, 91ff0dac5df86e798bfef5e573536b08 diff --git a/tests/ref/fate/dca-xll_71_24_96_768-dmix_2 b/tests/ref/fate/dca-xll_71_24_96_768-dmix_2 index 9f2877d3f790e..9bd0256c312a7 100644 --- a/tests/ref/fate/dca-xll_71_24_96_768-dmix_2 +++ b/tests/ref/fate/dca-xll_71_24_96_768-dmix_2 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s24le #sample_rate 0: 96000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) #stream#, dts, pts, duration, size, hash 0, 0, 0, 1024, 18432, 0a675f172b0e1a171c46dfaa4f1d0f00 0, 1024, 1024, 1024, 18432, f9debe3f07be68533bf0295e3d2ba68a diff --git a/tests/ref/fate/dca-xll_71_24_96_768-dmix_6 b/tests/ref/fate/dca-xll_71_24_96_768-dmix_6 index 9f2877d3f790e..9bd0256c312a7 100644 --- a/tests/ref/fate/dca-xll_71_24_96_768-dmix_6 +++ b/tests/ref/fate/dca-xll_71_24_96_768-dmix_6 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s24le #sample_rate 0: 96000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) #stream#, dts, pts, duration, size, hash 0, 0, 0, 1024, 18432, 0a675f172b0e1a171c46dfaa4f1d0f00 0, 1024, 1024, 1024, 18432, f9debe3f07be68533bf0295e3d2ba68a diff --git a/tests/ref/fate/dca-xll_x96_51_24_96_1509 b/tests/ref/fate/dca-xll_x96_51_24_96_1509 index 39a9e7970a05d..bc83f793a0076 100644 --- a/tests/ref/fate/dca-xll_x96_51_24_96_1509 +++ b/tests/ref/fate/dca-xll_x96_51_24_96_1509 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s24le #sample_rate 0: 96000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) #stream#, dts, pts, duration, size, hash 0, 0, 0, 1024, 18432, f9debe3f07be68533bf0295e3d2ba68a 0, 1024, 1024, 1024, 18432, f9debe3f07be68533bf0295e3d2ba68a diff --git a/tests/ref/fate/dca-xll_x96_51_24_96_1509-dmix_2 b/tests/ref/fate/dca-xll_x96_51_24_96_1509-dmix_2 index 39a9e7970a05d..bc83f793a0076 100644 --- a/tests/ref/fate/dca-xll_x96_51_24_96_1509-dmix_2 +++ b/tests/ref/fate/dca-xll_x96_51_24_96_1509-dmix_2 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s24le #sample_rate 0: 96000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) #stream#, dts, pts, duration, size, hash 0, 0, 0, 1024, 18432, f9debe3f07be68533bf0295e3d2ba68a 0, 1024, 1024, 1024, 18432, f9debe3f07be68533bf0295e3d2ba68a diff --git a/tests/ref/fate/dca-xll_x96_51_24_96_1509-dmix_6 b/tests/ref/fate/dca-xll_x96_51_24_96_1509-dmix_6 index 39a9e7970a05d..bc83f793a0076 100644 --- a/tests/ref/fate/dca-xll_x96_51_24_96_1509-dmix_6 +++ b/tests/ref/fate/dca-xll_x96_51_24_96_1509-dmix_6 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s24le #sample_rate 0: 96000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) #stream#, dts, pts, duration, size, hash 0, 0, 0, 1024, 18432, f9debe3f07be68533bf0295e3d2ba68a 0, 1024, 1024, 1024, 18432, f9debe3f07be68533bf0295e3d2ba68a diff --git a/tests/ref/fate/dca-xll_xch_61_24_48_768 b/tests/ref/fate/dca-xll_xch_61_24_48_768 index e3ac859662ecb..19816d93d3594 100644 --- a/tests/ref/fate/dca-xll_xch_61_24_48_768 +++ b/tests/ref/fate/dca-xll_xch_61_24_48_768 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s24le #sample_rate 0: 48000 #channel_layout 0: 70f +#channel_layout_name 0: 6.1 #stream#, dts, pts, duration, size, hash 0, 0, 0, 512, 10752, c3c5b236c266a9090378def1ad497a21 0, 512, 512, 512, 10752, 36eb6749f8d9ce9f94860dcc447253ac diff --git a/tests/ref/fate/dca-xll_xch_61_24_48_768-dmix_2 b/tests/ref/fate/dca-xll_xch_61_24_48_768-dmix_2 index b53a528b2cb6e..1f6989fbe4266 100644 --- a/tests/ref/fate/dca-xll_xch_61_24_48_768-dmix_2 +++ b/tests/ref/fate/dca-xll_xch_61_24_48_768-dmix_2 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s24le #sample_rate 0: 48000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) #stream#, dts, pts, duration, size, hash 0, 0, 0, 512, 9216, 652c4e61f9abe9fba9de792242e2d31d 0, 512, 512, 512, 9216, 13a95890b5f0947d6f058ca9c30a3e01 diff --git a/tests/ref/fate/dca-xll_xch_61_24_48_768-dmix_6 b/tests/ref/fate/dca-xll_xch_61_24_48_768-dmix_6 index b53a528b2cb6e..1f6989fbe4266 100644 --- a/tests/ref/fate/dca-xll_xch_61_24_48_768-dmix_6 +++ b/tests/ref/fate/dca-xll_xch_61_24_48_768-dmix_6 @@ -6,6 +6,7 @@ #codec_id 0: pcm_s24le #sample_rate 0: 48000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) #stream#, dts, pts, duration, size, hash 0, 0, 0, 512, 9216, 652c4e61f9abe9fba9de792242e2d31d 0, 512, 512, 512, 9216, 13a95890b5f0947d6f058ca9c30a3e01 diff --git a/tests/ref/fate/dcinema-encode b/tests/ref/fate/dcinema-encode index 27865d63e22dd..03e6e6ef6c613 100644 --- a/tests/ref/fate/dcinema-encode +++ b/tests/ref/fate/dcinema-encode @@ -6,6 +6,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 96000 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) #stream#, dts, pts, duration, size, hash 0, 0, 0, 341, 4092, 697cddfcd0e21f24782af0705b7048f3 0, 341, 341, 341, 4092, a057b18cd493923fed33c18578f61e0b diff --git a/tests/ref/fate/delphine-cin-audio b/tests/ref/fate/delphine-cin-audio index 5a69640a4c588..6fdc8048e42ea 100644 --- a/tests/ref/fate/delphine-cin-audio +++ b/tests/ref/fate/delphine-cin-audio @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 22050 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 88224, 176448, 0x541ddc55 0, 88224, 88224, 1838, 3676, 0xaf455081 0, 90062, 90062, 1838, 3676, 0x27ef4e91 diff --git a/tests/ref/fate/dpcm-idroq b/tests/ref/fate/dpcm-idroq index 39f2c799a3791..fb45ace2c633b 100644 --- a/tests/ref/fate/dpcm-idroq +++ b/tests/ref/fate/dpcm-idroq @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 22050 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 7456, 29824, 0x77e265b7 0, 7456, 7456, 736, 2944, 0x8dcdf50b 0, 8192, 8192, 736, 2944, 0xb135cd2a diff --git a/tests/ref/fate/dpcm-interplay b/tests/ref/fate/dpcm-interplay index 87a28620a59d9..720a98f38997c 100644 --- a/tests/ref/fate/dpcm-interplay +++ b/tests/ref/fate/dpcm-interplay @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 22050 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1462, 5848, 0xea04292b 0, 1462, 1462, 1472, 5888, 0x0e59e942 0, 2934, 2934, 1472, 5888, 0x56d480f6 diff --git a/tests/ref/fate/dss-lp b/tests/ref/fate/dss-lp index 6b5a7db8f50c0..ab1d5344b5b6e 100644 --- a/tests/ref/fate/dss-lp +++ b/tests/ref/fate/dss-lp @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 8000 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 240, 480, 0xf1107658 0, 240, 240, 240, 480, 0x50dee179 0, 480, 480, 240, 480, 0x40090802 diff --git a/tests/ref/fate/dss-sp b/tests/ref/fate/dss-sp index 5caa46999a17a..f407ce7da0c76 100644 --- a/tests/ref/fate/dss-sp +++ b/tests/ref/fate/dss-sp @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 11025 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 264, 528, 0xa2579e96 0, 264, 264, 264, 528, 0xf9b23172 0, 528, 528, 264, 528, 0x5571a0fe diff --git a/tests/ref/fate/ffmpeg-filter_colorkey b/tests/ref/fate/ffmpeg-filter_colorkey index 9fbdfebb42dee..1f96f2de796a9 100644 --- a/tests/ref/fate/ffmpeg-filter_colorkey +++ b/tests/ref/fate/ffmpeg-filter_colorkey @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 48000 #channel_layout 1: 3 +#channel_layout_name 1: stereo 0, 0, 0, 1, 622080, 0x4e30accb 1, 0, 0, 1152, 4608, 0x00000000 1, 1152, 1152, 1152, 4608, 0xbca29063 diff --git a/tests/ref/fate/filter-acrossfade b/tests/ref/fate/filter-acrossfade index b89f25d757c78..0567b022e873c 100644 --- a/tests/ref/fate/filter-acrossfade +++ b/tests/ref/fate/filter-acrossfade @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 888, 3552, 0x592ce6cc 0, 888, 888, 1024, 4096, 0x20f6f6a9 0, 1912, 1912, 1024, 4096, 0x3f840122 diff --git a/tests/ref/fate/filter-adelay b/tests/ref/fate/filter-adelay index a03f516e4ae58..e3ff763602bc3 100644 --- a/tests/ref/fate/filter-adelay +++ b/tests/ref/fate/filter-adelay @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 4096, 0x9d7bf760 0, 1024, 1024, 1024, 4096, 0xdf42c46b 0, 2048, 2048, 1024, 4096, 0x2214fd20 diff --git a/tests/ref/fate/filter-aecho b/tests/ref/fate/filter-aecho index f564fcca5d9eb..2c88c37fbc282 100644 --- a/tests/ref/fate/filter-aecho +++ b/tests/ref/fate/filter-aecho @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 4096, 0x3019edd5 0, 1024, 1024, 1024, 4096, 0x2df2fe2f 0, 2048, 2048, 1024, 4096, 0xde37ff37 diff --git a/tests/ref/fate/filter-aemphasis-50fm b/tests/ref/fate/filter-aemphasis-50fm index bae123cc89d32..649cd449be59d 100644 --- a/tests/ref/fate/filter-aemphasis-50fm +++ b/tests/ref/fate/filter-aemphasis-50fm @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 4096, 0xb9c5fefd 0, 1024, 1024, 1024, 4096, 0xb2ae0a90 0, 2048, 2048, 1024, 4096, 0x97e6e9f3 diff --git a/tests/ref/fate/filter-aemphasis-75kf b/tests/ref/fate/filter-aemphasis-75kf index c40a38958a3ae..5705e983385c2 100644 --- a/tests/ref/fate/filter-aemphasis-75kf +++ b/tests/ref/fate/filter-aemphasis-75kf @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 4096, 0x7b2101ec 0, 1024, 1024, 1024, 4096, 0x5c16fc93 0, 2048, 2048, 1024, 4096, 0x62bdee5d diff --git a/tests/ref/fate/filter-afade-esin b/tests/ref/fate/filter-afade-esin index b02c7ff92ccec..f9b910c693a5d 100644 --- a/tests/ref/fate/filter-afade-esin +++ b/tests/ref/fate/filter-afade-esin @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 4096, 0x06e0d68a 0, 1024, 1024, 1024, 4096, 0xb325d915 0, 2048, 2048, 1024, 4096, 0xc0a5f1f1 diff --git a/tests/ref/fate/filter-afade-exp b/tests/ref/fate/filter-afade-exp index f98db38d245e8..a0c519cd8b0bd 100644 --- a/tests/ref/fate/filter-afade-exp +++ b/tests/ref/fate/filter-afade-exp @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 4096, 0x00000000 0, 1024, 1024, 1024, 4096, 0x00000000 0, 2048, 2048, 1024, 4096, 0x00000000 diff --git a/tests/ref/fate/filter-afade-hsin b/tests/ref/fate/filter-afade-hsin index 7e51a8c362c4a..2c6a0e3a1ed69 100644 --- a/tests/ref/fate/filter-afade-hsin +++ b/tests/ref/fate/filter-afade-hsin @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 4096, 0x2042232e 0, 1024, 1024, 1024, 4096, 0x2c073cf7 0, 2048, 2048, 1024, 4096, 0x92fecae5 diff --git a/tests/ref/fate/filter-afade-iqsin b/tests/ref/fate/filter-afade-iqsin index aa7eea709f848..fc22baf913b2e 100644 --- a/tests/ref/fate/filter-afade-iqsin +++ b/tests/ref/fate/filter-afade-iqsin @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 4096, 0x220e908d 0, 1024, 1024, 1024, 4096, 0xdd65002e 0, 2048, 2048, 1024, 4096, 0x8072fb25 diff --git a/tests/ref/fate/filter-afade-log b/tests/ref/fate/filter-afade-log index 03d57940982be..99ac0b36d81ce 100644 --- a/tests/ref/fate/filter-afade-log +++ b/tests/ref/fate/filter-afade-log @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 4096, 0xf01adbd3 0, 1024, 1024, 1024, 4096, 0xbbe10f8e 0, 2048, 2048, 1024, 4096, 0xbf04fccf diff --git a/tests/ref/fate/filter-afade-qsin b/tests/ref/fate/filter-afade-qsin index a6586b1687b84..026fbbcc44e19 100644 --- a/tests/ref/fate/filter-afade-qsin +++ b/tests/ref/fate/filter-afade-qsin @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 4096, 0xd977ce0f 0, 1024, 1024, 1024, 4096, 0x9333f5b1 0, 2048, 2048, 1024, 4096, 0xf1a30794 diff --git a/tests/ref/fate/filter-agate b/tests/ref/fate/filter-agate index 4f7b10e71167d..b6e732a86e34d 100644 --- a/tests/ref/fate/filter-agate +++ b/tests/ref/fate/filter-agate @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 4096, 0x1af20090 0, 1024, 1024, 1024, 4096, 0x0b05ef2d 0, 2048, 2048, 1024, 4096, 0x574bf11d diff --git a/tests/ref/fate/filter-alimiter b/tests/ref/fate/filter-alimiter index 06e23f104cc1e..aef9765a83eff 100644 --- a/tests/ref/fate/filter-alimiter +++ b/tests/ref/fate/filter-alimiter @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 4096, 0xd4194af4 0, 1024, 1024, 1024, 4096, 0x686af4ab 0, 2048, 2048, 1024, 4096, 0xe80cee61 diff --git a/tests/ref/fate/filter-amerge b/tests/ref/fate/filter-amerge index 006383af5716e..b3e5eb50cc8da 100644 --- a/tests/ref/fate/filter-amerge +++ b/tests/ref/fate/filter-amerge @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 2048, 8192, 0x120efa65 0, 2048, 2048, 2048, 8192, 0x7b3cebf7 0, 4096, 4096, 2048, 8192, 0x0fb8ee01 diff --git a/tests/ref/fate/filter-anequalizer b/tests/ref/fate/filter-anequalizer index 21c7aaf31f68f..caed836bdf23b 100644 --- a/tests/ref/fate/filter-anequalizer +++ b/tests/ref/fate/filter-anequalizer @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 4096, 0x8e1bf8e0 0, 1024, 1024, 1024, 4096, 0xe315f564 0, 2048, 2048, 1024, 4096, 0x3d0efa98 diff --git a/tests/ref/fate/filter-apad b/tests/ref/fate/filter-apad index 194a459540f9b..9bf662d46abec 100644 --- a/tests/ref/fate/filter-apad +++ b/tests/ref/fate/filter-apad @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 4096, 0x29e3eecf 0, 1024, 1024, 1024, 4096, 0x18390b96 0, 2048, 2048, 1024, 4096, 0xc477fa99 diff --git a/tests/ref/fate/filter-asetnsamples b/tests/ref/fate/filter-asetnsamples index 5e246ec8f8d7d..23cf11b8af45e 100644 --- a/tests/ref/fate/filter-asetnsamples +++ b/tests/ref/fate/filter-asetnsamples @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 512, 2048, 0xd2dbf701 0, 512, 512, 512, 2048, 0xdb22f7bf 0, 1024, 1024, 512, 2048, 0x82a103be diff --git a/tests/ref/fate/filter-asetrate b/tests/ref/fate/filter-asetrate index e4487aec1171c..6ffa9403616e4 100644 --- a/tests/ref/fate/filter-asetrate +++ b/tests/ref/fate/filter-asetrate @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 20000 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 4096, 0x29e3eecf 0, 1024, 1024, 1024, 4096, 0x18390b96 0, 2048, 2048, 1024, 4096, 0xc477fa99 diff --git a/tests/ref/fate/filter-atrim-duration b/tests/ref/fate/filter-atrim-duration index 6f16c8f5e0c10..fafda1717f17c 100644 --- a/tests/ref/fate/filter-atrim-duration +++ b/tests/ref/fate/filter-atrim-duration @@ -3,4 +3,5 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 4410, 4410, 441, 1764, 0x61e374f7 diff --git a/tests/ref/fate/filter-atrim-mixed b/tests/ref/fate/filter-atrim-mixed index 8f8b4ed62c392..4cd1d8004f3ae 100644 --- a/tests/ref/fate/filter-atrim-mixed +++ b/tests/ref/fate/filter-atrim-mixed @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 1025, 1025, 1023, 4092, 0x78560a4c 0, 2048, 2048, 1024, 4096, 0xc477fa99 0, 3072, 3072, 1024, 4096, 0x3bc0f14f diff --git a/tests/ref/fate/filter-atrim-samples b/tests/ref/fate/filter-atrim-samples index 4dcb333b7e284..2d8c9a5235626 100644 --- a/tests/ref/fate/filter-atrim-samples +++ b/tests/ref/fate/filter-atrim-samples @@ -3,4 +3,5 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 26, 26, 54, 216, 0x6b376c6c diff --git a/tests/ref/fate/filter-atrim-time b/tests/ref/fate/filter-atrim-time index 4ca3d7353d7cb..a0c626c4ba3b1 100644 --- a/tests/ref/fate/filter-atrim-time +++ b/tests/ref/fate/filter-atrim-time @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 4410, 4410, 710, 2840, 0x658982a3 0, 5120, 5120, 1024, 4096, 0xfd6a0070 0, 6144, 6144, 1024, 4096, 0x0b01f4cf diff --git a/tests/ref/fate/filter-chorus b/tests/ref/fate/filter-chorus index 3fc4d7349834d..211e60ecb134b 100644 --- a/tests/ref/fate/filter-chorus +++ b/tests/ref/fate/filter-chorus @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 22050 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 2048, 4096, 0x1fc6f1f1 0, 2048, 2048, 2048, 4096, 0xe5f7f442 0, 4096, 4096, 2048, 4096, 0x4f14ecb9 diff --git a/tests/ref/fate/filter-compand b/tests/ref/fate/filter-compand index 14fe0b2fdd2ea..ac9095f4e36bc 100644 --- a/tests/ref/fate/filter-compand +++ b/tests/ref/fate/filter-compand @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 4096, 0xfc10e61b 0, 1024, 1024, 1024, 4096, 0x8801ef13 0, 2048, 2048, 1024, 4096, 0xba55fc17 diff --git a/tests/ref/fate/filter-concat b/tests/ref/fate/filter-concat index f8f7353c976ce..022697ec5bcd5 100644 --- a/tests/ref/fate/filter-concat +++ b/tests/ref/fate/filter-concat @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 44100 #channel_layout 1: 4 +#channel_layout_name 1: mono 0, 0, 0, 1, 230400, 0x88c4d19a 1, 0, 0, 1024, 2048, 0xb3f10192 1, 1024, 1024, 1024, 2048, 0xb340fe4e diff --git a/tests/ref/fate/filter-dcshift b/tests/ref/fate/filter-dcshift index d04aa926cbe8f..dad3df3ff051c 100644 --- a/tests/ref/fate/filter-dcshift +++ b/tests/ref/fate/filter-dcshift @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 4096, 0x96868842 0, 1024, 1024, 1024, 4096, 0xeff98700 0, 2048, 2048, 1024, 4096, 0x6ea28e1e diff --git a/tests/ref/fate/filter-earwax b/tests/ref/fate/filter-earwax index 8d4eaa8be8ba3..855f579cacfbd 100644 --- a/tests/ref/fate/filter-earwax +++ b/tests/ref/fate/filter-earwax @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 4096, 0x900af751 0, 1024, 1024, 1024, 4096, 0xad570065 0, 2048, 2048, 1024, 4096, 0x93d5f494 diff --git a/tests/ref/fate/filter-extrastereo b/tests/ref/fate/filter-extrastereo index e43de2d784aa8..179c1677927ec 100644 --- a/tests/ref/fate/filter-extrastereo +++ b/tests/ref/fate/filter-extrastereo @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 4096, 0x29e3eecf 0, 1024, 1024, 1024, 4096, 0x18390b96 0, 2048, 2048, 1024, 4096, 0xc477fa99 diff --git a/tests/ref/fate/filter-hls b/tests/ref/fate/filter-hls index 47bc51444c5c7..f68b42ee261ca 100644 --- a/tests/ref/fate/filter-hls +++ b/tests/ref/fate/filter-hls @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 1152, 2304, 0x907cb7fa 0, 1152, 1152, 1152, 2304, 0xb8dc7525 0, 2304, 2304, 1152, 2304, 0x3e7d6905 diff --git a/tests/ref/fate/filter-hls-append b/tests/ref/fate/filter-hls-append index 4a88b867f6435..759a2fb76289d 100644 --- a/tests/ref/fate/filter-hls-append +++ b/tests/ref/fate/filter-hls-append @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 1152, 2304, 0x593ea430 0, 1152, 1152, 1152, 2304, 0xde328304 0, 2304, 2304, 1152, 2304, 0x12f673c9 diff --git a/tests/ref/fate/filter-meta-4560-rotate0 b/tests/ref/fate/filter-meta-4560-rotate0 index 6e870c7afe513..97552ffb970f5 100644 --- a/tests/ref/fate/filter-meta-4560-rotate0 +++ b/tests/ref/fate/filter-meta-4560-rotate0 @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 44100 #channel_layout 1: 4 +#channel_layout_name 1: mono 0, 0, 0, 1, 195840, 0x0602351d 1, 0, 0, 1024, 2048, 0x00000000 1, 1024, 1024, 1024, 2048, 0xe6b00ffc diff --git a/tests/ref/fate/filter-overlay-dvdsub-2397 b/tests/ref/fate/filter-overlay-dvdsub-2397 index 0e0444dd06e01..b86a2184b7213 100644 --- a/tests/ref/fate/filter-overlay-dvdsub-2397 +++ b/tests/ref/fate/filter-overlay-dvdsub-2397 @@ -8,6 +8,7 @@ #codec_id 1: dts #sample_rate 1: 48000 #channel_layout 1: 60f +#channel_layout_name 1: 5.1(side) 0, 0, 0, 1, 518400, 0x6b05d48a 1, 27, 27, 10, 2013, 0x68e7b03a 0, 1, 1, 1, 518400, 0x2c2219cd diff --git a/tests/ref/fate/filter-silenceremove b/tests/ref/fate/filter-silenceremove index 43360e8dbc5cd..81647c60ba8ea 100644 --- a/tests/ref/fate/filter-silenceremove +++ b/tests/ref/fate/filter-silenceremove @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 192000 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1, 4, 0x00200008 0, 1, 1, 1, 4, 0x00180006 0, 2, 2, 1, 4, 0x001c0007 diff --git a/tests/ref/fate/filter-stereotools b/tests/ref/fate/filter-stereotools index 89babd693dd63..60acaf81b27ca 100644 --- a/tests/ref/fate/filter-stereotools +++ b/tests/ref/fate/filter-stereotools @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 4096, 0x48b6d241 0, 1024, 1024, 1024, 4096, 0xe0c4ca9a 0, 2048, 2048, 1024, 4096, 0x6dd8e26c diff --git a/tests/ref/fate/filter-tremolo b/tests/ref/fate/filter-tremolo index ed0e662a60a5a..c6cff52c0e102 100644 --- a/tests/ref/fate/filter-tremolo +++ b/tests/ref/fate/filter-tremolo @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1024, 4096, 0x5d3be907 0, 1024, 1024, 1024, 4096, 0xea151fbe 0, 2048, 2048, 1024, 4096, 0xa5bc19f4 diff --git a/tests/ref/fate/flv-demux b/tests/ref/fate/flv-demux index 0a4598c01b237..4a791754cb574 100644 --- a/tests/ref/fate/flv-demux +++ b/tests/ref/fate/flv-demux @@ -10,6 +10,7 @@ #codec_id 1: aac #sample_rate 1: 22050 #channel_layout 1: 3 +#channel_layout_name 1: stereo 0, 0, 0, 33, 135, 0x78b33078, S=1, 39, 0xf8aa0d44 1, 0, 0, 46, 9, 0x07bc01b8, S=1, 2, 0x00b600a3 0, 33, 33, 33, 92, 0x0d891dd0, F=0x0 diff --git a/tests/ref/fate/g722-encode b/tests/ref/fate/g722-encode index ddf97c97df64e..d84d62701c1b9 100644 --- a/tests/ref/fate/g722-encode +++ b/tests/ref/fate/g722-encode @@ -6,6 +6,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 16000 #channel_layout 0: 4 +#channel_layout_name 0: mono #stream#, dts, pts, duration, size, hash 0, 0, 0, 8192, 16384, 1dd9c285eb608038f3257d1a8e02eb75 0, 8192, 8192, 8192, 16384, f7459334cbe70c06bc0897edfe64e840 diff --git a/tests/ref/fate/g722dec-1 b/tests/ref/fate/g722dec-1 index b7ec0d3753b35..a97fc81fb06d7 100644 --- a/tests/ref/fate/g722dec-1 +++ b/tests/ref/fate/g722dec-1 @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 16000 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 2048, 4096, 0x4f9228b3 0, 2048, 2048, 2048, 4096, 0xfab58157 0, 4096, 4096, 2048, 4096, 0x0b641c78 diff --git a/tests/ref/fate/g723_1-dec-1 b/tests/ref/fate/g723_1-dec-1 index 01176fdba5db2..f7daad1b499c5 100644 --- a/tests/ref/fate/g723_1-dec-1 +++ b/tests/ref/fate/g723_1-dec-1 @@ -3,5 +3,6 @@ #codec_id 0: pcm_s16le #sample_rate 0: 8000 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 240, 480, 0x7f6f3970 0, 240, 240, 240, 480, 0x1105a0d3 diff --git a/tests/ref/fate/g723_1-dec-2 b/tests/ref/fate/g723_1-dec-2 index 0711ae44b1dfe..a403e565d0943 100644 --- a/tests/ref/fate/g723_1-dec-2 +++ b/tests/ref/fate/g723_1-dec-2 @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 8000 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 240, 480, 0x5d9d9091 0, 240, 240, 240, 480, 0x425095b7 0, 480, 480, 240, 480, 0xe7b6a1a7 diff --git a/tests/ref/fate/g723_1-dec-3 b/tests/ref/fate/g723_1-dec-3 index c1dde0c75b07e..e3d39781381cf 100644 --- a/tests/ref/fate/g723_1-dec-3 +++ b/tests/ref/fate/g723_1-dec-3 @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 8000 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 240, 480, 0xce908869 0, 240, 240, 240, 480, 0xfa63588e 0, 480, 480, 240, 480, 0x11ce850c diff --git a/tests/ref/fate/g723_1-dec-4 b/tests/ref/fate/g723_1-dec-4 index 34817eecff67c..309b3afea567e 100644 --- a/tests/ref/fate/g723_1-dec-4 +++ b/tests/ref/fate/g723_1-dec-4 @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 8000 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 240, 480, 0xa697b314 0, 240, 240, 240, 480, 0x43c5dc5a 0, 480, 480, 240, 480, 0xd2438147 diff --git a/tests/ref/fate/g723_1-dec-5 b/tests/ref/fate/g723_1-dec-5 index 7076fac322934..9e37c861a2d0f 100644 --- a/tests/ref/fate/g723_1-dec-5 +++ b/tests/ref/fate/g723_1-dec-5 @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 8000 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 240, 480, 0x4dce9773 0, 240, 240, 240, 480, 0xe6367ab8 0, 480, 480, 240, 480, 0xf36a589d diff --git a/tests/ref/fate/g723_1-dec-6 b/tests/ref/fate/g723_1-dec-6 index b493b37338693..a51e8df9c8b93 100644 --- a/tests/ref/fate/g723_1-dec-6 +++ b/tests/ref/fate/g723_1-dec-6 @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 8000 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 240, 480, 0x4fa1aed9 0, 240, 240, 240, 480, 0x6d7ef391 0, 480, 480, 240, 480, 0xaecaf2c1 diff --git a/tests/ref/fate/g723_1-dec-7 b/tests/ref/fate/g723_1-dec-7 index bd960f5aec163..db0ceb85ef0c2 100644 --- a/tests/ref/fate/g723_1-dec-7 +++ b/tests/ref/fate/g723_1-dec-7 @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 8000 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 240, 480, 0x35e4a1fd 0, 240, 240, 240, 480, 0x2f7bdd60 0, 480, 480, 240, 480, 0x0407e499 diff --git a/tests/ref/fate/g723_1-dec-8 b/tests/ref/fate/g723_1-dec-8 index 3399d7ae9fe14..740ed2b4c7fdb 100644 --- a/tests/ref/fate/g723_1-dec-8 +++ b/tests/ref/fate/g723_1-dec-8 @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 8000 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 240, 480, 0x17930e0f 0, 240, 240, 240, 480, 0x7c7f4247 0, 480, 480, 240, 480, 0xbf3489e5 diff --git a/tests/ref/fate/g726-encode-2bit b/tests/ref/fate/g726-encode-2bit index fdb42ff63c9da..4a83c95760256 100644 --- a/tests/ref/fate/g726-encode-2bit +++ b/tests/ref/fate/g726-encode-2bit @@ -6,6 +6,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 8000 #channel_layout 0: 4 +#channel_layout_name 0: mono #stream#, dts, pts, duration, size, hash 0, 0, 0, 16384, 32768, b28b116d2315323aeba6b66b58b7f4ed 0, 16384, 16384, 16384, 32768, e9cfbebe99490bd4987341ee748291c4 diff --git a/tests/ref/fate/g726-encode-3bit b/tests/ref/fate/g726-encode-3bit index 92ea73d199a5e..c551ae608f26d 100644 --- a/tests/ref/fate/g726-encode-3bit +++ b/tests/ref/fate/g726-encode-3bit @@ -6,6 +6,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 8000 #channel_layout 0: 4 +#channel_layout_name 0: mono #stream#, dts, pts, duration, size, hash 0, 0, 0, 10920, 21840, 517dd6d1ce566b998251f0d215fa69c0 0, 10920, 10920, 10920, 21840, b0268e2bcc67acb524753790123c65fd diff --git a/tests/ref/fate/g726-encode-4bit b/tests/ref/fate/g726-encode-4bit index ce7e1cb254706..ea277e12c54d9 100644 --- a/tests/ref/fate/g726-encode-4bit +++ b/tests/ref/fate/g726-encode-4bit @@ -6,6 +6,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 8000 #channel_layout 0: 4 +#channel_layout_name 0: mono #stream#, dts, pts, duration, size, hash 0, 0, 0, 8192, 16384, a0cf3a0953adce1a1032a4fd2da00a52 0, 8192, 8192, 8192, 16384, c750c1b76a203556dd60d73d261529e9 diff --git a/tests/ref/fate/g726-encode-5bit b/tests/ref/fate/g726-encode-5bit index bd0946f73a21d..30c456e864415 100644 --- a/tests/ref/fate/g726-encode-5bit +++ b/tests/ref/fate/g726-encode-5bit @@ -6,6 +6,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 8000 #channel_layout 0: 4 +#channel_layout_name 0: mono #stream#, dts, pts, duration, size, hash 0, 0, 0, 6552, 13104, 6fe3f75df1262c5f956887de9c32df40 0, 6552, 6552, 6552, 13104, f955518de6f61f94253280d11d64d68b diff --git a/tests/ref/fate/gapless-mp3 b/tests/ref/fate/gapless-mp3 index ebe7bfa2d60ee..ab4f1a045680d 100644 --- a/tests/ref/fate/gapless-mp3 +++ b/tests/ref/fate/gapless-mp3 @@ -1,5 +1,5 @@ -37534a3bcc3ef306e8c5ebfcfedfc41c *tests/data/fate/gapless-mp3.out-1 +44b42cc3a898b45507d856d0813f4f26 *tests/data/fate/gapless-mp3.out-1 c96c3ae7bd3300fd2f4debac222de5b7 -0cd1cdbcfd5cdbf6270cd98219bf31cd *tests/data/fate/gapless-mp3.out-2 +ec876434ed65e338e07234e54d136caf *tests/data/fate/gapless-mp3.out-2 c96c3ae7bd3300fd2f4debac222de5b7 -9d3d8ba8a61b534f2d02ee648d6a8229 *tests/data/fate/gapless-mp3.out-3 +806fd80eba887b46a1eba1eeff63df28 *tests/data/fate/gapless-mp3.out-3 diff --git a/tests/ref/fate/gsm-ms b/tests/ref/fate/gsm-ms index 92d78f3602a90..0acf9f6e69215 100644 --- a/tests/ref/fate/gsm-ms +++ b/tests/ref/fate/gsm-ms @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 8000 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 320, 640, 0xf79c59ee 0, 320, 320, 320, 640, 0x6e6248be 0, 640, 640, 320, 640, 0x2a5b3aed diff --git a/tests/ref/fate/gsm-toast b/tests/ref/fate/gsm-toast index 46aab790f890a..df5e824408f88 100644 --- a/tests/ref/fate/gsm-toast +++ b/tests/ref/fate/gsm-toast @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 8000 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 64, 128, 0x3ef33f6f 0, 64, 64, 160, 320, 0x2052a4e7 0, 224, 224, 160, 320, 0xe9aeafca diff --git a/tests/ref/fate/h264-skip-nointra b/tests/ref/fate/h264-skip-nointra index 40b5bb26d4e69..02599029270d0 100644 --- a/tests/ref/fate/h264-skip-nointra +++ b/tests/ref/fate/h264-skip-nointra @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 48000 #channel_layout 1: 3 +#channel_layout_name 1: stereo 1, 0, 0, 1152, 4608, 0x00000000 1, 1152, 1152, 1152, 4608, 0x00000000 1, 2304, 2304, 1152, 4608, 0x00000000 diff --git a/tests/ref/fate/h264-skip-nokey b/tests/ref/fate/h264-skip-nokey index 40b5bb26d4e69..02599029270d0 100644 --- a/tests/ref/fate/h264-skip-nokey +++ b/tests/ref/fate/h264-skip-nokey @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 48000 #channel_layout 1: 3 +#channel_layout_name 1: stereo 1, 0, 0, 1152, 4608, 0x00000000 1, 1152, 1152, 1152, 4608, 0x00000000 1, 2304, 2304, 1152, 4608, 0x00000000 diff --git a/tests/ref/fate/h264-xavc-4389 b/tests/ref/fate/h264-xavc-4389 index b1158b8e572d9..5c76bc222f93c 100644 --- a/tests/ref/fate/h264-xavc-4389 +++ b/tests/ref/fate/h264-xavc-4389 @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 48000 #channel_layout 1: 4 +#channel_layout_name 1: mono 0, 0, 0, 1, 8294400, 0x9a02ecf2 1, 0, 0, 1920, 3840, 0x38074ac8 0, 1, 1, 1, 8294400, 0x626f870a diff --git a/tests/ref/fate/id-cin-video b/tests/ref/fate/id-cin-video index 469e2393fa8bc..671b396a1133e 100644 --- a/tests/ref/fate/id-cin-video +++ b/tests/ref/fate/id-cin-video @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 22050 #channel_layout 1: 3 +#channel_layout_name 1: stereo 0, 0, 0, 1, 230400, 0x00000000 1, 0, 0, 1575, 6300, 0xdd759df8 0, 1, 1, 1, 230400, 0x3a3486b4 diff --git a/tests/ref/fate/jv-demux b/tests/ref/fate/jv-demux index 280528c5ed604..bf8211074c571 100644 --- a/tests/ref/fate/jv-demux +++ b/tests/ref/fate/jv-demux @@ -8,6 +8,7 @@ #codec_id 1: pcm_u8 #sample_rate 1: 22050 #channel_layout 1: 4 +#channel_layout_name 1: mono 0, 0, 0, 1, 6, 0x000a0003 1, 0, 0, 131072, 131072, 0x14c664d6 0, 1, 1, 1, 773, 0x11802a51 diff --git a/tests/ref/fate/lmlm4-demux b/tests/ref/fate/lmlm4-demux index 79cb53998b8c8..b0276d53e9a26 100644 --- a/tests/ref/fate/lmlm4-demux +++ b/tests/ref/fate/lmlm4-demux @@ -9,6 +9,7 @@ #codec_id 1: mp2 #sample_rate 1: 48000 #channel_layout 1: 3 +#channel_layout_name 1: stereo 0, 0, -9223372036854775808, 1, 5951, 0xe9118e0d 1, 0, 0, 2160, 768, 0xaebcbebb 1, 2160, 2160, 2160, 768, 0xaebcbebb diff --git a/tests/ref/fate/maxis-xa b/tests/ref/fate/maxis-xa index ae8124da7051f..ad9d73278ba48 100644 --- a/tests/ref/fate/maxis-xa +++ b/tests/ref/fate/maxis-xa @@ -3,6 +3,7 @@ #codec_id 0: adpcm_ea_maxis_xa #sample_rate 0: 22050 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 28, 30, 0x51750711 0, 28, 28, 28, 30, 0x9ca20c2a 0, 56, 56, 28, 30, 0x7551081f diff --git a/tests/ref/fate/mkv b/tests/ref/fate/mkv index 0e7f6514d0834..f9c3037f099b3 100644 --- a/tests/ref/fate/mkv +++ b/tests/ref/fate/mkv @@ -10,6 +10,7 @@ #codec_id 1: aac #sample_rate 1: 48000 #channel_layout 1: 3 +#channel_layout_name 1: stereo 0, -42, 0, 41, 63501, 0x139d4c99 0, 0, 84, 41, 5368, 0xd964b678, F=0x0 1, 8, 8, 21, 528, 0x3c990ddf diff --git a/tests/ref/fate/mkv-1242 b/tests/ref/fate/mkv-1242 index 1ba41a04a4450..34e5b4aa9c665 100644 --- a/tests/ref/fate/mkv-1242 +++ b/tests/ref/fate/mkv-1242 @@ -10,6 +10,7 @@ #codec_id 1: aac #sample_rate 1: 48000 #channel_layout 1: 3 +#channel_layout_name 1: stereo 0, -42, 0, 41, 2969, 0xa7016742 0, 0, 42, 41, 135, 0x33af1a9e, F=0x0 1, 0, 0, 21, 6, 0x027e00e8 diff --git a/tests/ref/fate/mov-mp3-demux b/tests/ref/fate/mov-mp3-demux index fc96c587986da..1930960640451 100644 --- a/tests/ref/fate/mov-mp3-demux +++ b/tests/ref/fate/mov-mp3-demux @@ -3,6 +3,7 @@ #codec_id 0: mp3 #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1152, 36, 0x8e260589 0, 1152, 1152, 1152, 36, 0x8e260589 0, 2304, 2304, 1152, 36, 0x8e260589 diff --git a/tests/ref/fate/mtv b/tests/ref/fate/mtv index 81711f72936dc..7b17bc1b6ce1a 100644 --- a/tests/ref/fate/mtv +++ b/tests/ref/fate/mtv @@ -9,6 +9,7 @@ #codec_id 1: mp3 #sample_rate 1: 44100 #channel_layout 1: 3 +#channel_layout_name 1: stereo 0, 0, 0, 1, 12288, 0xc2258ebc 1, 0, 0, 1152, 417, 0xae1cc66a 1, 1152, 1152, 1152, 418, 0xdc3ec850 diff --git a/tests/ref/fate/mxf-demux b/tests/ref/fate/mxf-demux index 66dea1027ed33..906a6d0638535 100644 --- a/tests/ref/fate/mxf-demux +++ b/tests/ref/fate/mxf-demux @@ -9,6 +9,7 @@ #codec_id 1: pcm_alaw #sample_rate 1: 8000 #channel_layout 1: 3 +#channel_layout_name 1: stereo 0, 0, -9223372036854775808, 1, 8468, 0xc0855553 1, 0, 0, 16000, 32000, 0x479155e6 0, 1, -9223372036854775808, 1, 3814, 0xa10783b4, F=0x0 diff --git a/tests/ref/fate/nsv-demux b/tests/ref/fate/nsv-demux index 7b9c000d9d63a..bff871dabee4e 100644 --- a/tests/ref/fate/nsv-demux +++ b/tests/ref/fate/nsv-demux @@ -8,6 +8,7 @@ #codec_id 1: mp3 #sample_rate 1: 11025 #channel_layout 1: 4 +#channel_layout_name 1: mono 0, 0, 0, 1, 12, 0x1396035f 0, 1, 1, 1, 24, 0x8ab80ac7, F=0x0 0, 2, 2, 1, 208, 0x1de1603e, F=0x0 diff --git a/tests/ref/fate/oggopus-demux b/tests/ref/fate/oggopus-demux index 4621af6a38983..9192760700098 100644 --- a/tests/ref/fate/oggopus-demux +++ b/tests/ref/fate/oggopus-demux @@ -4,6 +4,7 @@ #codec_id 0: opus #sample_rate 0: 48000 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, -356, -356, 960, 402, 0x89b1c40f 0, 604, 604, 960, 216, 0x7bf97146 0, 1564, 1564, 960, 215, 0x6cb86d8b diff --git a/tests/ref/fate/on2avc b/tests/ref/fate/on2avc index 2125cc6837e11..a9d6cbcea9b2c 100644 --- a/tests/ref/fate/on2avc +++ b/tests/ref/fate/on2avc @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 16000 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 1024, 2048, 0x00000000 0, 1024, 1024, 1024, 2048, 0x96ee1301 0, 2048, 2048, 1024, 2048, 0xe2a81605 diff --git a/tests/ref/fate/paf-audio b/tests/ref/fate/paf-audio index bb93ad50e25ca..a9ed9e99fe211 100644 --- a/tests/ref/fate/paf-audio +++ b/tests/ref/fate/paf-audio @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 22050 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 57330, 229320, 0x062508b4 0, 57330, 57330, 57330, 229320, 0x0a966cbf 0, 114660, 114660, 57330, 229320, 0xee9bad45 diff --git a/tests/ref/fate/paf-demux b/tests/ref/fate/paf-demux index 0f281fe7767f2..6a66697af8c0f 100644 --- a/tests/ref/fate/paf-demux +++ b/tests/ref/fate/paf-demux @@ -8,6 +8,7 @@ #codec_id 1: paf_audio #sample_rate 1: 22050 #channel_layout 1: 3 +#channel_layout_name 1: stereo 0, 0, 0, 1, 262144, 0x7f9a3c6a 1, 0, 0, 57330, 131072, 0x255a6ac2 0, 1, 1, 1, 260600, 0x0329e6f4, F=0x0 diff --git a/tests/ref/fate/pcm-planar b/tests/ref/fate/pcm-planar index 53394470844e7..8b6c96181acba 100644 --- a/tests/ref/fate/pcm-planar +++ b/tests/ref/fate/pcm-planar @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1471, 5884, 0x00000000 0, 1471, 1471, 1471, 5884, 0x00000000 0, 2942, 2942, 1472, 5888, 0x00000000 diff --git a/tests/ref/fate/pcm_dvd b/tests/ref/fate/pcm_dvd index 8aa87cdea57e3..2a24156284594 100644 --- a/tests/ref/fate/pcm_dvd +++ b/tests/ref/fate/pcm_dvd @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 48000 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 334, 1336, 0x8e3c0abc 0, 400, 400, 334, 1336, 0x99c41108 0, 720, 720, 334, 1336, 0xd65be322 diff --git a/tests/ref/fate/pmp-demux b/tests/ref/fate/pmp-demux index 4b66427c432e5..5c51b8b453b1e 100644 --- a/tests/ref/fate/pmp-demux +++ b/tests/ref/fate/pmp-demux @@ -3,6 +3,7 @@ #codec_id 0: mp3 #sample_rate 0: 44100 #channel_layout 0: 3 +#channel_layout_name 0: stereo 0, 0, 0, 1152, 417, 0xcb873fba 0, 1152, 1152, 1152, 104, 0x6d521c5a 0, 2304, 2304, 1152, 104, 0xb3af1d64 diff --git a/tests/ref/fate/prores-gray b/tests/ref/fate/prores-gray index 22b79b953e4bf..a1a63fa945d07 100644 --- a/tests/ref/fate/prores-gray +++ b/tests/ref/fate/prores-gray @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 48000 #channel_layout 1: 3 +#channel_layout_name 1: stereo 0, 0, 0, 1, 1658880, 0x43d9c9e2 1, 0, 0, 1024, 4096, 0x6c8a9a18 1, 1024, 1024, 1024, 4096, 0x960dadcf diff --git a/tests/ref/fate/prores-transparency b/tests/ref/fate/prores-transparency index 6a9c786f29300..7b3efc6335911 100644 --- a/tests/ref/fate/prores-transparency +++ b/tests/ref/fate/prores-transparency @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 48000 #channel_layout 1: 3 +#channel_layout_name 1: stereo 0, 0, 0, 1, 16588800, 0x7163b01a 1, 0, 0, 1024, 4096, 0x00000000 1, 1024, 1024, 896, 3584, 0x00000000 diff --git a/tests/ref/fate/prores-transparency_skip b/tests/ref/fate/prores-transparency_skip index 569d2ba2c758f..5c98d3e4383b2 100644 --- a/tests/ref/fate/prores-transparency_skip +++ b/tests/ref/fate/prores-transparency_skip @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 48000 #channel_layout 1: 3 +#channel_layout_name 1: stereo 0, 0, 0, 1, 12441600, 0x627d1548 1, 0, 0, 1024, 4096, 0x00000000 1, 1024, 1024, 896, 3584, 0x00000000 diff --git a/tests/ref/fate/psx-str-demux b/tests/ref/fate/psx-str-demux index e346c525093f8..a47c86952fb06 100644 --- a/tests/ref/fate/psx-str-demux +++ b/tests/ref/fate/psx-str-demux @@ -8,6 +8,7 @@ #codec_id 1: adpcm_xa #sample_rate 1: 37800 #channel_layout 1: 3 +#channel_layout_name 1: stereo 0, 0, 0, 1, 8832, 0x01ad3eeb 1, 0, 0, 1, 2304, 0xf0ad1000 1, 1, 1, 1, 2304, 0x69269ce6 diff --git a/tests/ref/fate/pva-demux b/tests/ref/fate/pva-demux index 4059af4f75d72..3f1c74f3665a0 100644 --- a/tests/ref/fate/pva-demux +++ b/tests/ref/fate/pva-demux @@ -8,6 +8,7 @@ #codec_id 1: mp2 #sample_rate 1: 48000 #channel_layout 1: 3 +#channel_layout_name 1: stereo 1, 0, 0, 2160, 384, 0x071abcc8 1, 2160, 2160, 2160, 384, 0x31c9aee0 1, 4320, 4320, 2160, 384, 0xa50eaa94 diff --git a/tests/ref/fate/ra3-144 b/tests/ref/fate/ra3-144 index b5fb47baae1d2..75e7bbfc7adb2 100644 --- a/tests/ref/fate/ra3-144 +++ b/tests/ref/fate/ra3-144 @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 8000 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 160, 320, 0x00000000 0, 160, 160, 160, 320, 0x4cfd5d74 0, 320, 320, 160, 320, 0xbb60fa3d diff --git a/tests/ref/fate/redcode-demux b/tests/ref/fate/redcode-demux index c08bbc87d06ee..45119ec71ecfc 100644 --- a/tests/ref/fate/redcode-demux +++ b/tests/ref/fate/redcode-demux @@ -8,6 +8,7 @@ #codec_id 1: pcm_s32be #sample_rate 1: 48000 #channel_layout 1: 4 +#channel_layout_name 1: mono 0, 0, 0, 10010, 1626280, 0x5768c7d6 1, 0, 0, 18140, 14816, 0xd185e8c7 0, 10010, 10010, 10010, 1626092, 0x070bd882 diff --git a/tests/ref/fate/segment-adts-to-mkv-header-000 b/tests/ref/fate/segment-adts-to-mkv-header-000 index d00e886849923..294aa2346f716 100644 --- a/tests/ref/fate/segment-adts-to-mkv-header-000 +++ b/tests/ref/fate/segment-adts-to-mkv-header-000 @@ -4,6 +4,7 @@ #codec_id 0: aac #sample_rate 0: 16000 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 64, 4, 0x02f70117 0, 64, 64, 64, 163, 0xd5f85007 0, 128, 128, 64, 127, 0x66484065 diff --git a/tests/ref/fate/segment-adts-to-mkv-header-001 b/tests/ref/fate/segment-adts-to-mkv-header-001 index 87adbb810c51a..ec4669f12cf71 100644 --- a/tests/ref/fate/segment-adts-to-mkv-header-001 +++ b/tests/ref/fate/segment-adts-to-mkv-header-001 @@ -4,6 +4,7 @@ #codec_id 0: aac #sample_rate 0: 16000 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 64, 153, 0xbb6e432f 0, 64, 64, 64, 185, 0xa01f4ff3 0, 128, 128, 64, 126, 0x85503ce6 diff --git a/tests/ref/fate/segment-adts-to-mkv-header-002 b/tests/ref/fate/segment-adts-to-mkv-header-002 index eae15bc4df1dd..06df8245652cc 100644 --- a/tests/ref/fate/segment-adts-to-mkv-header-002 +++ b/tests/ref/fate/segment-adts-to-mkv-header-002 @@ -4,6 +4,7 @@ #codec_id 0: aac #sample_rate 0: 16000 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 64, 156, 0x867d4f3a 0, 64, 64, 64, 201, 0x62745ff9 0, 128, 128, 64, 137, 0x90c639e0 diff --git a/tests/ref/fate/segment-adts-to-mkv-header-all b/tests/ref/fate/segment-adts-to-mkv-header-all index 1f7d7722684e0..9c78d33477121 100644 --- a/tests/ref/fate/segment-adts-to-mkv-header-all +++ b/tests/ref/fate/segment-adts-to-mkv-header-all @@ -4,6 +4,7 @@ #codec_id 0: aac #sample_rate 0: 16000 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 64, 4, 0x02f70117 0, 64, 64, 64, 163, 0xd5f85007 0, 128, 128, 64, 127, 0x66484065 diff --git a/tests/ref/fate/sierra-vmd-audio b/tests/ref/fate/sierra-vmd-audio index 2b9f8e84f2270..9c0e6b2db1cc6 100644 --- a/tests/ref/fate/sierra-vmd-audio +++ b/tests/ref/fate/sierra-vmd-audio @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 22050 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 61740, 123480, 0x3a794c13 0, 61740, 61740, 2205, 4410, 0x109d04e0 0, 63945, 63945, 2205, 4410, 0x224d244f diff --git a/tests/ref/fate/siff-demux b/tests/ref/fate/siff-demux index 687a51828fc54..f8e9897931892 100644 --- a/tests/ref/fate/siff-demux +++ b/tests/ref/fate/siff-demux @@ -8,6 +8,7 @@ #codec_id 1: pcm_u8 #sample_rate 1: 22050 #channel_layout 1: 4 +#channel_layout_name 1: mono 0, 0, 0, 1, 15152, 0x14fc0f1f 1, 0, 0, 22050, 22050, 0xa7d60d27 0, 1, 1, 1, 15344, 0x31614bd7 diff --git a/tests/ref/fate/smacker-audio b/tests/ref/fate/smacker-audio index fbeb4be584b3b..6b867874d9e5c 100644 --- a/tests/ref/fate/smacker-audio +++ b/tests/ref/fate/smacker-audio @@ -3,6 +3,7 @@ #codec_id 0: pcm_s16le #sample_rate 0: 22050 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 23620, 47240, 0x9974897c 0, 23620, 23620, 1564, 3128, 0x7e4064b4 0, 25184, 25184, 1564, 3128, 0x80883301 diff --git a/tests/ref/fate/smjpeg-demux b/tests/ref/fate/smjpeg-demux index 242a22fd6cf98..042f9ff9ec0b1 100644 --- a/tests/ref/fate/smjpeg-demux +++ b/tests/ref/fate/smjpeg-demux @@ -8,6 +8,7 @@ #codec_id 1: adpcm_ima_smjpeg #sample_rate 1: 22050 #channel_layout 1: 4 +#channel_layout_name 1: mono 0, 0, 0, 0, 734, 0x5a042c2c 1, 0, 0, 23, 260, 0x00000000 1, 23, 23, 23, 260, 0x00000000 diff --git a/tests/ref/fate/sp5x b/tests/ref/fate/sp5x index 603535bad24af..2ca79815eeb09 100644 --- a/tests/ref/fate/sp5x +++ b/tests/ref/fate/sp5x @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 8000 #channel_layout 1: 4 +#channel_layout_name 1: mono 0, 0, 0, 1, 115200, 0x8ebcb7f8 1, 0, 0, 1024, 2048, 0x366ee71c 0, 1, 1, 1, 115200, 0x1fa8e673 diff --git a/tests/ref/fate/tiertex-seq b/tests/ref/fate/tiertex-seq index 3504dd42fc4c9..1db906ad33fb9 100644 --- a/tests/ref/fate/tiertex-seq +++ b/tests/ref/fate/tiertex-seq @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 22050 #channel_layout 1: 4 +#channel_layout_name 1: mono 1, 0, 0, 882, 1764, 0x00000000 1, 882, 882, 882, 1764, 0x80a253d9 0, 2, 2, 1, 98304, 0x2e5db4a4 diff --git a/tests/ref/fate/tmv b/tests/ref/fate/tmv index 94437fa754b82..09198fab2b6a2 100644 --- a/tests/ref/fate/tmv +++ b/tests/ref/fate/tmv @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 22058 #channel_layout 1: 4 +#channel_layout_name 1: mono 0, 0, 0, 1, 192000, 0xc698297a 1, 0, 0, 368, 736, 0xf63db497 0, 1, 1, 1, 192000, 0x8d5bd6be diff --git a/tests/ref/fate/ts-demux b/tests/ref/fate/ts-demux index c66e9075b8374..e2931af427326 100644 --- a/tests/ref/fate/ts-demux +++ b/tests/ref/fate/ts-demux @@ -9,6 +9,7 @@ #codec_id 1: ac3 #sample_rate 1: 48000 #channel_layout 1: 60f +#channel_layout_name 1: 5.1(side) 1, 0, 0, 2880, 1536, 0x773ffeea, S=1, 1, 0x00bd00bd 1, 2880, 2880, 2880, 1536, 0x6dc10748 1, 5760, 5760, 2880, 1536, 0xbab5129c diff --git a/tests/ref/fate/ts-opus-demux b/tests/ref/fate/ts-opus-demux index 9d2da43feaa9e..3c5edffb2cc66 100644 --- a/tests/ref/fate/ts-opus-demux +++ b/tests/ref/fate/ts-opus-demux @@ -4,6 +4,7 @@ #codec_id 0: opus #sample_rate 0: 48000 #channel_layout 0: 63f +#channel_layout_name 0: 7.1 0, 0, 0, 1800, 744, 0x172b615b, S=1, 1, 0x00bd00bd 0, 1800, 1800, 1800, 743, 0x3f5b673d, S=1, 1, 0x00bd00bd 0, 3600, 3600, 1800, 747, 0xe54e735d, S=1, 1, 0x00bd00bd diff --git a/tests/ref/fate/tscc-15bit b/tests/ref/fate/tscc-15bit index e854320571131..abfe6a6aeeaa8 100644 --- a/tests/ref/fate/tscc-15bit +++ b/tests/ref/fate/tscc-15bit @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 11025 #channel_layout 1: 4 +#channel_layout_name 1: mono 0, 0, 0, 1, 657600, 0x50b3a0c2 1, 0, 0, 11025, 22050, 0x1740aaec 0, 1, 1, 1, 657600, 0x50b3a0c2 diff --git a/tests/ref/fate/vqf-demux b/tests/ref/fate/vqf-demux index 2d26a729f99ef..d768ddbb69dbf 100644 --- a/tests/ref/fate/vqf-demux +++ b/tests/ref/fate/vqf-demux @@ -1 +1 @@ -643ac05caf7ef16a8837933bf45281d5 +5f4cd9a6a8bea0040db6732a7830e9d7 diff --git a/tests/ref/fate/wav-ac3 b/tests/ref/fate/wav-ac3 index fd27f744bf187..039e155dafb63 100644 --- a/tests/ref/fate/wav-ac3 +++ b/tests/ref/fate/wav-ac3 @@ -3,6 +3,7 @@ #codec_id 0: ac3 #sample_rate 0: 44100 #channel_layout 0: 60f +#channel_layout_name 0: 5.1(side) 0, 0, 0, 1536, 2786, 0xe2fd0f40 0, 1536, 1536, 1536, 2786, 0x7a6207c2 0, 3072, 3072, 1536, 2786, 0x7a6207c2 diff --git a/tests/ref/fate/wc3movie-xan b/tests/ref/fate/wc3movie-xan index 58125034348ea..052dbbce7d5f6 100644 --- a/tests/ref/fate/wc3movie-xan +++ b/tests/ref/fate/wc3movie-xan @@ -8,6 +8,7 @@ #codec_id 1: pcm_s16le #sample_rate 1: 22050 #channel_layout 1: 4 +#channel_layout_name 1: mono 0, 0, 0, 1, 158400, 0x25aec781 1, 0, 0, 1470, 2940, 0x92cee2a6 0, 1, 1, 1, 158400, 0xda4dbf70 diff --git a/tests/ref/fate/westwood-aud b/tests/ref/fate/westwood-aud index fedcd5d6cb9c8..b719c50a4d47b 100644 --- a/tests/ref/fate/westwood-aud +++ b/tests/ref/fate/westwood-aud @@ -3,6 +3,7 @@ #codec_id 0: adpcm_ima_ws #sample_rate 0: 22050 #channel_layout 0: 4 +#channel_layout_name 0: mono 0, 0, 0, 1024, 512, 0x6694cc55 0, 1024, 1024, 1024, 512, 0xdbc5cb22 0, 2048, 2048, 1024, 512, 0x8e5bcbfd diff --git a/tests/ref/fate/wmv8-drm-nodec b/tests/ref/fate/wmv8-drm-nodec index 83aa92d23571f..a46c338d54e0f 100644 --- a/tests/ref/fate/wmv8-drm-nodec +++ b/tests/ref/fate/wmv8-drm-nodec @@ -10,6 +10,7 @@ #codec_id 1: wmavoice #sample_rate 1: 22050 #channel_layout 1: 4 +#channel_layout_name 1: mono 0, 0, 0, 0, 282, 0x000d949a 1, 0, 0, 0, 1088, 0x5cd379bb 1, 435, 435, 0, 1088, 0x8dfa1368 diff --git a/tests/ref/fate/wtv-demux b/tests/ref/fate/wtv-demux index 306fe00ed5d58..abe85a4ab6dcf 100644 --- a/tests/ref/fate/wtv-demux +++ b/tests/ref/fate/wtv-demux @@ -10,6 +10,7 @@ #codec_id 1: mp2 #sample_rate 1: 48000 #channel_layout 1: 3 +#channel_layout_name 1: stereo 1, -2, -2, 240000, 576, 0x9b6e1638 1, 239998, 239998, 240000, 576, 0x0ca91183 1, 479998, 479998, 240000, 576, 0xec6a180f diff --git a/tests/ref/fate/xmv-demux b/tests/ref/fate/xmv-demux index 5840129f8acaa..6da2b1a701115 100644 --- a/tests/ref/fate/xmv-demux +++ b/tests/ref/fate/xmv-demux @@ -9,6 +9,7 @@ #codec_id 1: adpcm_ima_wav #sample_rate 1: 44100 #channel_layout 1: 3 +#channel_layout_name 1: stereo 0, 0, 0, 0, 1508, 0xefceba48 1, 0, 0, 83, 5976, 0xfa2c2db9 1, 83, 83, 83, 5976, 0x256b935c From 75a13115cd6b961f4f6779423353c1cf25db4c0e Mon Sep 17 00:00:00 2001 From: James Almer Date: Fri, 23 Sep 2016 02:02:43 -0300 Subject: [PATCH 102/102] avformat/mux: remove unnecessary autobsf hack autobsf has been ported to the new bsf API. Signed-off-by: James Almer --- libavformat/mux.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/libavformat/mux.c b/libavformat/mux.c index 0d285f4a59558..77823a4e75d83 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -309,12 +309,6 @@ FF_DISABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS #endif - /* update internal context from codecpar, old bsf api needs this - * FIXME: remove when autobsf uses new bsf API */ - ret = avcodec_parameters_to_context(st->internal->avctx, st->codecpar); - if (ret < 0) - goto fail; - if (!st->time_base.num) { /* fall back on the default timebase values */ if (par->codec_type == AVMEDIA_TYPE_AUDIO && par->sample_rate)