[FFmpeg-devel] [PATCH 1/1] fix: use declared size for attribute of type string to ensure full value used and prevent parse failure for string lengths longer than 256

2022-05-12 Thread vectronic
Signed-off-by: vectronic 
---
 libavcodec/exr.c | 32 +++-
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 8cd867a32f..bc2afcee53 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -1912,10 +1912,13 @@ static int decode_header(EXRContext *s, AVFrame *frame)
 continue;
 } else if ((var_size = check_header_variable(s, "writer",
  "string", 1)) >= 0) {
-uint8_t key[256] = { 0 };
+uint8_t *key = av_malloc(var_size);
 
-bytestream2_get_buffer(gb, key, FFMIN(sizeof(key) - 1, var_size));
-av_dict_set(, "writer", key, 0);
+if (!key)
+return AVERROR(ENOMEM);
+
+bytestream2_get_buffer(gb, key, var_size);
+av_dict_set(, "writer", key, AV_DICT_DONT_STRDUP_VAL);
 
 continue;
 } else if ((var_size = check_header_variable(s, "framesPerSecond",
@@ -1937,9 +1940,12 @@ static int decode_header(EXRContext *s, AVFrame *frame)
 continue;
 } else if ((var_size = check_header_variable(s, "type",
  "string", 16)) >= 0) {
-uint8_t key[256] = { 0 };
+uint8_t *key = av_malloc(var_size);
+
+if (!key)
+return AVERROR(ENOMEM);
 
-bytestream2_get_buffer(gb, key, FFMIN(sizeof(key) - 1, var_size));
+bytestream2_get_buffer(gb, key, var_size);
 if (strncmp("scanlineimage", key, var_size) &&
 strncmp("tiledimage", key, var_size))
 return AVERROR_PATCHWELCOME;
@@ -1970,7 +1976,6 @@ static int decode_header(EXRContext *s, AVFrame *frame)
 {
 uint8_t name[256] = { 0 };
 uint8_t type[256] = { 0 };
-uint8_t value[256] = { 0 };
 int i = 0, size;
 
 while (bytestream2_get_bytes_left(gb) > 0 &&
@@ -1987,9 +1992,18 @@ static int decode_header(EXRContext *s, AVFrame *frame)
 bytestream2_skip(gb, 1);
 size = bytestream2_get_le32(gb);
 
-bytestream2_get_buffer(gb, value, FFMIN(sizeof(value) - 1, size));
-if (!strcmp(type, "string"))
-av_dict_set(, name, value, 0);
+if (strcmp(type, "string") != 0) {
+bytestream2_skip(gb, size);
+
+continue;
+}
+uint8_t *value = av_malloc(size);
+
+if (!value)
+return AVERROR(ENOMEM);
+
+bytestream2_get_buffer(gb, value, size);
+av_dict_set(, name, value, AV_DICT_DONT_STRDUP_VAL);
 }
 }
 
-- 
2.32.0 (Apple Git-132)

___
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 0/1] avcodec/exr: variable string attribute length

2022-05-12 Thread vectronic
  fix: use declared size for attribute of type string to ensure full
value used and prevent parse failure for string lengths longer than
256

 libavcodec/exr.c | 32 +++-
 1 file changed, 23 insertions(+), 9 deletions(-)

-- 
2.32.0 (Apple Git-132)

___
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/hls: add supporting fMP4(CMAF) format to seek on HLS demuxer

2020-07-16 Thread vectronic


> On 16 Jul 2020, at 10:36, Dongwon Kim  wrote:
> 
> 
> HLS spec RFC 8216(https://tools.ietf.org/html/rfc8216) version 7 added 
> supporting fMP4(CMAF) format for segment. However, when requesting seek 
> operation,
> the hls demuxer doesn't work properly due to previous implementation of the 
> HLS demuxer was only for supporting MPEG-TS format for segment.
> 
> So, I added procedure to reopen segment format on HLS demuxer when seeking 
> requested. It's quite similar to MPEG-DASH demuxer(libavformat/dashdec.c) 
> seeking procedure, as you know, MPEG-DASH also support fMP4(CMAF) format for 
> fragment as default. Refer to 
> https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/dashdec.c#L1904.
> 
> 
> Please test with below command:
> 
> Server:
> $ ffmpeg -y -i {input} -vcodec libx264 \
>-force_key_frames 30 \
>-sc_threshold 0 \
>-acodec aac \
>-hls_segment_type fmp4 \
>-hls_time 6 \
>-hls_playlist_type vod \
>-map 0:a -map 0:v -f hls \
>-var_stream_map "a:0,agroup:aud,default:yes v:0,agroup:aud" \
>-hls_segment_filename "segment_%v_%03d.m4s" \
>-master_pl_name playlist.m3u8 \
>hlscmaf_%v.m3u8
> 
> 
> Player:
> $ ffplay playlist.m3u8
> 
> 
> 
> On 20. 7. 15. 오후 4:20, Dongwon Kim wrote:
>> Signed-off-by: Dongwon Kim 
>> ---
>>  libavformat/hls.c | 67 +++
>>  1 file changed, 67 insertions(+)
>> 
>> diff --git a/libavformat/hls.c b/libavformat/hls.c
>> index ba17c4ed96..561b42ea6b 100644
>> --- a/libavformat/hls.c
>> +++ b/libavformat/hls.c
>> @@ -2139,6 +2139,68 @@ static int compare_ts_with_wrapdetect(int64_t ts_a, 
>> struct playlist *pls_a,
>>  return av_compare_mod(scaled_ts_a, scaled_ts_b, 1LL << 33);
>>  }
>>  +static int reopen_demux_for_component(AVFormatContext *s, struct playlist 
>> *pls)
>> +{
>> +ff_const59 AVInputFormat *in_fmt = NULL;
>> +AVDictionary  *in_fmt_opts = NULL;
>> +uint8_t *avio_ctx_buffer  = NULL;
>> +int ret = 0;
>> +
>> +if (pls->ctx) {
>> +av_freep(>pb.buffer);
>> +memset(>pb, 0x00, sizeof(AVIOContext));
>> +pls->ctx->pb = NULL;
>> +avformat_close_input(>ctx);
>> +pls->ctx = NULL;
>> +}
>> +
>> +if (ff_check_interrupt(>interrupt_callback)) {
>> +ret = AVERROR_EXIT;
>> +goto fail;
>> +}
>> +
>> +if (!(pls->ctx = avformat_alloc_context())) {
>> +ret = AVERROR(ENOMEM);
>> +goto fail;
>> +}
>> +
>> +avio_ctx_buffer  = av_malloc(INITIAL_BUFFER_SIZE);
>> +if (!avio_ctx_buffer ) {
>> +ret = AVERROR(ENOMEM);
>> +avformat_free_context(pls->ctx);
>> +pls->ctx = NULL;
>> +goto fail;
>> +}
>> +ffio_init_context(>pb, avio_ctx_buffer , INITIAL_BUFFER_SIZE, 0, 
>> pls, read_data, NULL, NULL);
>> +pls->pb.seekable = 0;
>> +
>> +if ((ret = ff_copy_whiteblacklists(pls->ctx, s)) < 0)
>> +goto fail;
>> +
>> +pls->ctx->flags = AVFMT_FLAG_CUSTOM_IO;
>> +ret = av_probe_input_buffer(>pb, _fmt, "", NULL, 0, 0);
>> +if (ret < 0) {
>> +av_log(s, AV_LOG_ERROR, "Error when loading segment, playlist 
>> %d\n", pls->cur_seq_no);
>> +avformat_free_context(pls->ctx);
>> +pls->ctx = NULL;
>> +goto fail;
>> +}
>> +
>> +pls->ctx->pb = >pb;
>> +pls->ctx->io_open  = nested_io_open;
>> +
>> +ret = avformat_open_input(>ctx, "", in_fmt, _fmt_opts);
>> +av_dict_free(_fmt_opts);
>> +if (ret < 0)
>> +goto fail;
>> +ret = avformat_find_stream_info(pls->ctx, NULL);
>> +if (ret < 0)
>> +goto fail;
>> +
>> +fail:
>> +return ret;
>> +}
>> +
>>  static int hls_read_packet(AVFormatContext *s, AVPacket *pkt)
>>  {
>>  HLSContext *c = s->priv_data;
>> @@ -2351,6 +2413,11 @@ static int hls_read_seek(AVFormatContext *s, int 
>> stream_index,
>>  pls->seek_stream_index = -1;
>>  pls->seek_flags |= AVSEEK_FLAG_ANY;
>>  }
>> +
>> +if (pls->ctx && pls->ctx->iformat && 
>> strcmp(pls->ctx->iformat->name, "mov,mp4,m4a,3gp,3g2,mj2") == 0) {
>> +pls->init_sec_buf_read_offset = 0;
>> +reopen_demux_for_component(s, pls);
>> +}
>>  }
>>c->cur_timestamp = seek_timestamp;
> 
> ___
> 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”.

I have previously submitted another means of achieving this here:

https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=1018 


My approach was to mirror in mp4 demux the same support that mpeg2ts has for 
detecting a position reset on the stream. And to improve the seek semantics in 
HLS demux.

Some older history here:

https://trac.ffmpeg.org/ticket/7485 


Re: [FFmpeg-devel] [PATCH 0/2] avformat movenc add flag to allow disabling limit on timescale

2020-07-07 Thread vectronic

> On 11 May 2020, at 16:46, Gyan Doshi  wrote:
> 
> 
> 
> On 11-05-2020 06:44 pm, vectronic wrote:
>> 
>>> On 5 May 2020, at 06:19, Gyan Doshi  wrote:
>>> 
>>> 
>>> 
>>> On 05-05-2020 03:16 am, vectronic wrote:
>>>>> On 4 May 2020, at 17:56, Gyan Doshi  wrote:
>>>>> 
>>>>> 
>>>>> 
>>>>> On 04-05-2020 09:54 pm, vectronic wrote:
>>>>>> I needed to encode to mov/mp4 with a timebase of 1/600 and the output 
>>>>>> was not as expected.
>>>>> What was the unexpected output?
>>>>> 
>>>>> You can use video_track_timescale to set any custom scale.
>>>>> 
>>>>> Gyan
>>>> The unexpected output is that if you request a timebase of 600 as an 
>>>> argument for ffmpeg on the command line, the output timebase is forced to 
>>>> be greater than 1.
>>>> 
>>>> As far as I can see there is no documentation or message logged that the 
>>>> following logic is applied which means the output differs to what a user 
>>>> has requested and expects:
>>>> 
>>>> while(track->timescale < 1)
>>>> track->timescale *= 2;
>>>> 
>>>> I believe video_track_timescale applies to all tracks - so you unable to 
>>>> specify timescales per track?
>>> I believe your flag also disables the scale clamping for all video tracks. 
>>> In that case, better to extend the min value of video_track_timescale  to 
>>> -1 to implement this instead of a new flag.
>>> 
>>> Gyan
>>> 
>> Hello Gyan,
>> 
>> I updated the patch with your feedback here: 
>> https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=1138
>> 
>> Do you have any further feedback?
> 
> Give me  a couple of days to test.
> 
> Thanks,,
> Gyan

Hello Gyan,

Did you end up getting any time to look at this?

Thanks very much,

Nick


___
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] Project orientation

2020-07-07 Thread vectronic
> On 7 Jul 2020, at 12:13, Anton Khirnov  wrote:
> 
> Quoting Nicolas George (2020-07-07 12:46:39)
>> 
>> * GMail's warnings about "less secure" applications are scare tactics to
>>  get you to exclusively use their products, because they cannot feed
>>  you advertisement when you use a real mail client with their IMAP and
>>  SMTP servers.
> 
> VERY much agree
> We should not go along with these attempts to build a walled garden
> around email.

+1

> 
>> But be very careful to not make them mandatory.
> 
> +1
> Any change that makes it necessary to use a web browser for development
> a big step back IMO.

+1

I think the key is choice. For example on GitHub people are able to contribute 
to the same project using any or all of: IDE plugins, the GitHub web UI or the 
standard git client CLI.
I am not proposing GitHub, just saying that being able to choose the mode of 
interaction is attractive.

> There are public APIs for github and gitlab that make it possible in
> theory to develop CLI tools for them. But AFAIK the currently existing
> gitlab tools are too primitive for serious use, the github ones are more
> advanced but still limited compared to the web interface.
> 
> Also, gitlab and github are not the only options. Sourcehut[1] looks
> quite appealing to me and should be considered.
> 
> In any case, I think there should be a dedicated discussion and a vote
> about any proposed change in development process.

In terms of issue management and patch reviews etc. what is the view of people 
with respect to these two systems (which are as far as I know only web based):

https://trac.ffmpeg.org 

https://patchwork.ffmpeg.org/project/ffmpeg/list/ 


vs the usage of terminal based mail client and mailing lists?



> [1] https://sourcehut.org


___
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 0/2] avformat movenc add flag to allow disabling limit on timescale

2020-05-11 Thread vectronic


> On 5 May 2020, at 06:19, Gyan Doshi  wrote:
> 
> 
> 
> On 05-05-2020 03:16 am, vectronic wrote:
>> 
>>> On 4 May 2020, at 17:56, Gyan Doshi  wrote:
>>> 
>>> 
>>> 
>>> On 04-05-2020 09:54 pm, vectronic wrote:
>>>> I needed to encode to mov/mp4 with a timebase of 1/600 and the output was 
>>>> not as expected.
>>> What was the unexpected output?
>>> 
>>> You can use video_track_timescale to set any custom scale.
>>> 
>>> Gyan
>> The unexpected output is that if you request a timebase of 600 as an 
>> argument for ffmpeg on the command line, the output timebase is forced to be 
>> greater than 1.
>> 
>> As far as I can see there is no documentation or message logged that the 
>> following logic is applied which means the output differs to what a user has 
>> requested and expects:
>> 
>> while(track->timescale < 1)
>> track->timescale *= 2;
>> 
>> I believe video_track_timescale applies to all tracks - so you unable to 
>> specify timescales per track?
> 
> I believe your flag also disables the scale clamping for all video tracks. In 
> that case, better to extend the min value of video_track_timescale  to -1 to 
> implement this instead of a new flag.
> 
> Gyan
> 

Hello Gyan,

I updated the patch with your feedback here: 
https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=1138

Do you have any further feedback?

Thanks,

Nick


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

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

[FFmpeg-devel] [PATCH V2 1/2] avformat movenc extend video_track_timescale flag range to allow use of video stream timescale for track

2020-05-05 Thread vectronic
Extend range of video_track_timescale flag value to -1 to indicate video stream 
timescale should be used for track timebase. Add debug message if 
video_track_timescale is not specified and the video stream timescale is 
clamped to greater than 1.

Signed-off-by: vectronic 
---
 libavformat/movenc.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 32e8109268..bcc0ab4377 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -92,7 +92,7 @@ static const AVOption options[] = {
 { "min_frag_duration", "Minimum fragment duration", 
offsetof(MOVMuxContext, min_fragment_duration), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 
INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
 { "frag_size", "Maximum fragment size", offsetof(MOVMuxContext, 
max_fragment_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, 
AV_OPT_FLAG_ENCODING_PARAM},
 { "ism_lookahead", "Number of lookahead entries for ISM files", 
offsetof(MOVMuxContext, ism_lookahead), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 
INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
-{ "video_track_timescale", "set timescale of all video tracks", 
offsetof(MOVMuxContext, video_track_timescale), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 
INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
+{ "video_track_timescale", "set timescale of all video tracks, -1 to use 
existing stream timescale", offsetof(MOVMuxContext, video_track_timescale), 
AV_OPT_TYPE_INT, {.i64 = 0}, -1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
 { "brand","Override major brand", offsetof(MOVMuxContext, 
major_brand),   AV_OPT_TYPE_STRING, {.str = NULL}, .flags = 
AV_OPT_FLAG_ENCODING_PARAM },
 { "use_editlist", "use edit list", offsetof(MOVMuxContext, use_editlist), 
AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, AV_OPT_FLAG_ENCODING_PARAM},
 { "fragment_index", "Fragment number of the next fragment", 
offsetof(MOVMuxContext, fragments), AV_OPT_TYPE_INT, {.i64 = 1}, 1, INT_MAX, 
AV_OPT_FLAG_ENCODING_PARAM},
@@ -6454,14 +6454,19 @@ static int mov_init(AVFormatContext *s)
 }
 track->height = track->tag >> 24 == 'n' ? 486 : 576;
 }
-if (mov->video_track_timescale) {
+if (mov->video_track_timescale > 0) {
 track->timescale = mov->video_track_timescale;
 if (mov->mode == MODE_ISM && mov->video_track_timescale != 
1000)
 av_log(s, AV_LOG_WARNING, "Warning: some tools, like 
mp4split, assume a timescale of 1000 for ISMV.\n");
 } else {
 track->timescale = st->time_base.den;
+if (mov->video_track_timescale != -1) {
 while(track->timescale < 1)
 track->timescale *= 2;
+if (track->timescale != st->time_base.den)
+av_log(s, AV_LOG_DEBUG, "Stream timescale was low (%d), 
the track timescale has been forced to %d.\n"
+"Specify -video_track_timescale -1 
to prevent this.\n", st->time_base.den, track->timescale);
+}
 }
 if (st->codecpar->width > 65535 || st->codecpar->height > 65535) {
 av_log(s, AV_LOG_ERROR, "Resolution %dx%d too large for 
mov/mp4\n", st->codecpar->width, st->codecpar->height);
-- 
2.24.2 (Apple Git-127)

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

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

[FFmpeg-devel] [PATCH V2 2/2] avformat movenc extend video_track_timescale flag range to allow use of video stream timescale for track

2020-05-05 Thread vectronic
indent

Signed-off-by: vectronic 
---
 libavformat/movenc.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index bcc0ab4377..989ba5b857 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -6461,11 +6461,11 @@ static int mov_init(AVFormatContext *s)
 } else {
 track->timescale = st->time_base.den;
 if (mov->video_track_timescale != -1) {
-while(track->timescale < 1)
-track->timescale *= 2;
-if (track->timescale != st->time_base.den)
-av_log(s, AV_LOG_DEBUG, "Stream timescale was low (%d), 
the track timescale has been forced to %d.\n"
-"Specify -video_track_timescale -1 
to prevent this.\n", st->time_base.den, track->timescale);
+while(track->timescale < 1)
+track->timescale *= 2;
+if (track->timescale != st->time_base.den)
+av_log(s, AV_LOG_DEBUG, "Stream timescale was low 
(%d), the track timescale has been forced to %d.\n"
+"Specify 
-video_track_timescale -1 to prevent this.\n", st->time_base.den, 
track->timescale);
 }
 }
 if (st->codecpar->width > 65535 || st->codecpar->height > 65535) {
-- 
2.24.2 (Apple Git-127)

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

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

[FFmpeg-devel] [PATCH V2 0/2] avformat movenc extend video_track_timescale flag to allow use of video stream timescale for track

2020-05-05 Thread vectronic
Revised patch based on feedback. Instead of introducing a new flag, this extend 
the range of video_track_timescale down to -1
which indicates to use the video stream timescale for video the track.

Still providing a debug message in default case if video timescale specified 
has been clamped to above 1.

The example scenario is where the input mov file has a video track timebase of 
e.g. 600.

Currently, if the following is run, the output file has a modified video track 
timebase of 19200:

ffmpeg -i in.mov -c:v copy out.mov

With this patch, if you run:

ffmpeg -loglevel debug -i in.mov -c:v copy out.mov

you will see in the output:

Stream timescale was low (600), the track timescale has been forced to 
19200.

And if you run the following, you will get an output file with the same video 
track timebase as the input e.g. 600:

ffmpeg -i in.mov -c:v copy -video_track_timescale -1 out.mov

The previous would be the same behaviour as the following, but it does not rely 
on the user knowing and specifying the input timebase:

ffmpeg -i in.mov -c:v copy -video_track_timescale 600 out.mov



vectronic (2):
  avformat movenc extend video_track_timescale flag range to allow use
of video stream timescale for track
  avformat movenc extend video_track_timescale flag range to allow use
of video stream timescale for track

 libavformat/movenc.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

-- 
2.24.2 (Apple Git-127)

___
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 0/2] avformat movenc add flag to allow disabling limit on timescale

2020-05-04 Thread vectronic


> On 4 May 2020, at 17:56, Gyan Doshi  wrote:
> 
> 
> 
> On 04-05-2020 09:54 pm, vectronic wrote:
>> I needed to encode to mov/mp4 with a timebase of 1/600 and the output was 
>> not as expected.
> 
> What was the unexpected output?
> 
> You can use video_track_timescale to set any custom scale.
> 
> Gyan

The unexpected output is that if you request a timebase of 600 as an argument 
for ffmpeg on the command line, the output timebase is forced to be greater 
than 1.

As far as I can see there is no documentation or message logged that the 
following logic is applied which means the output differs to what a user has 
requested and expects:

while(track->timescale < 1)
track->timescale *= 2;

I believe video_track_timescale applies to all tracks - so you unable to 
specify timescales per track?

Nick



___
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 0/2] avformat movenc add flag to allow disabling limit on timescale

2020-05-04 Thread vectronic
I needed to encode to mov/mp4 with a timebase of 1/600 and the output was not 
as expected.

I discovered the reason is a silent limiting of a track timebase added here:

https://github.com/FFmpeg/FFmpeg/commit/b02493e47668e66757b72a7163476e590edfea3a

The patch attached provides a new flag to disable the timebase limit, and in 
the case that the limit
is applied, a debug message is logged to prevent future user confusion.

vectronic (2):
  avformat movenc add flag to disable silent limit on timescale
  avformat movenc add flag to disable silent limit on timescale

 libavformat/movenc.c | 8 ++--
 libavformat/movenc.h | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

-- 
2.24.2 (Apple Git-127)

___
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] avformat movenc add flag to disable silent limit on timescale

2020-05-04 Thread vectronic
Add a flag to allow user to disable the forcing of a track timescale to be 
greater than 1. Log a debug message if the timescale is forced to be 
greater than 1.

Signed-off-by: vectronic 
---
 libavformat/movenc.c | 4 
 libavformat/movenc.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 32e8109268..143b00063d 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -107,6 +107,7 @@ static const AVOption options[] = {
 { "wallclock", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 
MOV_PRFT_SRC_WALLCLOCK}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM, "prft"},
 { "pts", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = MOV_PRFT_SRC_PTS}, 0, 0, 
AV_OPT_FLAG_ENCODING_PARAM, "prft"},
 { "empty_hdlr_name", "write zero-length name string in hdlr atoms within 
mdia and minf atoms", offsetof(MOVMuxContext, empty_hdlr_name), 
AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
+{ "allow_small_timescale", "Do not force track timescale to be >= 1", 
0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_ALLOW_SMALL_TSCALE}, INT_MIN, 
INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
 { NULL },
 };
 
@@ -6460,8 +6461,11 @@ static int mov_init(AVFormatContext *s)
 av_log(s, AV_LOG_WARNING, "Warning: some tools, like 
mp4split, assume a timescale of 1000 for ISMV.\n");
 } else {
 track->timescale = st->time_base.den;
+if (!(mov->flags & FF_MOV_FLAG_ALLOW_SMALL_TSCALE)) {
 while(track->timescale < 1)
 track->timescale *= 2;
+av_log(s, AV_LOG_DEBUG, "track timescale was less than 
1, it has been forced to %d\n", track->timescale);
+}
 }
 if (st->codecpar->width > 65535 || st->codecpar->height > 65535) {
 av_log(s, AV_LOG_ERROR, "Resolution %dx%d too large for 
mov/mp4\n", st->codecpar->width, st->codecpar->height);
diff --git a/libavformat/movenc.h b/libavformat/movenc.h
index 997b2d61c0..f91cd3420f 100644
--- a/libavformat/movenc.h
+++ b/libavformat/movenc.h
@@ -261,6 +261,7 @@ typedef struct MOVMuxContext {
 #define FF_MOV_FLAG_SKIP_SIDX (1 << 21)
 #define FF_MOV_FLAG_CMAF  (1 << 22)
 #define FF_MOV_FLAG_PREFER_ICC(1 << 23)
+#define FF_MOV_FLAG_ALLOW_SMALL_TSCALE(1 << 24)
 
 int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt);
 
-- 
2.24.2 (Apple Git-127)

___
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] avformat movenc add flag to disable silent limit on timescale

2020-05-04 Thread vectronic
Indent

Signed-off-by: vectronic 
---
 libavformat/movenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 143b00063d..ec7e95e838 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -6462,8 +6462,8 @@ static int mov_init(AVFormatContext *s)
 } else {
 track->timescale = st->time_base.den;
 if (!(mov->flags & FF_MOV_FLAG_ALLOW_SMALL_TSCALE)) {
-while(track->timescale < 1)
-track->timescale *= 2;
+while(track->timescale < 1)
+track->timescale *= 2;
 av_log(s, AV_LOG_DEBUG, "track timescale was less than 
1, it has been forced to %d\n", track->timescale);
 }
 }
-- 
2.24.2 (Apple Git-127)

___
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 0/1] avformat hls check discard state of streams always

2020-05-01 Thread vectronic
After opening an HLS package with avformat_open_input() and then getting stream
info with avformat_find_stream_info() I was then setting some of the input 
streams
to be discarded via avStream->discard = AVDISCARD_ALL.

However subsequent calls to av_read_frame() were returning packets from the 
streams
which were set to be discarded.

This patch addresses this issue:

The discard state of streams within HLS read packet logic was only checking the 
discard state when the first
packet was read. The first packet has already been read as part of calling 
avformat_find_stream_info.

vectronic (1):
  avformat hls check discard state of streams always

 libavformat/hls.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.24.2 (Apple Git-127)

___
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/1] avformat hls check discard state of streams always

2020-05-01 Thread vectronic
The discard needs to be checked on a stream even after the first packet is 
read. The first packet has already been read as part of calling 
avformat_find_stream_info. This means that setting AVStream->discard on a 
stream after having determined the stream info for the HLS package had no 
effect and unwanted packets were returned by subsequent calls to 
hls_read_packet.

Signed-off-by: vectronic 
---
 libavformat/hls.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index fc45719d1c..0740e9c546 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -2014,7 +2014,7 @@ fail:
 return ret;
 }
 
-static int recheck_discard_flags(AVFormatContext *s, int first)
+static int recheck_discard_flags(AVFormatContext *s)
 {
 HLSContext *c = s->priv_data;
 int i, changed = 0;
@@ -2041,7 +2041,7 @@ static int recheck_discard_flags(AVFormatContext *s, int 
first)
 pls->seek_stream_index = -1;
 }
 av_log(s, AV_LOG_INFO, "Now receiving playlist %d, segment %d\n", 
i, pls->cur_seq_no);
-} else if (first && !cur_needed && pls->needed) {
+} else if (!cur_needed && pls->needed) {
 ff_format_io_close(pls->parent, >input);
 pls->input_read_done = 0;
 ff_format_io_close(pls->parent, >input_next);
@@ -2101,7 +2101,7 @@ static int hls_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 HLSContext *c = s->priv_data;
 int ret, i, minplaylist = -1;
 
-recheck_discard_flags(s, c->first_packet);
+recheck_discard_flags(s);
 c->first_packet = 0;
 
 for (i = 0; i < c->n_playlists; i++) {
-- 
2.24.2 (Apple Git-127)

___
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 0/1] avformat hls restore options dict when retrying with a new connection

2020-04-30 Thread vectronic
as per avio_open2 semantics after open_url_keepalive has failed, the options 
dictionary
will have been modified and needs restoring before attempting a new connection

vectronic (1):
  avformat hls restore options dict when retrying with a new connection

 libavformat/hls.c | 4 
 1 file changed, 4 insertions(+)

-- 
2.24.2 (Apple Git-127)

___
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/1] avformat hls restore options dict when retrying with a new connection

2020-04-30 Thread vectronic
as per avio_open2 semantics after open_url_keepalive has failed, the options 
dictionary will have been modified and needs restoring before attempting a new 
connection

Signed-off-by: vectronic 
---
 libavformat/hls.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index fc45719d1c..9800c9bb8d 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -679,6 +679,10 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, 
const char *url,
 av_log(s, AV_LOG_WARNING,
 "keepalive request failed for '%s' with error: '%s' when 
opening url, retrying with new connection\n",
 url, av_err2str(ret));
+
+av_dict_copy(, opts, 0);
+av_dict_copy(, opts2, 0);
+
 ret = s->io_open(s, pb, url, AVIO_FLAG_READ, );
 }
 } else {
-- 
2.24.2 (Apple Git-127)

___
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 0/1] ffprobe add closed caption output to stream info

2020-04-29 Thread vectronic
ensure closed caption info which is visible in default stream dump is also
available in results when -show_streams is used and update test references
for closed_caption output in ffprobe stream results

changes from last version:

- ffprobe modifications are correctly within existing FF_API_LAVF_AVCTX checks
- added ffprobe xsd element is boolean

vectronic (1):
  ensure closed caption info which is visible in default stream dump is
also available in results when -show_streams is used

 doc/ffprobe.xsd   | 1 +
 fftools/ffprobe.c | 2 ++
 tests/ref/fate/concat-demuxer-extended-lavf-mxf   | 2 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10   | 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf| 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10| 2 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 2 +-
 tests/ref/fate/ffprobe_compact| 4 ++--
 tests/ref/fate/ffprobe_csv| 4 ++--
 tests/ref/fate/ffprobe_default| 2 ++
 tests/ref/fate/ffprobe_flat   | 2 ++
 tests/ref/fate/ffprobe_ini| 2 ++
 tests/ref/fate/ffprobe_json   | 2 ++
 tests/ref/fate/ffprobe_xml| 4 ++--
 tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 1 +
 tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 1 +
 tests/ref/fate/mov-zombie | 2 +-
 tests/ref/fate/mxf-probe-d10  | 1 +
 tests/ref/fate/mxf-probe-dnxhd| 1 +
 tests/ref/fate/mxf-probe-dv25 | 1 +
 20 files changed, 28 insertions(+), 12 deletions(-)

-- 
2.24.2 (Apple Git-127)

___
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/1] ensure closed caption info which is visible in default stream dump is also available in results when -show_streams is used

2020-04-29 Thread vectronic
Signed-off-by: vectronic 
---
 doc/ffprobe.xsd   | 1 +
 fftools/ffprobe.c | 2 ++
 tests/ref/fate/concat-demuxer-extended-lavf-mxf   | 2 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10   | 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf| 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10| 2 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 2 +-
 tests/ref/fate/ffprobe_compact| 4 ++--
 tests/ref/fate/ffprobe_csv| 4 ++--
 tests/ref/fate/ffprobe_default| 2 ++
 tests/ref/fate/ffprobe_flat   | 2 ++
 tests/ref/fate/ffprobe_ini| 2 ++
 tests/ref/fate/ffprobe_json   | 2 ++
 tests/ref/fate/ffprobe_xml| 4 ++--
 tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 1 +
 tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 1 +
 tests/ref/fate/mov-zombie | 2 +-
 tests/ref/fate/mxf-probe-d10  | 1 +
 tests/ref/fate/mxf-probe-dnxhd| 1 +
 tests/ref/fate/mxf-probe-dv25 | 1 +
 20 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd
index 97dc67def6..71cbd23ec6 100644
--- a/doc/ffprobe.xsd
+++ b/doc/ffprobe.xsd
@@ -226,6 +226,7 @@
   
   
   
+  
   
   
   
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 840fcb71e2..5515e1b31b 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2547,6 +2547,7 @@ static int show_stream(WriterContext *w, AVFormatContext 
*fmt_ctx, int stream_id
 if (dec_ctx) {
 print_int("coded_width",  dec_ctx->coded_width);
 print_int("coded_height", dec_ctx->coded_height);
+print_int("closed_captions", !!(dec_ctx->properties & 
FF_CODEC_PROPERTY_CLOSED_CAPTIONS));
 }
 #endif
 print_int("has_b_frames", par->video_delay);
@@ -2951,6 +2952,7 @@ static int open_input_file(InputFile *ifile, const char 
*filename,
 ist->dec_ctx->pkt_timebase = stream->time_base;
 ist->dec_ctx->framerate = stream->avg_frame_rate;
 #if FF_API_LAVF_AVCTX
+ist->dec_ctx->properties = stream->codec->properties;
 ist->dec_ctx->coded_width = stream->codec->coded_width;
 ist->dec_ctx->coded_height = stream->codec->coded_height;
 #endif
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
index 2fb5fce4b1..e49915e407 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
@@ -1 +1 @@
-a6fb9c37dc71cb43eb9664a8ae9f1c66 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
+861b9c23587d0a09caa78c3651faf5a0 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
index 60d729b3da..e3e76f217a 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
@@ -1 +1 @@
-cb7c8eac6f8917e39658e1fa4a250da8 
*tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
+d66177ea3922692bc91cd0f8aa907650 
*tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf 
b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
index d18e35b7ba..a590f6f24b 100644
--- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
@@ -120,5 +120,5 @@ 
audio|1|65280|1.36|65280|1.36|1920|0.04|N/A|N/A|3840|207872|K_|1
 Strings Metadata
 video|0|37|1.48|34|1.36|1|0.04|N/A|N/A|24786|212480|K_|1
 Strings Metadata
-0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
+0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
 
1|pcm_s16le|unknown|audio|1/48000|[0][0][0][0]|0x|s16|48000|1|unknown|16|N/A|0/0|0/0|1/48000|0|0.00|N/A|N/A|768000|N/A|N/A|N/A|N/A|50|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10 
b/tests/ref/fa

Re: [FFmpeg-devel] [PATCH V3 1/1] ensure closed caption info which is visible in default stream dump is also available in results when -show_streams is used

2020-04-25 Thread vectronic


> On 25 Apr 2020, at 09:08, Marton Balint  wrote:
> 
> 
> 
> On Fri, 24 Apr 2020, vectronic wrote:
> 
>> Signed-off-by: vectronic 
>> ---
>> doc/ffprobe.xsd   | 1 +
>> fftools/ffprobe.c | 2 ++
>> tests/ref/fate/concat-demuxer-extended-lavf-mxf   | 2 +-
>> tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10   | 2 +-
>> tests/ref/fate/concat-demuxer-simple1-lavf-mxf| 2 +-
>> tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10| 2 +-
>> tests/ref/fate/concat-demuxer-simple2-lavf-ts | 2 +-
>> tests/ref/fate/ffprobe_compact| 4 ++--
>> tests/ref/fate/ffprobe_csv| 4 ++--
>> tests/ref/fate/ffprobe_default| 2 ++
>> tests/ref/fate/ffprobe_flat   | 2 ++
>> tests/ref/fate/ffprobe_ini| 2 ++
>> tests/ref/fate/ffprobe_json   | 2 ++
>> tests/ref/fate/ffprobe_xml| 4 ++--
>> tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 1 +
>> tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 1 +
>> tests/ref/fate/mov-zombie | 2 +-
>> tests/ref/fate/mxf-probe-d10  | 1 +
>> tests/ref/fate/mxf-probe-dnxhd| 1 +
>> tests/ref/fate/mxf-probe-dv25 | 1 +
>> 20 files changed, 28 insertions(+), 12 deletions(-)
>> 
>> diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd
>> index 97dc67def6..f88045232f 100644
>> --- a/doc/ffprobe.xsd
>> +++ b/doc/ffprobe.xsd
>> @@ -227,6 +227,7 @@
>>  
>>  
>>  
>> +  
> 
> xsd:boolean seems more appropriate, no?

I was copying off has_b_frames above which I believed was also a 0/1. The 
output in the stream info is 0/1, not true/false.

>>  
>>  
>>  
>> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
>> index 840fcb71e2..f0916cbd70 100644
>> --- a/fftools/ffprobe.c
>> +++ b/fftools/ffprobe.c
>> @@ -2550,6 +2550,7 @@ static int show_stream(WriterContext *w, 
>> AVFormatContext *fmt_ctx, int stream_id
>>}
>> #endif
>>print_int("has_b_frames", par->video_delay);
>> +print_int("closed_captions", !!(dec_ctx->properties & 
>> FF_CODEC_PROPERTY_CLOSED_CAPTIONS));
> 
> Not strictly related to this patch, but maybe these FF_CODEC_PROPERTY_* 
> constants should be promoted to AV_*?

I’m not sure what is meant by this, but happy to do so if you can elaborate a 
bit more…?


>>sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL);
>>if (sar.num) {
>>print_q("sample_aspect_ratio", sar, ':');
>> @@ -2950,6 +2951,7 @@ static int open_input_file(InputFile *ifile, const 
>> char *filename,
>> 
>>ist->dec_ctx->pkt_timebase = stream->time_base;
>>ist->dec_ctx->framerate = stream->avg_frame_rate;
>> +ist->dec_ctx->properties = stream->codec->properties;
> 
> This is using the depreacted stream->codec, so I think this should go under 
> the #IF below.
> 
>> #if FF_API_LAVF_AVCTX
>>ist->dec_ctx->coded_width = stream->codec->coded_width;
>>ist->dec_ctx->coded_height = stream->codec->coded_height;

OK, if this is the case, is there anything to worry to worry about if 
FF_API_LAVF_AVCTX is not defined? Should I be outputting closed_captions value 
in this case? Or am I thinking too much?


___
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/1] ensure closed caption info which is visible in default stream dump is also available in results when -show_streams is used

2020-04-24 Thread vectronic
Signed-off-by: vectronic 
---
 doc/ffprobe.xsd   | 1 +
 fftools/ffprobe.c | 2 ++
 tests/ref/fate/concat-demuxer-extended-lavf-mxf   | 2 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10   | 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf| 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10| 2 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 2 +-
 tests/ref/fate/ffprobe_compact| 4 ++--
 tests/ref/fate/ffprobe_csv| 4 ++--
 tests/ref/fate/ffprobe_default| 2 ++
 tests/ref/fate/ffprobe_flat   | 2 ++
 tests/ref/fate/ffprobe_ini| 2 ++
 tests/ref/fate/ffprobe_json   | 2 ++
 tests/ref/fate/ffprobe_xml| 4 ++--
 tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 1 +
 tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 1 +
 tests/ref/fate/mov-zombie | 2 +-
 tests/ref/fate/mxf-probe-d10  | 1 +
 tests/ref/fate/mxf-probe-dnxhd| 1 +
 tests/ref/fate/mxf-probe-dv25 | 1 +
 20 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd
index 97dc67def6..f88045232f 100644
--- a/doc/ffprobe.xsd
+++ b/doc/ffprobe.xsd
@@ -227,6 +227,7 @@
   
   
   
+  
   
   
   
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 840fcb71e2..f0916cbd70 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2550,6 +2550,7 @@ static int show_stream(WriterContext *w, AVFormatContext 
*fmt_ctx, int stream_id
 }
 #endif
 print_int("has_b_frames", par->video_delay);
+print_int("closed_captions", !!(dec_ctx->properties & 
FF_CODEC_PROPERTY_CLOSED_CAPTIONS));
 sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL);
 if (sar.num) {
 print_q("sample_aspect_ratio", sar, ':');
@@ -2950,6 +2951,7 @@ static int open_input_file(InputFile *ifile, const char 
*filename,
 
 ist->dec_ctx->pkt_timebase = stream->time_base;
 ist->dec_ctx->framerate = stream->avg_frame_rate;
+ist->dec_ctx->properties = stream->codec->properties;
 #if FF_API_LAVF_AVCTX
 ist->dec_ctx->coded_width = stream->codec->coded_width;
 ist->dec_ctx->coded_height = stream->codec->coded_height;
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
index 2fb5fce4b1..da4ab35b59 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
@@ -1 +1 @@
-a6fb9c37dc71cb43eb9664a8ae9f1c66 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
+47f9fbf6cc419c0b3301f4b16b15cdcc 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
index 60d729b3da..463c8d3b0b 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
@@ -1 +1 @@
-cb7c8eac6f8917e39658e1fa4a250da8 
*tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
+fe2e8c65ef7a8d4e11d09ddc26cb432a 
*tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf 
b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
index d18e35b7ba..6aa7f287cb 100644
--- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
@@ -120,5 +120,5 @@ 
audio|1|65280|1.36|65280|1.36|1920|0.04|N/A|N/A|3840|207872|K_|1
 Strings Metadata
 video|0|37|1.48|34|1.36|1|0.04|N/A|N/A|24786|212480|K_|1
 Strings Metadata
-0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
+0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|1|0|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
 
1|pcm_s16le|unknown|audio|1/48000|[0][0][0][0]|0x|s16|48000|1|unknown|16|N/A|0/0|0/0|1/48000|0|0.00|N/A|N/A|768000|N/A|N/A|N/A|N/A|50|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10 
b/tests/ref/fate/concat-demuxer-simple1-lav

[FFmpeg-devel] [PATCH V3 0/1] ffprobe add closed caption output to stream info

2020-04-24 Thread vectronic
sorry, missed all the changes in the last version... trying again...

ensure closed caption info which is visible in default stream dump is also
available in results when -show_streams is used and update test references
for closed_caption output in ffprobe stream results

vectronic (1):
  ensure closed caption info which is visible in default stream dump is
also available in results when -show_streams is used

 doc/ffprobe.xsd   | 1 +
 fftools/ffprobe.c | 2 ++
 tests/ref/fate/concat-demuxer-extended-lavf-mxf   | 2 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10   | 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf| 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10| 2 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 2 +-
 tests/ref/fate/ffprobe_compact| 4 ++--
 tests/ref/fate/ffprobe_csv| 4 ++--
 tests/ref/fate/ffprobe_default| 2 ++
 tests/ref/fate/ffprobe_flat   | 2 ++
 tests/ref/fate/ffprobe_ini| 2 ++
 tests/ref/fate/ffprobe_json   | 2 ++
 tests/ref/fate/ffprobe_xml| 4 ++--
 tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 1 +
 tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 1 +
 tests/ref/fate/mov-zombie | 2 +-
 tests/ref/fate/mxf-probe-d10  | 1 +
 tests/ref/fate/mxf-probe-dnxhd| 1 +
 tests/ref/fate/mxf-probe-dv25 | 1 +
 20 files changed, 28 insertions(+), 12 deletions(-)

-- 
2.24.2 (Apple Git-127)

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

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

[FFmpeg-devel] [PATCH V2 0/1] ffprobe add closed caption output to stream info

2020-04-24 Thread vectronic
ensure closed caption info which is visible in default stream dump is also
available in results when -show_streams is used and update test references
for closed_caption output in ffprobe stream results

vectronic (1):
  ensure closed caption info which is visible in default stream dump is
also available in results when -show_streams is used

 doc/ffprobe.xsd   | 1 +
 tests/ref/fate/concat-demuxer-extended-lavf-mxf   | 2 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10   | 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf| 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10| 2 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 2 +-
 tests/ref/fate/ffprobe_compact| 4 ++--
 tests/ref/fate/ffprobe_csv| 4 ++--
 tests/ref/fate/ffprobe_default| 2 ++
 tests/ref/fate/ffprobe_flat   | 2 ++
 tests/ref/fate/ffprobe_ini| 2 ++
 tests/ref/fate/ffprobe_json   | 2 ++
 tests/ref/fate/ffprobe_xml| 4 ++--
 tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 1 +
 tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 1 +
 tests/ref/fate/mov-zombie | 2 +-
 tests/ref/fate/mxf-probe-d10  | 1 +
 tests/ref/fate/mxf-probe-dnxhd| 1 +
 tests/ref/fate/mxf-probe-dv25 | 1 +
 19 files changed, 26 insertions(+), 12 deletions(-)

-- 
2.24.2 (Apple Git-127)

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

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

[FFmpeg-devel] [PATCH V2 1/1] ensure closed caption info which is visible in default stream dump is also available in results when -show_streams is used

2020-04-24 Thread vectronic
Signed-off-by: vectronic 
---
 doc/ffprobe.xsd   | 1 +
 tests/ref/fate/concat-demuxer-extended-lavf-mxf   | 2 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10   | 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf| 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10| 2 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 2 +-
 tests/ref/fate/ffprobe_compact| 4 ++--
 tests/ref/fate/ffprobe_csv| 4 ++--
 tests/ref/fate/ffprobe_default| 2 ++
 tests/ref/fate/ffprobe_flat   | 2 ++
 tests/ref/fate/ffprobe_ini| 2 ++
 tests/ref/fate/ffprobe_json   | 2 ++
 tests/ref/fate/ffprobe_xml| 4 ++--
 tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 1 +
 tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 1 +
 tests/ref/fate/mov-zombie | 2 +-
 tests/ref/fate/mxf-probe-d10  | 1 +
 tests/ref/fate/mxf-probe-dnxhd| 1 +
 tests/ref/fate/mxf-probe-dv25 | 1 +
 19 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd
index 97dc67def6..f88045232f 100644
--- a/doc/ffprobe.xsd
+++ b/doc/ffprobe.xsd
@@ -227,6 +227,7 @@
   
   
   
+  
   
   
   
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
index 2fb5fce4b1..da4ab35b59 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
@@ -1 +1 @@
-a6fb9c37dc71cb43eb9664a8ae9f1c66 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
+47f9fbf6cc419c0b3301f4b16b15cdcc 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
index 60d729b3da..463c8d3b0b 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
@@ -1 +1 @@
-cb7c8eac6f8917e39658e1fa4a250da8 
*tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
+fe2e8c65ef7a8d4e11d09ddc26cb432a 
*tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf 
b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
index d18e35b7ba..6aa7f287cb 100644
--- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
@@ -120,5 +120,5 @@ 
audio|1|65280|1.36|65280|1.36|1920|0.04|N/A|N/A|3840|207872|K_|1
 Strings Metadata
 video|0|37|1.48|34|1.36|1|0.04|N/A|N/A|24786|212480|K_|1
 Strings Metadata
-0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
+0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|1|0|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
 
1|pcm_s16le|unknown|audio|1/48000|[0][0][0][0]|0x|s16|48000|1|unknown|16|N/A|0/0|0/0|1/48000|0|0.00|N/A|N/A|768000|N/A|N/A|N/A|N/A|50|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10 
b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
index e83d1bf847..79ce1e2306 100644
--- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
+++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
@@ -78,5 +78,5 @@ 
video|0|34|1.36|34|1.36|1|0.04|N/A|N/A|15|1924096|K_|1
 Strings Metadata
 audio|1|65280|1.36|65280|1.36|1920|0.04|N/A|N/A|7680|2074624|K_|1
 Strings Metadata
-0|mpeg2video|0|video|1/25|[0][0][0][0]|0x|720|608|0|0|0|1:1|45:38|yuv422p|5|tv|unknown|unknown|unknown|topleft|tt|N/A|1|N/A|25/1|25/1|1/25|0|0.00|N/A|N/A|3000|N/A|N/A|N/A|N/A|35|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
+0|mpeg2video|0|video|1/25|[0][0][0][0]|0x|720|608|0|0|0|0|1:1|45:38|yuv422p|5|tv|unknown|unknown|unknown|topleft|tt|N/A|1|N/A|25/1|25/1|1/25|0|0.00|N/A|N/A|3000|N/A|N/A|N/A|N/A|35|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
 
1|pcm_s16le|unknown|audio|1/48000|[0][0][0][0]|0x|s16|48000|2|unknown|16|N/A|0/0|0/0|1/48000|0|0.00|N/A|N/A|1536000|N/A|N/A|N/A|N/A|35|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301

[FFmpeg-devel] [PATCH 2/2] fate: update test references for closed_caption output in ffprobe stream results

2020-04-24 Thread vectronic
Signed-off-by: vectronic 
---
 tests/ref/fate/concat-demuxer-extended-lavf-mxf   | 2 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10   | 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf| 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10| 2 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 2 +-
 tests/ref/fate/ffprobe_compact| 4 ++--
 tests/ref/fate/ffprobe_csv| 4 ++--
 tests/ref/fate/ffprobe_default| 2 ++
 tests/ref/fate/ffprobe_flat   | 2 ++
 tests/ref/fate/ffprobe_ini| 2 ++
 tests/ref/fate/ffprobe_json   | 2 ++
 tests/ref/fate/ffprobe_xml| 4 ++--
 tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 1 +
 tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 1 +
 tests/ref/fate/mov-zombie | 2 +-
 tests/ref/fate/mxf-probe-d10  | 1 +
 tests/ref/fate/mxf-probe-dnxhd| 1 +
 tests/ref/fate/mxf-probe-dv25 | 1 +
 18 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
index 2fb5fce4b1..da4ab35b59 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
@@ -1 +1 @@
-a6fb9c37dc71cb43eb9664a8ae9f1c66 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
+47f9fbf6cc419c0b3301f4b16b15cdcc 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
index 60d729b3da..463c8d3b0b 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
@@ -1 +1 @@
-cb7c8eac6f8917e39658e1fa4a250da8 
*tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
+fe2e8c65ef7a8d4e11d09ddc26cb432a 
*tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf 
b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
index d18e35b7ba..6aa7f287cb 100644
--- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
@@ -120,5 +120,5 @@ 
audio|1|65280|1.36|65280|1.36|1920|0.04|N/A|N/A|3840|207872|K_|1
 Strings Metadata
 video|0|37|1.48|34|1.36|1|0.04|N/A|N/A|24786|212480|K_|1
 Strings Metadata
-0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
+0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|1|0|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
 
1|pcm_s16le|unknown|audio|1/48000|[0][0][0][0]|0x|s16|48000|1|unknown|16|N/A|0/0|0/0|1/48000|0|0.00|N/A|N/A|768000|N/A|N/A|N/A|N/A|50|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10 
b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
index e83d1bf847..79ce1e2306 100644
--- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
+++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
@@ -78,5 +78,5 @@ 
video|0|34|1.36|34|1.36|1|0.04|N/A|N/A|15|1924096|K_|1
 Strings Metadata
 audio|1|65280|1.36|65280|1.36|1920|0.04|N/A|N/A|7680|2074624|K_|1
 Strings Metadata
-0|mpeg2video|0|video|1/25|[0][0][0][0]|0x|720|608|0|0|0|1:1|45:38|yuv422p|5|tv|unknown|unknown|unknown|topleft|tt|N/A|1|N/A|25/1|25/1|1/25|0|0.00|N/A|N/A|3000|N/A|N/A|N/A|N/A|35|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
+0|mpeg2video|0|video|1/25|[0][0][0][0]|0x|720|608|0|0|0|0|1:1|45:38|yuv422p|5|tv|unknown|unknown|unknown|topleft|tt|N/A|1|N/A|25/1|25/1|1/25|0|0.00|N/A|N/A|3000|N/A|N/A|N/A|N/A|35|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
 
1|pcm_s16le|unknown|audio|1/48000|[0][0][0][0]|0x|s16|48000|2|unknown|16|N/A|0/0|0/0|1/48000|0|0.00|N/A|N/A|1536000|N/A|N/A|N/A|N/A|35|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
diff --git a/tests/ref/fate/concat-demuxer-simple2-lavf-ts 
b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
index 0f03d6e06b..e5de697049 100644
--- a/tests/ref/fate/concat-demuxer-simple2-lavf-ts
+++ b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
@@ -212,4 +212,4

[FFmpeg-devel] [PATCH 0/2] ffprobe add closed caption output to stream info

2020-04-24 Thread vectronic
closed caption presence is detected with ffprobe and output as part of
av_dump_format() however it is not included in output from -show_streams
this add closed_captions=0 or 1 to the stream info output and updates
fate test results.

vectronic (2):
  tools ffprobe: add closed caption output to stream info
  fate: update test references for closed_caption output in ffprobe
stream results

 fftools/ffprobe.c | 2 ++
 tests/ref/fate/concat-demuxer-extended-lavf-mxf   | 2 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10   | 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf| 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10| 2 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 2 +-
 tests/ref/fate/ffprobe_compact| 4 ++--
 tests/ref/fate/ffprobe_csv| 4 ++--
 tests/ref/fate/ffprobe_default| 2 ++
 tests/ref/fate/ffprobe_flat   | 2 ++
 tests/ref/fate/ffprobe_ini| 2 ++
 tests/ref/fate/ffprobe_json   | 2 ++
 tests/ref/fate/ffprobe_xml| 4 ++--
 tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 1 +
 tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 1 +
 tests/ref/fate/mov-zombie | 2 +-
 tests/ref/fate/mxf-probe-d10  | 1 +
 tests/ref/fate/mxf-probe-dnxhd| 1 +
 tests/ref/fate/mxf-probe-dv25 | 1 +
 19 files changed, 27 insertions(+), 12 deletions(-)

-- 
2.24.2 (Apple Git-127)

___
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] tools ffprobe: add closed caption output to stream info

2020-04-24 Thread vectronic
ensure closed caption info which is visible in default stream dump is also 
available in results when -show_streams is used

Signed-off-by: vectronic 
---
 fftools/ffprobe.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 840fcb71e2..f0916cbd70 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2550,6 +2550,7 @@ static int show_stream(WriterContext *w, AVFormatContext 
*fmt_ctx, int stream_id
 }
 #endif
 print_int("has_b_frames", par->video_delay);
+print_int("closed_captions", !!(dec_ctx->properties & 
FF_CODEC_PROPERTY_CLOSED_CAPTIONS));
 sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL);
 if (sar.num) {
 print_q("sample_aspect_ratio", sar, ':');
@@ -2950,6 +2951,7 @@ static int open_input_file(InputFile *ifile, const char 
*filename,
 
 ist->dec_ctx->pkt_timebase = stream->time_base;
 ist->dec_ctx->framerate = stream->avg_frame_rate;
+ist->dec_ctx->properties = stream->codec->properties;
 #if FF_API_LAVF_AVCTX
 ist->dec_ctx->coded_width = stream->codec->coded_width;
 ist->dec_ctx->coded_height = stream->codec->coded_height;
-- 
2.24.2 (Apple Git-127)

___
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] avformat mov fix to detect if stream position has been reset

2020-04-24 Thread vectronic
if pos has been reset, clear fragments and indexes and search for next root

Signed-off-by: vectronic 
---
 libavformat/mov.c | 36 +---
 1 file changed, 33 insertions(+), 3 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 3d6fef685d..8f051fb9b1 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -7796,15 +7796,15 @@ static int mov_switch_root(AVFormatContext *s, int64_t 
target, int index)
 
 if (index >= 0 && index < mov->frag_index.nb_items)
 target = mov->frag_index.item[index].moof_offset;
-if (avio_seek(s->pb, target, SEEK_SET) != target) {
+if (target >= 0 && avio_seek(s->pb, target, SEEK_SET) != target) {
 av_log(mov->fc, AV_LOG_ERROR, "root atom offset 0x%"PRIx64": partial 
file\n", target);
 return AVERROR_INVALIDDATA;
 }
 
 mov->next_root_atom = 0;
-if (index < 0 || index >= mov->frag_index.nb_items)
+if ((index < 0 && target >= 0) || index >= mov->frag_index.nb_items)
 index = search_frag_moof_offset(>frag_index, target);
-if (index < mov->frag_index.nb_items &&
+if (index >= 0 && index < mov->frag_index.nb_items &&
 mov->frag_index.item[index].moof_offset == target) {
 if (index + 1 < mov->frag_index.nb_items)
 mov->next_root_atom = mov->frag_index.item[index + 1].moof_offset;
@@ -7856,8 +7856,38 @@ static int mov_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 AVStream *st = NULL;
 int64_t current_index;
 int ret;
+int i;
 mov->fc = s;
  retry:
+if (s->pb->pos == 0) {
+
+// Discard current fragment index
+if (mov->frag_index.allocated_size > 0) {
+av_freep(>frag_index.item);
+mov->frag_index.nb_items = 0;
+mov->frag_index.allocated_size = 0;
+mov->frag_index.current = -1;
+mov->frag_index.complete = 0;
+}
+
+for (i = 0; i < s->nb_streams; i++) {
+AVStream *avst = s->streams[i];
+MOVStreamContext *msc = avst->priv_data;
+
+// Clear current sample
+mov_current_sample_set(msc, 0);
+
+// Discard current index entries
+if (avst->index_entries_allocated_size > 0) {
+av_freep(>index_entries);
+avst->index_entries_allocated_size = 0;
+avst->nb_index_entries = 0;
+}
+}
+
+if ((ret = mov_switch_root(s, -1, -1)) < 0)
+return ret;
+}
 sample = mov_find_next_sample(s, );
 if (!sample || (mov->next_root_atom && sample->pos > mov->next_root_atom)) 
{
 if (!mov->next_root_atom)
-- 
2.24.2 (Apple Git-127)

___
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] avformat hls fix to seek logic

2020-04-24 Thread vectronic
ensure a keyframe is returned if AVSEEK_FLAG_ANY is not specified

Signed-off-by: vectronic 
---
 libavformat/hls.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index fc45719d1c..4e59142c99 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -2146,8 +2146,10 @@ static int hls_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 ts_diff = av_rescale_rnd(pls->pkt.dts, AV_TIME_BASE,
 tb.den, AV_ROUND_DOWN) -
 pls->seek_timestamp;
-if (ts_diff >= 0 && (pls->seek_flags  & AVSEEK_FLAG_ANY ||
-pls->pkt.flags & AV_PKT_FLAG_KEY)) {
+/* If AVSEEK_FLAG_ANY, keep reading until ts_diff is 
greater than 0
+ * otherwise return the first keyframe encountered */
+if ((ts_diff >= 0 && (pls->seek_flags & AVSEEK_FLAG_ANY)) 
||
+(!(pls->seek_flags & AVSEEK_FLAG_ANY) && 
(pls->pkt.flags & AV_PKT_FLAG_KEY)))  {
 pls->seek_timestamp = AV_NOPTS_VALUE;
 break;
 }
@@ -2291,7 +2293,7 @@ static int hls_read_seek(AVFormatContext *s, int 
stream_index,
 pls->pb.eof_reached = 0;
 /* Clear any buffered data */
 pls->pb.buf_end = pls->pb.buf_ptr = pls->pb.buffer;
-/* Reset the pos, to let the mpegts demuxer know we've seeked. */
+/* Reset the pos, to let the mpegts/mov demuxer know we've seeked. */
 pls->pb.pos = 0;
 /* Flush the packet queue of the subdemuxer. */
 ff_read_frame_flush(pls->ctx);
-- 
2.24.2 (Apple Git-127)

___
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 0/2] fix for seeking in HLS with TS/FMP4 media

2020-04-24 Thread vectronic
I am resubmitting a patch which fixes the following two tickets:

https://trac.ffmpeg.org/ticket/7359
https://trac.ffmpeg.org/ticket/7485

The patch consists of 2 parts. The first is necessary to fix the case of HLS 
seeking when
the HLS package consists of ts files. The second fixes HLS seeking when the HLS 
package
consists of fmp4 files. Note that the first can be applied without the second, 
and HLS
seeking with fmp4 files will remain broken, but in a different manner. The 
first patch
works because it relies on correct behaviour implemented in mpegts.c, the 
second patch mirrors this
behaviour in mov.c.

The issues can be demonstrated as follows:

./ffmpeg -ss 3 -i http://vectronic.io/hls_seek_issue/ts/in.m3u8 -t 2 out.mp4
./ffmpeg -ss 3 -i http://vectronic.io/hls_seek_issue/fmp4/in.m3u8 -t 2 out.mp4

These both produce zero duration output files.

With the first patch applied, the ts example produces a 2 second output file as 
expected.
However the fmp4 example results in a conversion error.

With the second patch applied, both the ts and fmp4 examples produce 2 second 
output files as expected.

Patch 1: Change to logic in hls.c for seeking

After performing a rough seek in hls.c hls_read_seek() to the nearest segment, 
the logic for hls_read_packet() was to discard packets until a DTS after the 
accurate seek point is discovered. This was done even if AVSEEK_FLAG_ANY was 
not specified in the initial seek request. The patch changes this so that if 
AVSEEK_FLAG_ANY has not been specified, it will instead return the first 
keyframe discovered after the rough seek point.

Patch 2: Change to logic in mov.c for reading packets after an HLS seek

Within hls.c when hls_read_seek() is called it resets the stream position as 
follows:

/* Reset the pos, to let the mpegts demuxer know we've seeked. */
pls->pb.pos = 0;

There is support for this in the mpegts handle_packets() code to check if the 
position has been reset and clear out any PES packets:

if (avio_tell(s->pb) != ts->last_pos) {
  int i;
  av_log(ts->stream, AV_LOG_TRACE, "Skipping after seek\n");
  /* seek detected, flush pes buffer */

This behaviour needed to be mirrored in the mov demuxer. In mov.c it now 
detects if the pos has been reset in mov_read_packet(). It clears fragments and 
indexes and searches for the next root i.e. the next fragment via 
mov_switch_root().

vectronic (2):
  avformat hls fix to seek logic
  avformat mov fix to detect if stream position has been reset

 libavformat/hls.c |  8 +---
 libavformat/mov.c | 36 +---
 2 files changed, 38 insertions(+), 6 deletions(-)

-- 
2.24.2 (Apple Git-127)

___
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/1] avformat/http: handle SEEK_SET to filesize

2020-04-24 Thread vectronic
> On 24 Apr 2020, at 12:09, vectronic  wrote:
> 
> if whence == SEEK_SET and offset is filesize and is_streamable is false
> we can just return the filesize to prevent an HTTP 416 error
> 
> Signed-off-by: vectronic 
> ---
> libavformat/http.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/http.c b/libavformat/http.c
> index c9415578aa..1adcc6eb67 100644
> --- a/libavformat/http.c
> +++ b/libavformat/http.c
> @@ -1719,7 +1719,7 @@ static int64_t http_seek_internal(URLContext *h, 
> int64_t off, int whence, int fo
> int old_buf_size, ret;
> AVDictionary *options = NULL;
> 
> -if (whence == AVSEEK_SIZE)
> +if ((whence == AVSEEK_SIZE) || (whence == SEEK_SET && h->is_streamed == 
> 0 && off == s->filesize))
> return s->filesize;
> else if (!force_reconnect &&
>  ((whence == SEEK_CUR && off == 0) ||
> -- 
> 2.24.2 (Apple Git-127)
> 

Apologies for confusion on this, I believe this issue has already been fixed 
this commit:

https://github.com/FFmpeg/FFmpeg/commit/69fcc093c1241b5ee7711c56c9cd558832a7e491
 
<https://github.com/FFmpeg/FFmpeg/commit/69fcc093c1241b5ee7711c56c9cd558832a7e491>

Therefore I believe the following has already been fixed and can be closed:

https://trac.ffmpeg.org/ticket/6885 <https://trac.ffmpeg.org/ticket/6885>

___
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/1] avformat/http: handle SEEK_SET to filesize

2020-04-24 Thread vectronic
if whence == SEEK_SET and offset is filesize and is_streamable is false
we can just return the filesize to prevent an HTTP 416 error

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

diff --git a/libavformat/http.c b/libavformat/http.c
index c9415578aa..1adcc6eb67 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1719,7 +1719,7 @@ static int64_t http_seek_internal(URLContext *h, int64_t 
off, int whence, int fo
 int old_buf_size, ret;
 AVDictionary *options = NULL;
 
-if (whence == AVSEEK_SIZE)
+if ((whence == AVSEEK_SIZE) || (whence == SEEK_SET && h->is_streamed == 0 
&& off == s->filesize))
 return s->filesize;
 else if (!force_reconnect &&
  ((whence == SEEK_CUR && off == 0) ||
-- 
2.24.2 (Apple Git-127)

___
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 0/1] avformat/http: handle SEEK_SET to filesize and fix #6885

2020-04-24 Thread vectronic
if whence == SEEK_SET and offset is filesize and is_streamable is false
we can just return the filesize to prevent an HTTP 416 error

Fixes https://trac.ffmpeg.org/ticket/6885

vectronic (1):
  avformat/http: handle SEEK_SET to filesize

 libavformat/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.24.2 (Apple Git-127)

___
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 0/5] adding ICC profile support to MOV decode/encode

2019-10-07 Thread vectronic
> On 23 Sep 2019, at 21:43, vectronic  wrote:
> 
> As discussed earlier on this mailing list, I needed to implement support for 
> reading and writing ICC profiles which can be stored in MOV/MP4 sample 
> descriptor colour information.
> 
> The overall changes are:
> 
> 1. Add a new enum value AVPacketSideDataType.AV_PKT_DATA_ICC_PROFILE. (Not 
> sure if update to APIchanges is correct.) Added to ff_decode_frame_props() to 
> ensure ICC profiles are attached to decoded frames. Added support for the new 
> side data type to format dump as well.
> 
> 2. Use av_stream_new_side_data() when reading from the MOV/MP4 in 
> libavformat/mov.c => mov_read_colr() to store ICC profile if it exists.
> 
> 3. Use av_stream_get_side_data() when writing to the MOV/MP4 in 
> libavformat/moveenc.c => mov_write_colr_tag() to write ICC profile it it 
> exists. Added a movflag 'prefer_icc' to ensure backwards compatible behaviour 
> of 'write_colr' movflag.
> 
> 
> 
> 
> vectronic (5):
>  API: add AV_PKT_DATA_ICC_PROFILE to AVPacketSideDataType
>  DOC: add AV_PKT_DATA_ICC_PROFILE to API changes
>  avformat/mov: add ICC profile support for colr atom
>  avformat/mov: whitespace indent
>  avformat/movenc: add ICC profile support to colr atom. If 'write_colr' 
> movflag
>is set, then movflag 'prefer_icc' can be used to first look for an
>AV_PKT_DATA_ICC_PROFILE entry to encode. If ICC profile doesn't
>exist, default behaviour enabled by 'write_colr' occurs.
> 
> doc/APIchanges|  3 +++
> libavcodec/avcodec.h  |  6 +
> libavcodec/avpacket.c |  1 +
> libavcodec/decode.c   |  1 +
> libavformat/dump.c|  3 +++
> libavformat/mov.c | 63 +--
> libavformat/movenc.c  | 23 ++--
> libavformat/movenc.h  |  1 +
> 8 files changed, 73 insertions(+), 28 deletions(-)
> 
> -- 
> 2.21.0 (Apple Git-122)
> 

Hello,

Wondering if anyone would be able to review these changes? I’m currently using 
this in production and it is working well.

Thanks


___
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/1] [PATCH] avformat/hls: fix missing segment offset reset on last segment when http_multiple is enabled.

2019-10-04 Thread vectronic
Signed-off-by: vectronic 
---
 libavformat/hls.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 336608fa2d..d7f4d5b442 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1449,6 +1449,7 @@ reload:
 
 if (c->http_multiple == 1 && v->input_next_requested) {
 FFSWAP(AVIOContext *, v->input, v->input_next);
+v->cur_seg_offset = 0;
 v->input_next_requested = 0;
 ret = 0;
 } else {
-- 
2.21.0 (Apple Git-122)

___
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 0/1] avformat/hls: fix missing data from last segment of HLS+fMP4 when using http_multiple

2019-10-04 Thread vectronic
When using http_multiple with HLS and fragmented MP4 media, the last segment is 
attempted to be
read without resetting the current segment offset to 0. the previous segments 
last offset was
thus used which meant an invalid portion of the last segment was being read.

vectronic (1):
  avformat/hls: fix missing segment offset reset on last segment when
http_multiple is enabled.

 libavformat/hls.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.21.0 (Apple Git-122)

___
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 0/2] avformat/hls: fix demux of HLS+fMP4 when using persistent HTTP connections

2019-10-04 Thread vectronic
The offset of a playlist segment into a fragmented MP4 file was being ignored 
when
using support for persistent HTTP connections. To allow passing of the segment 
offsets
a new ff_http_do_new_request2() method is introduced.

vectronic (2):
  avformat/http: add ff_http_do_new_request2() which supports options to
be applied to HTTPContext after initialisation with the new uri
  avformat/hls: pass http offset options to http request made with
persistent connections to prevent incorrect reset of offset when
demuxing HLS+FMP4

 libavformat/hls.c  |  8 
 libavformat/http.c |  8 +++-
 libavformat/http.h | 13 +
 3 files changed, 24 insertions(+), 5 deletions(-)

-- 
2.21.0 (Apple Git-122)

___
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] [PATCH 1/2] avformat/http: add ff_http_do_new_request2() which supports options to be applied to HTTPContext after initialisation with the new uri

2019-10-04 Thread vectronic
Signed-off-by: vectronic 
---
 libavformat/http.c |  8 +++-
 libavformat/http.h | 13 +
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 71dd6c2b1f..85cbd06092 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -320,8 +320,11 @@ int ff_http_get_shutdown_status(URLContext *h)
 return ret;
 }
 
+int ff_http_do_new_request(URLContext *h, const char *uri) {
+return ff_http_do_new_request2(h, uri, NULL);
+}
 
-int ff_http_do_new_request(URLContext *h, const char *uri)
+int ff_http_do_new_request2(URLContext *h, const char *uri, AVDictionary 
**opts)
 {
 HTTPContext *s = h->priv_data;
 AVDictionary *options = NULL;
@@ -366,6 +369,9 @@ int ff_http_do_new_request(URLContext *h, const char *uri)
 if (!s->location)
 return AVERROR(ENOMEM);
 
+if ((ret = av_opt_set_dict(s, opts)) < 0)
+return ret;
+
 av_log(s, AV_LOG_INFO, "Opening \'%s\' for %s\n", uri, h->flags & 
AVIO_FLAG_WRITE ? "writing" : "reading");
 ret = http_open_cnx(h, );
 av_dict_free();
diff --git a/libavformat/http.h b/libavformat/http.h
index 662bd2cab6..5557ce9b58 100644
--- a/libavformat/http.h
+++ b/libavformat/http.h
@@ -56,6 +56,19 @@ int ff_http_get_shutdown_status(URLContext *h);
  */
 int ff_http_do_new_request(URLContext *h, const char *uri);
 
+/**
+ * Send a new HTTP request, reusing the old connection.
+ *
+ * @param h pointer to the resource
+ * @param uri uri used to perform the request
+ * @param options  A dictionary filled with HTTP options. On return
+ * this parameter will be destroyed and replaced with a dict containing options
+ * that were not found. May be NULL.
+ * @return a negative value if an error condition occurred, 0
+ * otherwise
+ */
+int ff_http_do_new_request2(URLContext *h, const char *uri, AVDictionary 
**options);
+
 int ff_http_averror(int status_code, int default_averror);
 
 #endif /* AVFORMAT_HTTP_H */
-- 
2.21.0 (Apple Git-122)

___
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] [PATCH 2/2] avformat/hls: pass http offset options to http request made with persistent connections to prevent incorrect reset of offset when demuxing HLS+FMP4

2019-10-04 Thread vectronic
Signed-off-by: vectronic 
---
 libavformat/hls.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 0611ddc6bb..336608fa2d 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -594,7 +594,7 @@ static int ensure_playlist(HLSContext *c, struct playlist 
**pls, const char *url
 }
 
 static int open_url_keepalive(AVFormatContext *s, AVIOContext **pb,
-  const char *url)
+  const char *url, AVDictionary **options)
 {
 #if !CONFIG_HTTP_PROTOCOL
 return AVERROR_PROTOCOL_NOT_FOUND;
@@ -603,7 +603,7 @@ static int open_url_keepalive(AVFormatContext *s, 
AVIOContext **pb,
 URLContext *uc = ffio_geturlcontext(*pb);
 av_assert0(uc);
 (*pb)->eof_reached = 0;
-ret = ff_http_do_new_request(uc, url);
+ret = ff_http_do_new_request2(uc, url, options);
 if (ret < 0) {
 ff_format_io_close(s, pb);
 }
@@ -656,7 +656,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, 
const char *url,
 av_dict_copy(, opts2, 0);
 
 if (is_http && c->http_persistent && *pb) {
-ret = open_url_keepalive(c->ctx, pb, url);
+ret = open_url_keepalive(c->ctx, pb, url, );
 if (ret == AVERROR_EXIT) {
 av_dict_free();
 return ret;
@@ -714,7 +714,7 @@ static int parse_playlist(HLSContext *c, const char *url,
 
 if (is_http && !in && c->http_persistent && c->playlist_pb) {
 in = c->playlist_pb;
-ret = open_url_keepalive(c->ctx, >playlist_pb, url);
+ret = open_url_keepalive(c->ctx, >playlist_pb, url, NULL);
 if (ret == AVERROR_EXIT) {
 return ret;
 } else if (ret < 0) {
-- 
2.21.0 (Apple Git-122)

___
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/5] API: add AV_PKT_DATA_ICC_PROFILE to AVPacketSideDataType

2019-09-23 Thread vectronic
Signed-off-by: vectronic 
---
 libavcodec/avcodec.h  | 6 ++
 libavcodec/avpacket.c | 1 +
 libavcodec/decode.c   | 1 +
 libavformat/dump.c| 3 +++
 4 files changed, 11 insertions(+)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index c91ee4af5b..7d341f85a6 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1407,6 +1407,12 @@ enum AVPacketSideDataType {
  */
 AV_PKT_DATA_AFD,
 
+/**
+ * ICC profile data consisting of an opaque octet buffer following the
+ * format described by ISO 15076-1.
+ */
+AV_PKT_DATA_ICC_PROFILE,
+
 /**
  * The number of side data types.
  * This is not part of the public API/ABI in the sense that it may
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 858f827a0a..efcc167d12 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -394,6 +394,7 @@ const char *av_packet_side_data_name(enum 
AVPacketSideDataType type)
 case AV_PKT_DATA_ENCRYPTION_INIT_INFO:   return "Encryption 
initialization data";
 case AV_PKT_DATA_ENCRYPTION_INFO:return "Encryption info";
 case AV_PKT_DATA_AFD:return "Active Format 
Description data";
+case AV_PKT_DATA_ICC_PROFILE:return "ICC Profile";
 }
 return NULL;
 }
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index a9ea5a51e6..ee12dd0129 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1750,6 +1750,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame 
*frame)
 { AV_PKT_DATA_MASTERING_DISPLAY_METADATA, 
AV_FRAME_DATA_MASTERING_DISPLAY_METADATA },
 { AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
 { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC },
+{ AV_PKT_DATA_ICC_PROFILE,AV_FRAME_DATA_ICC_PROFILE },
 };
 
 if (pkt) {
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 56814ff7d2..220f404d65 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -446,6 +446,9 @@ static void dump_sidedata(void *ctx, AVStream *st, const 
char *indent)
 case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:
 dump_content_light_metadata(ctx, );
 break;
+case AV_PKT_DATA_ICC_PROFILE:
+av_log(ctx, AV_LOG_INFO, "ICC Profile");
+break;
 default:
 av_log(ctx, AV_LOG_INFO,
"unknown side data type %d (%d bytes)", sd.type, sd.size);
-- 
2.21.0 (Apple Git-122)

___
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/5] avformat/mov: whitespace indent

2019-09-23 Thread vectronic
Signed-off-by: vectronic 
---
 libavformat/mov.c | 52 +++
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index b0331d3c96..af1227c89e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1573,34 +1573,34 @@ static int mov_read_colr(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 return ret;
 }
 else {
-color_primaries = avio_rb16(pb);
-color_trc = avio_rb16(pb);
-color_matrix = avio_rb16(pb);
-
-av_log(c->fc, AV_LOG_TRACE,
-   "%s: pri %d trc %d matrix %d",
-   color_parameter_type, color_primaries, color_trc, color_matrix);
-
-if (!strncmp(color_parameter_type, "nclx", 4)) {
-uint8_t color_range = avio_r8(pb) >> 7;
-av_log(c->fc, AV_LOG_TRACE, " full %"PRIu8"", color_range);
-if (color_range)
-st->codecpar->color_range = AVCOL_RANGE_JPEG;
-else
-st->codecpar->color_range = AVCOL_RANGE_MPEG;
-}
+color_primaries = avio_rb16(pb);
+color_trc = avio_rb16(pb);
+color_matrix = avio_rb16(pb);
 
-if (!av_color_primaries_name(color_primaries))
-color_primaries = AVCOL_PRI_UNSPECIFIED;
-if (!av_color_transfer_name(color_trc))
-color_trc = AVCOL_TRC_UNSPECIFIED;
-if (!av_color_space_name(color_matrix))
-color_matrix = AVCOL_SPC_UNSPECIFIED;
+av_log(c->fc, AV_LOG_TRACE,
+   "%s: pri %d trc %d matrix %d",
+   color_parameter_type, color_primaries, color_trc, color_matrix);
+
+if (!strncmp(color_parameter_type, "nclx", 4)) {
+uint8_t color_range = avio_r8(pb) >> 7;
+av_log(c->fc, AV_LOG_TRACE, " full %"PRIu8"", color_range);
+if (color_range)
+st->codecpar->color_range = AVCOL_RANGE_JPEG;
+else
+st->codecpar->color_range = AVCOL_RANGE_MPEG;
+}
 
-st->codecpar->color_primaries = color_primaries;
-st->codecpar->color_trc   = color_trc;
-st->codecpar->color_space = color_matrix;
-av_log(c->fc, AV_LOG_TRACE, "\n");
+if (!av_color_primaries_name(color_primaries))
+color_primaries = AVCOL_PRI_UNSPECIFIED;
+if (!av_color_transfer_name(color_trc))
+color_trc = AVCOL_TRC_UNSPECIFIED;
+if (!av_color_space_name(color_matrix))
+color_matrix = AVCOL_SPC_UNSPECIFIED;
+
+st->codecpar->color_primaries = color_primaries;
+st->codecpar->color_trc   = color_trc;
+st->codecpar->color_space = color_matrix;
+av_log(c->fc, AV_LOG_TRACE, "\n");
 }
 return 0;
 }
-- 
2.21.0 (Apple Git-122)

___
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/5] avformat/movenc: add ICC profile support to colr atom. If 'write_colr' movflag is set, then movflag 'prefer_icc' can be used to first look for an AV_PKT_DATA_ICC_PROFILE ent

2019-09-23 Thread vectronic
Signed-off-by: vectronic 
---
 libavformat/movenc.c | 23 +--
 libavformat/movenc.h |  1 +
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index c824ff5ba1..390dd64e2b 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -77,6 +77,7 @@ static const AVOption options[] = {
 { "global_sidx", "Write a global sidx index at the start of the file", 0, 
AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_GLOBAL_SIDX}, INT_MIN, INT_MAX, 
AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
 { "skip_sidx", "Skip writing of sidx atom", 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_MOV_FLAG_SKIP_SIDX}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, 
"movflags" },
 { "write_colr", "Write colr atom (Experimental, may be renamed or changed, 
do not use from scripts)", 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_MOV_FLAG_WRITE_COLR}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, 
"movflags" },
+{ "prefer_icc", "If writing colr atom prioritise usage of ICC profile if 
it exists in stream packet side data", 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_MOV_FLAG_PREFER_ICC}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, 
"movflags" },
 { "write_gama", "Write deprecated gama atom", 0, AV_OPT_TYPE_CONST, {.i64 
= FF_MOV_FLAG_WRITE_GAMA}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, 
"movflags" },
 { "use_metadata_tags", "Use mdta atom for metadata.", 0, 
AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_USE_MDTA}, INT_MIN, INT_MAX, 
AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
 { "skip_trailer", "Skip writing the mfra/tfra/mfro trailer for fragmented 
files", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_SKIP_TRAILER}, INT_MIN, 
INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
@@ -1865,13 +1866,31 @@ static int mov_write_gama_tag(AVFormatContext *s, 
AVIOContext *pb, MOVTrack *tra
 return 0;
 }
 
-static int mov_write_colr_tag(AVIOContext *pb, MOVTrack *track)
+static int mov_write_colr_tag(AVIOContext *pb, MOVTrack *track, int prefer_icc)
 {
 int64_t pos = avio_tell(pb);
 
 // Ref (MOV): 
https://developer.apple.com/library/mac/technotes/tn2162/_index.html#//apple_ref/doc/uid/DTS40013070-CH1-TNTAG9
 // Ref (MP4): ISO/IEC 14496-12:2012
 
+const uint8_t *icc_profile;
+int icc_profile_size;
+
+if (prefer_icc) {
+icc_profile = av_stream_get_side_data(track->st, 
AV_PKT_DATA_ICC_PROFILE, _profile_size);
+
+if (icc_profile) {
+avio_wb32(pb, 12 + icc_profile_size);
+ffio_wfourcc(pb, "colr");
+ffio_wfourcc(pb, "prof");
+avio_write(pb, icc_profile, icc_profile_size);
+return 12 + icc_profile_size;
+}
+else {
+av_log(NULL, AV_LOG_INFO, "no ICC profile found, will write 
nclx/nclc colour info instead\n");
+}
+}
+
 if (track->par->color_primaries == AVCOL_PRI_UNSPECIFIED &&
 track->par->color_trc == AVCOL_TRC_UNSPECIFIED &&
 track->par->color_space == AVCOL_SPC_UNSPECIFIED) {
@@ -2116,7 +2135,7 @@ static int mov_write_video_tag(AVFormatContext *s, 
AVIOContext *pb, MOVMuxContex
 }
 if (mov->flags & FF_MOV_FLAG_WRITE_COLR) {
 if (track->mode == MODE_MOV || track->mode == MODE_MP4)
-mov_write_colr_tag(pb, track);
+mov_write_colr_tag(pb, track, mov->flags & FF_MOV_FLAG_PREFER_ICC);
 else
 av_log(mov->fc, AV_LOG_WARNING, "Not writing 'colr' atom. Format 
is not MOV or MP4.\n");
 }
diff --git a/libavformat/movenc.h b/libavformat/movenc.h
index 68d6f23a5a..706cf26420 100644
--- a/libavformat/movenc.h
+++ b/libavformat/movenc.h
@@ -258,6 +258,7 @@ typedef struct MOVMuxContext {
 #define FF_MOV_FLAG_NEGATIVE_CTS_OFFSETS  (1 << 19)
 #define FF_MOV_FLAG_FRAG_EVERY_FRAME  (1 << 20)
 #define FF_MOV_FLAG_SKIP_SIDX (1 << 21)
+#define FF_MOV_FLAG_PREFER_ICC(1 << 22)
 
 int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt);
 
-- 
2.21.0 (Apple Git-122)

___
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/5] avformat/mov: add ICC profile support for colr atom

2019-09-23 Thread vectronic
Signed-off-by: vectronic 
---
 libavformat/mov.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 1533c35a1d..b0331d3c96 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1544,6 +1544,7 @@ static int mov_read_enda(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 static int mov_read_colr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
 AVStream *st;
+uint8_t *icc_profile;
 char color_parameter_type[5] = { 0 };
 uint16_t color_primaries, color_trc, color_matrix;
 int ret;
@@ -1556,12 +1557,22 @@ static int mov_read_colr(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 if (ret < 0)
 return ret;
 if (strncmp(color_parameter_type, "nclx", 4) &&
-strncmp(color_parameter_type, "nclc", 4)) {
+strncmp(color_parameter_type, "nclc", 4) &&
+strncmp(color_parameter_type, "prof", 4)) {
 av_log(c->fc, AV_LOG_WARNING, "unsupported color_parameter_type %s\n",
color_parameter_type);
 return 0;
 }
 
+if (!strncmp(color_parameter_type, "prof", 4)) {
+icc_profile = av_stream_new_side_data(st, AV_PKT_DATA_ICC_PROFILE, 
atom.size - 4);
+if (!icc_profile)
+return AVERROR(ENOMEM);
+ret = ffio_read_size(pb, icc_profile, atom.size - 4);
+if (ret < 0)
+return ret;
+}
+else {
 color_primaries = avio_rb16(pb);
 color_trc = avio_rb16(pb);
 color_matrix = avio_rb16(pb);
@@ -1590,7 +1601,7 @@ static int mov_read_colr(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 st->codecpar->color_trc   = color_trc;
 st->codecpar->color_space = color_matrix;
 av_log(c->fc, AV_LOG_TRACE, "\n");
-
+}
 return 0;
 }
 
-- 
2.21.0 (Apple Git-122)

___
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 0/5] adding ICC profile support to MOV decode/encode

2019-09-23 Thread vectronic
As discussed earlier on this mailing list, I needed to implement support for 
reading and writing ICC profiles which can be stored in MOV/MP4 sample 
descriptor colour information.

The overall changes are:

1. Add a new enum value AVPacketSideDataType.AV_PKT_DATA_ICC_PROFILE. (Not sure 
if update to APIchanges is correct.) Added to ff_decode_frame_props() to ensure 
ICC profiles are attached to decoded frames. Added support for the new side 
data type to format dump as well.

2. Use av_stream_new_side_data() when reading from the MOV/MP4 in 
libavformat/mov.c => mov_read_colr() to store ICC profile if it exists.

3. Use av_stream_get_side_data() when writing to the MOV/MP4 in 
libavformat/moveenc.c => mov_write_colr_tag() to write ICC profile it it 
exists. Added a movflag 'prefer_icc' to ensure backwards compatible behaviour 
of 'write_colr' movflag.




vectronic (5):
  API: add AV_PKT_DATA_ICC_PROFILE to AVPacketSideDataType
  DOC: add AV_PKT_DATA_ICC_PROFILE to API changes
  avformat/mov: add ICC profile support for colr atom
  avformat/mov: whitespace indent
  avformat/movenc: add ICC profile support to colr atom. If 'write_colr' movflag
is set, then movflag 'prefer_icc' can be used to first look for an
AV_PKT_DATA_ICC_PROFILE entry to encode. If ICC profile doesn't
exist, default behaviour enabled by 'write_colr' occurs.

 doc/APIchanges|  3 +++
 libavcodec/avcodec.h  |  6 +
 libavcodec/avpacket.c |  1 +
 libavcodec/decode.c   |  1 +
 libavformat/dump.c|  3 +++
 libavformat/mov.c | 63 +--
 libavformat/movenc.c  | 23 ++--
 libavformat/movenc.h  |  1 +
 8 files changed, 73 insertions(+), 28 deletions(-)

-- 
2.21.0 (Apple Git-122)

___
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/5] DOC: add AV_PKT_DATA_ICC_PROFILE to API changes

2019-09-23 Thread vectronic
Signed-off-by: vectronic 
---
 doc/APIchanges | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/APIchanges b/doc/APIchanges
index 80558a49c7..7328f24911 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
+2019-09-23 - xx - lavc 58.56.102 - avcodec.h
+  Add AV_PKT_DATA_ICC_PROFILE
+
 2019-09-04 - 2a9d461abc - lavu 56.35.100 - hwcontext_videotoolbox.h
   Add av_map_videotoolbox_format_from_pixfmt2() for full range pixfmt
 
-- 
2.21.0 (Apple Git-122)

___
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 2/2] avformat/dashdec: fix segfault when parsing segmentlist

2019-09-23 Thread vectronic
> On 16 Sep 2019, at 11:44, vectronic  wrote:
> 
> index into segmentlists_tab was specified as 4 instead of 3 causing invalid 
> access
> 
> further fix to: 8135
> 
> Signed-off-by: vectronic 
> ---
> libavformat/dashdec.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 738bfeaefb..7713ee8907 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -1017,7 +1017,7 @@ static int 
> parse_manifest_representation(AVFormatContext *s, const char *url,
> 
> duration_val = get_val_from_nodes_tab(segmentlists_tab, 3, 
> "duration");
> timescale_val = get_val_from_nodes_tab(segmentlists_tab, 3, 
> "timescale");
> -startnumber_val = get_val_from_nodes_tab(segmentlists_tab, 4, 
> "startNumber");
> +startnumber_val = get_val_from_nodes_tab(segmentlists_tab, 3, 
> "startNumber");
> if (duration_val) {
> rep->fragment_duration = (int64_t) strtoll(duration_val, 
> NULL, 10);
> av_log(s, AV_LOG_TRACE, "rep->fragment_duration = 
> [%"PRId64"]\n", rep->fragment_duration);
> -- 
> 2.20.1 (Apple Git-117)
> 


Could this be applied? It looks like it was introduced as a copy/paste error.


Thanks.
___
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 1/2] avformat/dashdec: fix pointer being freed was not allocated

2019-09-20 Thread vectronic


> On 16 Sep 2019, at 11:55, Liu Steven  wrote:
> 
> 
> 
>> 在 2019年9月16日,下午6:44,vectronic  写道:
>> 
>> prevent attempt to call xmlFree if val was not allocated
>> 
>> fixes: 8135
>> Signed-off-by: vectronic 
>> ---
>> libavformat/dashdec.c | 1 +
>> 1 file changed, 1 insertion(+)
>> 
>> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
>> index 8c0a9b0102..738bfeaefb 100644
>> --- a/libavformat/dashdec.c
>> +++ b/libavformat/dashdec.c
>> @@ -1203,6 +1203,7 @@ static int parse_programinformation(AVFormatContext 
>> *s, xmlNodePtr node)
>>}
>>node = xmlNextElementSibling(node);
>>xmlFree(val);
>> +val = NULL;
>>}
>>return 0;
>> }
>> -- 
>> 2.20.1 (Apple Git-117)
>> 
>> ___
>> 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".
> 
> patchset LGTM
> 
> Thanks
> Steven
> 

Anything else you need or will this be applied at some point?

Thanks
Nick


___
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] Adding ICC profile support to MOV decode/encode

2019-09-19 Thread vectronic


> On 18 Sep 2019, at 18:43, Derek Buitenhuis  wrote:
> 
> On 18/09/2019 17:29, Hello Vectronic wrote:
>> And here is an example file: http://vectronic.io/icc-profile/icc-profile.mov
>> 
>> And here is the relevant standard: 
>> https://standards.iso.org/ittf/PubliclyAvailableStandards/c068960_ISO_IEC_14496-12_2015.zip
>> 
> 
> Of note, the example file is not ISOBMFF, and thus not covered by the linked
> standard. It's covered by QTFF, which I mentioned in the other mail, has
> quite a quite iffy definition...
> 
> Is it possible to generate ISOBMFF with the VideoToolBox API too?
> 

Here is an updated example in both flavours:

http://vectronic.io/icc-profile/icc-profile.mov 
<http://vectronic.io/icc-profile/icc-profile.mov>

http://vectronic.io/icc-profile/icc-profile.mp4 
<http://vectronic.io/icc-profile/icc-profile.mp4>



___
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] Adding ICC profile support to MOV decode/encode

2019-09-18 Thread Hello Vectronic
> On 18 Sep 2019, at 15:27, Derek Buitenhuis  wrote:
> 
> On 18/09/2019 10:30, Hello Vectronic wrote:
>> I need to implement support for reading and writing ICC profiles which can 
>> be stored in MOV/MP4 sample descriptor colour information.
> 
> Does anything exist that can even consume or produce these sorts of files?
> 
> I looked a while back, and found literally nothing that could support these.
> 
> - Derek

It is possible to write and read this with VideoToolbox: 
https://developer.apple.com/documentation/videotoolbox/kvtcompressionpropertykey_iccprofile?language=objc

Here is a snippet of Swift code showing usage:


VTCompressionSessionCreate(
allocator: nil,
width: Int32(width),
height: Int32(height),
codecType: codec,
encoderSpecification: encoderSpecification,
imageBufferAttributes: sourceImageBufferAttributes,
compressedDataAllocator: nil,
outputCallback: outputCallback,
refcon: Unmanaged.passUnretained(self).toOpaque(),
compressionSessionOut: compressionSesionOut)

VTSessionSetProperties(vtCompressionSession, 
propertyDictionary: [
kVTCompressionPropertyKey_ICCProfile: colorSpace.copyICCData() as 
CFTypeRef,
kVTCompressionPropertyKey_MaxKeyFrameInterval: NSNumber(value: 50)
] as CFDictionary)


And here is an example file: http://vectronic.io/icc-profile/icc-profile.mov

And here is the relevant standard: 
https://standards.iso.org/ittf/PubliclyAvailableStandards/c068960_ISO_IEC_14496-12_2015.zip




___
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] Adding ICC profile support to MOV decode/encode

2019-09-18 Thread Hello Vectronic


> On 18 Sep 2019, at 11:09, Hendrik Leppkes  wrote:
> 
> On Wed, Sep 18, 2019 at 11:37 AM Hello Vectronic
>  wrote:
>> 
>> Hello,
>> 
>> I need to implement support for reading and writing ICC profiles which can 
>> be stored in MOV/MP4 sample descriptor colour information.
>> 
>> The relevant extract from the ISO standard is:
>> 
>> class ColourInformationBox extends Box('colr'){
>>unsigned int(32) colour_type;
>>if (colour_type == 'nclx')  /* on-screen colours */
>>{
>>unsigned int(16) colour_primaries;
>>unsigned int(16) transfer_characteristics;
>>unsigned int(16) matrix_coefficients;
>>unsigned int(1)  full_range_flag;
>>unsigned int(7)  reserved = 0;
>>}
>>else if (colour_type == 'rICC')
>>{
>>ICC_profile;// restricted ICC profile
>>}
>>else if (colour_type == 'prof')
>>{
>>ICC_profile;// unrestricted ICC profile
>>}
>> }
>> 
>> At the moment the code only supports nclc/nclx colour type in:
>> 
>> libavformat/mov.c  => mov_read_colr()
>> libavformat/moveenc.c =>  mov_write_colr_tag()
>> 
>> Support for ICC profile is implemented on a per frame basis in 
>> AVFrameSideDataType.AV_FRAME_DATA_ICC_PROFILE. This is used by the PNG, WEBP 
>> and MJPEG codec implementations. The ICC profile in this scenario is treated 
>> as an opaque octet buffer. I don't believe this is relevant to my use case 
>> as the colour information within the MOV/MP4 sample descriptor relates to 
>> the entire stream and is not used on a per-frame basis.
>> 
>> My thinking is to implement support for ICC profile in a similar way that 
>> color_range, color_primaries etc. are currently handled:
>> 
>> 1. Store the ICC profile as an opaque octet buffer stored in an 
>> AVCodecParameters struct value:
>> 
>> uint8_t *icc_profile_data;
>> int icc_profile_size;
>> 
> 
> Something like this has no place in AVCodecParameters, which is
> intentionally kept simple and easy. It should be stream-global
> side-data, similar to the frame side data, just on a stream level,
> which is already a concept we have, so it should be easy to fit it in
> there.
> 
> - Hendrik
> 



Thanks for the advice. 

So it seems I would:

1. add a new enum value AVPacketSideDataType.AV_PKT_DATA_ICC_PROFILE

2. use av_stream_add_side_data() when reading from the MOV/MP4 in 
libavformat/mov.c => mov_read_colr()

3. use av_stream_get_side_data() when writing to the MOV/MP4 in 
libavformat/moveenc.c => mov_write_colr_tag()

And I think that is it..?




___
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] Adding ICC profile support to MOV decode/encode

2019-09-18 Thread Hello Vectronic
Hello,

I need to implement support for reading and writing ICC profiles which can be 
stored in MOV/MP4 sample descriptor colour information.

The relevant extract from the ISO standard is:

class ColourInformationBox extends Box('colr'){
unsigned int(32) colour_type;
if (colour_type == 'nclx')  /* on-screen colours */
{
unsigned int(16) colour_primaries;
unsigned int(16) transfer_characteristics;
unsigned int(16) matrix_coefficients;
unsigned int(1)  full_range_flag;
unsigned int(7)  reserved = 0;
}
else if (colour_type == 'rICC')
{
ICC_profile;// restricted ICC profile
}
else if (colour_type == 'prof')
{
ICC_profile;// unrestricted ICC profile
}
}

At the moment the code only supports nclc/nclx colour type in:

libavformat/mov.c  => mov_read_colr()
libavformat/moveenc.c =>  mov_write_colr_tag()

Support for ICC profile is implemented on a per frame basis in 
AVFrameSideDataType.AV_FRAME_DATA_ICC_PROFILE. This is used by the PNG, WEBP 
and MJPEG codec implementations. The ICC profile in this scenario is treated as 
an opaque octet buffer. I don't believe this is relevant to my use case as the 
colour information within the MOV/MP4 sample descriptor relates to the entire 
stream and is not used on a per-frame basis.

My thinking is to implement support for ICC profile in a similar way that 
color_range, color_primaries etc. are currently handled:

1. Store the ICC profile as an opaque octet buffer stored in an 
AVCodecParameters struct value:

uint8_t *icc_profile_data;
int icc_profile_size;

2. Add handling of these in libavcodec/utils.c to the following:

codec_parameters_reset()
avcodec_parameters_to_context()
avcodec_parameters_from_context()

2. Add support for reading and writing to the existing MOV/MP4 implementations:

libavformat/mov.c => mov_read_colr()
libavformat/moveenc.c => mov_write_colr_tag()

I'd appreciate any suggestions on better/alternative ways to implement this as 
I would like to eventually submit as a patch.

Thanks very much,

vectronic



___
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/2] avformat/dashdec: fix segfault when parsing segmentlist

2019-09-16 Thread vectronic
index into segmentlists_tab was specified as 4 instead of 3 causing invalid 
access

further fix to: 8135

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

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 738bfeaefb..7713ee8907 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1017,7 +1017,7 @@ static int parse_manifest_representation(AVFormatContext 
*s, const char *url,
 
 duration_val = get_val_from_nodes_tab(segmentlists_tab, 3, 
"duration");
 timescale_val = get_val_from_nodes_tab(segmentlists_tab, 3, 
"timescale");
-startnumber_val = get_val_from_nodes_tab(segmentlists_tab, 4, 
"startNumber");
+startnumber_val = get_val_from_nodes_tab(segmentlists_tab, 3, 
"startNumber");
 if (duration_val) {
 rep->fragment_duration = (int64_t) strtoll(duration_val, NULL, 
10);
 av_log(s, AV_LOG_TRACE, "rep->fragment_duration = 
[%"PRId64"]\n", rep->fragment_duration);
-- 
2.20.1 (Apple Git-117)

___
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/2] avformat/dashdec: fix pointer being freed was not allocated

2019-09-16 Thread vectronic
prevent attempt to call xmlFree if val was not allocated

fixes: 8135
Signed-off-by: vectronic 
---
 libavformat/dashdec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 8c0a9b0102..738bfeaefb 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1203,6 +1203,7 @@ static int parse_programinformation(AVFormatContext *s, 
xmlNodePtr node)
 }
 node = xmlNextElementSibling(node);
 xmlFree(val);
+val = NULL;
 }
 return 0;
 }
-- 
2.20.1 (Apple Git-117)

___
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: fix pointer being freed was not allocated

2019-09-13 Thread vectronic
prevent attempt to call xmlFree if val was not allocated

fixes: 8135
Signed-off-by: vectronic 
---
 libavformat/dashdec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 4f725ba09a..4753477fd9 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1185,6 +1185,7 @@ static int parse_programinformation(AVFormatContext *s, 
xmlNodePtr node)
 
 node = xmlFirstElementChild(node);
 while (node) {
+val = NULL;
 if (!av_strcasecmp(node->name, "Title")) {
 val = xmlNodeGetContent(node);
 if (val) {
-- 
2.20.1 (Apple Git-117)

___
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: fix range parsing causing issues with http byte range requests

2019-09-13 Thread vectronic
data size calculation was off by one as per DASH SPEC which references RFC 
7233. this was then used in http byte range request causing data corruption 
when parsing media files referenced in manifest

fixes: 8136
Signed-off-by: vectronic 
---
 libavformat/dashdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 74eb900eea..aa0e3598a1 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -600,7 +600,7 @@ static struct fragment * get_Fragment(char *range)
 char *str_end_offset;
 char *str_offset = av_strtok(range, "-", _end_offset);
 seg->url_offset = strtoll(str_offset, NULL, 10);
-seg->size = strtoll(str_end_offset, NULL, 10) - seg->url_offset;
+seg->size = strtoll(str_end_offset, NULL, 10) - seg->url_offset + 1;
 }
 
 return seg;
-- 
2.20.1 (Apple Git-117)

___
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: fix segfault when parsing segmentlist

2019-09-13 Thread vectronic
index into segmentlists_tab was specified as 4 instead of 3 causing invalid 
access

further fix to: 7976

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

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 4f725ba09a..6a44912248 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1017,7 +1017,7 @@ static int parse_manifest_representation(AVFormatContext 
*s, const char *url,
 
 duration_val = get_val_from_nodes_tab(segmentlists_tab, 3, 
"duration");
 timescale_val = get_val_from_nodes_tab(segmentlists_tab, 3, 
"timescale");
-startnumber_val = get_val_from_nodes_tab(segmentlists_tab, 4, 
"startNumber");
+startnumber_val = get_val_from_nodes_tab(segmentlists_tab, 3, 
"startNumber");
 if (duration_val) {
 rep->fragment_duration = (int64_t) strtoll(duration_val, NULL, 
10);
 av_log(s, AV_LOG_TRACE, "rep->fragment_duration = 
[%"PRId64"]\n", rep->fragment_duration);
-- 
2.20.1 (Apple Git-117)

___
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: fix pointer being freed was not allocated

2019-09-13 Thread vectronic
prevent attempt to call xmlFree if val was not allocated

fixes: 8135
Signed-off-by: vectronic 
---
 libavformat/dashdec.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 4f725ba09a..8022ba9afe 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1185,6 +1185,7 @@ static int parse_programinformation(AVFormatContext *s, 
xmlNodePtr node)
 
 node = xmlFirstElementChild(node);
 while (node) {
+val = NULL;
 if (!av_strcasecmp(node->name, "Title")) {
 val = xmlNodeGetContent(node);
 if (val) {
@@ -1202,7 +1203,9 @@ static int parse_programinformation(AVFormatContext *s, 
xmlNodePtr node)
 }
 }
 node = xmlNextElementSibling(node);
-xmlFree(val);
+if (val) {
+xmlFree(val);
+}
 }
 return 0;
 }
-- 
2.20.1 (Apple Git-117)

___
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: fix pointer being freed was not allocated

2019-09-13 Thread vectronic
prevent attempt to call xmlFree if val was not allocated

fixes: 8135
Signed-off-by: vectronic 
---
 libavformat/dashdec.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 4f725ba09a..8022ba9afe 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1185,6 +1185,7 @@ static int parse_programinformation(AVFormatContext *s, 
xmlNodePtr node)
 
 node = xmlFirstElementChild(node);
 while (node) {
+val = NULL;
 if (!av_strcasecmp(node->name, "Title")) {
 val = xmlNodeGetContent(node);
 if (val) {
@@ -1202,7 +1203,9 @@ static int parse_programinformation(AVFormatContext *s, 
xmlNodePtr node)
 }
 }
 node = xmlNextElementSibling(node);
-xmlFree(val);
+if (val) {
+xmlFree(val);
+}
 }
 return 0;
 }
-- 
2.20.1 (Apple Git-117)

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