[FFmpeg-devel] [PATCH] avutil/opt: Don't use NULL for %s string in a log message

2020-03-28 Thread Andreas Rheinhardt
If one calls av_opt_set() with an incorrect string to set the value of
an option of type AV_OPT_TYPE_VIDEO_RATE, the given string is used in a
log message via %s. This also happens when the string is actually a
nullpointer in which case using it for %s is forbidden.

This commit changes this by erroring out early in case of a nullpointer.

This also fixes a warning from GCC 9.2:
"‘%s’ directive argument is null [-Wformat-overflow=]"

Signed-off-by: Andreas Rheinhardt 
---
There are two places that call set_string_video_rate(): av_opt_set() and
av_opt_set_defaults2(). This patch makes sure that av_opt_set() can't
call set_string_video_rate() with a NULL string. All AV_OPT_TYPE_VIDEO_RATE
options in the FFmpeg codebase have a default value different than NULL
and so I deemed a check in the av_opt_set_defaults2() codepath to be
unnecessary. But others might have a different opinion on this. 

 libavutil/opt.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index a482febf5f..bf2562737b 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -330,12 +330,7 @@ static int set_string_image_size(void *obj, const AVOption 
*o, const char *val,
 
 static int set_string_video_rate(void *obj, const AVOption *o, const char 
*val, AVRational *dst)
 {
-int ret;
-if (!val) {
-ret = AVERROR(EINVAL);
-} else {
-ret = av_parse_video_rate(dst, val);
-}
+int ret = av_parse_video_rate(dst, val);
 if (ret < 0)
 av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as 
video rate\n", val);
 return ret;
@@ -473,7 +468,7 @@ int av_opt_set(void *obj, const char *name, const char 
*val, int search_flags)
 return AVERROR_OPTION_NOT_FOUND;
 if (!val && (o->type != AV_OPT_TYPE_STRING &&
  o->type != AV_OPT_TYPE_PIXEL_FMT && o->type != 
AV_OPT_TYPE_SAMPLE_FMT &&
- o->type != AV_OPT_TYPE_IMAGE_SIZE && o->type != 
AV_OPT_TYPE_VIDEO_RATE &&
+ o->type != AV_OPT_TYPE_IMAGE_SIZE &&
  o->type != AV_OPT_TYPE_DURATION && o->type != 
AV_OPT_TYPE_COLOR &&
  o->type != AV_OPT_TYPE_CHANNEL_LAYOUT && o->type != 
AV_OPT_TYPE_BOOL))
 return AVERROR(EINVAL);
-- 
2.20.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] avformat/mxfdec: Correct confusing struct tag

2020-03-28 Thread Andreas Rheinhardt
Don't use typedef struct MXFTrack {...} MXFTimecodeComponent, in
particular given the fact that MXFTrack is a type of its own.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/mxfdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 3374f36a88..fdd0dd2a88 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -131,7 +131,7 @@ typedef struct MXFSequence {
 uint8_t origin;
 } MXFSequence;
 
-typedef struct MXFTrack {
+typedef struct MXFTimecodeComponent {
 UID uid;
 enum MXFMetadataSetType type;
 int drop_frame;
-- 
2.20.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] avformat/hlsenc: skip first char after compare path with path separator

2020-03-28 Thread Steven Liu
before patch:
ffmpeg -i input -g 25 -y -c:a aac -map 0:v -map 0:a
-master_pl_name playlist.m3u8 -var_stream_map "v:0,a:0" c%v.m3u8"
the master file playlist.m3u8 context is
#EXTM3U
#EXT-X-VERSION:3

#EXT-X-STREAM-INF:BANDWIDTH=2890800,RESOLUTION=1920x800,CODECS="avc1.640028,mp4a.40.2"
/c0.m3u8

this is incorrect.
after patch:
#EXTM3U
#EXT-X-VERSION:3

#EXT-X-STREAM-INF:BANDWIDTH=2890800,RESOLUTION=1920x800,CODECS="avc1.640028,mp4a.40.2"
c0.m3u8

Reported-by: Ibrahim Tachijian 
Signed-off-by: Steven Liu 
---
 libavformat/hlsenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index b4c72b6e54..a3c59432c5 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1260,7 +1260,7 @@ static const char* get_relative_url(const char 
*master_url, const char *media_ur
 }
 }
 
-return media_url + base_len;
+return media_url + 1 + base_len;
 }
 
 static int64_t get_stream_bit_rate(AVStream *stream)
-- 
2.25.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 1/3] avformat/avformat: Update av_read_frame() documentation

2020-03-28 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Anton Khirnov:
>> Quoting Andreas Rheinhardt (2019-12-01 11:05:44)
>>> This commit updates the documentation of av_read_frame() to match its
>>> actual behaviour in several ways:
>>>
>>> 1. On success, av_read_frame() always returns refcounted packets.
>>> 2. It can handle uninitialized packets.
>>> 3. On error, it always returns clean packets.
>>>
>>> This will allow callers to not initialize or unref unnecessarily.
>>>
>>> Signed-off-by: Andreas Rheinhardt 
>>> ---
>>
>> Looks ok, don't know if the version bump is necessary since there is no
>> change in behaviour.
>>
> I don't feel to strongly about it either. What do others think of it? If
> there is no one in favour of it, I will remove it.
> 
> - Andreas
> 
Pushed without the version bump. Thanks.

- 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 2/3] avfilter/vf_mix: Check sscanf() return value

2020-03-28 Thread Limin Wang
On Sun, Mar 29, 2020 at 01:32:59AM +0100, Nicolas George wrote:
> Limin Wang (12020-03-29):
> > Anyway if the user option is typo, 
> > the result may be unexpected for user. 
> 
> But your change does not address that. For that, you would print a
> message and return an error. Which is probably the right thing to do,
> actually.

OK, update the patch to print a message and return error.


> 
> Regards,
> 
> -- 
>   Nicolas George



> ___
> 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".


-- 
Thanks,
Limin Wang
___
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 v3 2/3] avfilter/vf_mix: Check sscanf() return value

2020-03-28 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavfilter/vf_mix.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_mix.c b/libavfilter/vf_mix.c
index 9e1ae79..9bb1b7a 100644
--- a/libavfilter/vf_mix.c
+++ b/libavfilter/vf_mix.c
@@ -108,7 +108,10 @@ static av_cold int init(AVFilterContext *ctx)
 break;
 
 p = NULL;
-av_sscanf(arg, "%f", >weights[i]);
+if (av_sscanf(arg, "%f", >weights[i]) != 1) {
+av_log(ctx, AV_LOG_ERROR, "Invalid syntax for weights[%d].\n", i);
+return AVERROR(EINVAL);
+}
 s->wfactor += s->weights[i];
 last = i;
 }
-- 
2.9.5

___
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] avformat/dashdec: add attribute lang for audio and subtitle streams

2020-03-28 Thread Steven Liu
There should have lang in the metadata of streams which show to user

Signed-off-by: Steven Liu 
---
 libavformat/dashdec.c | 49 +++
 1 file changed, 45 insertions(+), 4 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 271202b0a5..2a4ef03967 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -85,6 +85,7 @@ struct representation {
 
 enum AVMediaType type;
 char id[20];
+char *lang;
 int bandwidth;
 AVRational framerate;
 AVStream *assoc_stream; /* demuxer stream associated with this 
representation */
@@ -144,6 +145,9 @@ typedef struct DASHContext {
 uint64_t period_duration;
 uint64_t period_start;
 
+/* AdaptationSet Attribute */
+char *adaptionset_lang;
+
 int is_live;
 AVIOInterruptCB *interrupt_callback;
 char *allowed_extensions;
@@ -872,6 +876,15 @@ static int parse_manifest_representation(AVFormatContext 
*s, const char *url,
 ret = AVERROR(ENOMEM);
 goto end;
 }
+if (c->adaptionset_lang) {
+rep->lang = av_strdup(c->adaptionset_lang);
+if (!rep->lang) {
+av_log(s, AV_LOG_ERROR, "alloc language memory failure\n");
+av_freep();
+ret = AVERROR(ENOMEM);
+goto end;
+}
+}
 rep->parent = s;
 representation_segmenttemplate_node = 
find_child_node_by_name(representation_node, "SegmentTemplate");
 representation_baseurl_node = 
find_child_node_by_name(representation_node, "BaseURL");
@@ -1103,6 +1116,19 @@ end:
 return ret;
 }
 
+static int parse_manifest_adaptationset_attr(AVFormatContext *s, xmlNodePtr 
adaptionset_node)
+{
+DASHContext *c = s->priv_data;
+
+if (!adaptionset_node) {
+av_log(s, AV_LOG_WARNING, "Cannot get AdaptionSet\n");
+return AVERROR(EINVAL);
+}
+c->adaptionset_lang = xmlGetProp(adaptionset_node, "lang");
+
+return 0;
+}
+
 static int parse_manifest_adaptationset(AVFormatContext *s, const char *url,
 xmlNodePtr adaptionset_node,
 xmlNodePtr mpd_baseurl_node,
@@ -,6 +1137,7 @@ static int parse_manifest_adaptationset(AVFormatContext 
*s, const char *url,
 xmlNodePtr period_segmentlist_node)
 {
 int ret = 0;
+DASHContext *c = s->priv_data;
 xmlNodePtr fragment_template_node = NULL;
 xmlNodePtr content_component_node = NULL;
 xmlNodePtr adaptionset_baseurl_node = NULL;
@@ -1118,6 +1145,10 @@ static int parse_manifest_adaptationset(AVFormatContext 
*s, const char *url,
 xmlNodePtr adaptionset_supplementalproperty_node = NULL;
 xmlNodePtr node = NULL;
 
+ret = parse_manifest_adaptationset_attr(s, adaptionset_node);
+if (ret < 0)
+return ret;
+
 node = xmlFirstElementChild(adaptionset_node);
 while (node) {
 if (!av_strcasecmp(node->name, (const char *)"SegmentTemplate")) {
@@ -1142,13 +1173,15 @@ static int parse_manifest_adaptationset(AVFormatContext 
*s, const char *url,
 adaptionset_baseurl_node,
 adaptionset_segmentlist_node,
 
adaptionset_supplementalproperty_node);
-if (ret < 0) {
-return ret;
-}
+if (ret < 0)
+goto err;
 }
 node = xmlNextElementSibling(node);
 }
-return 0;
+
+err:
+av_freep(>adaptionset_lang);
+return ret;
 }
 
 static int parse_programinformation(AVFormatContext *s, xmlNodePtr node)
@@ -2121,6 +2154,10 @@ static int dash_read_header(AVFormatContext *s)
 av_dict_set_int(>assoc_stream->metadata, 
"variant_bitrate", rep->bandwidth, 0);
 if (rep->id[0])
 av_dict_set(>assoc_stream->metadata, "id", rep->id, 0);
+if (rep->lang) {
+av_dict_set(>assoc_stream->metadata, "lang", rep->lang, 
0);
+av_freep(>lang);
+}
 }
 for (i = 0; i < c->n_subtitles; i++) {
 rep = c->subtitles[i];
@@ -2128,6 +2165,10 @@ static int dash_read_header(AVFormatContext *s)
 rep->assoc_stream = s->streams[rep->stream_index];
 if (rep->id[0])
 av_dict_set(>assoc_stream->metadata, "id", rep->id, 0);
+if (rep->lang) {
+av_dict_set(>assoc_stream->metadata, "lang", rep->lang, 
0);
+av_freep(>lang);
+}
 }
 }
 
-- 
2.25.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 v2 2/2] avformat: add demuxer for Pro Pinball Series' Soundbanks

2020-03-28 Thread Carl Eugen Hoyos
Am Fr., 27. März 2020 um 15:25 Uhr schrieb Zane van Iperen
:
>
> On Wed, 18 Mar 2020 15:19:19 +0100
> "Carl Eugen Hoyos"  wrote:
> >
> > Any restrictions on track_count and sample_rate that can be used for
> > auto-detection?
> >
>
> I've done a preliminary probe function. How's this?
>
> On all the files I tested, I received one of two values:
> 99 - For music (these have an extra condition I can test for)
> 87 - For everything else
>
> static int pp_bnk_probe(const AVProbeData *p)
> {
> PPBnkHeader hdr;
> uint32_t expected_sample_rate;
> int score;
>
> pp_bnk_parse_header(, p->buf);
>
> if (hdr.track_count == 0 || hdr.sample_rate == 0)
> return 0;
>
> score = 0;
>
> /* These limits are based on analysing the game files. */
> if (hdr.track_count <= 113)
> score += AVPROBE_SCORE_MAX / 4;
>
> if (hdr.sample_rate <= 44100)
> score += AVPROBE_SCORE_MAX / 4;
>
> if ((hdr.flags & ~PP_BNK_FLAG_MASK) == 0)
> score += AVPROBE_SCORE_MAX / 4;
>
> if ((hdr.flags & PP_BNK_FLAG_MUSIC) && hdr.track_count == 2)
> score += AVPROBE_SCORE_MAX / 8;
>
> /* Also check based on file extension, if we have it. */
> if (av_match_ext(p->filename, "5c"))
> expected_sample_rate = 5512;
> else if (av_match_ext(p->filename, "11c"))
> expected_sample_rate = 11025;
> else if (av_match_ext(p->filename, "22c"))
> expected_sample_rate = 22050;
> else if (av_match_ext(p->filename, "44c"))
> expected_sample_rate = 44100;
> else
> expected_sample_rate = 0;
>
> if (expected_sample_rate && hdr.sample_rate == expected_sample_rate)
> score += AVPROBE_SCORE_MAX / 8;
>
> return score;

Apart from what I wrote on irc:
What surprises me most is that iirc, you explained that the sample_rate
is written repeatedly to the file and is always identical in one file. Why
is that not checked?

You seem to have a fine (and small) collection of sample rates to check against.

Carl Eugen
___
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] avformat/dashdec: Don't allocate and leak strings that are never used

2020-03-28 Thread Steven Liu


> 2020年3月29日 上午8:32,Andreas Rheinhardt  写道:
> 
> Since commit e134c203 strdups of several elements of a manifest are kept
> in the DASHContext; but said commit completely forgot to free these
> strings again (with xmlFree()). Given that these strings are never used
> at all, this commit closes this leak by reverting said commit.
> 
> This reverts commit e134c20374ee3cbc6d04885d306b02c9871683a2.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
> The only change in comparison to [1] is that the commit message now
> contains the typical "git revert"-line, including the full hash of the
> commit to be reverted.
> 
> [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-March/258389.html
> 
> libavformat/dashdec.c | 27 ---
> 1 file changed, 27 deletions(-)
> 
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 5bbe5d3985..271202b0a5 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -122,19 +122,6 @@ struct representation {
> typedef struct DASHContext {
> const AVClass *class;
> char *base_url;
> -char *adaptionset_contenttype_val;
> -char *adaptionset_par_val;
> -char *adaptionset_lang_val;
> -char *adaptionset_minbw_val;
> -char *adaptionset_maxbw_val;
> -char *adaptionset_minwidth_val;
> -char *adaptionset_maxwidth_val;
> -char *adaptionset_minheight_val;
> -char *adaptionset_maxheight_val;
> -char *adaptionset_minframerate_val;
> -char *adaptionset_maxframerate_val;
> -char *adaptionset_segmentalignment_val;
> -char *adaptionset_bitstreamswitching_val;
> 
> int n_videos;
> struct representation **videos;
> @@ -1124,26 +,12 @@ static int 
> parse_manifest_adaptationset(AVFormatContext *s, const char *url,
> xmlNodePtr period_segmentlist_node)
> {
> int ret = 0;
> -DASHContext *c = s->priv_data;
> xmlNodePtr fragment_template_node = NULL;
> xmlNodePtr content_component_node = NULL;
> xmlNodePtr adaptionset_baseurl_node = NULL;
> xmlNodePtr adaptionset_segmentlist_node = NULL;
> xmlNodePtr adaptionset_supplementalproperty_node = NULL;
> xmlNodePtr node = NULL;
> -c->adaptionset_contenttype_val = xmlGetProp(adaptionset_node, 
> "contentType");
> -c->adaptionset_par_val = xmlGetProp(adaptionset_node, "par");
> -c->adaptionset_lang_val = xmlGetProp(adaptionset_node, "lang");
> -c->adaptionset_minbw_val = xmlGetProp(adaptionset_node, "minBandwidth");
> -c->adaptionset_maxbw_val = xmlGetProp(adaptionset_node, "maxBandwidth");
> -c->adaptionset_minwidth_val = xmlGetProp(adaptionset_node, "minWidth");
> -c->adaptionset_maxwidth_val = xmlGetProp(adaptionset_node, "maxWidth");
> -c->adaptionset_minheight_val = xmlGetProp(adaptionset_node, "minHeight");
> -c->adaptionset_maxheight_val = xmlGetProp(adaptionset_node, "maxHeight");
> -c->adaptionset_minframerate_val = xmlGetProp(adaptionset_node, 
> "minFrameRate");
> -c->adaptionset_maxframerate_val = xmlGetProp(adaptionset_node, 
> "maxFrameRate");
> -c->adaptionset_segmentalignment_val = xmlGetProp(adaptionset_node, 
> "segmentAlignment");
> -c->adaptionset_bitstreamswitching_val = xmlGetProp(adaptionset_node, 
> "bitstreamSwitching");
> 
> node = xmlFirstElementChild(adaptionset_node);
> while (node) {
> -- 
> 2.20.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".

Applied


Thanks

Steven Liu

___
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/dashdec: Don't allocate and leak strings that are never used

2020-03-28 Thread Steven Liu


> 2020年3月14日 上午3:14,Andreas Rheinhardt  写道:
> 
> Since commit e134c203 strdups of several elements of a manifest are kept
> in the DASHContext; but said commit completely forgot to free these
> strings again (with xmlFree()). Given that these strings are never used
> at all, this commit closes this leak by reverting said commit.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
> libavformat/dashdec.c | 27 ---
> 1 file changed, 27 deletions(-)
> 
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 5bbe5d3985..271202b0a5 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -122,19 +122,6 @@ struct representation {
> typedef struct DASHContext {
> const AVClass *class;
> char *base_url;
> -char *adaptionset_contenttype_val;
> -char *adaptionset_par_val;
> -char *adaptionset_lang_val;
> -char *adaptionset_minbw_val;
> -char *adaptionset_maxbw_val;
> -char *adaptionset_minwidth_val;
> -char *adaptionset_maxwidth_val;
> -char *adaptionset_minheight_val;
> -char *adaptionset_maxheight_val;
> -char *adaptionset_minframerate_val;
> -char *adaptionset_maxframerate_val;
> -char *adaptionset_segmentalignment_val;
> -char *adaptionset_bitstreamswitching_val;
> 
> int n_videos;
> struct representation **videos;
> @@ -1124,26 +,12 @@ static int 
> parse_manifest_adaptationset(AVFormatContext *s, const char *url,
> xmlNodePtr period_segmentlist_node)
> {
> int ret = 0;
> -DASHContext *c = s->priv_data;
> xmlNodePtr fragment_template_node = NULL;
> xmlNodePtr content_component_node = NULL;
> xmlNodePtr adaptionset_baseurl_node = NULL;
> xmlNodePtr adaptionset_segmentlist_node = NULL;
> xmlNodePtr adaptionset_supplementalproperty_node = NULL;
> xmlNodePtr node = NULL;
> -c->adaptionset_contenttype_val = xmlGetProp(adaptionset_node, 
> "contentType");
> -c->adaptionset_par_val = xmlGetProp(adaptionset_node, "par");
> -c->adaptionset_lang_val = xmlGetProp(adaptionset_node, "lang");
> -c->adaptionset_minbw_val = xmlGetProp(adaptionset_node, "minBandwidth");
> -c->adaptionset_maxbw_val = xmlGetProp(adaptionset_node, "maxBandwidth");
> -c->adaptionset_minwidth_val = xmlGetProp(adaptionset_node, "minWidth");
> -c->adaptionset_maxwidth_val = xmlGetProp(adaptionset_node, "maxWidth");
> -c->adaptionset_minheight_val = xmlGetProp(adaptionset_node, "minHeight");
> -c->adaptionset_maxheight_val = xmlGetProp(adaptionset_node, "maxHeight");
> -c->adaptionset_minframerate_val = xmlGetProp(adaptionset_node, 
> "minFrameRate");
> -c->adaptionset_maxframerate_val = xmlGetProp(adaptionset_node, 
> "maxFrameRate");
> -c->adaptionset_segmentalignment_val = xmlGetProp(adaptionset_node, 
> "segmentAlignment");
> -c->adaptionset_bitstreamswitching_val = xmlGetProp(adaptionset_node, 
> "bitstreamSwitching");
> 
> node = xmlFirstElementChild(adaptionset_node);
> while (node) {
> -- 
> 2.20.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".

This is ok, but I think the comment should modify, because these variable will 
be used after merge this patch,
I think just name revert the e134c20374ee3cbc6d04885d306b02c9871683a2 is ok.

Thanks

Steven Liu

___
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 2/3] avfilter/vf_mix: Check sscanf() return value

2020-03-28 Thread Nicolas George
Limin Wang (12020-03-29):
> Anyway if the user option is typo, 
> the result may be unexpected for user. 

But your change does not address that. For that, you would print a
message and return an error. Which is probably the right thing to do,
actually.

Regards,

-- 
  Nicolas George


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".

[FFmpeg-devel] [PATCH v2] avformat/dashdec: Don't allocate and leak strings that are never used

2020-03-28 Thread Andreas Rheinhardt
Since commit e134c203 strdups of several elements of a manifest are kept
in the DASHContext; but said commit completely forgot to free these
strings again (with xmlFree()). Given that these strings are never used
at all, this commit closes this leak by reverting said commit.

This reverts commit e134c20374ee3cbc6d04885d306b02c9871683a2.

Signed-off-by: Andreas Rheinhardt 
---
The only change in comparison to [1] is that the commit message now
contains the typical "git revert"-line, including the full hash of the
commit to be reverted.

[1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-March/258389.html

 libavformat/dashdec.c | 27 ---
 1 file changed, 27 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 5bbe5d3985..271202b0a5 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -122,19 +122,6 @@ struct representation {
 typedef struct DASHContext {
 const AVClass *class;
 char *base_url;
-char *adaptionset_contenttype_val;
-char *adaptionset_par_val;
-char *adaptionset_lang_val;
-char *adaptionset_minbw_val;
-char *adaptionset_maxbw_val;
-char *adaptionset_minwidth_val;
-char *adaptionset_maxwidth_val;
-char *adaptionset_minheight_val;
-char *adaptionset_maxheight_val;
-char *adaptionset_minframerate_val;
-char *adaptionset_maxframerate_val;
-char *adaptionset_segmentalignment_val;
-char *adaptionset_bitstreamswitching_val;
 
 int n_videos;
 struct representation **videos;
@@ -1124,26 +,12 @@ static int parse_manifest_adaptationset(AVFormatContext 
*s, const char *url,
 xmlNodePtr period_segmentlist_node)
 {
 int ret = 0;
-DASHContext *c = s->priv_data;
 xmlNodePtr fragment_template_node = NULL;
 xmlNodePtr content_component_node = NULL;
 xmlNodePtr adaptionset_baseurl_node = NULL;
 xmlNodePtr adaptionset_segmentlist_node = NULL;
 xmlNodePtr adaptionset_supplementalproperty_node = NULL;
 xmlNodePtr node = NULL;
-c->adaptionset_contenttype_val = xmlGetProp(adaptionset_node, 
"contentType");
-c->adaptionset_par_val = xmlGetProp(adaptionset_node, "par");
-c->adaptionset_lang_val = xmlGetProp(adaptionset_node, "lang");
-c->adaptionset_minbw_val = xmlGetProp(adaptionset_node, "minBandwidth");
-c->adaptionset_maxbw_val = xmlGetProp(adaptionset_node, "maxBandwidth");
-c->adaptionset_minwidth_val = xmlGetProp(adaptionset_node, "minWidth");
-c->adaptionset_maxwidth_val = xmlGetProp(adaptionset_node, "maxWidth");
-c->adaptionset_minheight_val = xmlGetProp(adaptionset_node, "minHeight");
-c->adaptionset_maxheight_val = xmlGetProp(adaptionset_node, "maxHeight");
-c->adaptionset_minframerate_val = xmlGetProp(adaptionset_node, 
"minFrameRate");
-c->adaptionset_maxframerate_val = xmlGetProp(adaptionset_node, 
"maxFrameRate");
-c->adaptionset_segmentalignment_val = xmlGetProp(adaptionset_node, 
"segmentAlignment");
-c->adaptionset_bitstreamswitching_val = xmlGetProp(adaptionset_node, 
"bitstreamSwitching");
 
 node = xmlFirstElementChild(adaptionset_node);
 while (node) {
-- 
2.20.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".

Re: [FFmpeg-devel] [PATCH v4 1/2] Revert "avformat/dashdec: refine adaptionset attribute members"

2020-03-28 Thread Steven Liu


> 2020年3月29日 上午8:24,Andreas Rheinhardt  写道:
> 
> Steven Liu:
>> 
>> 
>>> 2020年3月29日 上午8:12,Andreas Rheinhardt  写道:
>>> 
>>> Steven Liu:
 
 
> 2020年3月29日 上午8:03,Andreas Rheinhardt  写道:
> 
> Steven Liu:
>> 
>> 
>>> 2020年3月29日 上午7:48,Andreas Rheinhardt  写道:
>>> 
>>> Steven Liu:
 This reverts commit e134c20374ee3cbc6d04885d306b02c9871683a2.
 
 Signed-off-by: Steven Liu 
 ---
 libavformat/dashdec.c | 27 ---
 1 file changed, 27 deletions(-)
 
 diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
 index 5bbe5d3985..271202b0a5 100644
 --- a/libavformat/dashdec.c
 +++ b/libavformat/dashdec.c
 @@ -122,19 +122,6 @@ struct representation {
 typedef struct DASHContext {
  const AVClass *class;
  char *base_url;
 -char *adaptionset_contenttype_val;
 -char *adaptionset_par_val;
 -char *adaptionset_lang_val;
 -char *adaptionset_minbw_val;
 -char *adaptionset_maxbw_val;
 -char *adaptionset_minwidth_val;
 -char *adaptionset_maxwidth_val;
 -char *adaptionset_minheight_val;
 -char *adaptionset_maxheight_val;
 -char *adaptionset_minframerate_val;
 -char *adaptionset_maxframerate_val;
 -char *adaptionset_segmentalignment_val;
 -char *adaptionset_bitstreamswitching_val;
 
  int n_videos;
  struct representation **videos;
 @@ -1124,26 +,12 @@ static int 
 parse_manifest_adaptationset(AVFormatContext *s, const char *url,
  xmlNodePtr 
 period_segmentlist_node)
 {
  int ret = 0;
 -DASHContext *c = s->priv_data;
  xmlNodePtr fragment_template_node = NULL;
  xmlNodePtr content_component_node = NULL;
  xmlNodePtr adaptionset_baseurl_node = NULL;
  xmlNodePtr adaptionset_segmentlist_node = NULL;
  xmlNodePtr adaptionset_supplementalproperty_node = NULL;
  xmlNodePtr node = NULL;
 -c->adaptionset_contenttype_val = xmlGetProp(adaptionset_node, 
 "contentType");
 -c->adaptionset_par_val = xmlGetProp(adaptionset_node, "par");
 -c->adaptionset_lang_val = xmlGetProp(adaptionset_node, "lang");
 -c->adaptionset_minbw_val = xmlGetProp(adaptionset_node, 
 "minBandwidth");
 -c->adaptionset_maxbw_val = xmlGetProp(adaptionset_node, 
 "maxBandwidth");
 -c->adaptionset_minwidth_val = xmlGetProp(adaptionset_node, 
 "minWidth");
 -c->adaptionset_maxwidth_val = xmlGetProp(adaptionset_node, 
 "maxWidth");
 -c->adaptionset_minheight_val = xmlGetProp(adaptionset_node, 
 "minHeight");
 -c->adaptionset_maxheight_val = xmlGetProp(adaptionset_node, 
 "maxHeight");
 -c->adaptionset_minframerate_val = xmlGetProp(adaptionset_node, 
 "minFrameRate");
 -c->adaptionset_maxframerate_val = xmlGetProp(adaptionset_node, 
 "maxFrameRate");
 -c->adaptionset_segmentalignment_val = 
 xmlGetProp(adaptionset_node, "segmentAlignment");
 -c->adaptionset_bitstreamswitching_val = 
 xmlGetProp(adaptionset_node, "bitstreamSwitching");
 
  node = xmlFirstElementChild(adaptionset_node);
  while (node) {
 
>>> Is there a reason you are not simply using my patch for this? It has a
>>> better commit message. Do you mind if I apply my patch?
>> This is revert, your patch is delete, isn't it?
> 
> My patch has the same diff as yours. Given that the patch to be reverted
> didn't delete anything, its revert just removes lines and doesn't add
> any old lines back.
 No, your patch is a patch commit, this is a git revert, this can revert 
 the old commit, your patch can save old commit.
>>> 
>>> What? A revert (whether it is yours or mine) is a patch on top of
>>> current master (or on top of the old branches that you backport it to);
>>> it does not remove the old commit from the repo. Removing the old commit
>>> would only be possible if one rewrote history, but this should never be
>>> done as soon as others have based work on it (for FFmpeg this means:
>>> what has been committed to the main repo can never be removed, only
>>> reverted; but you can rewrite history of your private developer branches
>>> any time).
>> For example:
>> 
>> commit de1b2aa7968343fe70ca924f473d9b53eeb85490
>> Author: Guo, Yejun 
>> Date:   Wed Jan 29 01:15:28 2020 +0100
>> 
>>Revert "fate/filter-video: add two tests for dnn_processing with frame 
>> format rgb24 and grayf32"
>> 
>>The tests broke fate without SAMPLES and fate on some platforms.
>>This reverts commit 

Re: [FFmpeg-devel] [PATCH v4 1/2] Revert "avformat/dashdec: refine adaptionset attribute members"

2020-03-28 Thread Steven Liu


> 2020年3月29日 上午8:24,Andreas Rheinhardt  写道:
> 
> Steven Liu:
>> 
>> 
>>> 2020年3月29日 上午8:12,Andreas Rheinhardt  写道:
>>> 
>>> Steven Liu:
 
 
> 2020年3月29日 上午8:03,Andreas Rheinhardt  写道:
> 
> Steven Liu:
>> 
>> 
>>> 2020年3月29日 上午7:48,Andreas Rheinhardt  写道:
>>> 
>>> Steven Liu:
 This reverts commit e134c20374ee3cbc6d04885d306b02c9871683a2.
 
 Signed-off-by: Steven Liu 
 ---
 libavformat/dashdec.c | 27 ---
 1 file changed, 27 deletions(-)
 
 diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
 index 5bbe5d3985..271202b0a5 100644
 --- a/libavformat/dashdec.c
 +++ b/libavformat/dashdec.c
 @@ -122,19 +122,6 @@ struct representation {
 typedef struct DASHContext {
 const AVClass *class;
 char *base_url;
 -char *adaptionset_contenttype_val;
 -char *adaptionset_par_val;
 -char *adaptionset_lang_val;
 -char *adaptionset_minbw_val;
 -char *adaptionset_maxbw_val;
 -char *adaptionset_minwidth_val;
 -char *adaptionset_maxwidth_val;
 -char *adaptionset_minheight_val;
 -char *adaptionset_maxheight_val;
 -char *adaptionset_minframerate_val;
 -char *adaptionset_maxframerate_val;
 -char *adaptionset_segmentalignment_val;
 -char *adaptionset_bitstreamswitching_val;
 
 int n_videos;
 struct representation **videos;
 @@ -1124,26 +,12 @@ static int 
 parse_manifest_adaptationset(AVFormatContext *s, const char *url,
 xmlNodePtr period_segmentlist_node)
 {
 int ret = 0;
 -DASHContext *c = s->priv_data;
 xmlNodePtr fragment_template_node = NULL;
 xmlNodePtr content_component_node = NULL;
 xmlNodePtr adaptionset_baseurl_node = NULL;
 xmlNodePtr adaptionset_segmentlist_node = NULL;
 xmlNodePtr adaptionset_supplementalproperty_node = NULL;
 xmlNodePtr node = NULL;
 -c->adaptionset_contenttype_val = xmlGetProp(adaptionset_node, 
 "contentType");
 -c->adaptionset_par_val = xmlGetProp(adaptionset_node, "par");
 -c->adaptionset_lang_val = xmlGetProp(adaptionset_node, "lang");
 -c->adaptionset_minbw_val = xmlGetProp(adaptionset_node, 
 "minBandwidth");
 -c->adaptionset_maxbw_val = xmlGetProp(adaptionset_node, 
 "maxBandwidth");
 -c->adaptionset_minwidth_val = xmlGetProp(adaptionset_node, 
 "minWidth");
 -c->adaptionset_maxwidth_val = xmlGetProp(adaptionset_node, 
 "maxWidth");
 -c->adaptionset_minheight_val = xmlGetProp(adaptionset_node, 
 "minHeight");
 -c->adaptionset_maxheight_val = xmlGetProp(adaptionset_node, 
 "maxHeight");
 -c->adaptionset_minframerate_val = xmlGetProp(adaptionset_node, 
 "minFrameRate");
 -c->adaptionset_maxframerate_val = xmlGetProp(adaptionset_node, 
 "maxFrameRate");
 -c->adaptionset_segmentalignment_val = 
 xmlGetProp(adaptionset_node, "segmentAlignment");
 -c->adaptionset_bitstreamswitching_val = 
 xmlGetProp(adaptionset_node, "bitstreamSwitching");
 
 node = xmlFirstElementChild(adaptionset_node);
 while (node) {
 
>>> Is there a reason you are not simply using my patch for this? It has a
>>> better commit message. Do you mind if I apply my patch?
>> This is revert, your patch is delete, isn't it?
> 
> My patch has the same diff as yours. Given that the patch to be reverted
> didn't delete anything, its revert just removes lines and doesn't add
> any old lines back.
 No, your patch is a patch commit, this is a git revert, this can revert 
 the old commit, your patch can save old commit.
>>> 
>>> What? A revert (whether it is yours or mine) is a patch on top of
>>> current master (or on top of the old branches that you backport it to);
>>> it does not remove the old commit from the repo. Removing the old commit
>>> would only be possible if one rewrote history, but this should never be
>>> done as soon as others have based work on it (for FFmpeg this means:
>>> what has been committed to the main repo can never be removed, only
>>> reverted; but you can rewrite history of your private developer branches
>>> any time).
>> For example:
>> 
>> commit de1b2aa7968343fe70ca924f473d9b53eeb85490
>> Author: Guo, Yejun 
>> Date:   Wed Jan 29 01:15:28 2020 +0100
>> 
>>   Revert "fate/filter-video: add two tests for dnn_processing with frame 
>> format rgb24 and grayf32"
>> 
>>   The tests broke fate without SAMPLES and fate on some platforms.
>>   This reverts commit 95ade711eb4afb8b76a765ef6571e7934ad7f8cc.
>> 

Re: [FFmpeg-devel] [PATCH v4 1/2] Revert "avformat/dashdec: refine adaptionset attribute members"

2020-03-28 Thread Andreas Rheinhardt
Steven Liu:
> 
> 
>> 2020年3月29日 上午8:12,Andreas Rheinhardt  写道:
>>
>> Steven Liu:
>>>
>>>
 2020年3月29日 上午8:03,Andreas Rheinhardt  写道:

 Steven Liu:
>
>
>> 2020年3月29日 上午7:48,Andreas Rheinhardt  写道:
>>
>> Steven Liu:
>>> This reverts commit e134c20374ee3cbc6d04885d306b02c9871683a2.
>>>
>>> Signed-off-by: Steven Liu 
>>> ---
>>> libavformat/dashdec.c | 27 ---
>>> 1 file changed, 27 deletions(-)
>>>
>>> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
>>> index 5bbe5d3985..271202b0a5 100644
>>> --- a/libavformat/dashdec.c
>>> +++ b/libavformat/dashdec.c
>>> @@ -122,19 +122,6 @@ struct representation {
>>> typedef struct DASHContext {
>>>   const AVClass *class;
>>>   char *base_url;
>>> -char *adaptionset_contenttype_val;
>>> -char *adaptionset_par_val;
>>> -char *adaptionset_lang_val;
>>> -char *adaptionset_minbw_val;
>>> -char *adaptionset_maxbw_val;
>>> -char *adaptionset_minwidth_val;
>>> -char *adaptionset_maxwidth_val;
>>> -char *adaptionset_minheight_val;
>>> -char *adaptionset_maxheight_val;
>>> -char *adaptionset_minframerate_val;
>>> -char *adaptionset_maxframerate_val;
>>> -char *adaptionset_segmentalignment_val;
>>> -char *adaptionset_bitstreamswitching_val;
>>>
>>>   int n_videos;
>>>   struct representation **videos;
>>> @@ -1124,26 +,12 @@ static int 
>>> parse_manifest_adaptationset(AVFormatContext *s, const char *url,
>>>   xmlNodePtr 
>>> period_segmentlist_node)
>>> {
>>>   int ret = 0;
>>> -DASHContext *c = s->priv_data;
>>>   xmlNodePtr fragment_template_node = NULL;
>>>   xmlNodePtr content_component_node = NULL;
>>>   xmlNodePtr adaptionset_baseurl_node = NULL;
>>>   xmlNodePtr adaptionset_segmentlist_node = NULL;
>>>   xmlNodePtr adaptionset_supplementalproperty_node = NULL;
>>>   xmlNodePtr node = NULL;
>>> -c->adaptionset_contenttype_val = xmlGetProp(adaptionset_node, 
>>> "contentType");
>>> -c->adaptionset_par_val = xmlGetProp(adaptionset_node, "par");
>>> -c->adaptionset_lang_val = xmlGetProp(adaptionset_node, "lang");
>>> -c->adaptionset_minbw_val = xmlGetProp(adaptionset_node, 
>>> "minBandwidth");
>>> -c->adaptionset_maxbw_val = xmlGetProp(adaptionset_node, 
>>> "maxBandwidth");
>>> -c->adaptionset_minwidth_val = xmlGetProp(adaptionset_node, 
>>> "minWidth");
>>> -c->adaptionset_maxwidth_val = xmlGetProp(adaptionset_node, 
>>> "maxWidth");
>>> -c->adaptionset_minheight_val = xmlGetProp(adaptionset_node, 
>>> "minHeight");
>>> -c->adaptionset_maxheight_val = xmlGetProp(adaptionset_node, 
>>> "maxHeight");
>>> -c->adaptionset_minframerate_val = xmlGetProp(adaptionset_node, 
>>> "minFrameRate");
>>> -c->adaptionset_maxframerate_val = xmlGetProp(adaptionset_node, 
>>> "maxFrameRate");
>>> -c->adaptionset_segmentalignment_val = xmlGetProp(adaptionset_node, 
>>> "segmentAlignment");
>>> -c->adaptionset_bitstreamswitching_val = 
>>> xmlGetProp(adaptionset_node, "bitstreamSwitching");
>>>
>>>   node = xmlFirstElementChild(adaptionset_node);
>>>   while (node) {
>>>
>> Is there a reason you are not simply using my patch for this? It has a
>> better commit message. Do you mind if I apply my patch?
> This is revert, your patch is delete, isn't it?

 My patch has the same diff as yours. Given that the patch to be reverted
 didn't delete anything, its revert just removes lines and doesn't add
 any old lines back.
>>> No, your patch is a patch commit, this is a git revert, this can revert the 
>>> old commit, your patch can save old commit.
>>
>> What? A revert (whether it is yours or mine) is a patch on top of
>> current master (or on top of the old branches that you backport it to);
>> it does not remove the old commit from the repo. Removing the old commit
>> would only be possible if one rewrote history, but this should never be
>> done as soon as others have based work on it (for FFmpeg this means:
>> what has been committed to the main repo can never be removed, only
>> reverted; but you can rewrite history of your private developer branches
>> any time).
> For example:
> 
> commit de1b2aa7968343fe70ca924f473d9b53eeb85490
> Author: Guo, Yejun 
> Date:   Wed Jan 29 01:15:28 2020 +0100
> 
> Revert "fate/filter-video: add two tests for dnn_processing with frame 
> format rgb24 and grayf32"
> 
> The tests broke fate without SAMPLES and fate on some platforms.
> This reverts commit 95ade711eb4afb8b76a765ef6571e7934ad7f8cc.
> 
> (base) liuqi05:ffmpeg liuqi$ git log | grep 
> 95ade711eb4afb8b76a765ef6571e7934ad7f8cc.
> This reverts commit 

Re: [FFmpeg-devel] [PATCH v4 1/2] Revert "avformat/dashdec: refine adaptionset attribute members"

2020-03-28 Thread Steven Liu


> 2020年3月29日 上午8:20,Andreas Rheinhardt  写道:
> 
> Steven Liu:
>> 
>> 
>>> 2020年3月29日 上午8:05,Steven Liu  写道:
>>> 
>>> 
 2020年3月29日 上午8:03,Andreas Rheinhardt  写道:
 
 Steven Liu:
> 
> 
>> 2020年3月29日 上午7:48,Andreas Rheinhardt  写道:
>> 
>> Steven Liu:
>>> This reverts commit e134c20374ee3cbc6d04885d306b02c9871683a2.
>>> 
>>> Signed-off-by: Steven Liu 
>>> ---
>>> libavformat/dashdec.c | 27 ---
>>> 1 file changed, 27 deletions(-)
>>> 
>>> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
>>> index 5bbe5d3985..271202b0a5 100644
>>> --- a/libavformat/dashdec.c
>>> +++ b/libavformat/dashdec.c
>>> @@ -122,19 +122,6 @@ struct representation {
>>> typedef struct DASHContext {
>>>  const AVClass *class;
>>>  char *base_url;
>>> -char *adaptionset_contenttype_val;
>>> -char *adaptionset_par_val;
>>> -char *adaptionset_lang_val;
>>> -char *adaptionset_minbw_val;
>>> -char *adaptionset_maxbw_val;
>>> -char *adaptionset_minwidth_val;
>>> -char *adaptionset_maxwidth_val;
>>> -char *adaptionset_minheight_val;
>>> -char *adaptionset_maxheight_val;
>>> -char *adaptionset_minframerate_val;
>>> -char *adaptionset_maxframerate_val;
>>> -char *adaptionset_segmentalignment_val;
>>> -char *adaptionset_bitstreamswitching_val;
>>> 
>>>  int n_videos;
>>>  struct representation **videos;
>>> @@ -1124,26 +,12 @@ static int 
>>> parse_manifest_adaptationset(AVFormatContext *s, const char *url,
>>>  xmlNodePtr period_segmentlist_node)
>>> {
>>>  int ret = 0;
>>> -DASHContext *c = s->priv_data;
>>>  xmlNodePtr fragment_template_node = NULL;
>>>  xmlNodePtr content_component_node = NULL;
>>>  xmlNodePtr adaptionset_baseurl_node = NULL;
>>>  xmlNodePtr adaptionset_segmentlist_node = NULL;
>>>  xmlNodePtr adaptionset_supplementalproperty_node = NULL;
>>>  xmlNodePtr node = NULL;
>>> -c->adaptionset_contenttype_val = xmlGetProp(adaptionset_node, 
>>> "contentType");
>>> -c->adaptionset_par_val = xmlGetProp(adaptionset_node, "par");
>>> -c->adaptionset_lang_val = xmlGetProp(adaptionset_node, "lang");
>>> -c->adaptionset_minbw_val = xmlGetProp(adaptionset_node, 
>>> "minBandwidth");
>>> -c->adaptionset_maxbw_val = xmlGetProp(adaptionset_node, 
>>> "maxBandwidth");
>>> -c->adaptionset_minwidth_val = xmlGetProp(adaptionset_node, 
>>> "minWidth");
>>> -c->adaptionset_maxwidth_val = xmlGetProp(adaptionset_node, 
>>> "maxWidth");
>>> -c->adaptionset_minheight_val = xmlGetProp(adaptionset_node, 
>>> "minHeight");
>>> -c->adaptionset_maxheight_val = xmlGetProp(adaptionset_node, 
>>> "maxHeight");
>>> -c->adaptionset_minframerate_val = xmlGetProp(adaptionset_node, 
>>> "minFrameRate");
>>> -c->adaptionset_maxframerate_val = xmlGetProp(adaptionset_node, 
>>> "maxFrameRate");
>>> -c->adaptionset_segmentalignment_val = xmlGetProp(adaptionset_node, 
>>> "segmentAlignment");
>>> -c->adaptionset_bitstreamswitching_val = 
>>> xmlGetProp(adaptionset_node, "bitstreamSwitching");
>>> 
>>>  node = xmlFirstElementChild(adaptionset_node);
>>>  while (node) {
>>> 
>> Is there a reason you are not simply using my patch for this? It has a
>> better commit message. Do you mind if I apply my patch?
> This is revert, your patch is delete, isn't it?
 
 My patch has the same diff as yours. Given that the patch to be reverted
 didn't delete anything, its revert just removes lines and doesn't add
 any old lines back.
>>> No, your patch is a patch commit, this is a git revert, this can revert the 
>>> old commit, your patch can save old commit.
>> Example:
>> After revert, you cannot find the commit use git log
>> e134c20374ee3cbc6d04885d306b02c9871683a2.
>> 
> This is wrong. You can still find the commit with "git log
> e134c20374ee3cbc6d04885d306b02c9871683a2" or "git show
> e134c20374ee3cbc6d04885d306b02c9871683a2" and other git tools.
> 
>> But after your patch, you can find the commit use git log
>> e134c20374ee3cbc6d04885d306b02c9871683a2.
> 
> And actually it is intended that the commit can still be found (after
> all, this commit is part of FFmpeg's history).
Other example:

(base) liuqi05:ffmpeg liuqi$ git show dbd3dbb4766126a806e7aeaa3e2dfbc3557f66f9
commit dbd3dbb4766126a806e7aeaa3e2dfbc3557f66f9
Author: Carl Eugen Hoyos 
Date:   Thu Sep 26 00:34:44 2019 +0200

Revert "lavc/tiff: correct the default value of YCbCrSubsampling to 2x2"

This reverts commit eb5d0f18ff609ba2280cea4e2c6286d216c8756b.

Together with 89f464e9, it breaks decoding of tiff files like 
fate-suite/exif/image_small.tiff

diff --git a/libavcodec/tiff.c 

Re: [FFmpeg-devel] [PATCH v4 1/2] Revert "avformat/dashdec: refine adaptionset attribute members"

2020-03-28 Thread Andreas Rheinhardt
Steven Liu:
> 
> 
>> 2020年3月29日 上午8:05,Steven Liu  写道:
>>
>>
>>> 2020年3月29日 上午8:03,Andreas Rheinhardt  写道:
>>>
>>> Steven Liu:


> 2020年3月29日 上午7:48,Andreas Rheinhardt  写道:
>
> Steven Liu:
>> This reverts commit e134c20374ee3cbc6d04885d306b02c9871683a2.
>>
>> Signed-off-by: Steven Liu 
>> ---
>> libavformat/dashdec.c | 27 ---
>> 1 file changed, 27 deletions(-)
>>
>> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
>> index 5bbe5d3985..271202b0a5 100644
>> --- a/libavformat/dashdec.c
>> +++ b/libavformat/dashdec.c
>> @@ -122,19 +122,6 @@ struct representation {
>> typedef struct DASHContext {
>>   const AVClass *class;
>>   char *base_url;
>> -char *adaptionset_contenttype_val;
>> -char *adaptionset_par_val;
>> -char *adaptionset_lang_val;
>> -char *adaptionset_minbw_val;
>> -char *adaptionset_maxbw_val;
>> -char *adaptionset_minwidth_val;
>> -char *adaptionset_maxwidth_val;
>> -char *adaptionset_minheight_val;
>> -char *adaptionset_maxheight_val;
>> -char *adaptionset_minframerate_val;
>> -char *adaptionset_maxframerate_val;
>> -char *adaptionset_segmentalignment_val;
>> -char *adaptionset_bitstreamswitching_val;
>>
>>   int n_videos;
>>   struct representation **videos;
>> @@ -1124,26 +,12 @@ static int 
>> parse_manifest_adaptationset(AVFormatContext *s, const char *url,
>>   xmlNodePtr period_segmentlist_node)
>> {
>>   int ret = 0;
>> -DASHContext *c = s->priv_data;
>>   xmlNodePtr fragment_template_node = NULL;
>>   xmlNodePtr content_component_node = NULL;
>>   xmlNodePtr adaptionset_baseurl_node = NULL;
>>   xmlNodePtr adaptionset_segmentlist_node = NULL;
>>   xmlNodePtr adaptionset_supplementalproperty_node = NULL;
>>   xmlNodePtr node = NULL;
>> -c->adaptionset_contenttype_val = xmlGetProp(adaptionset_node, 
>> "contentType");
>> -c->adaptionset_par_val = xmlGetProp(adaptionset_node, "par");
>> -c->adaptionset_lang_val = xmlGetProp(adaptionset_node, "lang");
>> -c->adaptionset_minbw_val = xmlGetProp(adaptionset_node, 
>> "minBandwidth");
>> -c->adaptionset_maxbw_val = xmlGetProp(adaptionset_node, 
>> "maxBandwidth");
>> -c->adaptionset_minwidth_val = xmlGetProp(adaptionset_node, 
>> "minWidth");
>> -c->adaptionset_maxwidth_val = xmlGetProp(adaptionset_node, 
>> "maxWidth");
>> -c->adaptionset_minheight_val = xmlGetProp(adaptionset_node, 
>> "minHeight");
>> -c->adaptionset_maxheight_val = xmlGetProp(adaptionset_node, 
>> "maxHeight");
>> -c->adaptionset_minframerate_val = xmlGetProp(adaptionset_node, 
>> "minFrameRate");
>> -c->adaptionset_maxframerate_val = xmlGetProp(adaptionset_node, 
>> "maxFrameRate");
>> -c->adaptionset_segmentalignment_val = xmlGetProp(adaptionset_node, 
>> "segmentAlignment");
>> -c->adaptionset_bitstreamswitching_val = 
>> xmlGetProp(adaptionset_node, "bitstreamSwitching");
>>
>>   node = xmlFirstElementChild(adaptionset_node);
>>   while (node) {
>>
> Is there a reason you are not simply using my patch for this? It has a
> better commit message. Do you mind if I apply my patch?
 This is revert, your patch is delete, isn't it?
>>>
>>> My patch has the same diff as yours. Given that the patch to be reverted
>>> didn't delete anything, its revert just removes lines and doesn't add
>>> any old lines back.
>> No, your patch is a patch commit, this is a git revert, this can revert the 
>> old commit, your patch can save old commit.
> Example:
> After revert, you cannot find the commit use git log
> e134c20374ee3cbc6d04885d306b02c9871683a2.
> 
This is wrong. You can still find the commit with "git log
e134c20374ee3cbc6d04885d306b02c9871683a2" or "git show
e134c20374ee3cbc6d04885d306b02c9871683a2" and other git tools.

> But after your patch, you can find the commit use git log
> e134c20374ee3cbc6d04885d306b02c9871683a2.

And actually it is intended that the commit can still be found (after
all, this commit is part of FFmpeg's history).

- 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 v4 1/2] Revert "avformat/dashdec: refine adaptionset attribute members"

2020-03-28 Thread Steven Liu


> 2020年3月29日 上午8:12,Andreas Rheinhardt  写道:
> 
> Steven Liu:
>> 
>> 
>>> 2020年3月29日 上午8:03,Andreas Rheinhardt  写道:
>>> 
>>> Steven Liu:
 
 
> 2020年3月29日 上午7:48,Andreas Rheinhardt  写道:
> 
> Steven Liu:
>> This reverts commit e134c20374ee3cbc6d04885d306b02c9871683a2.
>> 
>> Signed-off-by: Steven Liu 
>> ---
>> libavformat/dashdec.c | 27 ---
>> 1 file changed, 27 deletions(-)
>> 
>> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
>> index 5bbe5d3985..271202b0a5 100644
>> --- a/libavformat/dashdec.c
>> +++ b/libavformat/dashdec.c
>> @@ -122,19 +122,6 @@ struct representation {
>> typedef struct DASHContext {
>>   const AVClass *class;
>>   char *base_url;
>> -char *adaptionset_contenttype_val;
>> -char *adaptionset_par_val;
>> -char *adaptionset_lang_val;
>> -char *adaptionset_minbw_val;
>> -char *adaptionset_maxbw_val;
>> -char *adaptionset_minwidth_val;
>> -char *adaptionset_maxwidth_val;
>> -char *adaptionset_minheight_val;
>> -char *adaptionset_maxheight_val;
>> -char *adaptionset_minframerate_val;
>> -char *adaptionset_maxframerate_val;
>> -char *adaptionset_segmentalignment_val;
>> -char *adaptionset_bitstreamswitching_val;
>> 
>>   int n_videos;
>>   struct representation **videos;
>> @@ -1124,26 +,12 @@ static int 
>> parse_manifest_adaptationset(AVFormatContext *s, const char *url,
>>   xmlNodePtr period_segmentlist_node)
>> {
>>   int ret = 0;
>> -DASHContext *c = s->priv_data;
>>   xmlNodePtr fragment_template_node = NULL;
>>   xmlNodePtr content_component_node = NULL;
>>   xmlNodePtr adaptionset_baseurl_node = NULL;
>>   xmlNodePtr adaptionset_segmentlist_node = NULL;
>>   xmlNodePtr adaptionset_supplementalproperty_node = NULL;
>>   xmlNodePtr node = NULL;
>> -c->adaptionset_contenttype_val = xmlGetProp(adaptionset_node, 
>> "contentType");
>> -c->adaptionset_par_val = xmlGetProp(adaptionset_node, "par");
>> -c->adaptionset_lang_val = xmlGetProp(adaptionset_node, "lang");
>> -c->adaptionset_minbw_val = xmlGetProp(adaptionset_node, 
>> "minBandwidth");
>> -c->adaptionset_maxbw_val = xmlGetProp(adaptionset_node, 
>> "maxBandwidth");
>> -c->adaptionset_minwidth_val = xmlGetProp(adaptionset_node, 
>> "minWidth");
>> -c->adaptionset_maxwidth_val = xmlGetProp(adaptionset_node, 
>> "maxWidth");
>> -c->adaptionset_minheight_val = xmlGetProp(adaptionset_node, 
>> "minHeight");
>> -c->adaptionset_maxheight_val = xmlGetProp(adaptionset_node, 
>> "maxHeight");
>> -c->adaptionset_minframerate_val = xmlGetProp(adaptionset_node, 
>> "minFrameRate");
>> -c->adaptionset_maxframerate_val = xmlGetProp(adaptionset_node, 
>> "maxFrameRate");
>> -c->adaptionset_segmentalignment_val = xmlGetProp(adaptionset_node, 
>> "segmentAlignment");
>> -c->adaptionset_bitstreamswitching_val = 
>> xmlGetProp(adaptionset_node, "bitstreamSwitching");
>> 
>>   node = xmlFirstElementChild(adaptionset_node);
>>   while (node) {
>> 
> Is there a reason you are not simply using my patch for this? It has a
> better commit message. Do you mind if I apply my patch?
 This is revert, your patch is delete, isn't it?
>>> 
>>> My patch has the same diff as yours. Given that the patch to be reverted
>>> didn't delete anything, its revert just removes lines and doesn't add
>>> any old lines back.
>> No, your patch is a patch commit, this is a git revert, this can revert the 
>> old commit, your patch can save old commit.
> 
> What? A revert (whether it is yours or mine) is a patch on top of
> current master (or on top of the old branches that you backport it to);
> it does not remove the old commit from the repo. Removing the old commit
> would only be possible if one rewrote history, but this should never be
> done as soon as others have based work on it (for FFmpeg this means:
> what has been committed to the main repo can never be removed, only
> reverted; but you can rewrite history of your private developer branches
> any time).
For example:

commit de1b2aa7968343fe70ca924f473d9b53eeb85490
Author: Guo, Yejun 
Date:   Wed Jan 29 01:15:28 2020 +0100

Revert "fate/filter-video: add two tests for dnn_processing with frame 
format rgb24 and grayf32"

The tests broke fate without SAMPLES and fate on some platforms.
This reverts commit 95ade711eb4afb8b76a765ef6571e7934ad7f8cc.

(base) liuqi05:ffmpeg liuqi$ git log | grep 
95ade711eb4afb8b76a765ef6571e7934ad7f8cc.
This reverts commit 95ade711eb4afb8b76a765ef6571e7934ad7f8cc.
(base) liuqi05:ffmpeg liuqi$

It’s not a patch, just revert the commit.

> - Andreas
> 

Re: [FFmpeg-devel] [PATCH v4 1/2] Revert "avformat/dashdec: refine adaptionset attribute members"

2020-03-28 Thread Andreas Rheinhardt
Steven Liu:
> 
> 
>> 2020年3月29日 上午8:03,Andreas Rheinhardt  写道:
>>
>> Steven Liu:
>>>
>>>
 2020年3月29日 上午7:48,Andreas Rheinhardt  写道:

 Steven Liu:
> This reverts commit e134c20374ee3cbc6d04885d306b02c9871683a2.
>
> Signed-off-by: Steven Liu 
> ---
> libavformat/dashdec.c | 27 ---
> 1 file changed, 27 deletions(-)
>
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 5bbe5d3985..271202b0a5 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -122,19 +122,6 @@ struct representation {
> typedef struct DASHContext {
>const AVClass *class;
>char *base_url;
> -char *adaptionset_contenttype_val;
> -char *adaptionset_par_val;
> -char *adaptionset_lang_val;
> -char *adaptionset_minbw_val;
> -char *adaptionset_maxbw_val;
> -char *adaptionset_minwidth_val;
> -char *adaptionset_maxwidth_val;
> -char *adaptionset_minheight_val;
> -char *adaptionset_maxheight_val;
> -char *adaptionset_minframerate_val;
> -char *adaptionset_maxframerate_val;
> -char *adaptionset_segmentalignment_val;
> -char *adaptionset_bitstreamswitching_val;
>
>int n_videos;
>struct representation **videos;
> @@ -1124,26 +,12 @@ static int 
> parse_manifest_adaptationset(AVFormatContext *s, const char *url,
>xmlNodePtr period_segmentlist_node)
> {
>int ret = 0;
> -DASHContext *c = s->priv_data;
>xmlNodePtr fragment_template_node = NULL;
>xmlNodePtr content_component_node = NULL;
>xmlNodePtr adaptionset_baseurl_node = NULL;
>xmlNodePtr adaptionset_segmentlist_node = NULL;
>xmlNodePtr adaptionset_supplementalproperty_node = NULL;
>xmlNodePtr node = NULL;
> -c->adaptionset_contenttype_val = xmlGetProp(adaptionset_node, 
> "contentType");
> -c->adaptionset_par_val = xmlGetProp(adaptionset_node, "par");
> -c->adaptionset_lang_val = xmlGetProp(adaptionset_node, "lang");
> -c->adaptionset_minbw_val = xmlGetProp(adaptionset_node, 
> "minBandwidth");
> -c->adaptionset_maxbw_val = xmlGetProp(adaptionset_node, 
> "maxBandwidth");
> -c->adaptionset_minwidth_val = xmlGetProp(adaptionset_node, 
> "minWidth");
> -c->adaptionset_maxwidth_val = xmlGetProp(adaptionset_node, 
> "maxWidth");
> -c->adaptionset_minheight_val = xmlGetProp(adaptionset_node, 
> "minHeight");
> -c->adaptionset_maxheight_val = xmlGetProp(adaptionset_node, 
> "maxHeight");
> -c->adaptionset_minframerate_val = xmlGetProp(adaptionset_node, 
> "minFrameRate");
> -c->adaptionset_maxframerate_val = xmlGetProp(adaptionset_node, 
> "maxFrameRate");
> -c->adaptionset_segmentalignment_val = xmlGetProp(adaptionset_node, 
> "segmentAlignment");
> -c->adaptionset_bitstreamswitching_val = xmlGetProp(adaptionset_node, 
> "bitstreamSwitching");
>
>node = xmlFirstElementChild(adaptionset_node);
>while (node) {
>
 Is there a reason you are not simply using my patch for this? It has a
 better commit message. Do you mind if I apply my patch?
>>> This is revert, your patch is delete, isn't it?
>>
>> My patch has the same diff as yours. Given that the patch to be reverted
>> didn't delete anything, its revert just removes lines and doesn't add
>> any old lines back.
> No, your patch is a patch commit, this is a git revert, this can revert the 
> old commit, your patch can save old commit.

What? A revert (whether it is yours or mine) is a patch on top of
current master (or on top of the old branches that you backport it to);
it does not remove the old commit from the repo. Removing the old commit
would only be possible if one rewrote history, but this should never be
done as soon as others have based work on it (for FFmpeg this means:
what has been committed to the main repo can never be removed, only
reverted; but you can rewrite history of your private developer branches
any time).

- 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 v4 1/2] Revert "avformat/dashdec: refine adaptionset attribute members"

2020-03-28 Thread Steven Liu


> 2020年3月29日 上午8:05,Steven Liu  写道:
> 
> 
>> 2020年3月29日 上午8:03,Andreas Rheinhardt  写道:
>> 
>> Steven Liu:
>>> 
>>> 
 2020年3月29日 上午7:48,Andreas Rheinhardt  写道:
 
 Steven Liu:
> This reverts commit e134c20374ee3cbc6d04885d306b02c9871683a2.
> 
> Signed-off-by: Steven Liu 
> ---
> libavformat/dashdec.c | 27 ---
> 1 file changed, 27 deletions(-)
> 
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 5bbe5d3985..271202b0a5 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -122,19 +122,6 @@ struct representation {
> typedef struct DASHContext {
>   const AVClass *class;
>   char *base_url;
> -char *adaptionset_contenttype_val;
> -char *adaptionset_par_val;
> -char *adaptionset_lang_val;
> -char *adaptionset_minbw_val;
> -char *adaptionset_maxbw_val;
> -char *adaptionset_minwidth_val;
> -char *adaptionset_maxwidth_val;
> -char *adaptionset_minheight_val;
> -char *adaptionset_maxheight_val;
> -char *adaptionset_minframerate_val;
> -char *adaptionset_maxframerate_val;
> -char *adaptionset_segmentalignment_val;
> -char *adaptionset_bitstreamswitching_val;
> 
>   int n_videos;
>   struct representation **videos;
> @@ -1124,26 +,12 @@ static int 
> parse_manifest_adaptationset(AVFormatContext *s, const char *url,
>   xmlNodePtr period_segmentlist_node)
> {
>   int ret = 0;
> -DASHContext *c = s->priv_data;
>   xmlNodePtr fragment_template_node = NULL;
>   xmlNodePtr content_component_node = NULL;
>   xmlNodePtr adaptionset_baseurl_node = NULL;
>   xmlNodePtr adaptionset_segmentlist_node = NULL;
>   xmlNodePtr adaptionset_supplementalproperty_node = NULL;
>   xmlNodePtr node = NULL;
> -c->adaptionset_contenttype_val = xmlGetProp(adaptionset_node, 
> "contentType");
> -c->adaptionset_par_val = xmlGetProp(adaptionset_node, "par");
> -c->adaptionset_lang_val = xmlGetProp(adaptionset_node, "lang");
> -c->adaptionset_minbw_val = xmlGetProp(adaptionset_node, 
> "minBandwidth");
> -c->adaptionset_maxbw_val = xmlGetProp(adaptionset_node, 
> "maxBandwidth");
> -c->adaptionset_minwidth_val = xmlGetProp(adaptionset_node, 
> "minWidth");
> -c->adaptionset_maxwidth_val = xmlGetProp(adaptionset_node, 
> "maxWidth");
> -c->adaptionset_minheight_val = xmlGetProp(adaptionset_node, 
> "minHeight");
> -c->adaptionset_maxheight_val = xmlGetProp(adaptionset_node, 
> "maxHeight");
> -c->adaptionset_minframerate_val = xmlGetProp(adaptionset_node, 
> "minFrameRate");
> -c->adaptionset_maxframerate_val = xmlGetProp(adaptionset_node, 
> "maxFrameRate");
> -c->adaptionset_segmentalignment_val = xmlGetProp(adaptionset_node, 
> "segmentAlignment");
> -c->adaptionset_bitstreamswitching_val = xmlGetProp(adaptionset_node, 
> "bitstreamSwitching");
> 
>   node = xmlFirstElementChild(adaptionset_node);
>   while (node) {
> 
 Is there a reason you are not simply using my patch for this? It has a
 better commit message. Do you mind if I apply my patch?
>>> This is revert, your patch is delete, isn't it?
>> 
>> My patch has the same diff as yours. Given that the patch to be reverted
>> didn't delete anything, its revert just removes lines and doesn't add
>> any old lines back.
> No, your patch is a patch commit, this is a git revert, this can revert the 
> old commit, your patch can save old commit.
Example:
After revert, you cannot find the commit use git log
e134c20374ee3cbc6d04885d306b02c9871683a2.

But after your patch, you can find the commit use git log
e134c20374ee3cbc6d04885d306b02c9871683a2.

>> 
>> - 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".
> 
> Thanks
> 
> Steven Liu
> 

Thanks

Steven Liu



___
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/3] avfilter/af_adelay: Check sscanf() return value

2020-03-28 Thread Limin Wang
On Sat, Mar 28, 2020 at 07:06:13PM +0100, Michael Niedermayer wrote:
> On Sat, Mar 28, 2020 at 08:17:33AM +0800, lance.lmw...@gmail.com wrote:
> > From: Limin Wang 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> >  libavfilter/af_adelay.c | 5 -
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavfilter/af_adelay.c b/libavfilter/af_adelay.c
> > index c964777..2bb05e7 100644
> > --- a/libavfilter/af_adelay.c
> > +++ b/libavfilter/af_adelay.c
> > @@ -155,7 +155,10 @@ static int config_input(AVFilterLink *inlink)
> >  ret = av_sscanf(arg, "%d%c", >delay, );
> >  if (ret != 2 || type != 'S') {
> >  div = type == 's' ? 1.0 : 1000.0;
> > -av_sscanf(arg, "%f", );
> > +if (av_sscanf(arg, "%f", ) != 1) {
> 
> > +av_log(ctx, AV_LOG_ERROR, "Invalid syntax.\n");
> 
> I suggest to print the part of the string that is invalid.
> This would make it easier to the user to know where the error is

Fixed and update, thx.

> 
> thx
> 
> [...]
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> No human being will ever know the Truth, for even if they happen to say it
> by chance, they would not even known they had done so. -- Xenophanes



> ___
> 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".


-- 
Thanks,
Limin Wang
___
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 v3 1/3] avfilter/af_acrossover: Check sscanf() return value

2020-03-28 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavfilter/af_acrossover.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavfilter/af_acrossover.c b/libavfilter/af_acrossover.c
index f70c50b..002f378 100644
--- a/libavfilter/af_acrossover.c
+++ b/libavfilter/af_acrossover.c
@@ -99,7 +99,10 @@ static av_cold int init(AVFilterContext *ctx)
 
 p = NULL;
 
-av_sscanf(arg, "%f", );
+if (av_sscanf(arg, "%f", ) != 1) {
+av_log(ctx, AV_LOG_ERROR, "Invalid syntax for frequency[%d].\n", 
i);
+return AVERROR(EINVAL);
+}
 if (freq <= 0) {
 av_log(ctx, AV_LOG_ERROR, "Frequency %f must be positive 
number.\n", freq);
 return AVERROR(EINVAL);
-- 
2.9.5

___
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 v3 3/3] avfilter/af_adelay: Check sscanf() return value

2020-03-28 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavfilter/af_adelay.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavfilter/af_adelay.c b/libavfilter/af_adelay.c
index c964777..6ac81c2 100644
--- a/libavfilter/af_adelay.c
+++ b/libavfilter/af_adelay.c
@@ -155,7 +155,10 @@ static int config_input(AVFilterLink *inlink)
 ret = av_sscanf(arg, "%d%c", >delay, );
 if (ret != 2 || type != 'S') {
 div = type == 's' ? 1.0 : 1000.0;
-av_sscanf(arg, "%f", );
+if (av_sscanf(arg, "%f", ) != 1) {
+av_log(ctx, AV_LOG_ERROR, "Invalid syntax for delay.\n");
+return AVERROR(EINVAL);
+}
 d->delay = delay * inlink->sample_rate / div;
 }
 
-- 
2.9.5

___
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 2/3] avfilter/vf_mix: Check sscanf() return value

2020-03-28 Thread Limin Wang
On Sun, Mar 29, 2020 at 12:31:40AM +0100, Nicolas George wrote:
> Limin Wang (12020-03-29):
> > If av_sscanf failed,  s->weights[i] is invalid data and can't be used
> > further.
> 
> I think you are mistaken: if av_sscanf() fails, s->weights[i] stays
> unchanged: it was 0, it's still 0.
> 
> > As the old code allow to use the last weights, so I use 
> > continue to avoid invalid access only.
> 
> It's not invalid, it's 0.
> 
> > Do you think it's better to
> > print out one warning message?
> 
> With this correction, I think this change is not necessary at all.

Yes, the result is same with my change. Anyway if the user option is typo, 
the result may be unexpected for user. 

> 
> Regards,
> 
> -- 
>   Nicolas George



> ___
> 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".


-- 
Thanks,
Limin Wang
___
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 v4 1/2] Revert "avformat/dashdec: refine adaptionset attribute members"

2020-03-28 Thread Steven Liu


> 2020年3月29日 上午8:03,Andreas Rheinhardt  写道:
> 
> Steven Liu:
>> 
>> 
>>> 2020年3月29日 上午7:48,Andreas Rheinhardt  写道:
>>> 
>>> Steven Liu:
 This reverts commit e134c20374ee3cbc6d04885d306b02c9871683a2.
 
 Signed-off-by: Steven Liu 
 ---
 libavformat/dashdec.c | 27 ---
 1 file changed, 27 deletions(-)
 
 diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
 index 5bbe5d3985..271202b0a5 100644
 --- a/libavformat/dashdec.c
 +++ b/libavformat/dashdec.c
 @@ -122,19 +122,6 @@ struct representation {
 typedef struct DASHContext {
const AVClass *class;
char *base_url;
 -char *adaptionset_contenttype_val;
 -char *adaptionset_par_val;
 -char *adaptionset_lang_val;
 -char *adaptionset_minbw_val;
 -char *adaptionset_maxbw_val;
 -char *adaptionset_minwidth_val;
 -char *adaptionset_maxwidth_val;
 -char *adaptionset_minheight_val;
 -char *adaptionset_maxheight_val;
 -char *adaptionset_minframerate_val;
 -char *adaptionset_maxframerate_val;
 -char *adaptionset_segmentalignment_val;
 -char *adaptionset_bitstreamswitching_val;
 
int n_videos;
struct representation **videos;
 @@ -1124,26 +,12 @@ static int 
 parse_manifest_adaptationset(AVFormatContext *s, const char *url,
xmlNodePtr period_segmentlist_node)
 {
int ret = 0;
 -DASHContext *c = s->priv_data;
xmlNodePtr fragment_template_node = NULL;
xmlNodePtr content_component_node = NULL;
xmlNodePtr adaptionset_baseurl_node = NULL;
xmlNodePtr adaptionset_segmentlist_node = NULL;
xmlNodePtr adaptionset_supplementalproperty_node = NULL;
xmlNodePtr node = NULL;
 -c->adaptionset_contenttype_val = xmlGetProp(adaptionset_node, 
 "contentType");
 -c->adaptionset_par_val = xmlGetProp(adaptionset_node, "par");
 -c->adaptionset_lang_val = xmlGetProp(adaptionset_node, "lang");
 -c->adaptionset_minbw_val = xmlGetProp(adaptionset_node, 
 "minBandwidth");
 -c->adaptionset_maxbw_val = xmlGetProp(adaptionset_node, 
 "maxBandwidth");
 -c->adaptionset_minwidth_val = xmlGetProp(adaptionset_node, 
 "minWidth");
 -c->adaptionset_maxwidth_val = xmlGetProp(adaptionset_node, 
 "maxWidth");
 -c->adaptionset_minheight_val = xmlGetProp(adaptionset_node, 
 "minHeight");
 -c->adaptionset_maxheight_val = xmlGetProp(adaptionset_node, 
 "maxHeight");
 -c->adaptionset_minframerate_val = xmlGetProp(adaptionset_node, 
 "minFrameRate");
 -c->adaptionset_maxframerate_val = xmlGetProp(adaptionset_node, 
 "maxFrameRate");
 -c->adaptionset_segmentalignment_val = xmlGetProp(adaptionset_node, 
 "segmentAlignment");
 -c->adaptionset_bitstreamswitching_val = xmlGetProp(adaptionset_node, 
 "bitstreamSwitching");
 
node = xmlFirstElementChild(adaptionset_node);
while (node) {
 
>>> Is there a reason you are not simply using my patch for this? It has a
>>> better commit message. Do you mind if I apply my patch?
>> This is revert, your patch is delete, isn't it?
> 
> My patch has the same diff as yours. Given that the patch to be reverted
> didn't delete anything, its revert just removes lines and doesn't add
> any old lines back.
No, your patch is a patch commit, this is a git revert, this can revert the old 
commit, your patch can save old commit.
> 
> - 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".

Thanks

Steven Liu



___
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 v4 1/2] Revert "avformat/dashdec: refine adaptionset attribute members"

2020-03-28 Thread Andreas Rheinhardt
Steven Liu:
> 
> 
>> 2020年3月29日 上午7:48,Andreas Rheinhardt  写道:
>>
>> Steven Liu:
>>> This reverts commit e134c20374ee3cbc6d04885d306b02c9871683a2.
>>>
>>> Signed-off-by: Steven Liu 
>>> ---
>>> libavformat/dashdec.c | 27 ---
>>> 1 file changed, 27 deletions(-)
>>>
>>> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
>>> index 5bbe5d3985..271202b0a5 100644
>>> --- a/libavformat/dashdec.c
>>> +++ b/libavformat/dashdec.c
>>> @@ -122,19 +122,6 @@ struct representation {
>>> typedef struct DASHContext {
>>> const AVClass *class;
>>> char *base_url;
>>> -char *adaptionset_contenttype_val;
>>> -char *adaptionset_par_val;
>>> -char *adaptionset_lang_val;
>>> -char *adaptionset_minbw_val;
>>> -char *adaptionset_maxbw_val;
>>> -char *adaptionset_minwidth_val;
>>> -char *adaptionset_maxwidth_val;
>>> -char *adaptionset_minheight_val;
>>> -char *adaptionset_maxheight_val;
>>> -char *adaptionset_minframerate_val;
>>> -char *adaptionset_maxframerate_val;
>>> -char *adaptionset_segmentalignment_val;
>>> -char *adaptionset_bitstreamswitching_val;
>>>
>>> int n_videos;
>>> struct representation **videos;
>>> @@ -1124,26 +,12 @@ static int 
>>> parse_manifest_adaptationset(AVFormatContext *s, const char *url,
>>> xmlNodePtr period_segmentlist_node)
>>> {
>>> int ret = 0;
>>> -DASHContext *c = s->priv_data;
>>> xmlNodePtr fragment_template_node = NULL;
>>> xmlNodePtr content_component_node = NULL;
>>> xmlNodePtr adaptionset_baseurl_node = NULL;
>>> xmlNodePtr adaptionset_segmentlist_node = NULL;
>>> xmlNodePtr adaptionset_supplementalproperty_node = NULL;
>>> xmlNodePtr node = NULL;
>>> -c->adaptionset_contenttype_val = xmlGetProp(adaptionset_node, 
>>> "contentType");
>>> -c->adaptionset_par_val = xmlGetProp(adaptionset_node, "par");
>>> -c->adaptionset_lang_val = xmlGetProp(adaptionset_node, "lang");
>>> -c->adaptionset_minbw_val = xmlGetProp(adaptionset_node, 
>>> "minBandwidth");
>>> -c->adaptionset_maxbw_val = xmlGetProp(adaptionset_node, 
>>> "maxBandwidth");
>>> -c->adaptionset_minwidth_val = xmlGetProp(adaptionset_node, "minWidth");
>>> -c->adaptionset_maxwidth_val = xmlGetProp(adaptionset_node, "maxWidth");
>>> -c->adaptionset_minheight_val = xmlGetProp(adaptionset_node, 
>>> "minHeight");
>>> -c->adaptionset_maxheight_val = xmlGetProp(adaptionset_node, 
>>> "maxHeight");
>>> -c->adaptionset_minframerate_val = xmlGetProp(adaptionset_node, 
>>> "minFrameRate");
>>> -c->adaptionset_maxframerate_val = xmlGetProp(adaptionset_node, 
>>> "maxFrameRate");
>>> -c->adaptionset_segmentalignment_val = xmlGetProp(adaptionset_node, 
>>> "segmentAlignment");
>>> -c->adaptionset_bitstreamswitching_val = xmlGetProp(adaptionset_node, 
>>> "bitstreamSwitching");
>>>
>>> node = xmlFirstElementChild(adaptionset_node);
>>> while (node) {
>>>
>> Is there a reason you are not simply using my patch for this? It has a
>> better commit message. Do you mind if I apply my patch?
> This is revert, your patch is delete, isn't it?

My patch has the same diff as yours. Given that the patch to be reverted
didn't delete anything, its revert just removes lines and doesn't add
any old lines back.

- 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 v4 1/2] Revert "avformat/dashdec: refine adaptionset attribute members"

2020-03-28 Thread Steven Liu


> 2020年3月29日 上午7:48,Andreas Rheinhardt  写道:
> 
> Steven Liu:
>> This reverts commit e134c20374ee3cbc6d04885d306b02c9871683a2.
>> 
>> Signed-off-by: Steven Liu 
>> ---
>> libavformat/dashdec.c | 27 ---
>> 1 file changed, 27 deletions(-)
>> 
>> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
>> index 5bbe5d3985..271202b0a5 100644
>> --- a/libavformat/dashdec.c
>> +++ b/libavformat/dashdec.c
>> @@ -122,19 +122,6 @@ struct representation {
>> typedef struct DASHContext {
>> const AVClass *class;
>> char *base_url;
>> -char *adaptionset_contenttype_val;
>> -char *adaptionset_par_val;
>> -char *adaptionset_lang_val;
>> -char *adaptionset_minbw_val;
>> -char *adaptionset_maxbw_val;
>> -char *adaptionset_minwidth_val;
>> -char *adaptionset_maxwidth_val;
>> -char *adaptionset_minheight_val;
>> -char *adaptionset_maxheight_val;
>> -char *adaptionset_minframerate_val;
>> -char *adaptionset_maxframerate_val;
>> -char *adaptionset_segmentalignment_val;
>> -char *adaptionset_bitstreamswitching_val;
>> 
>> int n_videos;
>> struct representation **videos;
>> @@ -1124,26 +,12 @@ static int 
>> parse_manifest_adaptationset(AVFormatContext *s, const char *url,
>> xmlNodePtr period_segmentlist_node)
>> {
>> int ret = 0;
>> -DASHContext *c = s->priv_data;
>> xmlNodePtr fragment_template_node = NULL;
>> xmlNodePtr content_component_node = NULL;
>> xmlNodePtr adaptionset_baseurl_node = NULL;
>> xmlNodePtr adaptionset_segmentlist_node = NULL;
>> xmlNodePtr adaptionset_supplementalproperty_node = NULL;
>> xmlNodePtr node = NULL;
>> -c->adaptionset_contenttype_val = xmlGetProp(adaptionset_node, 
>> "contentType");
>> -c->adaptionset_par_val = xmlGetProp(adaptionset_node, "par");
>> -c->adaptionset_lang_val = xmlGetProp(adaptionset_node, "lang");
>> -c->adaptionset_minbw_val = xmlGetProp(adaptionset_node, "minBandwidth");
>> -c->adaptionset_maxbw_val = xmlGetProp(adaptionset_node, "maxBandwidth");
>> -c->adaptionset_minwidth_val = xmlGetProp(adaptionset_node, "minWidth");
>> -c->adaptionset_maxwidth_val = xmlGetProp(adaptionset_node, "maxWidth");
>> -c->adaptionset_minheight_val = xmlGetProp(adaptionset_node, 
>> "minHeight");
>> -c->adaptionset_maxheight_val = xmlGetProp(adaptionset_node, 
>> "maxHeight");
>> -c->adaptionset_minframerate_val = xmlGetProp(adaptionset_node, 
>> "minFrameRate");
>> -c->adaptionset_maxframerate_val = xmlGetProp(adaptionset_node, 
>> "maxFrameRate");
>> -c->adaptionset_segmentalignment_val = xmlGetProp(adaptionset_node, 
>> "segmentAlignment");
>> -c->adaptionset_bitstreamswitching_val = xmlGetProp(adaptionset_node, 
>> "bitstreamSwitching");
>> 
>> node = xmlFirstElementChild(adaptionset_node);
>> while (node) {
>> 
> Is there a reason you are not simply using my patch for this? It has a
> better commit message. Do you mind if I apply my patch?
This is revert, your patch is delete, isn't it?
> 
> - 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".

Thanks

Steven Liu



___
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 v4 1/2] Revert "avformat/dashdec: refine adaptionset attribute members"

2020-03-28 Thread Andreas Rheinhardt
Steven Liu:
> This reverts commit e134c20374ee3cbc6d04885d306b02c9871683a2.
> 
> Signed-off-by: Steven Liu 
> ---
>  libavformat/dashdec.c | 27 ---
>  1 file changed, 27 deletions(-)
> 
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 5bbe5d3985..271202b0a5 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -122,19 +122,6 @@ struct representation {
>  typedef struct DASHContext {
>  const AVClass *class;
>  char *base_url;
> -char *adaptionset_contenttype_val;
> -char *adaptionset_par_val;
> -char *adaptionset_lang_val;
> -char *adaptionset_minbw_val;
> -char *adaptionset_maxbw_val;
> -char *adaptionset_minwidth_val;
> -char *adaptionset_maxwidth_val;
> -char *adaptionset_minheight_val;
> -char *adaptionset_maxheight_val;
> -char *adaptionset_minframerate_val;
> -char *adaptionset_maxframerate_val;
> -char *adaptionset_segmentalignment_val;
> -char *adaptionset_bitstreamswitching_val;
>  
>  int n_videos;
>  struct representation **videos;
> @@ -1124,26 +,12 @@ static int 
> parse_manifest_adaptationset(AVFormatContext *s, const char *url,
>  xmlNodePtr period_segmentlist_node)
>  {
>  int ret = 0;
> -DASHContext *c = s->priv_data;
>  xmlNodePtr fragment_template_node = NULL;
>  xmlNodePtr content_component_node = NULL;
>  xmlNodePtr adaptionset_baseurl_node = NULL;
>  xmlNodePtr adaptionset_segmentlist_node = NULL;
>  xmlNodePtr adaptionset_supplementalproperty_node = NULL;
>  xmlNodePtr node = NULL;
> -c->adaptionset_contenttype_val = xmlGetProp(adaptionset_node, 
> "contentType");
> -c->adaptionset_par_val = xmlGetProp(adaptionset_node, "par");
> -c->adaptionset_lang_val = xmlGetProp(adaptionset_node, "lang");
> -c->adaptionset_minbw_val = xmlGetProp(adaptionset_node, "minBandwidth");
> -c->adaptionset_maxbw_val = xmlGetProp(adaptionset_node, "maxBandwidth");
> -c->adaptionset_minwidth_val = xmlGetProp(adaptionset_node, "minWidth");
> -c->adaptionset_maxwidth_val = xmlGetProp(adaptionset_node, "maxWidth");
> -c->adaptionset_minheight_val = xmlGetProp(adaptionset_node, "minHeight");
> -c->adaptionset_maxheight_val = xmlGetProp(adaptionset_node, "maxHeight");
> -c->adaptionset_minframerate_val = xmlGetProp(adaptionset_node, 
> "minFrameRate");
> -c->adaptionset_maxframerate_val = xmlGetProp(adaptionset_node, 
> "maxFrameRate");
> -c->adaptionset_segmentalignment_val = xmlGetProp(adaptionset_node, 
> "segmentAlignment");
> -c->adaptionset_bitstreamswitching_val = xmlGetProp(adaptionset_node, 
> "bitstreamSwitching");
>  
>  node = xmlFirstElementChild(adaptionset_node);
>  while (node) {
> 
Is there a reason you are not simply using my patch for this? It has a
better commit message. Do you mind if I apply my patch?

- 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 v3] avformat/dashdec: fix memleak for commit commit e134c203

2020-03-28 Thread Andreas Rheinhardt
Nicolas George:
> Andreas Rheinhardt (12020-03-28):
>> The commit title says that this commit is about fixing a memleak (it btw
> 
> That is my concern too.
> 
>> has one "commit" too much in it), whereas most of this patch is about
>> adding new functionality. Which makes me wonder how you intend to fix
>> this in the old releases? Backport everything?
>> (This problem would of course not exist if the new functionality would
>> be split from fixing the memleak.)
> 
> The leak exists in a release? 

It is in 4.1 and 4.2.

- 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 2/3] avfilter/vf_mix: Check sscanf() return value

2020-03-28 Thread Nicolas George
Limin Wang (12020-03-29):
> If av_sscanf failed,  s->weights[i] is invalid data and can't be used
> further.

I think you are mistaken: if av_sscanf() fails, s->weights[i] stays
unchanged: it was 0, it's still 0.

> As the old code allow to use the last weights, so I use 
> continue to avoid invalid access only.

It's not invalid, it's 0.

> Do you think it's better to
> print out one warning message?

With this correction, I think this change is not necessary at all.

Regards,

-- 
  Nicolas George


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] [PATCH v2 2/3] avfilter/vf_mix: Check sscanf() return value

2020-03-28 Thread Limin Wang
On Sat, Mar 28, 2020 at 08:10:51PM +0100, Nicolas George wrote:
> lance.lmw...@gmail.com (12020-03-28):
> > From: Limin Wang 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> >  libavfilter/vf_mix.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> Why? What do you expect to change with this patch, and how is it
> supposed to be better?
If av_sscanf failed,  s->weights[i] is invalid data and can't be used
further. As the old code allow to use the last weights, so I use 
continue to avoid invalid access only. Do you think it's better to
print out one warning message?

> 
> Regards,
> 
> -- 
>   Nicolas George



-- 
Thanks,
Limin Wang
___
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 6/8] avformat/mux: do not destroy packets of av_write_frame on bitstream filtering

2020-03-28 Thread Marton Balint



On Sat, 28 Mar 2020, Andreas Rheinhardt wrote:


Marton Balint:

av_write_frame() does not take ownership of the packet.

Signed-off-by: Marton Balint 
---
 libavformat/mux.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index 3054ab8644..706fdcbbf4 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -935,7 +935,16 @@ static int write_packets_common(AVFormatContext *s, 
AVStream *st, AVPacket *pkt,
 if (ret < 0) {
 if (ret == AVERROR(EAGAIN) && !consumed_packet) {
 av_assert2(sti->bsfcs_idx == 0);
-ret = av_bsf_send_packet(sti->bsfcs[0], pkt);
+if (!interleaved && pkt) {
+AVPacket tmp;
+ret = av_packet_ref(, pkt);
+if (ret < 0)
+goto fail;
+ret = av_bsf_send_packet(sti->bsfcs[0], );
+av_packet_unref();
+} else {
+ret = av_bsf_send_packet(sti->bsfcs[0], pkt);
+}
 av_assert2(ret != AVERROR(EAGAIN));
 if (ret >= 0) {
 consumed_packet = 1;


When I proposed something similar in [1] (based upon exactly the same
thinking as you with your patch), I was told that the owner of a packet
just has the obligation to free it; and not the right to expect others
not to modify it.


pts/dts/duration is one thing. But if the user must free the data (or the 
buffer) then the function must NOT. Is it a valid expectation from the 
user to have the data available after the av_write_frame() call? I think 
so.



I changed my mind on this: Given that av_write_frame()
does not take a const AVPacket * as parameter, the caller has no right
to believe that the packets are returned untouched.


IMHO we should make reasonable effort to not change the behaviour of 
the API, even if it is not explictly documented. Freeing data/buf passed 
to av_write_frame() seems like a breaking change to me. If you overwrite 
pkt->data to NULL in av_write_frame then fate-fifo-muxer-tst will fail.




Furthermore, you are using an AVPacket on the stack, yet I thought that
this should be avoided, because sizeof(AVPacket) should eventually no
longer be part of the public API.


Is there still interest to do this? We have tons of static AVPacket
allocations all over the codebase because it is simple. Even in new code. 
I don't think the added complexity actually worth removing it.


Regards,
Marton
___
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 2/8] avformat/mux: fix check_packet with null packet

2020-03-28 Thread Marton Balint



On Sat, 28 Mar 2020, Andreas Rheinhardt wrote:


Marton Balint:

Signed-off-by: Marton Balint 
---
 libavformat/mux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index bfd1bf491b..dfb21c8aa5 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -798,7 +798,7 @@ static int prepare_input_packet(AVFormatContext *s, 
AVPacket *pkt)

 #if !FF_API_COMPUTE_PKT_FIELDS2 || !FF_API_LAVF_AVCTX
 /* sanitize the timestamps */
-if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
+if (pkt && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
 AVStream *st = s->streams[pkt->stream_index];

 /* when there is no reordering (so dts is equal to pts), but


Overlaps with [1].


Can you resend still valid patches from that series? I might have more 
knowledge now to review...


Thanks,
Marton
___
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 8/8] avformat/audiointerleave: only keep the retime functionality of the audio interleaver

2020-03-28 Thread Marton Balint



On Sat, 28 Mar 2020, James Almer wrote:


On 3/28/2020 3:15 PM, Marton Balint wrote:

+static int mxf_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt)
+{
+int ret = 1;
+AVStream *st = s->streams[pkt->stream_index];
+MXFStreamContext *sc = st->priv_data;
+
+if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
+char arg[32];
+snprintf(arg, sizeof(arg), "r=%d/%d", sc->aic.time_base.den, 
sc->aic.time_base.num);
+ret = ff_stream_add_bitstream_filter(st, "pcm_rechunk", arg);


Shouldn't you check that the stream's codec is PCM?


Our MXF muxer only allows PCM streams at the moment, other codecs won't 
have a matching mxf_essence_mapping, so write_header will fail.


Regards,
Marton
___
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 8/8] avformat/audiointerleave: only keep the retime functionality of the audio interleaver

2020-03-28 Thread James Almer
On 3/28/2020 3:15 PM, Marton Balint wrote:
> +static int mxf_check_bitstream(struct AVFormatContext *s, const AVPacket 
> *pkt)
> +{
> +int ret = 1;
> +AVStream *st = s->streams[pkt->stream_index];
> +MXFStreamContext *sc = st->priv_data;
> +
> +if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
> +char arg[32];
> +snprintf(arg, sizeof(arg), "r=%d/%d", sc->aic.time_base.den, 
> sc->aic.time_base.num);
> +ret = ff_stream_add_bitstream_filter(st, "pcm_rechunk", arg);

Shouldn't you check that the stream's codec is PCM?

> +}
> +
> +return ret;

___
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/8] avformat/mux: add proper support for full N:M bitstream filtering

2020-03-28 Thread Andreas Rheinhardt
Marton Balint:
> Previously only 1:1 bitstream filters were supported, the end of the stream 
> was
> not signalled to the bitstream filters and time base changes were ignored.
> 
> Signed-off-by: Marton Balint 
> ---
>  libavformat/internal.h |   1 +
>  libavformat/mux.c  | 128 
> ++---
>  2 files changed, 91 insertions(+), 38 deletions(-)
> 
> diff --git a/libavformat/internal.h b/libavformat/internal.h
> index 332477a532..45aeef717a 100644
> --- a/libavformat/internal.h
> +++ b/libavformat/internal.h
> @@ -158,6 +158,7 @@ struct AVStreamInternal {
>   */
>  AVBSFContext **bsfcs;
>  int nb_bsfcs;
> +int bsfcs_idx;
>  
>  /**
>   * Whether or not check_bitstream should still be run on each packet
> diff --git a/libavformat/mux.c b/libavformat/mux.c
> index 8c2d6a8060..3054ab8644 100644
> --- a/libavformat/mux.c
> +++ b/libavformat/mux.c
> @@ -840,14 +840,48 @@ static int prepare_input_packet(AVFormatContext *s, 
> AVPacket *pkt)
>  return 0;
>  }
>  
> -static int do_packet_auto_bsf(AVFormatContext *s, AVPacket *pkt) {
> -AVStream *st = s->streams[pkt->stream_index];
> -int i, ret;
> +static int auto_bsf_receive_packet(AVFormatContext *s, AVStream *st, 
> AVPacket *pkt)
> +{
> +AVStreamInternal *sti = st->internal;
> +int ret = AVERROR(EAGAIN);
> +int eof = 0;
> +
> +while (sti->bsfcs_idx) {
> +/* get a packet from the previous filter up the chain */
> +ret = av_bsf_receive_packet(sti->bsfcs[sti->bsfcs_idx - 1], pkt);
> +if (ret == AVERROR(EAGAIN)) {
> +sti->bsfcs_idx--;
> +continue;
> +} else if (ret == AVERROR_EOF) {
> +eof = 1;
> +} else if (ret < 0)
> +break;
> +
> +/* send it to the next filter down the chain */
> +if (sti->bsfcs_idx < sti->nb_bsfcs) {
> +ret = av_bsf_send_packet(sti->bsfcs[sti->bsfcs_idx], eof ? NULL 
> : pkt);
> +av_assert2(ret != AVERROR(EAGAIN));
> +if (ret < 0)
> +break;
> +sti->bsfcs_idx++;
> +eof = 0;
> +} else if (eof) {
> +break;
> +} else {
> +return 0;
> +}
> +}

Would it actually be possible to simplify this by using the
av_bsf_list-API (right now code like this exists here and in ffmpeg.c
and probably at even more places)? The problem I see with this is that
one cannot send a packet for filtering to an unfinished bsf list whereas
the current code has this capability (although AFAIK no one uses it; if
I am not mistaken, all bsf chains that are automatically inserted
consist of exactly one bsf).

(This actually brings up a question: If check_bitstream returns that
more packets from this stream need to be checked, the current packet is
currently sent to the bsf-list as-is; it would not be sent to any bsf
that get added to the list later. Makes me wonder whether this is
actually a problem.)

- 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 2/2] avcodec/hcadec: Check scale_factors

2020-03-28 Thread Paul B Mahol
LGTM

On 3/28/20, Michael Niedermayer  wrote:
> Fixes: out of array read
> Fixes:
> 21286/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HCA_fuzzer-5683183715876864
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/hcadec.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libavcodec/hcadec.c b/libavcodec/hcadec.c
> index 4e3f589579..f25d6c39b6 100644
> --- a/libavcodec/hcadec.c
> +++ b/libavcodec/hcadec.c
> @@ -345,6 +345,7 @@ static void unpack(HCAContext *c, ChannelContext *ch,
>  } else {
>  factor += delta - half_max;
>  }
> +factor = av_clip_uintp2(factor, 6);
>
>  ch->scale_factors[i] = factor;
>  }
> --
> 2.17.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 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 1/2] avcodec/hapdec: Check tex_size more strictly and before using it

2020-03-28 Thread Michael Niedermayer
Fixes: OOM
Fixes: 
20774/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HAP_fuzzer-5678608951803904
Fixes: 
20956/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HAP_fuzzer-5713643025203200

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/hapdec.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c
index d23ceb5cef..e4abd739c5 100644
--- a/libavcodec/hapdec.c
+++ b/libavcodec/hapdec.c
@@ -342,6 +342,13 @@ static int hap_decode(AVCodecContext *avctx, void *data,
 if (ret < 0)
 return ret;
 
+if (ctx->tex_size != (avctx->coded_width  / TEXTURE_BLOCK_W)
+*(avctx->coded_height / TEXTURE_BLOCK_H)
+*tex_rat[t]) {
+av_log(avctx, AV_LOG_ERROR, "uncompressed size mismatches\n");
+return AVERROR_INVALIDDATA;
+}
+
 start_texture_section += ctx->texture_section_size + 4;
 
 if (avctx->codec->update_thread_context)
@@ -370,13 +377,6 @@ static int hap_decode(AVCodecContext *avctx, void *data,
 tex_size = ctx->tex_size;
 }
 
-if (tex_size < (avctx->coded_width  / TEXTURE_BLOCK_W)
-*(avctx->coded_height / TEXTURE_BLOCK_H)
-*tex_rat[t]) {
-av_log(avctx, AV_LOG_ERROR, "Insufficient data\n");
-return AVERROR_INVALIDDATA;
-}
-
 /* Use the decompress function on the texture, one block per thread */
 if (t == 0){
 avctx->execute2(avctx, decompress_texture_thread, tframe.f, NULL, 
ctx->slice_count);
-- 
2.17.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 2/2] avcodec/hcadec: Check scale_factors

2020-03-28 Thread Michael Niedermayer
Fixes: out of array read
Fixes: 
21286/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HCA_fuzzer-5683183715876864

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/hcadec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/hcadec.c b/libavcodec/hcadec.c
index 4e3f589579..f25d6c39b6 100644
--- a/libavcodec/hcadec.c
+++ b/libavcodec/hcadec.c
@@ -345,6 +345,7 @@ static void unpack(HCAContext *c, ChannelContext *ch,
 } else {
 factor += delta - half_max;
 }
+factor = av_clip_uintp2(factor, 6);
 
 ch->scale_factors[i] = factor;
 }
-- 
2.17.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".

Re: [FFmpeg-devel] [PATCH 6/8] avformat/mux: do not destroy packets of av_write_frame on bitstream filtering

2020-03-28 Thread Andreas Rheinhardt
Marton Balint:
> av_write_frame() does not take ownership of the packet.
> 
> Signed-off-by: Marton Balint 
> ---
>  libavformat/mux.c | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/mux.c b/libavformat/mux.c
> index 3054ab8644..706fdcbbf4 100644
> --- a/libavformat/mux.c
> +++ b/libavformat/mux.c
> @@ -935,7 +935,16 @@ static int write_packets_common(AVFormatContext *s, 
> AVStream *st, AVPacket *pkt,
>  if (ret < 0) {
>  if (ret == AVERROR(EAGAIN) && !consumed_packet) {
>  av_assert2(sti->bsfcs_idx == 0);
> -ret = av_bsf_send_packet(sti->bsfcs[0], pkt);
> +if (!interleaved && pkt) {
> +AVPacket tmp;
> +ret = av_packet_ref(, pkt);
> +if (ret < 0)
> +goto fail;
> +ret = av_bsf_send_packet(sti->bsfcs[0], );
> +av_packet_unref();
> +} else {
> +ret = av_bsf_send_packet(sti->bsfcs[0], pkt);
> +}
>  av_assert2(ret != AVERROR(EAGAIN));
>  if (ret >= 0) {
>  consumed_packet = 1;
> 
When I proposed something similar in [1] (based upon exactly the same
thinking as you with your patch), I was told that the owner of a packet
just has the obligation to free it; and not the right to expect others
not to modify it. I changed my mind on this: Given that av_write_frame()
does not take a const AVPacket * as parameter, the caller has no right
to believe that the packets are returned untouched.

Furthermore, you are using an AVPacket on the stack, yet I thought that
this should be avoided, because sizeof(AVPacket) should eventually no
longer be part of the public API.

- Andreas

[1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2019-August/248153.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 v2 2/3] avfilter/vf_mix: Check sscanf() return value

2020-03-28 Thread Nicolas George
lance.lmw...@gmail.com (12020-03-28):
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavfilter/vf_mix.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Why? What do you expect to change with this patch, and how is it
supposed to be better?

Regards,

-- 
  Nicolas George


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] [PATCH 03/14] pthread_frame: merge the functionality for normal decoder init and init_thread_copy

2020-03-28 Thread David Bryant
On 3/28/20 6:23 AM, Anton Khirnov wrote:
> Quoting David Bryant (2020-03-27 23:51:19)
>> On 3/27/20 5:57 AM, Anton Khirnov wrote:
>>> The current design, where
>>> - proper init is called for the first per-thread context
>>> - first thread's private data is copied into private data for all the
>>>   other threads
>>> - a "fixup" function is called for all the other threads to e.g.
>>>   allocate dynamically allocated data
>>> is very fragile and hard to follow, so it is abandoned. Instead, the
>>> same init function is used to init each per-thread context. Where
>>> necessary, AVCodecInternal.is_copy can be used to differentiate between
>>> the first thread and the other ones (e.g. for decoding the extradata
>>> just once).
>>> ---
>> I'm not sure I fully understand this change. You mention that 
>> AVCodecInternal.is_copy can be used where different treatment
>> might be necessary for subsequent threads, and I see that done in a couple 
>> places, but in most cases you have simply deleted the
>> init_thread_copy() function even when it's not at all obvious (to me anyway) 
>> that that won't break the codec.
> In most cases, just deleting init_thread_copy() is the right thing to
> do. E.g. all decoders that do not implement update_thread_context() have
> to be intra-only, so every frame thread is effectively a completely
> standalone decoder. And in most of the more complex decoders (like h264)
> the important parameters are dynamically changeable during decoding, so
> not that much is done in decoder init beyond allocating some stuff that
> does not depend on the bistream properties.
>
> My intent is for each frame-thread worker to be treated inasmuch as
> possible as a standalone decoder, and where it has to share data with
> other threads to make this sharing explicit (rather than implicit as is
> the case now).

Yes, this makes sense. The confusing part is when the decode_init() function 
looks completely different than the
init_thread_copy() function. This is often because the decode_init() function 
is generating things (tables, etc.) from scratch
and the init_thread_copy() is just copying the necessary things from the 
original. In cases where the original generation might
be time consuming this might make sense, but usually it's probably just making 
the code more complex and difficult to follow
(which I believe was your original point).

One possible interim solution for complex cases that break would be to leave 
the init_thread_copy() function there, but instead
of having it in the AVCodec struct and called from outside (which is no longer 
possible), it simply gets called first thing from
decode_init() if AVCodecInternal.is_copy is set. That way the architecture is 
cleaned up now, and the codec won't break and can
be cleaned up when time permits. Just a thought.

>
>> Specifically this will break WavPack because now it will be allocating a new 
>> dsdctx for every thread instead of sharing one
>> between all threads. I am happy to fix and test this case once the patch 
>> goes in, but is the intent of this patch that the
>> respective authors will find and fix all the breakages? Or did I just happen 
>> to catch the one case you missed?
> I certainly intended to convert the decoders correctly myself,
> apparently I didn't pay enough attention to the recent wavpack changes.
> Hopefully the other conversions are correct, but I will go through the
> changes again to check.
>
> Looking at wavpack, the code looks suspicious to me. You allocate one
> dsdctx per channel at init, but AFAIU the number of channels can change
> at each frame.
>
Multichannel WavPack consists of sequences of stereo or mono WavPack blocks 
that include flags indicating whether they are the
beginning or end of a "frame" or "packet". This allows the number of channels 
available to be essentially unlimited, however the
total number of channels in a stream may not change. When decoding, if a 
sequence of blocks generates more or less than the
correct number of channels, this is flagged as an error and overrun is 
prevented (see libavcodec/wavpack.c, line 1499 and line
1621).

If you are curious, the WavPack format is described in detail here:

https://github.com/dbry/WavPack/blob/master/doc/WavPack5FileFormat.pdf

Thanks!

-David


___
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 2/8] avformat/mux: fix check_packet with null packet

2020-03-28 Thread Andreas Rheinhardt
Marton Balint:
> Signed-off-by: Marton Balint 
> ---
>  libavformat/mux.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/mux.c b/libavformat/mux.c
> index bfd1bf491b..dfb21c8aa5 100644
> --- a/libavformat/mux.c
> +++ b/libavformat/mux.c
> @@ -798,7 +798,7 @@ static int prepare_input_packet(AVFormatContext *s, 
> AVPacket *pkt)
>  
>  #if !FF_API_COMPUTE_PKT_FIELDS2 || !FF_API_LAVF_AVCTX
>  /* sanitize the timestamps */
> -if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
> +if (pkt && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
>  AVStream *st = s->streams[pkt->stream_index];
>  
>  /* when there is no reordering (so dts is equal to pts), but
> 
Overlaps with [1].

- Andreas

[1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2019-August/248144.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".

[FFmpeg-devel] [PATCH 6/8] avformat/mux: do not destroy packets of av_write_frame on bitstream filtering

2020-03-28 Thread Marton Balint
av_write_frame() does not take ownership of the packet.

Signed-off-by: Marton Balint 
---
 libavformat/mux.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index 3054ab8644..706fdcbbf4 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -935,7 +935,16 @@ static int write_packets_common(AVFormatContext *s, 
AVStream *st, AVPacket *pkt,
 if (ret < 0) {
 if (ret == AVERROR(EAGAIN) && !consumed_packet) {
 av_assert2(sti->bsfcs_idx == 0);
-ret = av_bsf_send_packet(sti->bsfcs[0], pkt);
+if (!interleaved && pkt) {
+AVPacket tmp;
+ret = av_packet_ref(, pkt);
+if (ret < 0)
+goto fail;
+ret = av_bsf_send_packet(sti->bsfcs[0], );
+av_packet_unref();
+} else {
+ret = av_bsf_send_packet(sti->bsfcs[0], pkt);
+}
 av_assert2(ret != AVERROR(EAGAIN));
 if (ret >= 0) {
 consumed_packet = 1;
-- 
2.16.4

___
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 7/8] avcodec/pcm_rechunk_bsf: add bitstream filter to rechunk pcm audio

2020-03-28 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 Changelog  |   1 +
 doc/bitstream_filters.texi |  30 ++
 libavcodec/Makefile|   1 +
 libavcodec/bitstream_filters.c |   1 +
 libavcodec/pcm_rechunk_bsf.c   | 206 +
 libavcodec/version.h   |   4 +-
 6 files changed, 241 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/pcm_rechunk_bsf.c

diff --git a/Changelog b/Changelog
index 05b9a84562..dddaf02199 100644
--- a/Changelog
+++ b/Changelog
@@ -55,6 +55,7 @@ version :
 - CRI HCA decoder
 - CRI HCA demuxer
 - overlay_cuda filter
+- pcm_rechunk bitstream filter
 
 
 version 4.2:
diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi
index 8fe5b3ad75..70c276feed 100644
--- a/doc/bitstream_filters.texi
+++ b/doc/bitstream_filters.texi
@@ -548,6 +548,36 @@ ffmpeg -i INPUT -c copy -bsf noise[=1] output.mkv
 @section null
 This bitstream filter passes the packets through unchanged.
 
+@section pcm_rechunk
+
+Repacketize PCM audio to a fixed number of samples per packet or a fixed packet
+rate per second. This is similar to the @ref{asetnsamples,,asetnsamples audio
+filter,ffmpeg-filters} but works on audio packets instead of audio frames.
+
+@table @option
+@item nb_out_samples, n
+Set the number of samples per each output audio packet. The number is intended
+as the number of samples @emph{per each channel}. Default value is 1024.
+
+@item pad, p
+If set to 1, the filter will pad the last audio packet with silence, so that it
+will contain the same number of samples (or roughly the same number of samples,
+see @option{frame_rate}) as the previous ones. Default value is 1.
+
+@item frame_rate, r
+This option makes the filter output a fixed numer of packets per second instead
+of a fixed number of samples per packet. If the audio sample rate is not
+divisible by the frame rate then the number of samples will not be constant but
+will vary slightly so that each packet will start as close as to the frame
+boundary as possible. Using this option has precedence over 
@option{nb_out_samples}.
+@end table
+
+You can generate the well known 1602-1601-1602-1601-1602 pattern of 48kHz audio
+for NTSC frame rate using the @option{frame_rate} option.
+@example
+ffmpeg -f lavfi -i sine=r=48000:d=1 -c pcm_s16le -bsf pcm_rechunk=r=3/1001 
-f framecrc -
+@end example
+
 @section prores_metadata
 
 Modify color property metadata embedded in prores stream.
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index c1c9a44f2b..a49391f97f 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1110,6 +1110,7 @@ OBJS-$(CONFIG_MP3_HEADER_DECOMPRESS_BSF)  += 
mp3_header_decompress_bsf.o \
 OBJS-$(CONFIG_MPEG2_METADATA_BSF) += mpeg2_metadata_bsf.o
 OBJS-$(CONFIG_NOISE_BSF)  += noise_bsf.o
 OBJS-$(CONFIG_NULL_BSF)   += null_bsf.o
+OBJS-$(CONFIG_PCM_RECHUNK_BSF)+= pcm_rechunk_bsf.o
 OBJS-$(CONFIG_PRORES_METADATA_BSF)+= prores_metadata_bsf.o
 OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF)   += remove_extradata_bsf.o
 OBJS-$(CONFIG_TEXT2MOVSUB_BSF)+= movsub_bsf.o
diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c
index 6b5ffe4d70..9e701191f8 100644
--- a/libavcodec/bitstream_filters.c
+++ b/libavcodec/bitstream_filters.c
@@ -49,6 +49,7 @@ extern const AVBitStreamFilter ff_mpeg4_unpack_bframes_bsf;
 extern const AVBitStreamFilter ff_mov2textsub_bsf;
 extern const AVBitStreamFilter ff_noise_bsf;
 extern const AVBitStreamFilter ff_null_bsf;
+extern const AVBitStreamFilter ff_pcm_rechunk_bsf;
 extern const AVBitStreamFilter ff_prores_metadata_bsf;
 extern const AVBitStreamFilter ff_remove_extradata_bsf;
 extern const AVBitStreamFilter ff_text2movsub_bsf;
diff --git a/libavcodec/pcm_rechunk_bsf.c b/libavcodec/pcm_rechunk_bsf.c
new file mode 100644
index 00..e02a205eb6
--- /dev/null
+++ b/libavcodec/pcm_rechunk_bsf.c
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2020 Marton Balint
+ *
+ * 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
+ */
+
+#include "avcodec.h"
+#include "bsf.h"
+#include "libavutil/avassert.h"
+#include "libavutil/mem.h"
+#include "libavutil/opt.h"
+
+typedef struct PCMContext {
+const AVClass *class;
+
+int 

[FFmpeg-devel] [PATCH 8/8] avformat/audiointerleave: only keep the retime functionality of the audio interleaver

2020-03-28 Thread Marton Balint
And rename it to retimeinterleave, use the pcm_rechunk bitstream filter for
rechunking.

By seperating the two functions we hopefully get cleaner code.

Signed-off-by: Marton Balint 
---
 configure  |   2 +
 libavformat/Makefile   |   4 +-
 libavformat/audiointerleave.c  | 148 -
 libavformat/gxfenc.c   |  29 ++--
 libavformat/mux.c  |   1 -
 libavformat/mxfenc.c   |  32 +++--
 libavformat/retimeinterleave.c |  51 +++
 .../{audiointerleave.h => retimeinterleave.h}  |  31 ++---
 libavformat/utils.c|   1 -
 9 files changed, 111 insertions(+), 188 deletions(-)
 delete mode 100644 libavformat/audiointerleave.c
 create mode 100644 libavformat/retimeinterleave.c
 rename libavformat/{audiointerleave.h => retimeinterleave.h} (57%)

diff --git a/configure b/configure
index 21827eeb45..0640514a53 100755
--- a/configure
+++ b/configure
@@ -2722,6 +2722,7 @@ fraps_decoder_select="bswapdsp huffman"
 g2m_decoder_deps="zlib"
 g2m_decoder_select="blockdsp idctdsp jpegtables"
 g729_decoder_select="audiodsp"
+gxf_encoder_select="pcm_rechunk_bsf"
 h261_decoder_select="mpegvideo"
 h261_encoder_select="mpegvideoenc"
 h263_decoder_select="h263_parser h263dsp mpegvideo qpeldsp"
@@ -2793,6 +2794,7 @@ mts2_decoder_select="mss34dsp"
 mvha_decoder_deps="zlib"
 mvha_decoder_select="llviddsp"
 mwsc_decoder_deps="zlib"
+mxf_encoder_select="pcm_rechunk_bsf"
 mxpeg_decoder_select="mjpeg_decoder"
 nellymoser_decoder_select="mdct sinewin"
 nellymoser_encoder_select="audio_frame_queue mdct sinewin"
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 8fd0d43721..017b230baa 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -205,7 +205,7 @@ OBJS-$(CONFIG_GIF_DEMUXER)   += gifdec.o
 OBJS-$(CONFIG_GSM_DEMUXER)   += gsmdec.o
 OBJS-$(CONFIG_GSM_MUXER) += rawenc.o
 OBJS-$(CONFIG_GXF_DEMUXER)   += gxf.o
-OBJS-$(CONFIG_GXF_MUXER) += gxfenc.o audiointerleave.o
+OBJS-$(CONFIG_GXF_MUXER) += gxfenc.o retimeinterleave.o
 OBJS-$(CONFIG_G722_DEMUXER)  += g722.o rawdec.o
 OBJS-$(CONFIG_G722_MUXER)+= rawenc.o
 OBJS-$(CONFIG_G723_1_DEMUXER)+= g723_1.o
@@ -347,7 +347,7 @@ OBJS-$(CONFIG_MUSX_DEMUXER)  += musx.o
 OBJS-$(CONFIG_MV_DEMUXER)+= mvdec.o
 OBJS-$(CONFIG_MVI_DEMUXER)   += mvi.o
 OBJS-$(CONFIG_MXF_DEMUXER)   += mxfdec.o mxf.o
-OBJS-$(CONFIG_MXF_MUXER) += mxfenc.o mxf.o audiointerleave.o 
avc.o
+OBJS-$(CONFIG_MXF_MUXER) += mxfenc.o mxf.o retimeinterleave.o 
avc.o
 OBJS-$(CONFIG_MXG_DEMUXER)   += mxg.o
 OBJS-$(CONFIG_NC_DEMUXER)+= ncdec.o
 OBJS-$(CONFIG_NISTSPHERE_DEMUXER)+= nistspheredec.o pcm.o
diff --git a/libavformat/audiointerleave.c b/libavformat/audiointerleave.c
deleted file mode 100644
index 2e83031bd6..00
--- a/libavformat/audiointerleave.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Audio Interleaving functions
- *
- * Copyright (c) 2009 Baptiste Coudurier 
- *
- * 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
- */
-
-#include "libavutil/fifo.h"
-#include "libavutil/mathematics.h"
-#include "avformat.h"
-#include "audiointerleave.h"
-#include "internal.h"
-
-void ff_audio_interleave_close(AVFormatContext *s)
-{
-int i;
-for (i = 0; i < s->nb_streams; i++) {
-AVStream *st = s->streams[i];
-AudioInterleaveContext *aic = st->priv_data;
-
-if (aic && st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
-av_fifo_freep(>fifo);
-}
-}
-
-int ff_audio_interleave_init(AVFormatContext *s,
- const int samples_per_frame,
- AVRational time_base)
-{
-int i;
-
-if (!time_base.num) {
-av_log(s, AV_LOG_ERROR, "timebase not set for audio interleave\n");
-return AVERROR(EINVAL);
-}
-for (i = 0; i < s->nb_streams; i++) {
-AVStream *st = s->streams[i];
-AudioInterleaveContext *aic = st->priv_data;

[FFmpeg-devel] [PATCH 1/8] fftools/ffmpeg: also flush encoders which have a variable frame size

2020-03-28 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 fftools/ffmpeg.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index aaaf241314..6cc3c5a14d 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1913,9 +1913,6 @@ static void flush_encoders(void)
 }
 }
 
-if (enc->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <= 1)
-continue;
-
 if (enc->codec_type != AVMEDIA_TYPE_VIDEO && enc->codec_type != 
AVMEDIA_TYPE_AUDIO)
 continue;
 
-- 
2.16.4

___
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 5/8] avformat/mux: add proper support for full N:M bitstream filtering

2020-03-28 Thread Marton Balint
Previously only 1:1 bitstream filters were supported, the end of the stream was
not signalled to the bitstream filters and time base changes were ignored.

Signed-off-by: Marton Balint 
---
 libavformat/internal.h |   1 +
 libavformat/mux.c  | 128 ++---
 2 files changed, 91 insertions(+), 38 deletions(-)

diff --git a/libavformat/internal.h b/libavformat/internal.h
index 332477a532..45aeef717a 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -158,6 +158,7 @@ struct AVStreamInternal {
  */
 AVBSFContext **bsfcs;
 int nb_bsfcs;
+int bsfcs_idx;
 
 /**
  * Whether or not check_bitstream should still be run on each packet
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 8c2d6a8060..3054ab8644 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -840,14 +840,48 @@ static int prepare_input_packet(AVFormatContext *s, 
AVPacket *pkt)
 return 0;
 }
 
-static int do_packet_auto_bsf(AVFormatContext *s, AVPacket *pkt) {
-AVStream *st = s->streams[pkt->stream_index];
-int i, ret;
+static int auto_bsf_receive_packet(AVFormatContext *s, AVStream *st, AVPacket 
*pkt)
+{
+AVStreamInternal *sti = st->internal;
+int ret = AVERROR(EAGAIN);
+int eof = 0;
+
+while (sti->bsfcs_idx) {
+/* get a packet from the previous filter up the chain */
+ret = av_bsf_receive_packet(sti->bsfcs[sti->bsfcs_idx - 1], pkt);
+if (ret == AVERROR(EAGAIN)) {
+sti->bsfcs_idx--;
+continue;
+} else if (ret == AVERROR_EOF) {
+eof = 1;
+} else if (ret < 0)
+break;
+
+/* send it to the next filter down the chain */
+if (sti->bsfcs_idx < sti->nb_bsfcs) {
+ret = av_bsf_send_packet(sti->bsfcs[sti->bsfcs_idx], eof ? NULL : 
pkt);
+av_assert2(ret != AVERROR(EAGAIN));
+if (ret < 0)
+break;
+sti->bsfcs_idx++;
+eof = 0;
+} else if (eof) {
+break;
+} else {
+return 0;
+}
+}
+
+return ret;
+}
+
+static int need_auto_bsf(AVFormatContext *s, AVStream *st, AVPacket *pkt) {
+int ret;
 
 if (!(s->flags & AVFMT_FLAG_AUTO_BSF))
-return 1;
+return 0;
 
-if (s->oformat->check_bitstream) {
+if (pkt && s->oformat->check_bitstream) {
 if (!st->internal->bitstream_checked) {
 if ((ret = s->oformat->check_bitstream(s, pkt)) < 0)
 return ret;
@@ -856,31 +890,7 @@ static int do_packet_auto_bsf(AVFormatContext *s, AVPacket 
*pkt) {
 }
 }
 
-for (i = 0; i < st->internal->nb_bsfcs; i++) {
-AVBSFContext *ctx = st->internal->bsfcs[i];
-// TODO: when any bitstream filter requires flushing at EOF, we'll 
need to
-// 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\n",
-ctx->filter->name, pkt->stream_index);
-return ret;
-}
-// TODO: when any automatically-added bitstream filter is generating 
multiple
-// output packets for a single input one, we'll need to call this in a 
loop
-// and write each output packet.
-if ((ret = av_bsf_receive_packet(ctx, pkt)) < 0) {
-if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
-return 0;
-av_log(ctx, AV_LOG_ERROR,
-"Failed to receive packet from filter %s for stream %d\n",
-ctx->filter->name, pkt->stream_index);
-if (s->error_recognition & AV_EF_EXPLODE)
-return ret;
-return 0;
-}
-}
-return 1;
+return st->internal->nb_bsfcs;
 }
 
 static int interleaved_write_packet(AVFormatContext *s, AVPacket *pkt, int 
flush);
@@ -909,19 +919,54 @@ static int write_packet_common(AVFormatContext *s, 
AVStream *st, AVPacket *pkt,
 
 static int write_packets_common(AVFormatContext *s, AVStream *st, AVPacket 
*pkt, int interleaved)
 {
-int ret = do_packet_auto_bsf(s, pkt);
-if (ret == 0)
-return 0;
-else if (ret < 0)
+AVStreamInternal *sti = st->internal;
+int ret;
+
+ret = need_auto_bsf(s, st, pkt);
+if (ret < 0)
 goto fail;
 
-ret = write_packet_common(s, st, pkt, interleaved);
+if (ret) {
+AVPacket opkt = {0};
+int consumed_packet = 0;
+
+do {
+ret = auto_bsf_receive_packet(s, st, );
+if (ret < 0) {
+if (ret == AVERROR(EAGAIN) && !consumed_packet) {
+av_assert2(sti->bsfcs_idx == 0);
+ret = av_bsf_send_packet(sti->bsfcs[0], pkt);
+av_assert2(ret != AVERROR(EAGAIN));
+if (ret >= 0) {
+consumed_packet = 1;
+  

[FFmpeg-devel] [PATCH 2/8] avformat/mux: fix check_packet with null packet

2020-03-28 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 libavformat/mux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index bfd1bf491b..dfb21c8aa5 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -798,7 +798,7 @@ static int prepare_input_packet(AVFormatContext *s, 
AVPacket *pkt)
 
 #if !FF_API_COMPUTE_PKT_FIELDS2 || !FF_API_LAVF_AVCTX
 /* sanitize the timestamps */
-if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
+if (pkt && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
 AVStream *st = s->streams[pkt->stream_index];
 
 /* when there is no reordering (so dts is equal to pts), but
-- 
2.16.4

___
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 4/8] avformat/mux: factorize writing a packet

2020-03-28 Thread Marton Balint
In preparation for N:M bsf support.

Signed-off-by: Marton Balint 
---
 libavformat/mux.c | 82 +++
 1 file changed, 47 insertions(+), 35 deletions(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index f68f962a92..8c2d6a8060 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -883,6 +883,49 @@ static int do_packet_auto_bsf(AVFormatContext *s, AVPacket 
*pkt) {
 return 1;
 }
 
+static int interleaved_write_packet(AVFormatContext *s, AVPacket *pkt, int 
flush);
+
+static int write_packet_common(AVFormatContext *s, AVStream *st, AVPacket 
*pkt, int interleaved)
+{
+int ret;
+
+if (s->debug & FF_FDEBUG_TS)
+av_log(s, AV_LOG_DEBUG, "%s size:%d dts:%s pts:%s\n", __FUNCTION__,
+   pkt->size, av_ts2str(pkt->dts), av_ts2str(pkt->pts));
+
+#if FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX
+if ((ret = compute_muxer_pkt_fields(s, st, pkt)) < 0 && 
!(s->oformat->flags & AVFMT_NOTIMESTAMPS))
+return ret;
+#endif
+
+if (pkt->dts == AV_NOPTS_VALUE && !(s->oformat->flags & 
AVFMT_NOTIMESTAMPS))
+return AVERROR(EINVAL);
+
+if (interleaved)
+return interleaved_write_packet(s, pkt, 0);
+else
+return write_packet(s, pkt);
+}
+
+static int write_packets_common(AVFormatContext *s, AVStream *st, AVPacket 
*pkt, int interleaved)
+{
+int ret = do_packet_auto_bsf(s, pkt);
+if (ret == 0)
+return 0;
+else if (ret < 0)
+goto fail;
+
+ret = write_packet_common(s, st, pkt, interleaved);
+if (ret < 0)
+goto fail;
+return ret;
+
+fail:
+if (interleaved)
+av_packet_unref(pkt);
+return ret;
+}
+
 int av_write_frame(AVFormatContext *s, AVPacket *pkt)
 {
 int ret;
@@ -902,18 +945,7 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
 return 1;
 }
 
-ret = do_packet_auto_bsf(s, pkt);
-if (ret <= 0)
-return ret;
-
-#if FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX
-ret = compute_muxer_pkt_fields(s, s->streams[pkt->stream_index], pkt);
-
-if (ret < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
-return ret;
-#endif
-
-return write_packet(s, pkt);
+return write_packets_common(s, s->streams[pkt->stream_index], pkt, 
0/*non-interleaved*/);
 }
 
 #define CHUNK_START 0x1000
@@ -1211,7 +1243,7 @@ static int interleaved_write_packet(AVFormatContext *s, 
AVPacket *pkt, int flush
 
 int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
 {
-int ret, flush = 0;
+int ret;
 
 ret = prepare_input_packet(s, pkt);
 if (ret < 0)
@@ -1219,31 +1251,11 @@ int av_interleaved_write_frame(AVFormatContext *s, 
AVPacket *pkt)
 
 if (pkt) {
 AVStream *st = s->streams[pkt->stream_index];
-
-ret = do_packet_auto_bsf(s, pkt);
-if (ret == 0)
-return 0;
-else if (ret < 0)
-goto fail;
-
-if (s->debug & FF_FDEBUG_TS)
-av_log(s, AV_LOG_DEBUG, "av_interleaved_write_frame size:%d dts:%s 
pts:%s\n",
-pkt->size, av_ts2str(pkt->dts), av_ts2str(pkt->pts));
-
-#if FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX
-if ((ret = compute_muxer_pkt_fields(s, st, pkt)) < 0 && 
!(s->oformat->flags & AVFMT_NOTIMESTAMPS))
-goto fail;
-#endif
-
-if (pkt->dts == AV_NOPTS_VALUE && !(s->oformat->flags & 
AVFMT_NOTIMESTAMPS)) {
-ret = AVERROR(EINVAL);
-goto fail;
-}
+return write_packets_common(s, st, pkt, 1/*interleaved*/);
 } else {
 av_log(s, AV_LOG_TRACE, "av_interleaved_write_frame FLUSH\n");
-flush = 1;
+return interleaved_write_packet(s, NULL, 1/*flush*/);
 }
-return interleaved_write_packet(s, pkt, flush);
 
 fail:
 av_packet_unref(pkt);
-- 
2.16.4

___
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 3/8] avformat/mux: factorize interleaved write_packet

2020-03-28 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 libavformat/mux.c | 58 +++
 1 file changed, 24 insertions(+), 34 deletions(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index dfb21c8aa5..f68f962a92 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -1187,6 +1187,28 @@ static int interleave_packet(AVFormatContext *s, 
AVPacket *out, AVPacket *in, in
 return ff_interleave_packet_per_dts(s, out, in, flush);
 }
 
+static int interleaved_write_packet(AVFormatContext *s, AVPacket *pkt, int 
flush)
+{
+for (;; ) {
+AVPacket opkt;
+int ret = interleave_packet(s, , pkt, flush);
+if (pkt) {
+memset(pkt, 0, sizeof(*pkt));
+av_init_packet(pkt);
+pkt = NULL;
+}
+if (ret <= 0) //FIXME cleanup needed for ret<0 ?
+return ret;
+
+ret = write_packet(s, );
+
+av_packet_unref();
+
+if (ret < 0)
+return ret;
+}
+}
+
 int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
 {
 int ret, flush = 0;
@@ -1221,25 +1243,8 @@ int av_interleaved_write_frame(AVFormatContext *s, 
AVPacket *pkt)
 av_log(s, AV_LOG_TRACE, "av_interleaved_write_frame FLUSH\n");
 flush = 1;
 }
+return interleaved_write_packet(s, pkt, flush);
 
-for (;; ) {
-AVPacket opkt;
-int ret = interleave_packet(s, , pkt, flush);
-if (pkt) {
-memset(pkt, 0, sizeof(*pkt));
-av_init_packet(pkt);
-pkt = NULL;
-}
-if (ret <= 0) //FIXME cleanup needed for ret<0 ?
-return ret;
-
-ret = write_packet(s, );
-
-av_packet_unref();
-
-if (ret < 0)
-return ret;
-}
 fail:
 av_packet_unref(pkt);
 return ret;
@@ -1249,23 +1254,8 @@ int av_write_trailer(AVFormatContext *s)
 {
 int ret, i;
 
-for (;; ) {
-AVPacket pkt;
-ret = interleave_packet(s, , NULL, 1);
-if (ret < 0)
-goto fail;
-if (!ret)
-break;
-
-ret = write_packet(s, );
+ret = interleaved_write_packet(s, NULL, 1);
 
-av_packet_unref();
-
-if (ret < 0)
-goto fail;
-}
-
-fail:
 if (s->oformat->write_trailer) {
 if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb)
 avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_TRAILER);
-- 
2.16.4

___
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 v1 2/2] avfilter/vf_showinfo: limit the max number of timecode

2020-03-28 Thread Michael Niedermayer
On Wed, Mar 25, 2020 at 06:45:48PM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavfilter/vf_showinfo.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

will apply

thx

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

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato


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] [PATCH v2 3/3] avfilter/af_adelay: Check sscanf() return value

2020-03-28 Thread Michael Niedermayer
On Sat, Mar 28, 2020 at 08:17:33AM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavfilter/af_adelay.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavfilter/af_adelay.c b/libavfilter/af_adelay.c
> index c964777..2bb05e7 100644
> --- a/libavfilter/af_adelay.c
> +++ b/libavfilter/af_adelay.c
> @@ -155,7 +155,10 @@ static int config_input(AVFilterLink *inlink)
>  ret = av_sscanf(arg, "%d%c", >delay, );
>  if (ret != 2 || type != 'S') {
>  div = type == 's' ? 1.0 : 1000.0;
> -av_sscanf(arg, "%f", );
> +if (av_sscanf(arg, "%f", ) != 1) {

> +av_log(ctx, AV_LOG_ERROR, "Invalid syntax.\n");

I suggest to print the part of the string that is invalid.
This would make it easier to the user to know where the error is

thx

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

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes


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] [PATCH v2 2/2] avfilter: add vf_overlay_cuda

2020-03-28 Thread Timo Rothenpieler

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".

[FFmpeg-devel] [PATCH v6 2/2] libavcodec/jpeg2000dec.c: Handle non EOC streams

2020-03-28 Thread gautamramk
From: Gautam Ramakrishnan 

This patch allows decoding of j2k streams which do
not have an EOC marker. OpenJPEG implements a similar
check.
---
 libavcodec/jpeg2000dec.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 55fab00152..4f923d620d 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -2078,8 +2078,12 @@ static int 
jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
 
 len = bytestream2_get_be16(>g);
 if (len < 2 || bytestream2_get_bytes_left(>g) < len - 2) {
-av_log(s->avctx, AV_LOG_ERROR, "Invalid len %d left=%d\n", len, 
bytestream2_get_bytes_left(>g));
-return AVERROR_INVALIDDATA;
+if (s->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT) {
+av_log(s->avctx, AV_LOG_ERROR, "Invalid len %d left=%d\n", 
len, bytestream2_get_bytes_left(>g));
+return AVERROR_INVALIDDATA;
+}
+av_log(s->avctx, AV_LOG_WARNING, "Mising EOC Marker.\n");
+return 0;
 }
 
 switch (marker) {
-- 
2.17.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 v6 1/2] libavcodec/jpeg2000dec.c: Add functions and modify structs for PPT marker support

2020-03-28 Thread gautamramk
From: Gautam Ramakrishnan 

This patch adds support for the PPT marker. It breaks down the
jpeg2000_decode_packet() function to decode headers and data
separately.
---
 libavcodec/jpeg2000dec.c | 202 +--
 1 file changed, 172 insertions(+), 30 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 7103cd6ceb..55fab00152 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -83,8 +83,12 @@ typedef struct Jpeg2000Tile {
 Jpeg2000QuantStyle  qntsty[4];
 Jpeg2000POC poc;
 Jpeg2000TileParttile_part[32];
-uint16_t tp_idx;// Tile-part index
-int coord[2][2];// border coordinates {{x0, x1}, {y0, 
y1}}
+uint8_t has_ppt;// whether this tile has a ppt 
marker
+uint8_t *packed_headers;// contains packed headers. 
Used only along with PPT marker
+int packed_headers_size;// size in bytes of the packed 
headers
+GetByteContext  packed_headers_stream;  // byte context corresponding 
to packed headers
+uint16_t tp_idx;// Tile-part index
+int coord[2][2];// border coordinates {{x0, 
x1}, {y0, y1}}
 } Jpeg2000Tile;
 
 typedef struct Jpeg2000DecoderContext {
@@ -855,6 +859,40 @@ static int get_plt(Jpeg2000DecoderContext *s, int n)
 return 0;
 }
 
+static int get_ppt(Jpeg2000DecoderContext *s, int n)
+{
+Jpeg2000Tile *tile;
+
+if (s->curtileno < 0)
+return AVERROR_INVALIDDATA;
+
+tile = >tile[s->curtileno];
+
+if (tile->tp_idx != 0) {
+av_log(s->avctx, AV_LOG_ERROR,
+   "PPT marker can occur only on first tile part of a tile.\n");
+return AVERROR_INVALIDDATA;
+}
+
+tile->has_ppt = 1;  // this tile has a ppt marker
+/*Zppt = */ bytestream2_get_byte(>g);
+if (!tile->packed_headers) {
+tile->packed_headers = av_malloc_array(n - 3, sizeof(uint8_t));
+memcpy(tile->packed_headers, s->g.buffer, sizeof(uint8_t)*(n - 3));
+tile->packed_headers_size = n - 3;
+} else {
+tile->packed_headers = av_realloc_array(tile->packed_headers,
+tile->packed_headers_size + n 
- 3,
+sizeof(uint8_t));
+memcpy(tile->packed_headers + tile->packed_headers_size,
+   s->g.buffer, sizeof(uint8_t)*(n - 3));
+tile->packed_headers_size += n - 3;
+}
+bytestream2_skip(>g, n - 3);
+
+return 0;
+}
+
 static int init_tile(Jpeg2000DecoderContext *s, int tileno)
 {
 int compno;
@@ -927,30 +965,38 @@ static int getlblockinc(Jpeg2000DecoderContext *s)
 return res;
 }
 
-static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s, Jpeg2000Tile 
*tile, int *tp_index,
-  Jpeg2000CodingStyle *codsty,
-  Jpeg2000ResLevel *rlevel, int precno,
-  int layno, uint8_t *expn, int numgbits)
+static int jpeg2000_decode_packet_header(Jpeg2000DecoderContext *s, 
Jpeg2000Tile *tile,
+ int *tp_index,
+ Jpeg2000CodingStyle *codsty,
+ Jpeg2000ResLevel *rlevel, int precno,
+ int layno, uint8_t *expn, int 
numgbits,
+ int *process_data)
 {
 int bandno, cblkno, ret, nb_code_blocks;
-int cwsno;
 
-if (layno < rlevel->band[0].prec[precno].decoded_layers)
+if (layno < rlevel->band[0].prec[precno].decoded_layers) {
+*process_data = 0;
 return 0;
+}
 rlevel->band[0].prec[precno].decoded_layers = layno + 1;
 
-if (bytestream2_get_bytes_left(>g) == 0 && s->bit_index == 8) {
-if (*tp_index < FF_ARRAY_ELEMS(tile->tile_part) - 1) {
-s->g = tile->tile_part[++(*tp_index)].tpg;
+if (tile->has_ppt) {
+s->g = tile->packed_headers_stream;
+} else {
+s->g = tile->tile_part[*tp_index].tpg;
+if (bytestream2_get_bytes_left(>g) == 0 && s->bit_index == 8) {
+if (*tp_index < FF_ARRAY_ELEMS(tile->tile_part) - 1) {
+s->g = tile->tile_part[++(*tp_index)].tpg;
+}
 }
+if (bytestream2_peek_be32(>g) == JPEG2000_SOP_FIXED_BYTES)
+bytestream2_skip(>g, JPEG2000_SOP_BYTE_LENGTH);
 }
 
-if (bytestream2_peek_be32(>g) == JPEG2000_SOP_FIXED_BYTES)
-bytestream2_skip(>g, JPEG2000_SOP_BYTE_LENGTH);
-
 if (!(ret = get_bits(s, 1))) {
 jpeg2000_flush(s);
-return 0;
+*process_data = 0;
+goto end;
 } else if (ret < 0)
 return ret;
 
@@ -1055,6 +1101,34 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext 
*s, Jpeg2000Tile *tile,
 else
  

Re: [FFmpeg-devel] [PATCH 3/3] lavc/vaapi_encode_h265: add h265 tile encoding support

2020-03-28 Thread Fu, Linjie
> From: ffmpeg-devel  On Behalf Of Fu,
> Linjie
> Sent: Tuesday, March 24, 2020 10:15
> To: myp...@gmail.com; FFmpeg development discussions and patches
> 
> Subject: Re: [FFmpeg-devel] [PATCH 3/3] lavc/vaapi_encode_h265: add h265
> tile encoding support
> 
> > From: myp...@gmail.com 
> > Sent: Monday, March 23, 2020 22:44
> > To: FFmpeg development discussions and patches  > de...@ffmpeg.org>
> > Cc: Fu, Linjie 
> > Subject: Re: [FFmpeg-devel] [PATCH 3/3] lavc/vaapi_encode_h265: add
> h265
> > tile encoding support
> >
> > On Mon, Mar 23, 2020 at 10:30 PM Linjie Fu  wrote:
> > >
> > > Default to enable uniform_spacing_flag. Guess level by the tile
> > > rows/cols. Supported for ICL+ platforms.
> > >
> > > Also add documentations.
> > >
> > > To encode with 4 rows 2 columns:
> > > ffmpeg ... -c:v hevc_vaapi -tile_rows 4 -tile_cols 2 ...
> > >
> > > Signed-off-by: Linjie Fu 
> > > ---
> > >  doc/encoders.texi  |  8 
> > >  libavcodec/vaapi_encode_h265.c | 36
> > +++-
> > >  2 files changed, 43 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/doc/encoders.texi b/doc/encoders.texi
> > > index e23b6b3..2dc5cd4 100644
> > > --- a/doc/encoders.texi
> > > +++ b/doc/encoders.texi
> > > @@ -3091,6 +3091,14 @@ Include HDR metadata if the input frames have
> it
> > >  messages).
> > >  @end table
> > >
> > > +@item tile_rows
> > > +Selects how many rows of tiles to encode with. For example, 4 tile rows
> > would
> > > +be requested by setting the tile_rows option to 4.
> > > +
> > > +@item tile_cols
> > > +Selects how many columns of tiles to encode with. For example, 5 tile
> > columns
> > > +would be requested by setting the tile_cols option to 5.
> > > +
> > >  @end table
> > >
> > >  @item mjpeg_vaapi
> > > diff --git a/libavcodec/vaapi_encode_h265.c
> > b/libavcodec/vaapi_encode_h265.c
> > > index 97dc5a7..457e3d9 100644
> > > --- a/libavcodec/vaapi_encode_h265.c
> > > +++ b/libavcodec/vaapi_encode_h265.c
> > > @@ -63,6 +63,9 @@ typedef struct VAAPIEncodeH265Context {
> > >  int level;
> > >  int sei;
> > >
> > > +int trows;
> > > +int tcols;
> > > +
> > >  // Derived settings.
> > >  int fixed_qp_idr;
> > >  int fixed_qp_p;
> > > @@ -345,7 +348,7 @@ static int
> > vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx)
> > >
> > >  level = ff_h265_guess_level(ptl, avctx->bit_rate,
> > >  ctx->surface_width, 
> > > ctx->surface_height,
> > > -ctx->nb_slices, 1, 1,
> > > +ctx->nb_slices, ctx->tile_rows, 
> > > ctx->tile_cols,
> > >  (ctx->b_per_p > 0) + 1);
> > >  if (level) {
> > >  av_log(avctx, AV_LOG_VERBOSE, "Using level %s.\n", level-
> >name);
> > > @@ -558,6 +561,20 @@ static int
> > vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx)
> > >
> > >  pps->pps_loop_filter_across_slices_enabled_flag = 1;
> > >
> > > +if (ctx->tile_rows && ctx->tile_cols) {
> > > +pps->tiles_enabled_flag = 1;
> > > +pps->uniform_spacing_flag   = 1;
> > > +
> > > +pps->num_tile_rows_minus1   = ctx->tile_rows - 1;
> > > +pps->num_tile_columns_minus1= ctx->tile_cols - 1;
> > > +
> > > +pps->loop_filter_across_tiles_enabled_flag = 1;
> > > +
> > > +for (i = 0; i <= pps->num_tile_rows_minus1; i++)
> > > +pps->row_height_minus1[i]   = ctx->row_height[i] - 1;
> > > +for (i = 0; i <= pps->num_tile_columns_minus1; i++)
> > > +pps->column_width_minus1[i] = ctx->col_width[i] - 1;
> > > +}
> > >
> > >  // Fill VAAPI parameter buffers.
> > >
> > > @@ -666,6 +683,13 @@ static int
> > vaapi_encode_h265_init_sequence_params(AVCodecContext *avctx)
> > >  },
> > >  };
> > >
> > > +if (pps->tiles_enabled_flag) {
> > > +for (i = 0; i <= vpic->num_tile_rows_minus1; i++)
> > > +vpic->row_height_minus1[i]   = pps->row_height_minus1[i];
> > > +for (i = 0; i <= vpic->num_tile_columns_minus1; i++)
> > > +vpic->column_width_minus1[i] = pps->column_width_minus1[i];
> > > +}
> > > +
> > >  return 0;
> > >  }
> > >
> > > @@ -1181,6 +1205,11 @@ static av_cold int
> > vaapi_encode_h265_init(AVCodecContext *avctx)
> > >  if (priv->qp > 0)
> > >  ctx->explicit_qp = priv->qp;
> > >
> > > +if (priv->trows && priv->tcols) {
> > > +ctx->tile_rows = priv->trows;
> > > +ctx->tile_cols = priv->tcols;
> > > +}
> > > +
> > >  return ff_vaapi_encode_init(avctx);
> > >  }
> > >
> > > @@ -1257,6 +1286,11 @@ static const AVOption
> > vaapi_encode_h265_options[] = {
> > >{ .i64 = SEI_MASTERING_DISPLAY | SEI_CONTENT_LIGHT_LEVEL },
> > >INT_MIN, INT_MAX, FLAGS, "sei" },
> > >
> > > +{ "tile_rows", "Number of rows for tile encoding",
> > > +  OFFSET(trows), 

Re: [FFmpeg-devel] [PATCH 06/14] pthread_frame: do not copy a range of AVCodecContext fields at once

2020-03-28 Thread Michael Niedermayer
On Fri, Mar 27, 2020 at 01:57:40PM +0100, Anton Khirnov wrote:
> This is extremely fragile against reordering and hides what is actually
> being copied. Copy all the fields manually instead.
> ---
>  libavcodec/pthread_frame.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

LGTM

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Whats the most studid thing your enemy could do ? Blow himself up
Whats the most studid thing you could do ? Give up your rights and
freedom because your enemy blew himself up.



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] [PATCH v4 2/2] avformat/dashdec: refine adaptionset attribute members

2020-03-28 Thread Nicolas George
Steven Liu (12020-03-28):
> all the members is used check all the representation useable.
> 
> Signed-off-by: Steven Liu 
> ---
>  libavformat/dashdec.c | 203 +-
>  1 file changed, 199 insertions(+), 4 deletions(-)

Thanks. I find this version easier to read, it has less deleted lines
making noise.

> 
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 271202b0a5..63caa696f8 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -108,6 +108,7 @@ struct representation {
>  int64_t cur_seg_offset;
>  int64_t cur_seg_size;
>  struct fragment *cur_seg;
> +char *lang;
>  
>  /* Currently active Media Initialization Section */
>  struct fragment *init_section;
> @@ -123,6 +124,16 @@ typedef struct DASHContext {
>  const AVClass *class;
>  char *base_url;
>  
> +char *adaptionset_lang;
> +uint64_t adaptionset_minbw;
> +uint64_t adaptionset_maxbw;
> +uint64_t adaptionset_minwidth;
> +uint64_t adaptionset_maxwidth;
> +uint64_t adaptionset_minheight;
> +uint64_t adaptionset_maxheight;
> +AVRational adaptionset_minframerate;
> +AVRational adaptionset_maxframerate;
> +
>  int n_videos;
>  struct representation **videos;
>  int n_audios;
> @@ -156,6 +167,85 @@ typedef struct DASHContext {
>  
>  } DASHContext;
>  
> +static int get_ratio_from_string(AVRational *dst, const char *src)
> +{
> +char *end = NULL;
> +char *end_ptr = NULL;
> +long num, den;
> +

> +num = strtol(src, _ptr, 10);
> +if (errno == ERANGE || end_ptr == src)
> +return AVERROR_INVALIDDATA;

If you use errno to check for error, it needs to be initialized to 0
before; otherwise, it could be leftover from a completely different part
of the code.

Also, the list of errors in the standard is not exhaustive: errno could
be something else than ERANGE and still indicate a failure.

> +
> +if (num > INT_MAX)
> +return AVERROR_INVALIDDATA;

This could be merged with the previous test. And I think you need to
test for num < INT_MIN too.

> +
> +if (end_ptr[0] == '\0') {
> +dst->den = 1;
> +dst->num = (int)num;
> +return 0;
> +}
> +
> +if (end_ptr[0] != '/')
> +return AVERROR_INVALIDDATA;
> +
> +end_ptr++;
> +den = strtol(end_ptr, , 10);

> +if (errno == ERANGE || end == src)
> +return AVERROR_INVALIDDATA;
> +
> +if (den > INT_MAX)
> +return AVERROR_INVALIDDATA;

Same as above, of course.

> +
> +dst->den = (int)den;
> +
> +return 0;
> +}
> +
> +static int  dash_prop_get_uint64(AVFormatContext *s, xmlNodePtr node, 
> uint64_t *dst, const char *key)
> +{
> +char *end_ptr = NULL;
> +char *val = xmlGetProp(node, key);
> +int ret = 0;
> +uint64_t tmpval = 0;
> +
> +if (val) {
> +tmpval = strtoull(val, _ptr, 10);

> +if (errno == ERANGE) {
> +av_log(s, AV_LOG_WARNING, "overflow/underflow when get value of 
> %s\n", key);

Same remarks about errno.

> +ret = AVERROR_INVALIDDATA;
> +goto out;
> +}
> +if (end_ptr == val || end_ptr[0] != '\0') {
> +av_log(s, AV_LOG_ERROR, "The %s field value is "
> +"not a valid number: %s\n", key, val);
> +ret = AVERROR_INVALIDDATA;
> +goto out;
> +}
> +*dst = tmpval;

I think, if you want to check all cases, you need to check if tmpval is
greater than UINT64_MAX.

> +out:
> +xmlFree(val);
> +}
> +return ret;
> +}
> +
> +static int dash_get_prop_ratio(AVFormatContext *s, xmlNodePtr node, 
> AVRational *member, const char *key)
> +{
> +char *val = xmlGetProp(node, key);
> +int ret = 0;
> +AVRational rate;
> +
> +if (val) {
> +ret = get_ratio_from_string(, val);
> +if (ret < 0)
> +av_log(s, AV_LOG_WARNING, "Ignoring invalid %s frame rate 
> '%s'\n", key, val);
> +xmlFree(val);
> +}
> +member->num = rate.num;
> +member->den = rate.den;
> +return ret;
> +}
> +
>  static int ishttp(char *url)
>  {
>  const char *proto_name = avio_find_protocol_name(url);
> @@ -872,6 +962,15 @@ static int parse_manifest_representation(AVFormatContext 
> *s, const char *url,
>  ret = AVERROR(ENOMEM);
>  goto end;
>  }
> +if (c->adaptionset_lang) {
> +rep->lang = av_strdup(c->adaptionset_lang);
> +if (!rep->lang) {
> +av_log(s, AV_LOG_ERROR, "alloc language memory failure\n");
> +av_freep();
> +ret = AVERROR(ENOMEM);
> +goto end;
> +}
> +}
>  rep->parent = s;
>  representation_segmenttemplate_node = 
> find_child_node_by_name(representation_node, "SegmentTemplate");
>  representation_baseurl_node = 
> find_child_node_by_name(representation_node, "BaseURL");
> @@ -1057,15 +1156,55 @@ 

Re: [FFmpeg-devel] [PATCH v5 1/2] libavcodec/jpeg2000dec.c: Add functions and modify structs for PPT marker support

2020-03-28 Thread Michael Niedermayer
On Sat, Mar 28, 2020 at 06:54:58PM +0530, gautamr...@gmail.com wrote:
> From: Gautam Ramakrishnan 
> 
> This patch adds support for the PPT marker. It breaks down the
> jpeg2000_decode_packet() function to decode headers and data
> separately.
> ---
>  libavcodec/jpeg2000dec.c | 200 +--
>  1 file changed, 170 insertions(+), 30 deletions(-)

this patch causes an assertion failure:

Thread 26 "read_thread" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fff80ff9700 (LWP 29700)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x7fffefafc801 in __GI_abort () at abort.c:79
#2  0x55d06ffb in get_ppt (s=0x7fff78051640, n=47) at 
libavcodec/jpeg2000dec.c:868
#3  0x55d0cf04 in jpeg2000_read_main_headers (s=0x7fff78051640) at 
libavcodec/jpeg2000dec.c:2133
#4  0x55d0dcd5 in jpeg2000_decode_frame (avctx=0x7fff78050dc0, 
data=0x7fff78051280, got_frame=0x7fff780070d0, avpkt=0x7fff78007070) at 
libavcodec/jpeg2000dec.c:2372
#5  0x55e44803 in frame_worker_thread (arg=0x7fff78006f70) at 
libavcodec/pthread_frame.c:201
#6  0x7fffefeb46db in start_thread (arg=0x7fff80ff9700) at 
pthread_create.c:463
#7  0x7fffefbdd88f in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:95

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

Elect your leaders based on what they did after the last election, not
based on what they say before an election.



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] [PATCH 02/14] avformat/matroska: clean the structure formatting

2020-03-28 Thread Steve Lhomme

On 2020-03-25 23:24, Andreas Rheinhardt wrote:

Steve Lhomme:

From: Steve Lhomme 

Always use a comma at the end, order elements by value.
---
  libavformat/matroska.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/matroska.h b/libavformat/matroska.h
index 9e33e51c94..e177cd027f 100644
--- a/libavformat/matroska.h
+++ b/libavformat/matroska.h
@@ -286,13 +286,13 @@ typedef enum {
  typedef enum {
  MATROSKA_VIDEO_INTERLACE_FLAG_UNDETERMINED = 0,
  MATROSKA_VIDEO_INTERLACE_FLAG_INTERLACED   = 1,
-MATROSKA_VIDEO_INTERLACE_FLAG_PROGRESSIVE  = 2
+MATROSKA_VIDEO_INTERLACE_FLAG_PROGRESSIVE  = 2,
  } MatroskaVideoInterlaceFlag;
  
  typedef enum {

  MATROSKA_VIDEO_FIELDORDER_PROGRESSIVE  = 0,
-MATROSKA_VIDEO_FIELDORDER_UNDETERMINED = 2,
  MATROSKA_VIDEO_FIELDORDER_TT   = 1,
+MATROSKA_VIDEO_FIELDORDER_UNDETERMINED = 2,
  MATROSKA_VIDEO_FIELDORDER_BB   = 6,
  MATROSKA_VIDEO_FIELDORDER_TB   = 9,
  MATROSKA_VIDEO_FIELDORDER_BT   = 14,


Would it actually be allowed to add new values to the range of
FlagInterlaced (to which the MatroskaVideoInterlaceFlag enum
corresponds)? If no, then we should not add a comma, as this signals
extensibility.
The reordering looks good either way.


Yes, dependending on the DocType version it might be possible that some 
new values are added to enums (not just this one).


Also I'm not sure I can tell an element in the last of an "list" in XSLT 
so that would be more trouble to generate the code.

___
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 10/14] avformat/matroskadec: move the elements semantic in a separate file

2020-03-28 Thread Steve Lhomme

On 2020-03-25 3:09, Andreas Rheinhardt wrote:

Steve Lhomme:

From: Steve Lhomme 

So the file can be generated from the Matroska Schema.

The EbmlSyntax structures are not shared between files.
matroska_segments and matroska_cluster_enter also have their size predefined.

No functional changes.
---
  libavformat/Makefile  |   2 +-
  libavformat/matroskadec.c | 668 +-
  libavformat/matroskasem.c | 384 ++
  libavformat/matroskasem.h | 362 +
  4 files changed, 748 insertions(+), 668 deletions(-)
  create mode 100644 libavformat/matroskasem.c
  create mode 100644 libavformat/matroskasem.h


[...]


diff --git a/libavformat/matroskasem.h b/libavformat/matroskasem.h
new file mode 100644
index 00..8171982abf
--- /dev/null
+++ b/libavformat/matroskasem.h
@@ -0,0 +1,362 @@
+/*
+ * Matroska file semantic definition
+ * Copyright (c) 2003-2020 The FFmpeg project
+ *
+ * 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
+ */
+
+/**
+ * @file
+ * Matroska file demuxer
+ * @author Ronald Bultje 
+ * @author with a little help from Moritz Bunkus 
+ * @author totally reworked by Aurelien Jacobs 
+ * @see specs available on the Matroska project page: http://www.matroska.org/
+ */
+
+#ifndef AVFORMAT_MATROSKASEM_H
+#define AVFORMAT_MATROSKASEM_H
+
+#include 
+
+#include "matroska.h"
+#include "avformat.h"
+#include "libavutil/frame.h"


Is it possible that you just included this for AVBufferRef (which is
defined in libavutil/buffer.h)?


Sure, I'll give it a try.
___
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] avformat: Add Dynacolor MVC Demuxer

2020-03-28 Thread Tom Needham
Hi Michael

I have fixed the build errors you mentioned by not inlining those functions
so they do not get relocated. Updated patch below.

From 4c17850cb2546487d789b86f511a30bdef40f817 Mon Sep 17 00:00:00 2001
From: Tom Needham <06needh...@gmail.com>
Date: Sun, 21 Jul 2019 21:11:19 +0100
Subject: [PATCH] avformat: Add Dynacolor MVC Demuxer

This demuxer adds support for demuxing files in the Dynacolor format
such as the sample located at:

http://samples.ffmpeg.org/camera-dvr/dynacolor/dynacolor-camera-sample

However some decode errors are showing on the resulting MPEG4 stream.
I don't know whether this is a bug with the demuxer or the file as there is
only one sample
but the output results in a 1 second mp4 file that is playable in VLC media
player.

Signed-off-by: Tom Needham <06needh...@gmail.com>
---
 Changelog|   1 +
 doc/general.texi |   1 +
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/dynacolor.c  | 497 +++
 libavformat/dynacolor.h  | 276 ++
 libavformat/version.h|   2 +-
 7 files changed, 778 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/dynacolor.c
 create mode 100644 libavformat/dynacolor.h

diff --git a/Changelog b/Changelog
index 711861bda9..79d39494c9 100644
--- a/Changelog
+++ b/Changelog
@@ -54,6 +54,7 @@ version :
 - DERF demuxer
 - CRI HCA decoder
 - CRI HCA demuxer
+- Dynacolor MVC Demuxer


 version 4.2:
diff --git a/doc/general.texi b/doc/general.texi
index 752618a00b..4eb4716d87 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -452,6 +452,7 @@ library:
 @item DXA   @tab   @tab X
 @tab This format is used in the non-Windows version of the Feeble Files
  game and different game cutscenes repacked for use with ScummVM.
+@item Dynacolor MVC @tab   @tab X
 @item Electronic Arts cdata  @tab@tab X
 @item Electronic Arts Multimedia  @tab@tab X
 @tab Used in various EA games; files have extensions like WVE and UV2.
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 8fd0d43721..4d1ca8b7ed 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -169,6 +169,7 @@ OBJS-$(CONFIG_DV_MUXER)  += dvenc.o
 OBJS-$(CONFIG_DVBSUB_DEMUXER)+= dvbsub.o rawdec.o
 OBJS-$(CONFIG_DVBTXT_DEMUXER)+= dvbtxt.o rawdec.o
 OBJS-$(CONFIG_DXA_DEMUXER)   += dxa.o
+OBJS-$(CONFIG_DYNACOLOR_DEMUXER) += dynacolor.o
 OBJS-$(CONFIG_EA_CDATA_DEMUXER)  += eacdata.o
 OBJS-$(CONFIG_EA_DEMUXER)+= electronicarts.o
 OBJS-$(CONFIG_EAC3_DEMUXER)  += ac3dec.o rawdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 39d2c352f5..50f3926b05 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -131,6 +131,7 @@ extern AVOutputFormat ff_dv_muxer;
 extern AVInputFormat  ff_dvbsub_demuxer;
 extern AVInputFormat  ff_dvbtxt_demuxer;
 extern AVInputFormat  ff_dxa_demuxer;
+extern AVInputFormat  ff_dynacolor_demuxer;
 extern AVInputFormat  ff_ea_demuxer;
 extern AVInputFormat  ff_ea_cdata_demuxer;
 extern AVInputFormat  ff_eac3_demuxer;
diff --git a/libavformat/dynacolor.c b/libavformat/dynacolor.c
new file mode 100644
index 00..cccbbf82f2
--- /dev/null
+++ b/libavformat/dynacolor.c
@@ -0,0 +1,497 @@
+/*
+ * Dynacolor MVC Demuxer
+ * Copyright (c) 2020 Tom Needham
+ *
+ * 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
+ */
+
+#include 
+#include "avformat.h"
+#include "internal.h"
+#include "dynacolor.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/timecode.h"
+#include "libavutil/avassert.h"
+
+//max total
size=sizeof(tHeader)+sizeof(tSuperExtraIdx1)+PENTAMICRO_PES_HEADER_SIZE+frame
size
+unsigned char ff_dyna_callback_checksum(tBasicIdx *header)
+{
+int i;
+unsigned char chksum = 0, *pHeader;
+pHeader = (unsigned char *)header;
+if (*pHeader == '@' && *(pHeader + 1) == '2') {
+for (i = 0; i < sizeof(tBasicIdx) - 1; ++i) {
+chksum ^= *(pHeader + i);
+}
+}
+return chksum;
+}
+
+unsigned char ff_dyna_extra_checksum(tBasicIdx *header)
+{
+int i;
+ 

[FFmpeg-devel] [PATCH v4 2/2] avformat/dashdec: refine adaptionset attribute members

2020-03-28 Thread Steven Liu
all the members is used check all the representation useable.

Signed-off-by: Steven Liu 
---
 libavformat/dashdec.c | 203 +-
 1 file changed, 199 insertions(+), 4 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 271202b0a5..63caa696f8 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -108,6 +108,7 @@ struct representation {
 int64_t cur_seg_offset;
 int64_t cur_seg_size;
 struct fragment *cur_seg;
+char *lang;
 
 /* Currently active Media Initialization Section */
 struct fragment *init_section;
@@ -123,6 +124,16 @@ typedef struct DASHContext {
 const AVClass *class;
 char *base_url;
 
+char *adaptionset_lang;
+uint64_t adaptionset_minbw;
+uint64_t adaptionset_maxbw;
+uint64_t adaptionset_minwidth;
+uint64_t adaptionset_maxwidth;
+uint64_t adaptionset_minheight;
+uint64_t adaptionset_maxheight;
+AVRational adaptionset_minframerate;
+AVRational adaptionset_maxframerate;
+
 int n_videos;
 struct representation **videos;
 int n_audios;
@@ -156,6 +167,85 @@ typedef struct DASHContext {
 
 } DASHContext;
 
+static int get_ratio_from_string(AVRational *dst, const char *src)
+{
+char *end = NULL;
+char *end_ptr = NULL;
+long num, den;
+
+num = strtol(src, _ptr, 10);
+if (errno == ERANGE || end_ptr == src)
+return AVERROR_INVALIDDATA;
+
+if (num > INT_MAX)
+return AVERROR_INVALIDDATA;
+
+if (end_ptr[0] == '\0') {
+dst->den = 1;
+dst->num = (int)num;
+return 0;
+}
+
+if (end_ptr[0] != '/')
+return AVERROR_INVALIDDATA;
+
+end_ptr++;
+den = strtol(end_ptr, , 10);
+if (errno == ERANGE || end == src)
+return AVERROR_INVALIDDATA;
+
+if (den > INT_MAX)
+return AVERROR_INVALIDDATA;
+
+dst->den = (int)den;
+
+return 0;
+}
+
+static int  dash_prop_get_uint64(AVFormatContext *s, xmlNodePtr node, uint64_t 
*dst, const char *key)
+{
+char *end_ptr = NULL;
+char *val = xmlGetProp(node, key);
+int ret = 0;
+uint64_t tmpval = 0;
+
+if (val) {
+tmpval = strtoull(val, _ptr, 10);
+if (errno == ERANGE) {
+av_log(s, AV_LOG_WARNING, "overflow/underflow when get value of 
%s\n", key);
+ret = AVERROR_INVALIDDATA;
+goto out;
+}
+if (end_ptr == val || end_ptr[0] != '\0') {
+av_log(s, AV_LOG_ERROR, "The %s field value is "
+"not a valid number: %s\n", key, val);
+ret = AVERROR_INVALIDDATA;
+goto out;
+}
+*dst = tmpval;
+out:
+xmlFree(val);
+}
+return ret;
+}
+
+static int dash_get_prop_ratio(AVFormatContext *s, xmlNodePtr node, AVRational 
*member, const char *key)
+{
+char *val = xmlGetProp(node, key);
+int ret = 0;
+AVRational rate;
+
+if (val) {
+ret = get_ratio_from_string(, val);
+if (ret < 0)
+av_log(s, AV_LOG_WARNING, "Ignoring invalid %s frame rate '%s'\n", 
key, val);
+xmlFree(val);
+}
+member->num = rate.num;
+member->den = rate.den;
+return ret;
+}
+
 static int ishttp(char *url)
 {
 const char *proto_name = avio_find_protocol_name(url);
@@ -872,6 +962,15 @@ static int parse_manifest_representation(AVFormatContext 
*s, const char *url,
 ret = AVERROR(ENOMEM);
 goto end;
 }
+if (c->adaptionset_lang) {
+rep->lang = av_strdup(c->adaptionset_lang);
+if (!rep->lang) {
+av_log(s, AV_LOG_ERROR, "alloc language memory failure\n");
+av_freep();
+ret = AVERROR(ENOMEM);
+goto end;
+}
+}
 rep->parent = s;
 representation_segmenttemplate_node = 
find_child_node_by_name(representation_node, "SegmentTemplate");
 representation_baseurl_node = 
find_child_node_by_name(representation_node, "BaseURL");
@@ -1057,15 +1156,55 @@ static int 
parse_manifest_representation(AVFormatContext *s, const char *url,
 }
 
 if (rep) {
+uint64_t width = 0;
+uint64_t height = 0;
+
 if (rep->fragment_duration > 0 && !rep->fragment_timescale)
 rep->fragment_timescale = 1;
 rep->bandwidth = rep_bandwidth_val ? atoi(rep_bandwidth_val) : 0;
+if (rep_bandwidth_val && (rep->bandwidth > c->adaptionset_maxbw || 
rep->bandwidth < c->adaptionset_minbw)) {
+av_log(s, AV_LOG_WARNING, "The bandwidth of representation %s 
is incorrect, "
+"will ignore this representation.\n", rep_id_val);
+free_representation(rep);
+goto end;
+}
+
+if (dash_prop_get_uint64(s, representation_node, , "width") 
< 0)
+av_log(s, AV_LOG_WARNING, "Ignoring the width of 
representation %s is incorrect.\n", 

[FFmpeg-devel] [PATCH v4 1/2] Revert "avformat/dashdec: refine adaptionset attribute members"

2020-03-28 Thread Steven Liu
This reverts commit e134c20374ee3cbc6d04885d306b02c9871683a2.

Signed-off-by: Steven Liu 
---
 libavformat/dashdec.c | 27 ---
 1 file changed, 27 deletions(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 5bbe5d3985..271202b0a5 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -122,19 +122,6 @@ struct representation {
 typedef struct DASHContext {
 const AVClass *class;
 char *base_url;
-char *adaptionset_contenttype_val;
-char *adaptionset_par_val;
-char *adaptionset_lang_val;
-char *adaptionset_minbw_val;
-char *adaptionset_maxbw_val;
-char *adaptionset_minwidth_val;
-char *adaptionset_maxwidth_val;
-char *adaptionset_minheight_val;
-char *adaptionset_maxheight_val;
-char *adaptionset_minframerate_val;
-char *adaptionset_maxframerate_val;
-char *adaptionset_segmentalignment_val;
-char *adaptionset_bitstreamswitching_val;
 
 int n_videos;
 struct representation **videos;
@@ -1124,26 +,12 @@ static int parse_manifest_adaptationset(AVFormatContext 
*s, const char *url,
 xmlNodePtr period_segmentlist_node)
 {
 int ret = 0;
-DASHContext *c = s->priv_data;
 xmlNodePtr fragment_template_node = NULL;
 xmlNodePtr content_component_node = NULL;
 xmlNodePtr adaptionset_baseurl_node = NULL;
 xmlNodePtr adaptionset_segmentlist_node = NULL;
 xmlNodePtr adaptionset_supplementalproperty_node = NULL;
 xmlNodePtr node = NULL;
-c->adaptionset_contenttype_val = xmlGetProp(adaptionset_node, 
"contentType");
-c->adaptionset_par_val = xmlGetProp(adaptionset_node, "par");
-c->adaptionset_lang_val = xmlGetProp(adaptionset_node, "lang");
-c->adaptionset_minbw_val = xmlGetProp(adaptionset_node, "minBandwidth");
-c->adaptionset_maxbw_val = xmlGetProp(adaptionset_node, "maxBandwidth");
-c->adaptionset_minwidth_val = xmlGetProp(adaptionset_node, "minWidth");
-c->adaptionset_maxwidth_val = xmlGetProp(adaptionset_node, "maxWidth");
-c->adaptionset_minheight_val = xmlGetProp(adaptionset_node, "minHeight");
-c->adaptionset_maxheight_val = xmlGetProp(adaptionset_node, "maxHeight");
-c->adaptionset_minframerate_val = xmlGetProp(adaptionset_node, 
"minFrameRate");
-c->adaptionset_maxframerate_val = xmlGetProp(adaptionset_node, 
"maxFrameRate");
-c->adaptionset_segmentalignment_val = xmlGetProp(adaptionset_node, 
"segmentAlignment");
-c->adaptionset_bitstreamswitching_val = xmlGetProp(adaptionset_node, 
"bitstreamSwitching");
 
 node = xmlFirstElementChild(adaptionset_node);
 while (node) {
-- 
2.25.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".

[FFmpeg-devel] [PATCH v5 1/2] libavcodec/jpeg2000dec.c: Add functions and modify structs for PPT marker support

2020-03-28 Thread gautamramk
From: Gautam Ramakrishnan 

This patch adds support for the PPT marker. It breaks down the
jpeg2000_decode_packet() function to decode headers and data
separately.
---
 libavcodec/jpeg2000dec.c | 200 +--
 1 file changed, 170 insertions(+), 30 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 7103cd6ceb..44b3e7e41b 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -83,8 +83,12 @@ typedef struct Jpeg2000Tile {
 Jpeg2000QuantStyle  qntsty[4];
 Jpeg2000POC poc;
 Jpeg2000TileParttile_part[32];
-uint16_t tp_idx;// Tile-part index
-int coord[2][2];// border coordinates {{x0, x1}, {y0, 
y1}}
+uint8_t has_ppt;// whether this tile has a ppt 
marker
+uint8_t *packed_headers;// contains packed headers. 
Used only along with PPT marker
+int packed_headers_size;// size in bytes of the packed 
headers
+GetByteContext  packed_headers_stream;  // byte context corresponding 
to packed headers
+uint16_t tp_idx;// Tile-part index
+int coord[2][2];// border coordinates {{x0, 
x1}, {y0, y1}}
 } Jpeg2000Tile;
 
 typedef struct Jpeg2000DecoderContext {
@@ -855,6 +859,38 @@ static int get_plt(Jpeg2000DecoderContext *s, int n)
 return 0;
 }
 
+static int get_ppt(Jpeg2000DecoderContext *s, int n)
+{
+Jpeg2000Tile *tile;
+
+tile = >tile[s->curtileno];
+
+av_assert1(s->curtileno >= 0);
+if (tile->tp_idx != 0) {
+av_log(s->avctx, AV_LOG_ERROR,
+   "PPT marker can occur only on first tile part of a tile.\n");
+return AVERROR_INVALIDDATA;
+}
+
+tile->has_ppt = 1;  // this tile has a ppt marker
+/*Zppt = */ bytestream2_get_byte(>g);
+if (!tile->packed_headers) {
+tile->packed_headers = av_malloc_array(n - 3, sizeof(uint8_t));
+memcpy(tile->packed_headers, s->g.buffer, sizeof(uint8_t)*(n - 3));
+tile->packed_headers_size = n - 3;
+} else {
+tile->packed_headers = av_realloc_array(tile->packed_headers,
+tile->packed_headers_size + n 
- 3,
+sizeof(uint8_t));
+memcpy(tile->packed_headers + tile->packed_headers_size,
+   s->g.buffer, sizeof(uint8_t)*(n - 3));
+tile->packed_headers_size += n - 3;
+}
+bytestream2_skip(>g, n - 3);
+
+return 0;
+}
+
 static int init_tile(Jpeg2000DecoderContext *s, int tileno)
 {
 int compno;
@@ -927,30 +963,38 @@ static int getlblockinc(Jpeg2000DecoderContext *s)
 return res;
 }
 
-static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s, Jpeg2000Tile 
*tile, int *tp_index,
-  Jpeg2000CodingStyle *codsty,
-  Jpeg2000ResLevel *rlevel, int precno,
-  int layno, uint8_t *expn, int numgbits)
+static int jpeg2000_decode_packet_header(Jpeg2000DecoderContext *s, 
Jpeg2000Tile *tile,
+ int *tp_index,
+ Jpeg2000CodingStyle *codsty,
+ Jpeg2000ResLevel *rlevel, int precno,
+ int layno, uint8_t *expn, int 
numgbits,
+ int *process_data)
 {
 int bandno, cblkno, ret, nb_code_blocks;
-int cwsno;
 
-if (layno < rlevel->band[0].prec[precno].decoded_layers)
+if (layno < rlevel->band[0].prec[precno].decoded_layers) {
+*process_data = 0;
 return 0;
+}
 rlevel->band[0].prec[precno].decoded_layers = layno + 1;
 
-if (bytestream2_get_bytes_left(>g) == 0 && s->bit_index == 8) {
-if (*tp_index < FF_ARRAY_ELEMS(tile->tile_part) - 1) {
-s->g = tile->tile_part[++(*tp_index)].tpg;
+if (tile->has_ppt) {
+s->g = tile->packed_headers_stream;
+} else {
+s->g = tile->tile_part[*tp_index].tpg;
+if (bytestream2_get_bytes_left(>g) == 0 && s->bit_index == 8) {
+if (*tp_index < FF_ARRAY_ELEMS(tile->tile_part) - 1) {
+s->g = tile->tile_part[++(*tp_index)].tpg;
+}
 }
+if (bytestream2_peek_be32(>g) == JPEG2000_SOP_FIXED_BYTES)
+bytestream2_skip(>g, JPEG2000_SOP_BYTE_LENGTH);
 }
 
-if (bytestream2_peek_be32(>g) == JPEG2000_SOP_FIXED_BYTES)
-bytestream2_skip(>g, JPEG2000_SOP_BYTE_LENGTH);
-
 if (!(ret = get_bits(s, 1))) {
 jpeg2000_flush(s);
-return 0;
+*process_data = 0;
+goto end;
 } else if (ret < 0)
 return ret;
 
@@ -1055,6 +1099,34 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext 
*s, Jpeg2000Tile *tile,
 else
 av_log(s->avctx, 

[FFmpeg-devel] [PATCH v5 2/2] libavcodec/jpeg2000dec.c: Handle non EOC streams

2020-03-28 Thread gautamramk
From: Gautam Ramakrishnan 

This patch allows decoding of j2k streams which do
not have an EOC marker. OpenJPEG implements a similar
check.
---
 libavcodec/jpeg2000dec.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 44b3e7e41b..235078e26d 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -2076,8 +2076,12 @@ static int 
jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
 
 len = bytestream2_get_be16(>g);
 if (len < 2 || bytestream2_get_bytes_left(>g) < len - 2) {
-av_log(s->avctx, AV_LOG_ERROR, "Invalid len %d left=%d\n", len, 
bytestream2_get_bytes_left(>g));
-return AVERROR_INVALIDDATA;
+if (s->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT) {
+av_log(s->avctx, AV_LOG_ERROR, "Invalid len %d left=%d\n", 
len, bytestream2_get_bytes_left(>g));
+return AVERROR_INVALIDDATA;
+}
+av_log(s->avctx, AV_LOG_WARNING, "Mising EOC Marker.\n");
+return 0;
 }
 
 switch (marker) {
-- 
2.17.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".

Re: [FFmpeg-devel] [PATCH 03/14] pthread_frame: merge the functionality for normal decoder init and init_thread_copy

2020-03-28 Thread Anton Khirnov
Quoting David Bryant (2020-03-27 23:51:19)
> On 3/27/20 5:57 AM, Anton Khirnov wrote:
> > The current design, where
> > - proper init is called for the first per-thread context
> > - first thread's private data is copied into private data for all the
> >   other threads
> > - a "fixup" function is called for all the other threads to e.g.
> >   allocate dynamically allocated data
> > is very fragile and hard to follow, so it is abandoned. Instead, the
> > same init function is used to init each per-thread context. Where
> > necessary, AVCodecInternal.is_copy can be used to differentiate between
> > the first thread and the other ones (e.g. for decoding the extradata
> > just once).
> > ---
> 
> I'm not sure I fully understand this change. You mention that 
> AVCodecInternal.is_copy can be used where different treatment
> might be necessary for subsequent threads, and I see that done in a couple 
> places, but in most cases you have simply deleted the
> init_thread_copy() function even when it's not at all obvious (to me anyway) 
> that that won't break the codec.

In most cases, just deleting init_thread_copy() is the right thing to
do. E.g. all decoders that do not implement update_thread_context() have
to be intra-only, so every frame thread is effectively a completely
standalone decoder. And in most of the more complex decoders (like h264)
the important parameters are dynamically changeable during decoding, so
not that much is done in decoder init beyond allocating some stuff that
does not depend on the bistream properties.

My intent is for each frame-thread worker to be treated inasmuch as
possible as a standalone decoder, and where it has to share data with
other threads to make this sharing explicit (rather than implicit as is
the case now).

> 
> Specifically this will break WavPack because now it will be allocating a new 
> dsdctx for every thread instead of sharing one
> between all threads. I am happy to fix and test this case once the patch goes 
> in, but is the intent of this patch that the
> respective authors will find and fix all the breakages? Or did I just happen 
> to catch the one case you missed?

I certainly intended to convert the decoders correctly myself,
apparently I didn't pay enough attention to the recent wavpack changes.
Hopefully the other conversions are correct, but I will go through the
changes again to check.

Looking at wavpack, the code looks suspicious to me. You allocate one
dsdctx per channel at init, but AFAIU the number of channels can change
at each frame.

-- 
Anton Khirnov
___
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 v4 2/2] libavcodec/jpeg2000dec.c: Handle non EOC streams

2020-03-28 Thread Gautam Ramakrishnan
On Sat, Mar 28, 2020 at 6:22 PM Carl Eugen Hoyos  wrote:
>
> Am Sa., 28. März 2020 um 13:28 Uhr schrieb :
> >
> > From: Gautam Ramakrishnan 
> >
> > This patch allows decoding of j2k streams which do
> > not have an EOC marker. OpenJPEG implements a similar
> > check.
> > ---
> >  libavcodec/jpeg2000dec.c | 7 +--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> > index 44b3e7e41b..eb877d499d 100644
> > --- a/libavcodec/jpeg2000dec.c
> > +++ b/libavcodec/jpeg2000dec.c
> > @@ -2076,8 +2076,11 @@ static int 
> > jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
> >
> >  len = bytestream2_get_be16(>g);
> >  if (len < 2 || bytestream2_get_bytes_left(>g) < len - 2) {
> > -av_log(s->avctx, AV_LOG_ERROR, "Invalid len %d left=%d\n", 
> > len, bytestream2_get_bytes_left(>g));
> > -return AVERROR_INVALIDDATA;
> > +if (s->avctx->err_recognition & AV_EF_EXPLODE) {
>
> lol
> Sorry, my mistake, please check for the following:
> avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT
>
oops, should not have copied it blindly!!
> > +av_log(s->avctx, AV_LOG_ERROR, "Invalid len %d left=%d\n", 
> > len, bytestream2_get_bytes_left(>g));
> > +return AVERROR_INVALIDDATA;
>
> A message should always be shown (after all, the stream is clearly
> invalid), some
> people argue that it should be WARNING for < STRICT and ERROR for >= STRICT.
>
> > +}
> > +continue;
> >  }
> >
> >  switch (marker) {
>
> I don't know if the continue is more correct.
The reasoning behind the "continue" is that it goes to the next
iteration and throws the
"Missing EOC" message. As the message is already there, I thought it
would be better
to reuse it rather than adding a new log message.
>
> Carl Eugen
> ___
> 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".



-- 
-
Gautam |
___
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]lavfi/minterpolate: Allow bigger resolutions if SIZE_MAX is big

2020-03-28 Thread Carl Eugen Hoyos
Hi!

Attached patch allows to work-around ticket #7140, tested on a system
with a lot of memory.

Please review, Carl Eugen
From c9f21979215660d78dfa3e308acf148094522a02 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Sat, 28 Mar 2020 13:46:05 +0100
Subject: [PATCH] lavfi/minterpolate: Allow larger allocations if SIZE_MAX is
 big.

Works around ticket #7140.
---
 libavfilter/vf_minterpolate.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_minterpolate.c b/libavfilter/vf_minterpolate.c
index b0bb238ade..452166a2e3 100644
--- a/libavfilter/vf_minterpolate.c
+++ b/libavfilter/vf_minterpolate.c
@@ -361,9 +361,11 @@ static int config_input(AVFilterLink *inlink)
 }
 
 if (mi_ctx->mi_mode == MI_MODE_MCI) {
-mi_ctx->pixel_mvs = av_mallocz_array(width * height, sizeof(PixelMVS));
-mi_ctx->pixel_weights = av_mallocz_array(width * height, sizeof(PixelWeights));
-mi_ctx->pixel_refs = av_mallocz_array(width * height, sizeof(PixelRefs));
+if ((uint64_t)width * height < SIZE_MAX / 2 / FFMAX3(sizeof(PixelMVS), sizeof(PixelWeights), sizeof(PixelRefs))) {
+mi_ctx->pixel_mvs = av_mallocz(width * height * sizeof(PixelMVS));
+mi_ctx->pixel_weights = av_mallocz(width * height * sizeof(PixelWeights));
+mi_ctx->pixel_refs = av_mallocz(width * height * sizeof(PixelRefs));
+}
 if (!mi_ctx->pixel_mvs || !mi_ctx->pixel_weights || !mi_ctx->pixel_refs) {
 ret = AVERROR(ENOMEM);
 goto fail;
-- 
2.24.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".

Re: [FFmpeg-devel] [PATCH v4 2/2] libavcodec/jpeg2000dec.c: Handle non EOC streams

2020-03-28 Thread Carl Eugen Hoyos
Am Sa., 28. März 2020 um 13:28 Uhr schrieb :
>
> From: Gautam Ramakrishnan 
>
> This patch allows decoding of j2k streams which do
> not have an EOC marker. OpenJPEG implements a similar
> check.
> ---
>  libavcodec/jpeg2000dec.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> index 44b3e7e41b..eb877d499d 100644
> --- a/libavcodec/jpeg2000dec.c
> +++ b/libavcodec/jpeg2000dec.c
> @@ -2076,8 +2076,11 @@ static int 
> jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
>
>  len = bytestream2_get_be16(>g);
>  if (len < 2 || bytestream2_get_bytes_left(>g) < len - 2) {
> -av_log(s->avctx, AV_LOG_ERROR, "Invalid len %d left=%d\n", len, 
> bytestream2_get_bytes_left(>g));
> -return AVERROR_INVALIDDATA;
> +if (s->avctx->err_recognition & AV_EF_EXPLODE) {

lol
Sorry, my mistake, please check for the following:
avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT

> +av_log(s->avctx, AV_LOG_ERROR, "Invalid len %d left=%d\n", 
> len, bytestream2_get_bytes_left(>g));
> +return AVERROR_INVALIDDATA;

A message should always be shown (after all, the stream is clearly
invalid), some
people argue that it should be WARNING for < STRICT and ERROR for >= STRICT.

> +}
> +continue;
>  }
>
>  switch (marker) {

I don't know if the continue is more correct.

Carl Eugen
___
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 v4 1/2] libavcodec/jpeg2000dec.c: Add functions and modify structs for PPT marker support

2020-03-28 Thread gautamramk
From: Gautam Ramakrishnan 

This patch adds support for the PPT marker. It breaks down the
jpeg2000_decode_packet() function to decode headers and data
separately.
---
 libavcodec/jpeg2000dec.c | 200 +--
 1 file changed, 170 insertions(+), 30 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 7103cd6ceb..44b3e7e41b 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -83,8 +83,12 @@ typedef struct Jpeg2000Tile {
 Jpeg2000QuantStyle  qntsty[4];
 Jpeg2000POC poc;
 Jpeg2000TileParttile_part[32];
-uint16_t tp_idx;// Tile-part index
-int coord[2][2];// border coordinates {{x0, x1}, {y0, 
y1}}
+uint8_t has_ppt;// whether this tile has a ppt 
marker
+uint8_t *packed_headers;// contains packed headers. 
Used only along with PPT marker
+int packed_headers_size;// size in bytes of the packed 
headers
+GetByteContext  packed_headers_stream;  // byte context corresponding 
to packed headers
+uint16_t tp_idx;// Tile-part index
+int coord[2][2];// border coordinates {{x0, 
x1}, {y0, y1}}
 } Jpeg2000Tile;
 
 typedef struct Jpeg2000DecoderContext {
@@ -855,6 +859,38 @@ static int get_plt(Jpeg2000DecoderContext *s, int n)
 return 0;
 }
 
+static int get_ppt(Jpeg2000DecoderContext *s, int n)
+{
+Jpeg2000Tile *tile;
+
+tile = >tile[s->curtileno];
+
+av_assert1(s->curtileno >= 0);
+if (tile->tp_idx != 0) {
+av_log(s->avctx, AV_LOG_ERROR,
+   "PPT marker can occur only on first tile part of a tile.\n");
+return AVERROR_INVALIDDATA;
+}
+
+tile->has_ppt = 1;  // this tile has a ppt marker
+/*Zppt = */ bytestream2_get_byte(>g);
+if (!tile->packed_headers) {
+tile->packed_headers = av_malloc_array(n - 3, sizeof(uint8_t));
+memcpy(tile->packed_headers, s->g.buffer, sizeof(uint8_t)*(n - 3));
+tile->packed_headers_size = n - 3;
+} else {
+tile->packed_headers = av_realloc_array(tile->packed_headers,
+tile->packed_headers_size + n 
- 3,
+sizeof(uint8_t));
+memcpy(tile->packed_headers + tile->packed_headers_size,
+   s->g.buffer, sizeof(uint8_t)*(n - 3));
+tile->packed_headers_size += n - 3;
+}
+bytestream2_skip(>g, n - 3);
+
+return 0;
+}
+
 static int init_tile(Jpeg2000DecoderContext *s, int tileno)
 {
 int compno;
@@ -927,30 +963,38 @@ static int getlblockinc(Jpeg2000DecoderContext *s)
 return res;
 }
 
-static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s, Jpeg2000Tile 
*tile, int *tp_index,
-  Jpeg2000CodingStyle *codsty,
-  Jpeg2000ResLevel *rlevel, int precno,
-  int layno, uint8_t *expn, int numgbits)
+static int jpeg2000_decode_packet_header(Jpeg2000DecoderContext *s, 
Jpeg2000Tile *tile,
+ int *tp_index,
+ Jpeg2000CodingStyle *codsty,
+ Jpeg2000ResLevel *rlevel, int precno,
+ int layno, uint8_t *expn, int 
numgbits,
+ int *process_data)
 {
 int bandno, cblkno, ret, nb_code_blocks;
-int cwsno;
 
-if (layno < rlevel->band[0].prec[precno].decoded_layers)
+if (layno < rlevel->band[0].prec[precno].decoded_layers) {
+*process_data = 0;
 return 0;
+}
 rlevel->band[0].prec[precno].decoded_layers = layno + 1;
 
-if (bytestream2_get_bytes_left(>g) == 0 && s->bit_index == 8) {
-if (*tp_index < FF_ARRAY_ELEMS(tile->tile_part) - 1) {
-s->g = tile->tile_part[++(*tp_index)].tpg;
+if (tile->has_ppt) {
+s->g = tile->packed_headers_stream;
+} else {
+s->g = tile->tile_part[*tp_index].tpg;
+if (bytestream2_get_bytes_left(>g) == 0 && s->bit_index == 8) {
+if (*tp_index < FF_ARRAY_ELEMS(tile->tile_part) - 1) {
+s->g = tile->tile_part[++(*tp_index)].tpg;
+}
 }
+if (bytestream2_peek_be32(>g) == JPEG2000_SOP_FIXED_BYTES)
+bytestream2_skip(>g, JPEG2000_SOP_BYTE_LENGTH);
 }
 
-if (bytestream2_peek_be32(>g) == JPEG2000_SOP_FIXED_BYTES)
-bytestream2_skip(>g, JPEG2000_SOP_BYTE_LENGTH);
-
 if (!(ret = get_bits(s, 1))) {
 jpeg2000_flush(s);
-return 0;
+*process_data = 0;
+goto end;
 } else if (ret < 0)
 return ret;
 
@@ -1055,6 +1099,34 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext 
*s, Jpeg2000Tile *tile,
 else
 av_log(s->avctx, 

[FFmpeg-devel] [PATCH v4 2/2] libavcodec/jpeg2000dec.c: Handle non EOC streams

2020-03-28 Thread gautamramk
From: Gautam Ramakrishnan 

This patch allows decoding of j2k streams which do
not have an EOC marker. OpenJPEG implements a similar
check.
---
 libavcodec/jpeg2000dec.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 44b3e7e41b..eb877d499d 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -2076,8 +2076,11 @@ static int 
jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
 
 len = bytestream2_get_be16(>g);
 if (len < 2 || bytestream2_get_bytes_left(>g) < len - 2) {
-av_log(s->avctx, AV_LOG_ERROR, "Invalid len %d left=%d\n", len, 
bytestream2_get_bytes_left(>g));
-return AVERROR_INVALIDDATA;
+if (s->avctx->err_recognition & AV_EF_EXPLODE) {
+av_log(s->avctx, AV_LOG_ERROR, "Invalid len %d left=%d\n", 
len, bytestream2_get_bytes_left(>g));
+return AVERROR_INVALIDDATA;
+}
+continue;
 }
 
 switch (marker) {
-- 
2.17.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".

Re: [FFmpeg-devel] [PATCH v3] avformat/dashdec: fix memleak for commit commit e134c203

2020-03-28 Thread Nicolas George
Andreas Rheinhardt (12020-03-28):
> The commit title says that this commit is about fixing a memleak (it btw

That is my concern too.

> has one "commit" too much in it), whereas most of this patch is about
> adding new functionality. Which makes me wonder how you intend to fix
> this in the old releases? Backport everything?
> (This problem would of course not exist if the new functionality would
> be split from fixing the memleak.)

The leak exists in a release? Then it settles things: revert the
original commit, period.

Then, Steven, you can continue this very patch, you just need to rebase
it on top of the revert, it will actually be simpler.

Regards,

-- 
  Nicolas George


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] [PATCH v3 3/3] libavcodec/jpeb2000dec.c: Handle non EOC streams

2020-03-28 Thread Gautam Ramakrishnan
On Sat, Mar 28, 2020 at 4:59 PM Carl Eugen Hoyos  wrote:
>
> Am Sa., 28. März 2020 um 12:13 Uhr schrieb Gautam Ramakrishnan
> :
> >
> > On Sat, Mar 28, 2020 at 3:54 PM Carl Eugen Hoyos  wrote:
> > >
> > > Am Sa., 28. März 2020 um 05:19 Uhr schrieb :
> > > >
> > > > From: Gautam Ramakrishnan 
> > > >
> > > > This patch allows decoding of j2k streams which do
> > > > not have an EOC marker. OpenJPEG implements a similar
> > > > check.
> > > > ---
> > > >  libavcodec/jpeg2000dec.c | 5 +++--
> > > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> > > > index 44b3e7e41b..99fcb2cf68 100644
> > > > --- a/libavcodec/jpeg2000dec.c
> > > > +++ b/libavcodec/jpeg2000dec.c
> > > > @@ -2076,8 +2076,9 @@ static int 
> > > > jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
> > > >
> > > >  len = bytestream2_get_be16(>g);
> > > >  if (len < 2 || bytestream2_get_bytes_left(>g) < len - 2) {
> > > > -av_log(s->avctx, AV_LOG_ERROR, "Invalid len %d left=%d\n", 
> > > > len, bytestream2_get_bytes_left(>g));
> > > > -return AVERROR_INVALIDDATA;
> > > > +av_log(s->avctx, AV_LOG_WARNING, "Invalid len %d 
> > > > left=%d\n", len, bytestream2_get_bytes_left(>g));
> > > > +av_log(s->avctx, AV_LOG_WARNING, "Stream does not end with 
> > > > EOC.\n");
> > > > +return 0;
> > >
> > > The return value should depend on the "strictness" requested by the user,
> > > grep for "EXPLODE".
> > >
> > I did not understand this point too well. Could you point out some example I
> > could refer to?
>
> Did you grep for "EXPLODE"?
>
Ran grep with -rnw accidently. Found it. Shall get back if I do not understand
> > > As said, the first two patches are (imo) not ok, either merge them or 
> > > split
> > > them differently so that the first does not add an unused function but
> > > only splits ("uselessly" but making the second patch easier to read) an
> > > existing function.
> > >
> > Shall do that. What is your opinion on the third patch? Do you feel
> > the fix is right?
>
> Yes, I believe the same is done for jpeg.
In that case I'll make all the changes and resubmit a v4
>
> Carl Eugen
> ___
> 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".



-- 
-
Gautam |
___
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 v3 3/3] libavcodec/jpeb2000dec.c: Handle non EOC streams

2020-03-28 Thread Carl Eugen Hoyos
Am Sa., 28. März 2020 um 12:13 Uhr schrieb Gautam Ramakrishnan
:
>
> On Sat, Mar 28, 2020 at 3:54 PM Carl Eugen Hoyos  wrote:
> >
> > Am Sa., 28. März 2020 um 05:19 Uhr schrieb :
> > >
> > > From: Gautam Ramakrishnan 
> > >
> > > This patch allows decoding of j2k streams which do
> > > not have an EOC marker. OpenJPEG implements a similar
> > > check.
> > > ---
> > >  libavcodec/jpeg2000dec.c | 5 +++--
> > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> > > index 44b3e7e41b..99fcb2cf68 100644
> > > --- a/libavcodec/jpeg2000dec.c
> > > +++ b/libavcodec/jpeg2000dec.c
> > > @@ -2076,8 +2076,9 @@ static int 
> > > jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
> > >
> > >  len = bytestream2_get_be16(>g);
> > >  if (len < 2 || bytestream2_get_bytes_left(>g) < len - 2) {
> > > -av_log(s->avctx, AV_LOG_ERROR, "Invalid len %d left=%d\n", 
> > > len, bytestream2_get_bytes_left(>g));
> > > -return AVERROR_INVALIDDATA;
> > > +av_log(s->avctx, AV_LOG_WARNING, "Invalid len %d left=%d\n", 
> > > len, bytestream2_get_bytes_left(>g));
> > > +av_log(s->avctx, AV_LOG_WARNING, "Stream does not end with 
> > > EOC.\n");
> > > +return 0;
> >
> > The return value should depend on the "strictness" requested by the user,
> > grep for "EXPLODE".
> >
> I did not understand this point too well. Could you point out some example I
> could refer to?

Did you grep for "EXPLODE"?

> > As said, the first two patches are (imo) not ok, either merge them or split
> > them differently so that the first does not add an unused function but
> > only splits ("uselessly" but making the second patch easier to read) an
> > existing function.
> >
> Shall do that. What is your opinion on the third patch? Do you feel
> the fix is right?

Yes, I believe the same is done for jpeg.

Carl Eugen
___
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 v3 3/3] libavcodec/jpeb2000dec.c: Handle non EOC streams

2020-03-28 Thread Gautam Ramakrishnan
On Sat, Mar 28, 2020 at 3:54 PM Carl Eugen Hoyos  wrote:
>
> Am Sa., 28. März 2020 um 05:19 Uhr schrieb :
> >
> > From: Gautam Ramakrishnan 
> >
> > This patch allows decoding of j2k streams which do
> > not have an EOC marker. OpenJPEG implements a similar
> > check.
> > ---
> >  libavcodec/jpeg2000dec.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> > index 44b3e7e41b..99fcb2cf68 100644
> > --- a/libavcodec/jpeg2000dec.c
> > +++ b/libavcodec/jpeg2000dec.c
> > @@ -2076,8 +2076,9 @@ static int 
> > jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
> >
> >  len = bytestream2_get_be16(>g);
> >  if (len < 2 || bytestream2_get_bytes_left(>g) < len - 2) {
> > -av_log(s->avctx, AV_LOG_ERROR, "Invalid len %d left=%d\n", 
> > len, bytestream2_get_bytes_left(>g));
> > -return AVERROR_INVALIDDATA;
> > +av_log(s->avctx, AV_LOG_WARNING, "Invalid len %d left=%d\n", 
> > len, bytestream2_get_bytes_left(>g));
> > +av_log(s->avctx, AV_LOG_WARNING, "Stream does not end with 
> > EOC.\n");
> > +return 0;
>
> The return value should depend on the "strictness" requested by the user,
> grep for "EXPLODE".
>
I did not understand this point too well. Could you point out some example I
could refer to?
> As said, the first two patches are (imo) not ok, either merge them or split
> them differently so that the first does not add an unused function but
> only splits ("uselessly" but making the second patch easier to read) an
> existing function.
>
Shall do that. What is your opinion on the third patch? Do you feel
the fix is right?

> Carl Eugen
> ___
> 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".



--
-
Gautam |
___
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 v3 3/3] libavcodec/jpeb2000dec.c: Handle non EOC streams

2020-03-28 Thread Carl Eugen Hoyos
Am Sa., 28. März 2020 um 05:19 Uhr schrieb :
>
> From: Gautam Ramakrishnan 
>
> This patch allows decoding of j2k streams which do
> not have an EOC marker. OpenJPEG implements a similar
> check.
> ---
>  libavcodec/jpeg2000dec.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> index 44b3e7e41b..99fcb2cf68 100644
> --- a/libavcodec/jpeg2000dec.c
> +++ b/libavcodec/jpeg2000dec.c
> @@ -2076,8 +2076,9 @@ static int 
> jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
>
>  len = bytestream2_get_be16(>g);
>  if (len < 2 || bytestream2_get_bytes_left(>g) < len - 2) {
> -av_log(s->avctx, AV_LOG_ERROR, "Invalid len %d left=%d\n", len, 
> bytestream2_get_bytes_left(>g));
> -return AVERROR_INVALIDDATA;
> +av_log(s->avctx, AV_LOG_WARNING, "Invalid len %d left=%d\n", 
> len, bytestream2_get_bytes_left(>g));
> +av_log(s->avctx, AV_LOG_WARNING, "Stream does not end with 
> EOC.\n");
> +return 0;

The return value should depend on the "strictness" requested by the user,
grep for "EXPLODE".

As said, the first two patches are (imo) not ok, either merge them or split
them differently so that the first does not add an unused function but
only splits ("uselessly" but making the second patch easier to read) an
existing function.

Carl Eugen
___
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".