Re: [FFmpeg-devel] [PATCH 3/5] avfilter/scale: separate exprs parse and eval

2019-12-19 Thread Gyan

Ping for this and remaining patches in set.

On 17-12-2019 02:55 pm, Gyan wrote:



On 17-12-2019 01:44 am, Michael Niedermayer wrote:

On Sun, Dec 15, 2019 at 10:36:58PM +0530, Gyan wrote:

3rd of 5 factorized patches; supersedes
https://patchwork.ffmpeg.org/patch/16272/
  scale_eval.c |   69 --
  vf_scale.c   |  286 
+++

  2 files changed, 271 insertions(+), 84 deletions(-)
2a3ae4ce4e91893fddb020485e6936c82894eb81 
0003-avfilter-scale-separate-exprs-parse-and-eval.patch

 From 00b54948b88ae60aa3ab7c158b98e55cb8b967d3 Mon Sep 17 00:00:00 2001
From: Gyan Doshi 
Date: Thu, 12 Dec 2019 22:54:31 +0530
Subject: [PATCH 3/5] avfilter/scale: separate exprs parse and eval

Will allow adding animation support.

[...]
@@ -566,19 +746,87 @@ static int process_command(AVFilterContext 
*ctx, const char *cmd, const char *ar

 char *res, int res_len, int flags)
  {
  ScaleContext *scale = ctx->priv;
-    int ret;
+    AVFilterLink *outlink = ctx->outputs[0];
+    char *old_w_str, *old_h_str;
+    AVExpr *old_w_pexpr, *old_h_pexpr;
+    int ret, w = 0, h = 0;
+    const char scale2ref = ctx->filter == _vf_scale2ref;
+    const char *const *names = scale2ref ? var_names_scale2ref : 
var_names;

+
+    w = !strcmp(cmd, "width")  || !strcmp(cmd, "w");
+    h = !strcmp(cmd, "height")  || !strcmp(cmd, "h");
+
+    if (w || h) {
  -    if (   !strcmp(cmd, "width")  || !strcmp(cmd, "w")
-    || !strcmp(cmd, "height") || !strcmp(cmd, "h")) {
+    if (w) {
+    old_w_str = av_strdup(scale->w_expr);
+    if (!old_w_str)
+    return AVERROR(ENOMEM);
+    old_w_pexpr = scale->w_pexpr;
+    scale->w_pexpr = NULL;
+    }
  -    int old_w = scale->w;
-    int old_h = scale->h;
-    AVFilterLink *outlink = ctx->outputs[0];
+    if (h) {
+    old_h_str = av_strdup(scale->h_expr);
+    if (!old_h_str)
+    return AVERROR(ENOMEM);
+    old_h_pexpr = scale->h_pexpr;
+    scale->h_pexpr = NULL;
+    }
    av_opt_set(scale, cmd, args, 0);
+
+    if (w) {
+    ret = av_expr_parse(>w_pexpr, scale->w_expr,
+    names,
+    NULL, NULL, NULL, NULL, 0, ctx);
+    if (ret < 0) {
+    av_log(ctx, AV_LOG_ERROR, "Cannot parse width 
expression: '%s'\n", scale->w_expr);

+    av_opt_set(scale, "w", old_w_str, 0);
+    av_free(old_w_str);
+    scale->w_pexpr = old_w_pexpr;
+    return ret;
+    }
+    }
+
+    if (h) {
+    ret = av_expr_parse(>h_pexpr, scale->h_expr,
+    names,
+    NULL, NULL, NULL, NULL, 0, ctx);
+    if (ret < 0) {
+    av_log(ctx, AV_LOG_ERROR, "Cannot parse height 
expression: '%s'\n", scale->h_expr);

+    av_opt_set(scale, "h", old_h_str, 0);
+    av_free(old_h_str);
+    scale->h_pexpr = old_h_pexpr;
+    return ret;
+    }
+    }
+
  if ((ret = config_props(outlink)) < 0) {
-    scale->w = old_w;
-    scale->h = old_h;
+
+    if (w) {
+    av_opt_set(scale, "w", old_w_str, 0);
+    av_free(old_w_str);
+    av_expr_free(scale->w_pexpr);
+    scale->w_pexpr = old_w_pexpr;
+    }
+    if (h) {
+    av_opt_set(scale, "h", old_h_str, 0);
+    av_free(old_h_str);
+    av_expr_free(scale->h_pexpr);
+    scale->h_pexpr = old_h_pexpr;
+    }
+    av_log(ctx, AV_LOG_ERROR, "Command failed. Continuing 
with existing parameters.\n");

+    return ret;
+    }

the cleanup code is duplicated

also if you can make the overall change this patch is making
cleaner/clearer that would be welcome too. Its just a feeling
but this seems more messy than what i would expect from spliting
parse out


More compact v2 patch attached.

Which changes do you find messy? Once parse and eval are separated, 
the AVExpr and expr strings are backed up for restoration should the 
command fail.


Gyan

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v1] avfilter: add overlay vaapi filter

2019-12-19 Thread Xinpeng Sun
Overlay one video on the top of another.

It takes two inputs and has one output. The first input is the "main" video on 
which the
second input is overlaid. This filter requires same memory layout for all the 
inputs.

An example command to use this filter to overlay an image LOGO at the top-left 
corner of
the INPUT video and both inputs are yuv420p format:
FFMPEG -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -hwaccel_output_format 
vaapi \
-i INPUT -i LOGO -filter_complex \
"[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_vaapi, 
hwdownload" \
OUTPUT

Signed-off-by: Xinpeng Sun 
Signed-off-by: Zachary Zhou 
---
 configure  |   3 +
 doc/filters.texi   |  51 
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/vf_overlay_vaapi.c | 432 +
 5 files changed, 488 insertions(+)
 create mode 100644 libavfilter/vf_overlay_vaapi.c

diff --git a/configure b/configure
index eec43c3b06..9969c9e984 100755
--- a/configure
+++ b/configure
@@ -3527,6 +3527,7 @@ openclsrc_filter_deps="opencl"
 overlay_opencl_filter_deps="opencl"
 overlay_qsv_filter_deps="libmfx"
 overlay_qsv_filter_select="qsvvpp"
+overlay_vaapi_filter_deps="vaapi"
 owdenoise_filter_deps="gpl"
 pan_filter_deps="swresample"
 perspective_filter_deps="gpl"
@@ -3584,6 +3585,7 @@ tonemap_vaapi_filter_deps="vaapi 
VAProcPipelineParameterBuffer_output_hdr_metada
 tonemap_opencl_filter_deps="opencl const_nan"
 transpose_opencl_filter_deps="opencl"
 transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags"
+overlay_vaapi_filter_deps="vaapi VAProcPipelineCaps_blend_flags"
 unsharp_opencl_filter_deps="opencl"
 uspp_filter_deps="gpl avcodec"
 vaguedenoiser_filter_deps="gpl"
@@ -6587,6 +6589,7 @@ if enabled vaapi; then
 check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth
 check_struct "va/va.h va/va_vpp.h" "VAProcPipelineParameterBuffer" 
output_hdr_metadata
 check_struct "va/va.h va/va_vpp.h" "VAProcPipelineCaps" rotation_flags
+check_struct "va/va.h va/va_vpp.h" "VAProcPipelineCaps" blend_flags
 check_type "va/va.h va/va_enc_hevc.h" "VAEncPictureParameterBufferHEVC"
 check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG"
 check_type "va/va.h va/va_enc_vp8.h"  "VAEncPictureParameterBufferVP8"
diff --git a/doc/filters.texi b/doc/filters.texi
index 527c6a08b2..d391218529 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -21049,6 +21049,57 @@ To enable compilation of these filters you need to 
configure FFmpeg with
 
 To use vaapi filters, you need to setup the vaapi device correctly. For more 
information, please read @url{https://trac.ffmpeg.org/wiki/Hardware/VAAPI}
 
+@section overlay_vaapi
+
+Overlay one video on the top of another.
+
+It takes two inputs and has one output. The first input is the "main" video on 
which the second input is overlaid.
+This filter requires same memory layout for all the inputs. So, format 
conversion may be needed.
+
+The filter accepts the following options:
+
+@table @option
+
+@item x
+Set the x coordinate of the overlaid video on the main video.
+Default value is @code{0}.
+
+@item y
+Set the y coordinate of the overlaid video on the main video.
+Default value is @code{0}.
+
+@item w
+Set the width of the overlaid video on the main video.
+Default value is the width of input overlay video.
+
+@item h
+Set the height of the overlaid video on the main video.
+Default value is the height of input overlay video.
+
+@item alpha
+Set blocking detection thresholds. Allowed range is 0.0 to 1.0, it
+need input video has alpha channel.
+Default value is @code{0.0}.
+
+@end table
+
+@subsection Examples
+
+@itemize
+@item
+Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs 
are yuv420p format.
+@example
+-i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, 
hwupload[b], [a][b]overlay_vaapi, hwdownload" OUTPUT
+@end example
+@item
+Overlay an image LOGO at the offset (200, 100) from the top-left corner of the 
INPUT video.
+The inputs have same memory layout for color channels, the overlay has 
additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
+@example
+-i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, 
hwupload[b], [a][b]overlay_vaapi=x=200:y=100:w=400:h=300:alpha=1.0, hwdownload" 
OUTPUT
+@end example
+
+@end itemize
+
 @section tonemap_vappi
 
 Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with 
tone-mapping.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 37d4eee858..ea73fef9aa 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -322,6 +322,7 @@ OBJS-$(CONFIG_OVERLAY_FILTER)+= 
vf_overlay.o framesync.o
 OBJS-$(CONFIG_OVERLAY_OPENCL_FILTER) += vf_overlay_opencl.o opencl.o \
 opencl/overlay.o framesync.o
 

Re: [FFmpeg-devel] [PATCH] doc/encoders: correct the description for ts_target_bitrate

2019-12-19 Thread James Zern
Hi,

On Wed, Dec 18, 2019 at 2:00 PM Wonkap Jang
 wrote:
>
> Hi James,
>
> I have updated the libvpx.
> https://chromium-review.googlesource.com/c/webm/libvpx/+/1974899
>

Thanks for posting the patch. Remember top-posting isn't preferred on
this mailing list [1].

[1] http://ffmpeg.org/contact.html#MailingLists

> Thank you,
>
> Wonkap
>
> On Wed, Dec 18, 2019 at 1:39 PM James Zern 
> wrote:
>
> > Hi,
> >
> > On Wed, Dec 18, 2019 at 1:17 PM Wonkap Jang
> >  wrote:
> > >
> > > ts_target_bitrate is in kbps, not bps. This commit clarifies the unit
> > > and modifies the example to match the description.
> > > ---
> > >  doc/encoders.texi | 5 +++--
> > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > >
> >
> > lgtm if you can verify that with the libvpx implementation and update
> > the docs [1].
> >
> > [1]
> > https://chromium.googlesource.com/webm/libvpx/+/refs/heads/master/vpx/vpx_encoder.h#646
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] web: add hosting provider

2019-12-19 Thread Lou Logan
On Wed, Dec 18, 2019, at 1:28 PM, Michael Niedermayer wrote:
>
> this or something similar LGTM

Pushed.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v1] avcodec/hevc_sei: switch to AVBufferRef buffer for a53 caption

2019-12-19 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
Please apply after the following patch:
https://patchwork.ffmpeg.org/patch/16878/

 libavcodec/hevc_sei.c | 15 +++
 libavcodec/hevc_sei.h |  3 +--
 libavcodec/hevcdec.c  | 16 
 3 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index 7f738a049c..b87871e52a 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -177,7 +177,8 @@ static int 
decode_registered_user_data_closed_caption(HEVCSEIA53Caption *s, GetB
 size -= 2;
 
 if (cc_count && size >= cc_count * 3) {
-const uint64_t new_size = (s->a53_caption_size + cc_count
+int old_size = s->buf_ref ? s->buf_ref->size : 0;
+const uint64_t new_size = (old_size + cc_count
* UINT64_C(3));
 int i, ret;
 
@@ -185,14 +186,14 @@ static int 
decode_registered_user_data_closed_caption(HEVCSEIA53Caption *s, GetB
 return AVERROR(EINVAL);
 
 /* Allow merging of the cc data from two fields. */
-ret = av_reallocp(>a53_caption, new_size);
+ret = av_buffer_realloc(>buf_ref, new_size);
 if (ret < 0)
 return ret;
 
 for (i = 0; i < cc_count; i++) {
-s->a53_caption[s->a53_caption_size++] = get_bits(gb, 8);
-s->a53_caption[s->a53_caption_size++] = get_bits(gb, 8);
-s->a53_caption[s->a53_caption_size++] = get_bits(gb, 8);
+s->buf_ref->data[old_size++] = get_bits(gb, 8);
+s->buf_ref->data[old_size++] = get_bits(gb, 8);
+s->buf_ref->data[old_size++] = get_bits(gb, 8);
 }
 skip_bits(gb, 8); // marker_bits
 }
@@ -392,9 +393,7 @@ int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, 
HEVCSEI *s,
 
 void ff_hevc_reset_sei(HEVCSEI *s)
 {
-s->a53_caption.a53_caption_size = 0;
-av_freep(>a53_caption.a53_caption);
-
+av_buffer_unref(>a53_caption.buf_ref);
 for (int i = 0; i < s->unregistered.nb_buf_ref; i++)
 av_buffer_unref(>unregistered.buf_ref[i]);
 s->unregistered.nb_buf_ref = 0;
diff --git a/libavcodec/hevc_sei.h b/libavcodec/hevc_sei.h
index 2464117d47..a8a2ab7dc6 100644
--- a/libavcodec/hevc_sei.h
+++ b/libavcodec/hevc_sei.h
@@ -83,8 +83,7 @@ typedef struct HEVCSEIPictureTiming {
 } HEVCSEIPictureTiming;
 
 typedef struct HEVCSEIA53Caption {
-int a53_caption_size;
-uint8_t *a53_caption;
+AVBufferRef *buf_ref;
 } HEVCSEIA53Caption;
 
 typedef struct HEVCSEIUnregistered {
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index a4981e983c..451a58fb7f 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2778,14 +2778,14 @@ static int set_side_data(HEVCContext *s)
metadata->MaxCLL, metadata->MaxFALL);
 }
 
-if (s->sei.a53_caption.a53_caption) {
-AVFrameSideData* sd = av_frame_new_side_data(out,
- AV_FRAME_DATA_A53_CC,
- 
s->sei.a53_caption.a53_caption_size);
-if (sd)
-memcpy(sd->data, s->sei.a53_caption.a53_caption, 
s->sei.a53_caption.a53_caption_size);
-av_freep(>sei.a53_caption.a53_caption);
-s->sei.a53_caption.a53_caption_size = 0;
+if (s->sei.a53_caption.buf_ref) {
+HEVCSEIA53Caption *a53 = >sei.a53_caption;
+
+AVFrameSideData *sd = av_frame_new_side_data_from_buf(out, 
AV_FRAME_DATA_A53_CC, a53->buf_ref);
+if (!sd)
+av_buffer_unref(>buf_ref);
+a53->buf_ref = NULL;
+
 s->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
 }
 
-- 
2.21.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 3/7] avformat/icecast: Free the right buffer on error

2019-12-19 Thread Andreas Rheinhardt
Michael Niedermayer:
> On Sun, Nov 10, 2019 at 05:07:29AM +0100, Andreas Rheinhardt wrote:
>> In case an AVBPrint was not complete, icecast_open() would free some
>> buffers that have not been allocated yet instead of freeing the data of
>> the AVBPrint (if they have been allocated). Because this error does not
>> trigger a jump to the general cleanup section any more, one can moreover
>> remove a (now unnecessary) initialization of a pointer.
>>
>> Furthermore, finalizing an AVBPrint can fail (namely when the string
>> inside the AVBPrint has not been allocated yet) and so this needs to be
>> checked.
>>
>> Signed-off-by: Andreas Rheinhardt 
>> ---
>>  libavformat/icecast.c | 9 +
>>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> will apply
> 
> thx
> 
> [...]
> 
Thanks. Can you also take a look at the follow-up patch [1]?

- Andreas

[1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2019-November/252778.html

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avformat/tls_openssl: don't use libcrypto locking functions with newer OpenSLL versions

2019-12-19 Thread James Almer
On 12/11/2019 1:39 PM, James Almer wrote:
> On 12/11/2019 1:37 PM, Gyan wrote:
>> A few typos:
>>
>> (in commit title)
>> OpenSLL --> OpenSSL
>>
>> On 11-12-2019 09:45 pm, James Almer wrote:
>>> They have been removed altogheter without a compat implementatino, and
>>> are
>> altogheter --> altogether
>>
>> implementatino --> implementation
> 
> Amended locally (Plus a mental note to proofread commit messages before
> git send-email).

Pushed.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 3/7] avformat/icecast: Free the right buffer on error

2019-12-19 Thread Michael Niedermayer
On Sun, Nov 10, 2019 at 05:07:29AM +0100, Andreas Rheinhardt wrote:
> In case an AVBPrint was not complete, icecast_open() would free some
> buffers that have not been allocated yet instead of freeing the data of
> the AVBPrint (if they have been allocated). Because this error does not
> trigger a jump to the general cleanup section any more, one can moreover
> remove a (now unnecessary) initialization of a pointer.
> 
> Furthermore, finalizing an AVBPrint can fail (namely when the string
> inside the AVBPrint has not been allocated yet) and so this needs to be
> checked.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/icecast.c | 9 +
>  1 file changed, 5 insertions(+), 4 deletions(-)

will apply

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The smallest minority on earth is the individual. Those who deny 
individual rights cannot claim to be defenders of minorities. - Ayn Rand


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] Append to fmp4

2019-12-19 Thread Jun Li
On Thu, Dec 19, 2019 at 4:00 AM Daniel Oberhoff <
danieloberh...@googlemail.com> wrote:

> Hello.
>
> I have been diving deep into the mp4 spec to understand fragmented mp4.
> From what I understand using moof atoms it is possible, given stream
> compatibility, to straight append to an mp4 file by appending moof+mdat
> pairs. Can ffmpeg or libavformat be somehow used to achieve that?


I use the command line like " ffmpeg -i test.mp4 -codec copy -f mp4
-movflags empty_moov+frag_keyframe+skip_trailer out.mp4".
It generates  fmp4 with atiom :   ftyp+moov+[moof+mdata]*


>
>
Gruß!
>
> Daniel Oberhoff
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 1/2] avformat/microdvd: Use \n instead of \0 to end file header

2019-12-19 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Up until now, the microdvd demuxer uses av_strdup() to allocate the
> extradata from a string; its length is set to strlen() + 1, i.e.
> including the \0 at the end. Upon remuxing, the muxer would simply copy
> the extradata at the beginning, including the \0.
> 
> This commit changes this by not adding the \0 to the size of the
> extradata; the muxer now delimits extradata by inserting a \n. This
> required to change the subtitles-microdvd-remux FATE-test.
> 
> Furthermore, the extradata is now allocated with zeroed padding.
> 
> The microdvd decoder is not affected by this, as it didn't use the size
> of the extradata at all, but treated it as a C-string.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/microdvddec.c |   9 +
>  libavformat/microdvdenc.c |   1 +
>  tests/ref/fate/sub-microdvd-remux | Bin 416 -> 416 bytes
>  3 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/libavformat/microdvddec.c b/libavformat/microdvddec.c
> index ca9086afe9..08e6fca09c 100644
> --- a/libavformat/microdvddec.c
> +++ b/libavformat/microdvddec.c
> @@ -117,10 +117,11 @@ static int microdvd_read_header(AVFormatContext *s)
>  continue;
>  }
>  if (!st->codecpar->extradata && sscanf(line, "{DEFAULT}{}%c", 
> ) == 1) {
> -st->codecpar->extradata = av_strdup(line + 11);
> -if (!st->codecpar->extradata)
> -return AVERROR(ENOMEM);
> -st->codecpar->extradata_size = 
> strlen(st->codecpar->extradata) + 1;
> +int ret, size = strlen(line + 11);
> +ret = ff_alloc_extradata(st->codecpar, size);
> +if (ret < 0)
> +return ret;
> +memcpy(st->codecpar->extradata, line + 11, size);
>  continue;
>  }
>  }
> diff --git a/libavformat/microdvdenc.c b/libavformat/microdvdenc.c
> index 04f475b645..6639651e02 100644
> --- a/libavformat/microdvdenc.c
> +++ b/libavformat/microdvdenc.c
> @@ -36,6 +36,7 @@ static int microdvd_write_header(struct AVFormatContext *s)
>  if (par->extradata && par->extradata_size > 0) {
>  avio_write(s->pb, "{DEFAULT}{}", 11);
>  avio_write(s->pb, par->extradata, par->extradata_size);
> +avio_w8(s->pb, '\n');
>  avio_flush(s->pb);
>  }
>  
> diff --git a/tests/ref/fate/sub-microdvd-remux 
> b/tests/ref/fate/sub-microdvd-remux
> index 
> a71da99031fdc4bff13ea7124c046e761a650dc8..92ff233f56b6fec33d4e9e0698ec43377ea5fab7
>  100644
> GIT binary patch
> delta 12
> TcmZ3$ynuOvE+f}Qy&^^c7%l^0
> 
> delta 12
> TcmZ3$ynuOvE+fN6y&^^c7yJWP
> 
Ping.

- Andreas
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 5/5] avcodec/hevc_mp4toannexb_bsf: Check that there is enough input left for nalu size

2019-12-19 Thread Andreas Rheinhardt
Michael Niedermayer:
> On Fri, Dec 13, 2019 at 06:05:21PM +0100, Andreas Rheinhardt wrote:
>> On Fri, Dec 13, 2019 at 5:56 PM Michael Niedermayer 
>> wrote:
>>
>>> On Fri, Dec 13, 2019 at 12:24:04PM +0100, Andreas Rheinhardt wrote:
 On Fri, Dec 13, 2019 at 3:07 AM Michael Niedermayer
>>> 
 wrote:

> No testcase
>
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/hevc_mp4toannexb_bsf.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/hevc_mp4toannexb_bsf.c
> b/libavcodec/hevc_mp4toannexb_bsf.c
> index baa93628ed..e0d20a550c 100644
> --- a/libavcodec/hevc_mp4toannexb_bsf.c
> +++ b/libavcodec/hevc_mp4toannexb_bsf.c
> @@ -152,7 +152,9 @@ static int hevc_mp4toannexb_filter(AVBSFContext
>>> *ctx,
> AVPacket *out)
>  extra_size= add_extradata * ctx->par_out->extradata_size;
>  got_irap |= is_irap;
>
> -if (FFMIN(INT_MAX, SIZE_MAX) < 4ULL + nalu_size + extra_size)
>>> {
> +if (FFMIN(INT_MAX, SIZE_MAX) < 4ULL + nalu_size + extra_size
>>> ||
>

 Up until now I thought that FFmpeg has some implicit assumptions: int
 having 32bit being one of them (the log2 functions depend on this). And I
>>>
>>> yes, that was from POSIX
>>>
>>>
 also thought that size_t being able to hold all the values of an unsigned
 was one of these implicit assumptions, too. Am I wrong on this?
>>>
>>> I was asking myself the same, and i couldnt really find anything where we
>>> stated that previously so i added a FFMIN.
>>>
>>> In this case we would have to add lots of checks before av_malloc and
>> other allocation functions that use size_t parameters in order to ensure
>> that no loss of information happens when an int (or unsigned) is converted
>> to size_t. In other words: We should not support such systems.
> 
> If we would choose to support such platforms in the future then using our own
> type thats the bigger of the 2 might make this relativly painless. But first
> such a platform needs to be relevant for us and exist ...
> And if we choose to assume things about these types, that should be in our
> developer documentation.
> 
> But to return to the patch here, do you want me to remove the FFMIN ?
> 

Yes, please do so. After all, as long as there is no platform relevant
to us it is just an unnecessary complication/potential for confusion.

- Andreas
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2 3/7] avformat: Add av_stream_add_coded_side_data()

2019-12-19 Thread Andreas Rheinhardt
Nicolas Gaullier:
> This will allow avformat_find_stream_info() get side data from the codec 
> context.
> ---
>  doc/APIchanges |  3 +++
>  libavformat/avformat.h | 11 +++
>  libavformat/utils.c| 15 +++
>  libavformat/version.h  |  2 +-
>  4 files changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 401c65a753..62b5effda7 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -15,6 +15,9 @@ libavutil: 2017-10-21
>  
>  API changes, most recent first:
>  
> +2019-12-19 - xx - lavf 58.36.101 - avformat.h
> +  Add av_stream_add_coded_side_data().
> +
>  2019-11-17 - 1c23abc88f - lavu 56.36.100 - eval API
>Add av_expr_count_vars().
>  
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index d4d9a3b06e..4dee1a272a 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -2191,6 +2191,17 @@ int av_stream_add_side_data(AVStream *st, enum 
> AVPacketSideDataType type,
>   */
>  uint8_t *av_stream_new_side_data(AVStream *stream,
>   enum AVPacketSideDataType type, int size);
> +
> +/**
> + * Add stream side_data from the coded_side_data of the supplied context.
> + *
> + * @param stream stream
> + * @param avctx the codec context that may contain coded_side_data
> + * @return >= 0 in case of success, a negative AVERROR code in case of
> + * failure
> + */
> +int av_stream_add_coded_side_data(AVStream *stream, AVCodecContext *avctx);
> +
>  /**
>   * Get side information from stream.
>   *
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index b472762dd1..fe92ad4a1d 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -5556,6 +5556,21 @@ uint8_t *av_stream_new_side_data(AVStream *st, enum 
> AVPacketSideDataType type,
>  return data;
>  }
>  
> +int av_stream_add_coded_side_data(AVStream *st, AVCodecContext *avctx)
> +{
> +int i;
> +
> +for (i = 0; i < avctx->nb_coded_side_data; i++) {
> +const AVPacketSideData *sd_src = >coded_side_data[i];
> +uint8_t *dst_data;
> +dst_data = av_stream_new_side_data(st, sd_src->type, sd_src->size);
> +if (!dst_data)
> +return AVERROR(ENOMEM);
> +memcpy(dst_data, sd_src->data, sd_src->size);
> +}
> +return 0;
> +}
> +
>  int ff_stream_add_bitstream_filter(AVStream *st, const char *name, const 
> char *args)
>  {
>  int ret;
> diff --git a/libavformat/version.h b/libavformat/version.h
> index 213b66b45f..15495bfd31 100644
> --- a/libavformat/version.h
> +++ b/libavformat/version.h
> @@ -32,7 +32,7 @@
>  // Major bumping may affect Ticket5467, 5421, 5451(compatibility with 
> Chromium)
>  // Also please add any ticket numbers that you believe might be affected here
>  #define LIBAVFORMAT_VERSION_MAJOR  58
> -#define LIBAVFORMAT_VERSION_MINOR  35
> +#define LIBAVFORMAT_VERSION_MINOR  36
>  #define LIBAVFORMAT_VERSION_MICRO 101
>  
You forgot to reset micro.

- Andreas
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avcodec/cbs_av1: add missing valid range of values for num_cb_points and num_cr_points

2019-12-19 Thread James Almer
On 12/13/2019 5:44 PM, James Almer wrote:
> It is a requirement of bitstream conformance that num_cr_points is less than 
> or equal to 10.
> It is a requirement of bitstream conformance that num_cb_points is less than 
> or equal to 10.
> 
> Signed-off-by: James Almer 
> ---
>  libavcodec/cbs_av1.h | 8 
>  libavcodec/cbs_av1_syntax_template.c | 4 ++--
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/libavcodec/cbs_av1.h b/libavcodec/cbs_av1.h
> index 643e76793f..9306bc59d6 100644
> --- a/libavcodec/cbs_av1.h
> +++ b/libavcodec/cbs_av1.h
> @@ -260,11 +260,11 @@ typedef struct AV1RawFrameHeader {
>  uint8_t  point_y_scaling[16];
>  uint8_t  chroma_scaling_from_luma;
>  uint8_t  num_cb_points;
> -uint8_t  point_cb_value[16];
> -uint8_t  point_cb_scaling[16];
> +uint8_t  point_cb_value[10];
> +uint8_t  point_cb_scaling[10];
>  uint8_t  num_cr_points;
> -uint8_t  point_cr_value[16];
> -uint8_t  point_cr_scaling[16];
> +uint8_t  point_cr_value[10];
> +uint8_t  point_cr_scaling[10];
>  uint8_t  grain_scaling_minus_8;
>  uint8_t  ar_coeff_lag;
>  uint8_t  ar_coeffs_y_plus_128[24];
> diff --git a/libavcodec/cbs_av1_syntax_template.c 
> b/libavcodec/cbs_av1_syntax_template.c
> index f53955c52e..848348af7d 100644
> --- a/libavcodec/cbs_av1_syntax_template.c
> +++ b/libavcodec/cbs_av1_syntax_template.c
> @@ -1174,12 +1174,12 @@ static int 
> FUNC(film_grain_params)(CodedBitstreamContext *ctx, RWContext *rw,
>  infer(num_cb_points, 0);
>  infer(num_cr_points, 0);
>  } else {
> -fb(4, num_cb_points);
> +fc(4, num_cb_points, 0, 10);
>  for (i = 0; i < current->num_cb_points; i++) {
>  fbs(8, point_cb_value[i],   1, i);
>  fbs(8, point_cb_scaling[i], 1, i);
>  }
> -fb(4, num_cr_points);
> +fc(4, num_cr_points, 0, 10);
>  for (i = 0; i < current->num_cr_points; i++) {
>  fbs(8, point_cr_value[i],   1, i);
>  fbs(8, point_cr_scaling[i], 1, i);

Applied.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avfilter/image2: Add source file path and basename to each packet side data.

2019-12-19 Thread Michael Niedermayer
On Tue, Dec 17, 2019 at 02:30:39PM +, Alexandre Heitor Schmidt wrote:
> On 17/12/2019 00:35, Marton Balint wrote:
> > On Mon, 16 Dec 2019, Alexandre Heitor Schmidt wrote:
> >> This is the second time I'm submiting this patch, now modified to be
> >> less intrusive, as sugested by Marton Balint, and hopefully without git
> >> send-email messing up with the diff by replacing '@' within
> >> documentation entries.
> >>
> >> The patch modifies image2 filter to make available two special metadata
> >> entries called source_path and source_file, which represents,
> >> respectively, the complete path to the source image for the current
> >> frame and the basename i.e. the file name related to the current frame.
> >> These can then be used by filters like drawtext and others.
> >>
> >> doc/filters: The documentation for drawtext was also updated and an usage
> >> example was added.
> >>
> >> Fixes #2874.
> >>
> >> Signed-off-by: Alexandre Heitor Schmidt 
> >> ---
> >> doc/filters.texi  | 15 +--
> >> libavformat/img2.h    |  2 ++
> >> libavformat/img2dec.c | 28 
> >> 3 files changed, 43 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/doc/filters.texi b/doc/filters.texi
> >> index c543203ce3..15498aee0d 100644
> >> --- a/doc/filters.texi
> >> +++ b/doc/filters.texi
> >> @@ -9723,8 +9723,12 @@ Available metadata can be identified by inspecting
> entries
> >> starting with TAG included within each frame section
> >> printed by running @code{ffprobe -show_frames}.
> >>
> >> -String metadata generated in filters leading to
> >> -the drawtext filter are also available.
> >> +String metadata generated in filters leading to the drawtext filter are
> also
> >> +available. For example, image2 filter generates two special metadata
> fields
> >> +called @var{source_path} and @var{source_basename} for each input frame
> >> +generated from a single image. @var{source_path} contains the entire
> path
> >> +to input filename, while @var{source_basename} contains the equivalent
> >> +to @code{basename(source_path)}.
> >
> > This does not really belong here, you are documenting the image2
> *demuxer*'s behaviour of setting source_basename and source_path metadata
> fields.
> 
> Ok. Fixed that. Updated the example for drawtext and added the metadata tags
> to demuxers.texi
> 
> > The only thing that might be relevant here is that the metadata can not
> > only come from filters but from demuxers as well.
> >
> > Also since the metadata names are demuxer specific probably it is better
> to use hierarchical names, like "lavf.image2dec.source_path" and
> "lavf.image2dec.source_basename", similar to how the filters set their
> custom metadata fields.
> 
> Right. Names of metadata tags changed accordingly.
> 
> >> @item n, frame_num
> >> The frame number, starting from 0.
> >> @@ -9872,6 +9876,13 @@
> drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
> >>
> drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
> >> @end example
> >>
> >> +@item
> >> +Plot special @var{source_basename} metadata, extracted from each input
> frame, or
> >> +the string "NA" if the metadata is not defined.
> >> +@example
> >> +drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%{metadata\:source_basename\:NA}':x=10:y=10"
> >> +@end example
> >> +
> >
> > The example can stay as is, that is fine.
> 
> Ok. I just updated the metadata tag names.
> 
> >> @end itemize
> >>
> >> For more information about libfreetype, check:
> >> diff --git a/libavformat/img2.h b/libavformat/img2.h
> >> index 0e5b374a6b..8208c1f58b 100644
> >> --- a/libavformat/img2.h
> >> +++ b/libavformat/img2.h
> >> @@ -74,5 +74,7 @@ extern const AVOption ff_img_options[];
> >>
> >> int ff_img_read_header(AVFormatContext *s1);
> >>
> >> +int add_filename_as_pkt_side_data(char *filename, AVPacket *pkt);
> >> +
> >
> > No need to make it part of the header.
> 
> Removed.
> 
> >> int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt);
> >> #endif
> >> diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
> >> index f8b4a655a5..3fb7aa7967 100644
> >> --- a/libavformat/img2dec.c
> >> +++ b/libavformat/img2dec.c
> >> @@ -374,6 +374,32 @@ int ff_img_read_header(AVFormatContext *s1)
> >> return 0;
> >> }
> >>
> >> +/**
> >> + * Add this frame's source path and basename to packet's sidedata
> >> + * as a dictionary, so it can be used by filters like 'drawtext'.
> >> + */
> >> +int add_filename_as_pkt_side_data(char *filename, AVPacket *pkt) {
> >
> > This can be made static.
> 
> Done.
> 
> >> +    uint8_t* metadata;
> >> +    int metadata_len;
> >> +    AVDictionary *d = NULL;
> >> +    char *packed_metadata = NULL;
> >> +
> >> +    av_dict_set(, "source_path", filename, 0);
> >> +    av_dict_set(, "source_basename", av_basename(filename), 0);
> >> +
> >> +    packed_metadata = av_packet_pack_dictionary(d, _len);
> >> +    if (!packed_metadata)
> >> +    return 

[FFmpeg-devel] [PATCH v2 7/7] avcodec/mpeg12dec: Add CPB coded side data

2019-12-19 Thread Nicolas Gaullier
This fixes mpeg2video stream copies to mpeg muxer like this:
  ffmpeg -i xdcamhd.mxf -c:v copy output.mpg
---
 libavcodec/mpeg12dec.c   | 7 +++
 tests/ref/fate/mxf-probe-d10 | 3 +++
 tests/ref/fate/ts-demux  | 2 +-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 775579f9f0..2dc44e6d6f 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1398,6 +1398,7 @@ static void mpeg_decode_sequence_extension(Mpeg1Context 
*s1)
 MpegEncContext *s = >mpeg_enc_ctx;
 int horiz_size_ext, vert_size_ext;
 int bit_rate_ext;
+AVCPBProperties *cpb_props;
 
 skip_bits(>gb, 1); /* profile and level esc*/
 s->avctx->profile   = get_bits(>gb, 3);
@@ -1429,6 +1430,12 @@ static void mpeg_decode_sequence_extension(Mpeg1Context 
*s1)
 ff_dlog(s->avctx, "sequence extension\n");
 s->codec_id = s->avctx->codec_id = AV_CODEC_ID_MPEG2VIDEO;
 
+if (cpb_props = ff_add_cpb_side_data(s->avctx)) {
+cpb_props->buffer_size = FFMAX(cpb_props->buffer_size, 
s->avctx->rc_buffer_size);
+if (s->bit_rate != 0x3*400)
+cpb_props->max_bitrate = FFMAX(cpb_props->max_bitrate, 
s->bit_rate);
+}
+
 if (s->avctx->debug & FF_DEBUG_PICT_INFO)
 av_log(s->avctx, AV_LOG_DEBUG,
"profile: %d, level: %d ps: %d cf:%d vbv buffer: %d, 
bitrate:%"PRId64"\n",
diff --git a/tests/ref/fate/mxf-probe-d10 b/tests/ref/fate/mxf-probe-d10
index ab564467b5..317d4ae4c5 100644
--- a/tests/ref/fate/mxf-probe-d10
+++ b/tests/ref/fate/mxf-probe-d10
@@ -50,6 +50,9 @@ DISPOSITION:clean_effects=0
 DISPOSITION:attached_pic=0
 DISPOSITION:timed_thumbnails=0
 
TAG:file_package_umid=0x060A2B340101010501010D131300AE86B20091310580080046A54011
+[SIDE_DATA]
+side_data_type=CPB properties
+[/SIDE_DATA]
 [/STREAM]
 [STREAM]
 index=1
diff --git a/tests/ref/fate/ts-demux b/tests/ref/fate/ts-demux
index eb13ecc684..cdf34d6af0 100644
--- a/tests/ref/fate/ts-demux
+++ b/tests/ref/fate/ts-demux
@@ -15,7 +15,7 @@
 1,   5760,   5760, 2880, 1536, 0xbab5129c
 1,   8640,   8640, 2880, 1536, 0x602f034b, S=1,1, 
0x00bd00bd
 1,  11520,  11520, 2880,  906, 0x69cdcbcd
-0,  32037,  36541, 1501,   114336, 0x37a215a8, S=1,1, 
0x00e000e0
+0,  32037,  36541, 1501,   114336, 0x37a215a8, S=2,1, 
0x00e000e0,   24, 0x663d0b52
 0,  33538,  33538, 1501,12560, 0xb559a3d4, F=0x0, S=1,
1, 0x00e000e0
 0,  35040,  35040, 1501,12704, 0x2614adf4, F=0x0, S=1,
1, 0x00e000e0
 0,  36541,  41046, 1501,51976, 0x9ff1dbfe, F=0x0, S=1,
1, 0x00e000e0
-- 
2.14.1.windows.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 5/7] fftools/ffmpeg: Use the new av_stream_add_coded_side_data()

2019-12-19 Thread Nicolas Gaullier
This code is now shared with avformat_find_stream_info().
---
 fftools/ffmpeg.c | 16 +++-
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 9af2bc2fb5..232c8f5fd8 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3537,19 +3537,9 @@ static int init_output_stream(OutputStream *ost, char 
*error, int error_len)
 if (ret < 0)
 return ret;
 
-if (ost->enc_ctx->nb_coded_side_data) {
-int i;
-
-for (i = 0; i < ost->enc_ctx->nb_coded_side_data; i++) {
-const AVPacketSideData *sd_src = 
>enc_ctx->coded_side_data[i];
-uint8_t *dst_data;
-
-dst_data = av_stream_new_side_data(ost->st, sd_src->type, 
sd_src->size);
-if (!dst_data)
-return AVERROR(ENOMEM);
-memcpy(dst_data, sd_src->data, sd_src->size);
-}
-}
+ret = av_stream_add_coded_side_data(ost->st, ost->enc_ctx);
+if (ret < 0)
+return ret;
 
 /*
  * Add global input side data. For now this is naive, and copies it
-- 
2.14.1.windows.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 3/7] avformat: Add av_stream_add_coded_side_data()

2019-12-19 Thread Nicolas Gaullier
This will allow avformat_find_stream_info() get side data from the codec 
context.
---
 doc/APIchanges |  3 +++
 libavformat/avformat.h | 11 +++
 libavformat/utils.c| 15 +++
 libavformat/version.h  |  2 +-
 4 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 401c65a753..62b5effda7 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
+2019-12-19 - xx - lavf 58.36.101 - avformat.h
+  Add av_stream_add_coded_side_data().
+
 2019-11-17 - 1c23abc88f - lavu 56.36.100 - eval API
   Add av_expr_count_vars().
 
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index d4d9a3b06e..4dee1a272a 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2191,6 +2191,17 @@ int av_stream_add_side_data(AVStream *st, enum 
AVPacketSideDataType type,
  */
 uint8_t *av_stream_new_side_data(AVStream *stream,
  enum AVPacketSideDataType type, int size);
+
+/**
+ * Add stream side_data from the coded_side_data of the supplied context.
+ *
+ * @param stream stream
+ * @param avctx the codec context that may contain coded_side_data
+ * @return >= 0 in case of success, a negative AVERROR code in case of
+ * failure
+ */
+int av_stream_add_coded_side_data(AVStream *stream, AVCodecContext *avctx);
+
 /**
  * Get side information from stream.
  *
diff --git a/libavformat/utils.c b/libavformat/utils.c
index b472762dd1..fe92ad4a1d 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -5556,6 +5556,21 @@ uint8_t *av_stream_new_side_data(AVStream *st, enum 
AVPacketSideDataType type,
 return data;
 }
 
+int av_stream_add_coded_side_data(AVStream *st, AVCodecContext *avctx)
+{
+int i;
+
+for (i = 0; i < avctx->nb_coded_side_data; i++) {
+const AVPacketSideData *sd_src = >coded_side_data[i];
+uint8_t *dst_data;
+dst_data = av_stream_new_side_data(st, sd_src->type, sd_src->size);
+if (!dst_data)
+return AVERROR(ENOMEM);
+memcpy(dst_data, sd_src->data, sd_src->size);
+}
+return 0;
+}
+
 int ff_stream_add_bitstream_filter(AVStream *st, const char *name, const char 
*args)
 {
 int ret;
diff --git a/libavformat/version.h b/libavformat/version.h
index 213b66b45f..15495bfd31 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  58
-#define LIBAVFORMAT_VERSION_MINOR  35
+#define LIBAVFORMAT_VERSION_MINOR  36
 #define LIBAVFORMAT_VERSION_MICRO 101
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
-- 
2.14.1.windows.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 6/7] avcodec/utils: Fix ff_add_cpb_side_data() add twice

2019-12-19 Thread Nicolas Gaullier
Makes it behave similarly to av_stream_add_side_data().
---
 libavcodec/utils.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 8a49234bcd..f35cfcf2f9 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1975,6 +1975,11 @@ AVCPBProperties *ff_add_cpb_side_data(AVCodecContext 
*avctx)
 AVPacketSideData *tmp;
 AVCPBProperties  *props;
 size_t size;
+int i;
+
+for (i = 0; i < avctx->nb_coded_side_data; i++)
+if (avctx->coded_side_data[i].type == AV_PKT_DATA_CPB_PROPERTIES)
+return (AVCPBProperties  *)avctx->coded_side_data[i].data;
 
 props = av_cpb_properties_alloc();
 if (!props)
-- 
2.14.1.windows.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 4/7] avformat/utils: Make find_stream_info get side data from codec context

2019-12-19 Thread Nicolas Gaullier
This will allow probing input coded side data, and also forwarding them to the 
output.
---
 libavformat/utils.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index fe92ad4a1d..f7c949f0a1 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4137,6 +4137,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
 ret = avcodec_parameters_from_context(st->codecpar, 
st->internal->avctx);
 if (ret < 0)
 goto find_stream_info_err;
+ret = av_stream_add_coded_side_data(st, st->internal->avctx);
+if (ret < 0)
+goto find_stream_info_err;
 #if FF_API_LOWRES
 // The decoder might reduce the video size by the lowres factor.
 if (st->internal->avctx->lowres && orig_w) {
-- 
2.14.1.windows.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 2/7] fftools/ffmpeg: Reindent after last commit

2019-12-19 Thread Nicolas Gaullier
---
 fftools/ffmpeg.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 36c207653b..9af2bc2fb5 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3563,12 +3563,12 @@ static int init_output_stream(OutputStream *ost, char 
*error, int error_len)
 for (i = 0; i < ist->st->nb_side_data; i++) {
 AVPacketSideData *sd = >st->side_data[i];
 if (sd->type != AV_PKT_DATA_CPB_PROPERTIES) {
-uint8_t *dst = av_stream_new_side_data(ost->st, sd->type, 
sd->size);
-if (!dst)
-return AVERROR(ENOMEM);
-memcpy(dst, sd->data, sd->size);
-if (ist->autorotate && sd->type == AV_PKT_DATA_DISPLAYMATRIX)
-av_display_rotation_set((uint32_t *)dst, 0);
+uint8_t *dst = av_stream_new_side_data(ost->st, sd->type, 
sd->size);
+if (!dst)
+return AVERROR(ENOMEM);
+memcpy(dst, sd->data, sd->size);
+if (ist->autorotate && sd->type == 
AV_PKT_DATA_DISPLAYMATRIX)
+av_display_rotation_set((uint32_t *)dst, 0);
 }
 }
 }
-- 
2.14.1.windows.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 1/7] fftools/ffmpeg: Fix forward CPB props in to out

2019-12-19 Thread Nicolas Gaullier
CPB side_data is copied when stream-copying (see 
init_output_stream_streamcopy()),
but it shall not be copied when the stream is decoded.
---
 fftools/ffmpeg.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 27f68933f8..36c207653b 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3562,12 +3562,14 @@ static int init_output_stream(OutputStream *ost, char 
*error, int error_len)
 int i;
 for (i = 0; i < ist->st->nb_side_data; i++) {
 AVPacketSideData *sd = >st->side_data[i];
+if (sd->type != AV_PKT_DATA_CPB_PROPERTIES) {
 uint8_t *dst = av_stream_new_side_data(ost->st, sd->type, 
sd->size);
 if (!dst)
 return AVERROR(ENOMEM);
 memcpy(dst, sd->data, sd->size);
 if (ist->autorotate && sd->type == AV_PKT_DATA_DISPLAYMATRIX)
 av_display_rotation_set((uint32_t *)dst, 0);
+}
 }
 }
 
-- 
2.14.1.windows.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2 0/7] Fix mpeg1/2 stream copy

2019-12-19 Thread Nicolas Gaullier
Includes Hendrik and Michael feedbacks (thanks to you!) :
- comments added
- API changes and minor version updated
- split lib/tools commits

(the code itself was left untouched)

Nicolas Gaullier (7):
  fftools/ffmpeg: Fix forward CPB props in to out
  fftools/ffmpeg: Reindent after last commit
  avformat: Add av_stream_add_coded_side_data()
  avformat/utils: Make find_stream_info get side data from codec context
  fftools/ffmpeg: Use the new av_stream_add_coded_side_data()
  avcodec/utils: Fix ff_add_cpb_side_data add twice
  avcodec/mpeg12dec: Add CPB coded side data

 doc/APIchanges   |  3 +++
 fftools/ffmpeg.c | 30 +++---
 libavcodec/mpeg12dec.c   |  7 +++
 libavcodec/utils.c   |  5 +
 libavformat/avformat.h   | 11 +++
 libavformat/utils.c  | 18 ++
 libavformat/version.h|  2 +-
 tests/ref/fate/mxf-probe-d10 |  3 +++
 tests/ref/fate/ts-demux  |  2 +-
 9 files changed, 60 insertions(+), 21 deletions(-)

-- 
2.14.1.windows.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] Append to fmp4

2019-12-19 Thread Daniel Oberhoff
Hello.

I have been diving deep into the mp4 spec to understand fragmented mp4. From 
what I understand using moof atoms it is possible, given stream compatibility, 
to straight append to an mp4 file by appending moof+mdat pairs. Can ffmpeg or 
libavformat be somehow used to achieve that?

Gruß!

Daniel Oberhoff
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".