[FFmpeg-devel] [PATCH] avcodec/exr: preserve half-float NaN bits and add fate test

2020-11-22 Thread mindmark
From: Mark Reid 

Hi,
This patch handles NaNs more like the offical implentation handles them, 
preserving
the original bits.

https://github.com/AcademySoftwareFoundation/openexr/blob/RB-2.5/IlmBase/Half/toFloat.cpp#L111

It also adds a fate test that is a 256x256 exr containing all possible 16bit 
half-float values. 

Here is a link to download the fate test file, if someone could add it to fate 
me
https://www.dropbox.com/s/2q4jg8w489aunsf/rgb_scanline_zip_half_float_0x0_to_0x.exr

---
 libavcodec/exr.c| 3 +--
 tests/fate/image.mak| 2 ++
 tests/ref/fate/exr-rgb-scanline-zip-half-0x0-0x | 6 ++
 3 files changed, 9 insertions(+), 2 deletions(-)
 create mode 100644 tests/ref/fate/exr-rgb-scanline-zip-half-0x0-0x

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index d233dd43fb..6e6ce4275c 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -193,8 +193,7 @@ static union av_intfloat32 exr_half2float(uint16_t hf)
 // half-float NaNs will be converted to a single precision NaN
 // half-float Infs will be converted to a single precision Inf
 exp = FLOAT_MAX_BIASED_EXP;
-if (mantissa)
-mantissa = (1 << 23) - 1;// set all bits to indicate a NaN
+mantissa <<= 13; // preserve half-float NaN bits if set
 } else if (exp == 0x0) {
 // convert half-float zero/denorm to single precision value
 if (mantissa) {
diff --git a/tests/fate/image.mak b/tests/fate/image.mak
index 22072a62f1..c453f0f79c 100644
--- a/tests/fate/image.mak
+++ b/tests/fate/image.mak
@@ -317,6 +317,8 @@ fate-exr-rgb-scanline-half-zip-dw-outside: CMD = framecrc 
-i $(TARGET_SAMPLES)/e
 FATE_EXR += fate-exr-rgb-tile-half-zip-dw-outside
 fate-exr-rgb-tile-half-zip-dw-outside: CMD = framecrc -i 
$(TARGET_SAMPLES)/exr/rgb_tile_half_zip_dw_outside.exr -pix_fmt gbrpf32le
 
+FATE_EXR += fate-exr-rgb-scanline-zip-half-0x0-0x
+fate-exr-rgb-scanline-zip-half-0x0-0x: CMD = framecrc -i 
$(TARGET_SAMPLES)/exr/rgb_scanline_zip_half_float_0x0_to_0x.exr -pix_fmt 
gbrpf32le
 
 FATE_EXR-$(call DEMDEC, IMAGE2, EXR) += $(FATE_EXR)
 
diff --git a/tests/ref/fate/exr-rgb-scanline-zip-half-0x0-0x 
b/tests/ref/fate/exr-rgb-scanline-zip-half-0x0-0x
new file mode 100644
index 00..b6201116fe
--- /dev/null
+++ b/tests/ref/fate/exr-rgb-scanline-zip-half-0x0-0x
@@ -0,0 +1,6 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 256x256
+#sar 0: 1/1
+0,  0,  0,1,   786432, 0x1445e411
-- 
2.29.2

___
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] Add RTSP range header

2020-11-22 Thread Yakov Okshtein
Whoops, looks like Gmail sent the .patch file attachment as 
application/octet-stream ... I must say, the ffmpeg binary is much more 
lenient in its input than the ffmpeg-devel mailing list :)


Let me try again with Thunderbird, and a .txt file.

Thanks all,

Yakov

On 11/22/20 11:21 AM, Yakov Okshtein wrote:

Hi all,

While working to get historical video off a DVR, I found the lack of a 
customizable Range: header for RTSP video frustrating (as, apparently, 
have others on StackOverflow and the Trac wiki, #6659). One user 
mentionedhaving made a custom patch, but didn't post it; so, I decided 
to make one.


It's my first submission to ffmpeg. I read the submission guidelines 
and hope I didn't miss anything.


Thanks all!

Yakov
From 1c0a5ce96eef83bb3ed55a4dfa6e825668055cdb Mon Sep 17 00:00:00 2001
From: Yakov Okshtein 
Date: Sun, 22 Nov 2020 16:06:46 +
Subject: [PATCH] Add optional Range and Rate-Control header to RTSP PLAY
 command

Some DVR/NVRs send historical video specified by the Range: header,
and can send files faster than real-time by the presence of the
Rate-Control: no header. This patch adds optional -range and
-rate_control CLI arguments, and if present, uses those values to
override the defaults.

Closes #6659
---
 libavformat/rtsp.c|  2 ++
 libavformat/rtsp.h| 10 ++
 libavformat/rtspdec.c | 15 +++
 libavformat/rtspenc.c |  9 +++--
 4 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 0be405aba1..ca0b92251c 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -101,6 +101,8 @@ const AVOption ff_rtsp_options[] = {
 #endif
 COMMON_OPTS(),
 { "user_agent", "override User-Agent header", OFFSET(user_agent), 
AV_OPT_TYPE_STRING, {.str = LIBAVFORMAT_IDENT}, 0, 0, DEC },
+{ "range", "override Range header", OFFSET(range), AV_OPT_TYPE_STRING, 
{.str = LIBAVFORMAT_IDENT}, 0, 0, DEC },
+{ "rate_control", "override Rate-Control header", OFFSET(rate_control), 
AV_OPT_TYPE_STRING, {.str = LIBAVFORMAT_IDENT}, 0, 0, DEC },
 #if FF_API_OLD_RTSP_OPTIONS
 { "user-agent", "override User-Agent header (deprecated, use user_agent)", 
OFFSET(user_agent), AV_OPT_TYPE_STRING, {.str = LIBAVFORMAT_IDENT}, 0, 0, DEC },
 #endif
diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
index 251ed86d19..0778515045 100644
--- a/libavformat/rtsp.h
+++ b/libavformat/rtsp.h
@@ -409,6 +409,16 @@ typedef struct RTSPState {
  */
 char *user_agent;
 
+/**
+ * Range header override; string.
+ */
+char *range;
+
+/**
+ * Rate-Control header; optional string.
+ */
+char *rate_control;
+
 char default_lang[4];
 int buffer_size;
 int pkt_size;
diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index 28b35d1993..0a0de21b82 100644
--- a/libavformat/rtspdec.c
+++ b/libavformat/rtspdec.c
@@ -541,11 +541,18 @@ static int rtsp_read_play(AVFormatContext *s)
 if (rt->state == RTSP_STATE_PAUSED) {
 cmd[0] = 0;
 } else {
-snprintf(cmd, sizeof(cmd),
- "Range: npt=%"PRId64".%03"PRId64"-\r\n",
- rt->seek_timestamp / AV_TIME_BASE,
- rt->seek_timestamp / (AV_TIME_BASE / 1000) % 1000);
+   if (rt->range != NULL) {
+snprintf(cmd, sizeof(cmd), "Range: %s\r\n", rt->range);
+   } else {
+snprintf(cmd, sizeof(cmd),
+ "Range: npt=%"PRId64".%03"PRId64"-\r\n",
+ rt->seek_timestamp / AV_TIME_BASE,
+ rt->seek_timestamp / (AV_TIME_BASE / 1000) % 1000);
+   }
 }
+   if (rt->rate_control != NULL) {
+   snprintf(cmd, sizeof(cmd), "Rate-Control: %s\r\n", 
rt->rate_control);
+   }
 ff_rtsp_send_cmd(s, "PLAY", rt->control_uri, cmd, reply, NULL);
 if (reply->status_code != RTSP_STATUS_OK) {
 return ff_rtsp_averror(reply->status_code, -1);
diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c
index d50544456d..1b7281cc67 100644
--- a/libavformat/rtspenc.c
+++ b/libavformat/rtspenc.c
@@ -113,8 +113,13 @@ static int rtsp_write_record(AVFormatContext *s)
 RTSPMessageHeader reply1, *reply = &reply1;
 char cmd[1024];
 
-snprintf(cmd, sizeof(cmd),
- "Range: npt=0.000-\r\n");
+if (rt->range != NULL) {
+snprintf(cmd, sizeof(cmd),
+ "Range: %s\r\n", rt->range);
+} else {
+snprintf(cmd, sizeof(cmd),
+ "Range: npt=0.-\r\n");
+}
 ff_rtsp_send_cmd(s, "RECORD", rt->control_uri, cmd, reply, NULL);
 if (reply->status_code != RTSP_STATUS_OK)
 return ff_rtsp_averror(reply->status_code, -1);
-- 
2.25.1

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

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

[FFmpeg-devel] [PATCH 6/6] tools/target_dec_fuzzer: Adjust threshold for interplayacm

2020-11-22 Thread Michael Niedermayer
Fixes: Timeout (long -> 1sec)
Fixes: 
27439/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INTERPLAY_ACM_fuzzer-5145715814432768

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

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index 11530cbf79..d45c585924 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -158,6 +158,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 case AV_CODEC_ID_HNM4_VIDEO:  maxpixels  /= 128;   break;
 case AV_CODEC_ID_IFF_ILBM:maxpixels  /= 128;   break;
 case AV_CODEC_ID_INDEO4:  maxpixels  /= 128;   break;
+case AV_CODEC_ID_INTERPLAY_ACM: maxsamples /= 16384;  break;
 case AV_CODEC_ID_LAGARITH:maxpixels  /= 1024;  break;
 case AV_CODEC_ID_LSCR:maxpixels  /= 16;break;
 case AV_CODEC_ID_MOTIONPIXELS:maxpixels  /= 256;   break;
-- 
2.17.1

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

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

[FFmpeg-devel] [PATCH 5/6] avformat/4xm: Make audio_frame_count 64bit

2020-11-22 Thread Michael Niedermayer
Fixes: signed integer overflow: 2099257366 * 2 cannot be represented in type 
'int'
Fixes: 
27486/clusterfuzz-testcase-minimized-ffmpeg_dem_FOURXM_fuzzer-5112179134824448

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

diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index 6a227a0b0d..30f1b05324 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -299,7 +299,7 @@ static int fourxm_read_packet(AVFormatContext *s,
 unsigned int track_number;
 int packet_read = 0;
 unsigned char header[8];
-int audio_frame_count;
+int64_t audio_frame_count;
 
 while (!packet_read) {
 if ((ret = avio_read(s->pb, header, 8)) < 0)
-- 
2.17.1

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

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

[FFmpeg-devel] [PATCH 3/6] avformat/vividas: Check sample_rate

2020-11-22 Thread Michael Niedermayer
Fixes: Assertion c > 0 failed at libavutil/mathematics.c
Fixes: 
27001/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-5726041328582656
Fixes: 
27453/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-5716060384526336

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

diff --git a/libavformat/vividas.c b/libavformat/vividas.c
index 4adc125439..96e0631b06 100644
--- a/libavformat/vividas.c
+++ b/libavformat/vividas.c
@@ -373,6 +373,8 @@ static int track_header(VividasDemuxContext *viv, 
AVFormatContext *s,  uint8_t *
 avio_rl16(pb); //codec_subid
 st->codecpar->channels = avio_rl16(pb); // channels
 st->codecpar->sample_rate = avio_rl32(pb); // sample_rate
+if (st->codecpar->sample_rate <= 0)
+return AVERROR_INVALIDDATA;
 avio_seek(pb, 10, SEEK_CUR); // data_1
 q = avio_r8(pb);
 avio_seek(pb, q, SEEK_CUR); // data_2
-- 
2.17.1

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

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

[FFmpeg-devel] [PATCH 1/6] avcodec/vp9dsp_template: Fix integer overflows in itxfm_wrapper

2020-11-22 Thread Michael Niedermayer
Fixes: signed integer overflow: 2147483641 + 32 cannot be represented in type 
'int'
Fixes: 
27452/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP9_fuzzer-5078752576667648

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

diff --git a/libavcodec/vp9dsp_template.c b/libavcodec/vp9dsp_template.c
index 3acf94c583..9b11661704 100644
--- a/libavcodec/vp9dsp_template.c
+++ b/libavcodec/vp9dsp_template.c
@@ -1138,7 +1138,7 @@ static void 
type_a##_##type_b##_##sz##x##sz##_add_c(uint8_t *_dst, \
 for (j = 0; j < sz; j++) \
 dst[j * stride] = av_clip_pixel(dst[j * stride] + \
 (bits ? \
- (t + (1 << (bits - 1))) >> 
bits : \
+ (int)(t + (1U << (bits - 1))) 
>> bits : \
  t)); \
 dst++; \
 } \
@@ -1153,7 +1153,7 @@ static void 
type_a##_##type_b##_##sz##x##sz##_add_c(uint8_t *_dst, \
 for (j = 0; j < sz; j++) \
 dst[j * stride] = av_clip_pixel(dst[j * stride] + \
 (bits ? \
- (out[j] + (1 << (bits - 1))) >> 
bits : \
+ (int)(out[j] + (1U << (bits - 
1))) >> bits : \
  out[j])); \
 dst++; \
 } \
-- 
2.17.1

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

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

[FFmpeg-devel] [PATCH 4/6] avformat/mov: Use av_mul_q() to avoid integer overflows

2020-11-22 Thread Michael Niedermayer
Fixes: signed integer overflow: 538976288 * 538976288 cannot be represented in 
type 'int'
Fixes: 
27473/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5758978289827840

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavformat/mov.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 2b90e31170..a66e3d6b3b 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2345,12 +2345,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
 if (tmcd_ctx->tmcd_flags & 0x0008) {
 int timescale = AV_RB32(st->codecpar->extradata + 8);
 int framedur = AV_RB32(st->codecpar->extradata + 12);
-st->avg_frame_rate.num *= timescale;
-st->avg_frame_rate.den *= framedur;
+st->avg_frame_rate = av_mul_q(st->avg_frame_rate, 
(AVRational){timescale, framedur});
 #if FF_API_LAVF_AVCTX
 FF_DISABLE_DEPRECATION_WARNINGS
-st->codec->time_base.den *= timescale;
-st->codec->time_base.num *= framedur;
+st->codec->time_base = av_mul_q(st->codec->time_base , 
(AVRational){framedur, timescale});
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 }
-- 
2.17.1

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

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

[FFmpeg-devel] [PATCH 2/6] avformat/vividas: Make len signed

2020-11-22 Thread Michael Niedermayer
Fixes: out of array access
Fixes: 
27424/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-5682070692823040

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

diff --git a/libavformat/vividas.c b/libavformat/vividas.c
index 46c66bf9a0..4adc125439 100644
--- a/libavformat/vividas.c
+++ b/libavformat/vividas.c
@@ -389,8 +389,8 @@ static int track_header(VividasDemuxContext *viv, 
AVFormatContext *s,  uint8_t *
 ffio_read_varlen(pb); // len_3
 num_data = avio_r8(pb);
 for (j = 0; j < num_data; j++) {
-uint64_t len = ffio_read_varlen(pb);
-if (len > INT_MAX/2 - xd_size) {
+int64_t len = ffio_read_varlen(pb);
+if (len < 0 || len > INT_MAX/2 - xd_size) {
 return AVERROR_INVALIDDATA;
 }
 data_len[j] = len;
-- 
2.17.1

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

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

Re: [FFmpeg-devel] [PATCH v2 2/4] avdevice/decklink: add AV_OPT_FLAG_DEPRECATED flag for list_devices

2020-11-22 Thread Marton Balint



On Sun, 22 Nov 2020, lance.lmw...@gmail.com wrote:


From: Limin Wang 

Signed-off-by: Limin Wang 
---
libavdevice/decklink_dec_c.c | 2 +-
libavdevice/decklink_enc_c.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavdevice/decklink_dec_c.c b/libavdevice/decklink_dec_c.c
index 53a4774..60b7186 100644
--- a/libavdevice/decklink_dec_c.c
+++ b/libavdevice/decklink_dec_c.c
@@ -30,7 +30,7 @@
#define DEC AV_OPT_FLAG_DECODING_PARAM

static const AVOption options[] = {
-{ "list_devices", "list available devices"  , OFFSET(list_devices), 
AV_OPT_TYPE_BOOL  , { .i64 = 0   }, 0, 1, DEC },
+{ "list_devices", "list available devices"  , OFFSET(list_devices), 
AV_OPT_TYPE_BOOL  , { .i64 = 0   }, 0, 1, DEC | AV_OPT_FLAG_DEPRECATED},
{ "list_formats", "list supported formats"  , OFFSET(list_formats), 
AV_OPT_TYPE_INT   , { .i64 = 0   }, 0, 1, DEC },
{ "format_code",  "set format by fourcc", OFFSET(format_code),  
AV_OPT_TYPE_STRING, { .str = NULL}, 0, 0, DEC },
{ "raw_format",   "pixel format to be returned by the card when capturing" , 
OFFSET(raw_format),  AV_OPT_TYPE_INT, { .i64 = 0}, 0, 5, DEC, "raw_format" },
diff --git a/libavdevice/decklink_enc_c.c b/libavdevice/decklink_enc_c.c
index e7b0117..6cc0743 100644
--- a/libavdevice/decklink_enc_c.c
+++ b/libavdevice/decklink_enc_c.c
@@ -28,7 +28,7 @@
#define OFFSET(x) offsetof(struct decklink_cctx, x)
#define ENC AV_OPT_FLAG_ENCODING_PARAM
static const AVOption options[] = {
-{ "list_devices", "list available devices"  , OFFSET(list_devices), 
AV_OPT_TYPE_BOOL  , { .i64 = 0   }, 0, 1, ENC },
+{ "list_devices", "list available devices"  , OFFSET(list_devices), 
AV_OPT_TYPE_BOOL  , { .i64 = 0   }, 0, 1, ENC | AV_OPT_FLAG_DEPRECATED},
{ "list_formats", "list supported formats"  , OFFSET(list_formats), 
AV_OPT_TYPE_INT   , { .i64 = 0   }, 0, 1, ENC },
{ "preroll" , "video preroll in seconds", OFFSET(preroll ), 
AV_OPT_TYPE_DOUBLE, { .dbl = 0.5 }, 0, 5, ENC },
{ "duplex_mode" , "duplex mode" , OFFSET(duplex_mode ), AV_OPT_TYPE_INT   
, { .i64 = 0   }, 0, 2, ENC, "duplex_mode"},


LGTM, thanks.

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

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

Re: [FFmpeg-devel] [PATCH v2 1/3] libavutil: introduce AVFilmGrainParams side data

2020-11-22 Thread James Almer

On 11/12/2020 4:28 PM, Lynne wrote:

Nov 12, 2020, 19:46 by jamr...@gmail.com:


On 11/12/2020 2:42 PM, Lynne wrote:


This patch introduces a new frame side data type AVFilmGrainParams for use
with video codecs which are able to use it.

It is generalized rather than being AV1 specific as AV2 is expected to carry
the same data, as well as the fact there already exist rarely-used 
specifications
for both H.264 and HEVC.

Patch attached.

 From 522e3a80f44129c98f0c564d44815dbe6a740568 Mon Sep 17 00:00:00 2001
From: Lynne 
Date: Thu, 12 Nov 2020 12:44:30 +0100
Subject: [PATCH v2 1/3] libavutil: introduce AVFilmGrainParams side data

This patch introduces a new frame side data type AVFilmGrainParams for use
with video codecs which are able to use it.

It is generalized rather than being AV1 specific as AV2 is expected to carry
the same data, as well as the fact there already exist rarely-used 
specifications
for both H.264 and HEVC.
---
  doc/APIchanges|   4 +
  libavutil/Makefile|   2 +
  libavutil/film_grain_params.c |  42 +
  libavutil/film_grain_params.h | 159 ++
  libavutil/frame.c |   1 +
  libavutil/frame.h |   6 ++
  libavutil/version.h   |   2 +-
  7 files changed, 215 insertions(+), 1 deletion(-)
  create mode 100644 libavutil/film_grain_params.c
  create mode 100644 libavutil/film_grain_params.h

diff --git a/doc/APIchanges b/doc/APIchanges
index b70c78a483..41248724d9 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@ libavutil: 2017-10-21
  API changes, most recent first:
  +2020-xx-xx - xx - lavu 56.61.100 - film_grain_params.h
+  Adds a new API for extracting codec film grain parameters as side data.
+  Adds a new AVFrameSideDataType entry AV_FRAME_DATA_FILM_GRAIN_PARAMS for it.
+
  2020-xx-xx - xx - lavf 58.64.100 - avformat.h
  Add AVSTREAM_EVENT_FLAG_NEW_PACKETS.
  diff --git a/libavutil/Makefile b/libavutil/Makefile
index 9b08372eb2..27bafe9e12 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -84,6 +84,7 @@ HEADERS = adler32.h   
  \
  xtea.h\
  tea.h \
  tx.h  \
+  film_grain_params.h   \
  HEADERS-$(CONFIG_LZO)   += lzo.h
  @@ -170,6 +171,7 @@ OBJS = adler32.o  
  \
  tx_double.o  \
  tx_int32.o   \
  video_enc_params.o   \
+   film_grain_params.o  \
  OBJS-$(CONFIG_CUDA) += hwcontext_cuda.o
diff --git a/libavutil/film_grain_params.c b/libavutil/film_grain_params.c
new file mode 100644
index 00..930d23c7fe
--- /dev/null
+++ b/libavutil/film_grain_params.c
@@ -0,0 +1,42 @@
+/**
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "film_grain_params.h"
+
+AVFilmGrainParams *av_film_grain_params_alloc(size_t *size)
+{
+AVFilmGrainParams *params = av_mallocz(sizeof(AVFilmGrainParams));
+
+if (size)
+*size = sizeof(*params);
+
+return params;
+}
+
+AVFilmGrainParams *av_film_grain_params_create_side_data(AVFrame *frame)
+{
+AVFrameSideData *side_data = av_frame_new_side_data(frame,
+
AV_FRAME_DATA_FILM_GRAIN_PARAMS,
+
sizeof(AVFilmGrainParams));
+if (!side_data)
+return NULL;
+
+memset(side_data->data, 0, sizeof(AVFilmGrainParams));
+
+return (AVFilmGrainParams *)side_data->data;
+}
diff --git a/libavutil/film_grain_params.h b/libavutil/film_grain_params.h
new file mode 100644
index 00..ba20fe7fa6
--- /dev/null
+++ b/libavutil/film_grain_params.h
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2016 Neil Birkbeck 



Copy paste mistake?



Yup.




+typedef struct AVFilmGrainAOMParams {



If you believe AV2 will have a compatibl

Re: [FFmpeg-devel] [PATCH 8/8] avcodec/exr: skip bottom clearing loop when its outside the image

2020-11-22 Thread Michael Niedermayer
On Sun, Oct 25, 2020 at 12:23:12AM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 1633771809 * 32960 cannot be represented in 
> type 'int'
> Fixes: 
> 26532/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5613925708857344
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/exr.c | 13 +++--
>  1 file changed, 7 insertions(+), 6 deletions(-)

will apply

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

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


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

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

Re: [FFmpeg-devel] [PATCH 6/8] avformat/avs: Use 64bit for the avio_tell() output

2020-11-22 Thread Michael Niedermayer
On Sun, Oct 25, 2020 at 12:23:10AM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 9223372036854775807 - -1 cannot be 
> represented in type 'long'
> Fixes: 
> 26549/clusterfuzz-testcase-minimized-ffmpeg_dem_AVS_fuzzer-4844306424397824
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/avs.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

will apply

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

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides


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

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

Re: [FFmpeg-devel] [PATCH 7/8] avcodec/exr: Check ymin vs. h

2020-11-22 Thread Michael Niedermayer
On Sun, Oct 25, 2020 at 12:23:11AM +0200, Michael Niedermayer wrote:
> Fixes: out of array access
> Fixes: 
> 26532/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5613925708857344
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/exr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

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

You can kill me, but you cannot change the truth.


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

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

Re: [FFmpeg-devel] [PATCH 3/8] avformat/moflex: Check pkt_size

2020-11-22 Thread Michael Niedermayer
On Sun, Oct 25, 2020 at 12:23:07AM +0200, Michael Niedermayer wrote:
> Fixes: Timeout (>20sec -> 1ms)
> Fixes: 
> 26527/clusterfuzz-testcase-minimized-ffmpeg_dem_MOFLEX_fuzzer-6308307310215168
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/moflex.c | 2 ++
>  1 file changed, 2 insertions(+)

will apply

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

If you drop bombs on a foreign country and kill a hundred thousand
innocent people, expect your government to call the consequence
"unprovoked inhuman terrorist attacks" and use it to justify dropping
more bombs and killing more people. The technology changed, the idea is old.


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

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

[FFmpeg-devel] Add RTSP range header

2020-11-22 Thread Yakov Okshtein
Hi all,

While working to get historical video off a DVR, I found the lack of a
customizable Range: header for RTSP video frustrating (as, apparently, have
others on StackOverflow and the Trac wiki, #6659). One user mentionedhaving
made a custom patch, but didn't post it; so, I decided to make one.

It's my first submission to ffmpeg. I read the submission guidelines and
hope I didn't miss anything.

Thanks all!

Yakov


0001-Add-optional-Range-and-Rate-Control-header-to-RTSP-P.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH 2/2] avcodec/rscc: Check inflated_buf size whan it is used

2020-11-22 Thread Michael Niedermayer
Fixes: out of array access
Fixes: 
27434/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RSCC_fuzzer-5196757675540480

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
---
 libavcodec/rscc.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/rscc.c b/libavcodec/rscc.c
index bd0520950f..07a7c3dca3 100644
--- a/libavcodec/rscc.c
+++ b/libavcodec/rscc.c
@@ -300,6 +300,10 @@ static int rscc_decode_frame(AVCodecContext *avctx, void 
*data,
 ret = AVERROR_INVALIDDATA;
 goto end;
 }
+if (ctx->inflated_size < pixel_size) {
+ret = AVERROR_INVALIDDATA;
+goto end;
+}
 ret = uncompress(ctx->inflated_buf, &len, gbc->buffer, packed_size);
 if (ret) {
 av_log(avctx, AV_LOG_ERROR, "Pixel deflate error %d.\n", ret);
-- 
2.17.1

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

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

[FFmpeg-devel] [PATCH 1/2] avformat/utils: Change compute_chapters_end() from O(n²) to O(n log n)

2020-11-22 Thread Michael Niedermayer
Fixes: Timeout (49sec -> 9sec)
Fixes: 
27427/clusterfuzz-testcase-minimized-ffmpeg_dem_FFMETADATA_fuzzer-5140589838073856

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavformat/utils.c | 42 --
 1 file changed, 32 insertions(+), 10 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 503e583ad0..db4b54aebe 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3191,31 +3191,51 @@ enum AVCodecID av_codec_get_id(const AVCodecTag *const 
*tags, unsigned int tag)
 return AV_CODEC_ID_NONE;
 }
 
-static void compute_chapters_end(AVFormatContext *s)
+static int chapter_start_cmp(const void *p1, const void *p2)
+{
+AVChapter *ch1 = *(AVChapter**)p1;
+AVChapter *ch2 = *(AVChapter**)p2;
+int delta = av_compare_ts(ch1->start, ch1->time_base, ch2->start, 
ch2->time_base);
+if (delta)
+return delta;
+return (ch1 > ch2) - (ch1 < ch2);
+}
+
+static int compute_chapters_end(AVFormatContext *s)
 {
 unsigned int i, j;
 int64_t max_time = 0;
+AVChapter **timetable = av_malloc(s->nb_chapters * sizeof(*timetable));
+
+if (!timetable)
+return AVERROR(ENOMEM);
 
 if (s->duration > 0 && s->start_time < INT64_MAX - s->duration)
 max_time = s->duration +
((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time);
 
 for (i = 0; i < s->nb_chapters; i++)
-if (s->chapters[i]->end == AV_NOPTS_VALUE) {
-AVChapter *ch = s->chapters[i];
+timetable[i] = s->chapters[i];
+qsort(timetable, s->nb_chapters, sizeof(*timetable), chapter_start_cmp);
+
+for (i = 0; i < s->nb_chapters; i++)
+if (timetable[i]->end == AV_NOPTS_VALUE) {
+AVChapter *ch = timetable[i];
 int64_t end = max_time ? av_rescale_q(max_time, AV_TIME_BASE_Q,
-  ch->time_base)
-   : INT64_MAX;
+ch->time_base)
+: INT64_MAX;
 
-for (j = 0; j < s->nb_chapters; j++) {
-AVChapter *ch1 = s->chapters[j];
+if (i + 1 < s->nb_chapters) {
+AVChapter *ch1 = timetable[i + 1];
 int64_t next_start = av_rescale_q(ch1->start, ch1->time_base,
-  ch->time_base);
-if (j != i && next_start > ch->start && next_start < end)
+ch->time_base);
+if (next_start > ch->start && next_start < end)
 end = next_start;
 }
 ch->end = (end == INT64_MAX || end < ch->start) ? ch->start : end;
 }
+av_free(timetable);
+return 0;
 }
 
 static int get_std_framerate(int i)
@@ -4071,7 +4091,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
 }
 }
 
-compute_chapters_end(ic);
+ret = compute_chapters_end(ic);
+if (ret < 0)
+goto find_stream_info_err;
 
 /* update the stream parameters from the internal codec contexts */
 for (i = 0; i < ic->nb_streams; i++) {
-- 
2.17.1

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

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

[FFmpeg-devel] [PATCH v2 2/4] avdevice/decklink: add AV_OPT_FLAG_DEPRECATED flag for list_devices

2020-11-22 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavdevice/decklink_dec_c.c | 2 +-
 libavdevice/decklink_enc_c.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavdevice/decklink_dec_c.c b/libavdevice/decklink_dec_c.c
index 53a4774..60b7186 100644
--- a/libavdevice/decklink_dec_c.c
+++ b/libavdevice/decklink_dec_c.c
@@ -30,7 +30,7 @@
 #define DEC AV_OPT_FLAG_DECODING_PARAM
 
 static const AVOption options[] = {
-{ "list_devices", "list available devices"  , OFFSET(list_devices), 
AV_OPT_TYPE_BOOL  , { .i64 = 0   }, 0, 1, DEC },
+{ "list_devices", "list available devices"  , OFFSET(list_devices), 
AV_OPT_TYPE_BOOL  , { .i64 = 0   }, 0, 1, DEC | AV_OPT_FLAG_DEPRECATED},
 { "list_formats", "list supported formats"  , OFFSET(list_formats), 
AV_OPT_TYPE_INT   , { .i64 = 0   }, 0, 1, DEC },
 { "format_code",  "set format by fourcc", OFFSET(format_code),  
AV_OPT_TYPE_STRING, { .str = NULL}, 0, 0, DEC },
 { "raw_format",   "pixel format to be returned by the card when capturing" 
, OFFSET(raw_format),  AV_OPT_TYPE_INT, { .i64 = 0}, 0, 5, DEC, "raw_format" },
diff --git a/libavdevice/decklink_enc_c.c b/libavdevice/decklink_enc_c.c
index e7b0117..6cc0743 100644
--- a/libavdevice/decklink_enc_c.c
+++ b/libavdevice/decklink_enc_c.c
@@ -28,7 +28,7 @@
 #define OFFSET(x) offsetof(struct decklink_cctx, x)
 #define ENC AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
-{ "list_devices", "list available devices"  , OFFSET(list_devices), 
AV_OPT_TYPE_BOOL  , { .i64 = 0   }, 0, 1, ENC },
+{ "list_devices", "list available devices"  , OFFSET(list_devices), 
AV_OPT_TYPE_BOOL  , { .i64 = 0   }, 0, 1, ENC | AV_OPT_FLAG_DEPRECATED},
 { "list_formats", "list supported formats"  , OFFSET(list_formats), 
AV_OPT_TYPE_INT   , { .i64 = 0   }, 0, 1, ENC },
 { "preroll" , "video preroll in seconds", OFFSET(preroll ), 
AV_OPT_TYPE_DOUBLE, { .dbl = 0.5 }, 0, 5, ENC },
 { "duplex_mode" , "duplex mode" , OFFSET(duplex_mode ), 
AV_OPT_TYPE_INT   , { .i64 = 0   }, 0, 2, ENC, "duplex_mode"},
-- 
1.8.3.1

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

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

Re: [FFmpeg-devel] [PATCH 2/4] avdevice/decklink: add AV_OPT_FLAG_DEPRECATED flag for list_devices

2020-11-22 Thread lance . lmwang
On Sat, Nov 21, 2020 at 12:21:10PM +0100, Marton Balint wrote:
> 
> 
> On Sat, 21 Nov 2020, lance.lmw...@gmail.com wrote:
> 
> > From: Limin Wang 
> > 
> > and claim the option deprecated in the description.
> 
> No, the description should stay as is. Adding the flag is enough, the
> deprecation will be printed if the user asks for the list of options based
> on the flag.

thanks, will update the patch and add the flag only.

> 
> Regards,
> Marton
> 
> > 
> > Signed-off-by: Limin Wang 
> > ---
> > libavdevice/decklink_dec_c.c | 3 ++-
> > libavdevice/decklink_enc_c.c | 3 ++-
> > 2 files changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavdevice/decklink_dec_c.c b/libavdevice/decklink_dec_c.c
> > index 53a4774..c6b38d2 100644
> > --- a/libavdevice/decklink_dec_c.c
> > +++ b/libavdevice/decklink_dec_c.c
> > @@ -30,7 +30,8 @@
> > #define DEC AV_OPT_FLAG_DECODING_PARAM
> > 
> > static const AVOption options[] = {
> > -{ "list_devices", "list available devices"  , OFFSET(list_devices), 
> > AV_OPT_TYPE_BOOL  , { .i64 = 0   }, 0, 1, DEC },
> > +{ "list_devices", "list available devices(deprecated, use -sources 
> > decklink instead)", OFFSET(list_devices),
> > +
> > AV_OPT_TYPE_BOOL  , { .i64 = 0   }, 0, 1, DEC | AV_OPT_FLAG_DEPRECATED},
> > { "list_formats", "list supported formats"  , OFFSET(list_formats), 
> > AV_OPT_TYPE_INT   , { .i64 = 0   }, 0, 1, DEC },
> > { "format_code",  "set format by fourcc", OFFSET(format_code),  
> > AV_OPT_TYPE_STRING, { .str = NULL}, 0, 0, DEC },
> > { "raw_format",   "pixel format to be returned by the card when 
> > capturing" , OFFSET(raw_format),  AV_OPT_TYPE_INT, { .i64 = 0}, 0, 5, DEC, 
> > "raw_format" },
> > diff --git a/libavdevice/decklink_enc_c.c b/libavdevice/decklink_enc_c.c
> > index e7b0117..ce99220 100644
> > --- a/libavdevice/decklink_enc_c.c
> > +++ b/libavdevice/decklink_enc_c.c
> > @@ -28,7 +28,8 @@
> > #define OFFSET(x) offsetof(struct decklink_cctx, x)
> > #define ENC AV_OPT_FLAG_ENCODING_PARAM
> > static const AVOption options[] = {
> > -{ "list_devices", "list available devices"  , OFFSET(list_devices), 
> > AV_OPT_TYPE_BOOL  , { .i64 = 0   }, 0, 1, ENC },
> > +{ "list_devices", "list available devices(deprecated, use -sinks 
> > decklink instead)"
> > +, OFFSET(list_devices), 
> > AV_OPT_TYPE_BOOL  , { .i64 = 0   }, 0, 1, ENC | AV_OPT_FLAG_DEPRECATED},
> > { "list_formats", "list supported formats"  , OFFSET(list_formats), 
> > AV_OPT_TYPE_INT   , { .i64 = 0   }, 0, 1, ENC },
> > { "preroll" , "video preroll in seconds", OFFSET(preroll ), 
> > AV_OPT_TYPE_DOUBLE, { .dbl = 0.5 }, 0, 5, ENC },
> > { "duplex_mode" , "duplex mode" , OFFSET(duplex_mode ), 
> > AV_OPT_TYPE_INT   , { .i64 = 0   }, 0, 2, ENC, "duplex_mode"},
> > -- 
> > 1.8.3.1
> > 
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > 
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

-- 
Thanks,
Limin Wang
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avformat/movenc: allow Apple Lossless inside mp4

2020-11-22 Thread Jan Ekström
On Sat, Nov 21, 2020 at 9:08 PM Jan Ekström  wrote:
>
> On Fri, Nov 20, 2020 at 10:53 PM Jan Ekström  wrote:
> >
> > On Fri, Nov 20, 2020 at 7:02 PM Leo Izen  wrote:
> > >
> > > MP4 already supports Apple Lossless, and it can be put inside by using
> > > muxer=ipod, but it's not tagged as supported in mp4. The mp4ra lists
> > > alac as a valid fourcc inside mp4, so it should be supported by spec.
> > >
> > > See: https://mp4ra.org/#/codecs
> >
> > I would just note in the paragraph that the identifier has been
> > registered to ISO and thus towards ISOBMFF (which we usually call
> > "mp4") at the MP4 registration authority.
> >
> > This can be changed when applying the patch, so no second revision
> > needed for this change.
> >
> > > ---
> > >  libavformat/movenc.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> > > index fea8a86192..18fa3f9b5e 100644
> > > --- a/libavformat/movenc.c
> > > +++ b/libavformat/movenc.c
> > > @@ -7128,6 +7128,7 @@ static const AVCodecTag codec_mp4_tags[] = {
> > >  { AV_CODEC_ID_VP9, MKTAG('v', 'p', '0', '9') },
> > >  { AV_CODEC_ID_AV1, MKTAG('a', 'v', '0', '1') },
> > >  { AV_CODEC_ID_AAC, MKTAG('m', 'p', '4', 'a') },
> > > +{ AV_CODEC_ID_ALAC,MKTAG('a', 'l', 'a', 'c') },
> > >  { AV_CODEC_ID_MP4ALS,  MKTAG('m', 'p', '4', 'a') },
> > >  { AV_CODEC_ID_MP3, MKTAG('m', 'p', '4', 'a') },
> > >  { AV_CODEC_ID_MP2, MKTAG('m', 'p', '4', 'a') },
> > > --
> > > 2.29.2
> > >
> >
> > Not sure of the location in the list (this matches the ipod muxer's
> > ordering, while additional formats seem to have just been added into
> > their list/group as they popped up - that said since this is a static
> > symbol I would expect even if the addition was in the middle, it
> > should be a-OK), but after taking a quick look at the ALAC code paths
> > this seems to cause writing of boxes that seem to make sense (audio
> > description plus whatever is in the extradata).
> >
> > I will attempt to check tomorrow if there's a spec for this to
> > double-check against, but preliminarily this looks good to me.
>
> Verified against the spec
> (https://github.com/macosforge/alac/blob/master/ALACMagicCookieDescription.txt#L177).
>
> As we already had the non-legacy (mode != MOV) support in place, the
> output - as expected - matches the specification (checked with
> L-SMASH's boxdumper).
>
> Thus, the change itself is LGTM.

Applied as f5dcaf2daa34d9cbe6e6ad13ea2c8a7ee43d0064 .

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