Re: [FFmpeg-devel] [PATCH] fate: add adpcm_ima_cunning tests

2023-05-27 Thread Zane van Iperen




On 27/5/23 19:14, Anton Khirnov wrote:

Hi Zane,
Quoting Zane van Iperen (2020-05-09 16:00:04)

diff --git a/tests/ref/fate/adpcm-ima-cunning-trunc-t2-track1 
b/tests/ref/fate/adpcm-ima-cunning-trunc-t2-track1
new file mode 100644
index 00..df9edc403d
--- /dev/null
+++ b/tests/ref/fate/adpcm-ima-cunning-trunc-t2-track1
@@ -0,0 +1 @@
+d41d8cd98f00b204e9800998ecf8427e


This test seems to produce an empty file. Is that intended?



Responded on IRC, posting here for posterity:

Yes, that test is meant to produce an empty file. The channels are planar - the 
input file has missing data for the second one.
See https://0x0.st/HqUw.png
___
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] avformat/imfdec: use CPL start timecode if available

2022-10-30 Thread Zane van Iperen

lgtm, will apply in a few days if no objections


On 29/10/22 00:55, Pierre-Anthony Lemieux wrote:

Hi Zane et al.,

Quick ping on the revised patchset below.

It addresses https://trac.ffmpeg.org/ticket/9842.

Best,

-- Pierre

On Sun, Oct 2, 2022 at 9:28 AM  wrote:


From: Pierre-Anthony Lemieux 

The IMF CPL contains an optional timecode start address. This patch reads the
latter, if present, into the context's timecode metadata parameter.
This addresses https://trac.ffmpeg.org/ticket/9842.

---
  libavformat/imf.h |   2 +
  libavformat/imf_cpl.c | 106 ++
  libavformat/imfdec.c  |  11 +
  3 files changed, 119 insertions(+)

diff --git a/libavformat/imf.h b/libavformat/imf.h
index 4271cd9582..70ed007312 100644
--- a/libavformat/imf.h
+++ b/libavformat/imf.h
@@ -59,6 +59,7 @@
  #include "libavformat/avio.h"
  #include "libavutil/rational.h"
  #include "libavutil/uuid.h"
+#include "libavutil/timecode.h"
  #include 

  /**
@@ -130,6 +131,7 @@ typedef struct FFIMFCPL {
  AVUUID id_uuid;   /**< CompositionPlaylist/Id 
element */
  xmlChar *content_title_utf8; /**< 
CompositionPlaylist/ContentTitle element */
  AVRational edit_rate;/**< 
CompositionPlaylist/EditRate element */
+AVTimecode *tc;  /**< 
CompositionPlaylist/CompositionTimecode element */
  FFIMFMarkerVirtualTrack *main_markers_track; /**< Main Marker Virtual 
Track */
  FFIMFTrackFileVirtualTrack *main_image_2d_track; /**< Main Image Virtual 
Track */
  uint32_t main_audio_track_count; /**< Number of Main 
Audio Virtual Tracks */
diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c
index 474db6b7f5..183e6dd84e 100644
--- a/libavformat/imf_cpl.c
+++ b/libavformat/imf_cpl.c
@@ -116,6 +116,22 @@ int ff_imf_xml_read_uint32(xmlNodePtr element, uint32_t 
*number)
  return ret;
  }

+static int ff_imf_xml_read_boolean(xmlNodePtr element, int *value)
+{
+int ret = 0;
+
+xmlChar *element_text = xmlNodeListGetString(element->doc, 
element->xmlChildrenNode, 1);
+if (xmlStrcmp(element_text, "true") == 0 || xmlStrcmp(element_text, "1") 
== 0)
+*value = 1;
+else if (xmlStrcmp(element_text, "false") == 0 || xmlStrcmp(element_text, 
"0") == 0)
+*value = 0;
+else
+ret = 1;
+xmlFree(element_text);
+
+return ret;
+}
+
  static void imf_base_virtual_track_init(FFIMFBaseVirtualTrack *track)
  {
  memset(track->id_uuid, 0, sizeof(track->id_uuid));
@@ -179,6 +195,90 @@ static int fill_content_title(xmlNodePtr cpl_element, 
FFIMFCPL *cpl)
  return 0;
  }

+static int digit_to_int(char digit)
+{
+if (digit >= '0' && digit <= '9')
+return digit - '0';
+return -1;
+}
+
+/**
+ * Parses a string that conform to the TimecodeType used in IMF CPL and defined
+ * in SMPTE ST 2067-3.
+ * @param[in] s string to parse
+ * @param[out] tc_comps pointer to an array of 4 integers where the parsed HH,
+ *  MM, SS and FF fields of the timecode are returned.
+ * @return 0 on success, < 0 AVERROR code on error.
+ */
+static int parse_cpl_tc_type(const char *s, int *tc_comps)
+{
+if (av_strnlen(s, 11) != 11)
+return AVERROR(EINVAL);
+
+for (int i = 0; i < 4; i++) {
+int hi;
+int lo;
+
+hi = digit_to_int(s[i * 3]);
+lo = digit_to_int(s[i * 3 + 1]);
+
+if (hi == -1 || lo == -1)
+return AVERROR(EINVAL);
+
+tc_comps[i] = 10 * hi + lo;
+}
+
+return 0;
+}
+
+static int fill_timecode(xmlNodePtr cpl_element, FFIMFCPL *cpl)
+{
+xmlNodePtr tc_element = NULL;
+xmlNodePtr element = NULL;
+xmlChar *tc_str = NULL;
+int df = 0;
+int comps[4];
+int ret = 0;
+
+tc_element = ff_imf_xml_get_child_element_by_name(cpl_element, 
"CompositionTimecode");
+if (!tc_element)
+   return 0;
+
+element = ff_imf_xml_get_child_element_by_name(tc_element, 
"TimecodeDropFrame");
+if (!element) {
+av_log(NULL, AV_LOG_ERROR, "CompositionTimecode element is missing\
+a TimecodeDropFrame child element\n");
+return AVERROR_INVALIDDATA;
+}
+
+if (ff_imf_xml_read_boolean(element, )) {
+av_log(NULL, AV_LOG_ERROR, "TimecodeDropFrame element is invalid\n");
+return AVERROR_INVALIDDATA;
+}
+element = ff_imf_xml_get_child_element_by_name(tc_element, 
"TimecodeStartAddress");
+if (!element) {
+av_log(NULL, AV_LOG_ERROR, "CompositionTimecode element is missing\
+a TimecodeStartAddress child element\n");
+return AVERROR_INVALIDDATA;
+}
+
+tc_str = xmlNodeListGetString(element->doc, element->xmlChildrenNode, 1);
+ret = parse_cpl_tc_type(tc_str, comps);
+xmlFree(tc_str);
+if (ret)
+return ret;
+
+cpl->tc = av_malloc(sizeof(AVTimecode));
+

Re: [FFmpeg-devel] [PATCH v1 1/2] avformat/imfdec: use CPL start timecode if available

2022-09-27 Thread Zane van Iperen

Looks mostly ok from a cursory glance, just one minor nit.

On 23/8/22 15:10, p...@sandflow.com wrote:


+static int ff_imf_xml_read_boolean(xmlNodePtr element, int *value)
+{
+xmlChar *element_text = NULL;
+int ret = 0;
+
+element_text = xmlNodeListGetString(element->doc, 
element->xmlChildrenNode, 1);
+


No need for "element_text = NULL".

  
+static int digit_to_int(char digit)

+{
+if (digit >= '0' && digit <= '9')
+return digit - '0';
+return -1;
+}
+


I feel like there should be a av_* helper for this, but apparently there isn't.
Maybe it's worth adding one in a future patch? av_isdigit() is in avstring.h, so
perhaps there?
___
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] format/imfdec: improve error handling when selecting tracks for playback

2022-09-27 Thread Zane van Iperen

lgtm, will apply

On 20/9/22 01:26, p...@sandflow.com wrote:

From: Pierre-Anthony Lemieux 

---
  libavformat/imfdec.c | 15 ---
  1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c
index 5bbe7a53f8..9ba8b6de8b 100644
--- a/libavformat/imfdec.c
+++ b/libavformat/imfdec.c
@@ -681,8 +681,11 @@ static IMFVirtualTrackPlaybackCtx 
*get_next_track_with_minimum_timestamp(AVForma
  {
  IMFContext *c = s->priv_data;
  IMFVirtualTrackPlaybackCtx *track;
-
  AVRational minimum_timestamp = av_make_q(INT32_MAX, 1);
+
+if (!c->track_count)
+return NULL;
+
  for (uint32_t i = c->track_count; i > 0; i--) {
  av_log(s, AV_LOG_TRACE, "Compare track %d timestamp " 
AVRATIONAL_FORMAT
 " to minimum " AVRATIONAL_FORMAT
@@ -697,8 +700,6 @@ static IMFVirtualTrackPlaybackCtx 
*get_next_track_with_minimum_timestamp(AVForma
  }
  }
  
-av_log(s, AV_LOG_DEBUG, "Found next track to read: %d (timestamp: %lf / %lf)\n",

-   track->index, av_q2d(track->current_timestamp), 
av_q2d(minimum_timestamp));
  return track;
  }
  
@@ -761,6 +762,14 @@ static int imf_read_packet(AVFormatContext *s, AVPacket *pkt)
  
  track = get_next_track_with_minimum_timestamp(s);
  
+if (!track) {

+av_log(s, AV_LOG_ERROR, "No track found for playback\n");
+return AVERROR_INVALIDDATA;
+}
+
+av_log(s, AV_LOG_DEBUG, "Found track %d to read at timestamp %lf\n",
+   track->index, av_q2d(track->current_timestamp));
+
  ret = get_resource_context_for_timestamp(s, track, );
  if (ret)
  return ret;

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

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


Re: [FFmpeg-devel] [PATCH v2 4/4] avformat/argo_cvg: expose loop/reverb/checksum via metadata

2022-07-21 Thread Zane van Iperen




On 21/7/22 08:00, Andreas Rheinhardt wrote:


+if (av_dict_set_int(>metadata, "loop", ctx->header.loop, 0) < 0)
+return AVERROR(ENOMEM);
+
+if (av_dict_set_int(>metadata, "reverb", ctx->header.reverb, 0) < 0)
+return AVERROR(ENOMEM);
+
+if (av_dict_set_int(>metadata, "checksum", ctx->checksum, 0) < 0)
+return AVERROR(ENOMEM);


Don't second-guess error codes (unless you have a good reason to).



Right, don't know why I did that...

I'll apply in a few days (with the fixed return codes).

___
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] avformat/argo_cvg: add -loop and -reverb options

2022-07-20 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/argo_cvg.c | 28 +---
 1 file changed, 25 insertions(+), 3 deletions(-)

diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c
index be78091f0c..32247a06be 100644
--- a/libavformat/argo_cvg.c
+++ b/libavformat/argo_cvg.c
@@ -62,6 +62,8 @@ typedef struct ArgoCVGDemuxContext {
 typedef struct ArgoCVGMuxContext {
 const AVClass *class;
 int   skip_rate_check;
+int   loop;
+int   reverb;
 uint32_t  checksum;
 size_tsize;
 } ArgoCVGMuxContext;
@@ -301,10 +303,10 @@ static int argo_cvg_write_header(AVFormatContext *s)
 ArgoCVGMuxContext *ctx = s->priv_data;
 
 avio_wl32(s->pb, 0); /* Size, fixed later. */
-avio_wl32(s->pb, 0);
-avio_wl32(s->pb, 1);
+avio_wl32(s->pb, !!ctx->loop);
+avio_wl32(s->pb, !!ctx->reverb);
 
-ctx->checksum = 1;
+ctx->checksum = !!ctx->loop + !!ctx->reverb;
 ctx->size = 8;
 return 0;
 }
@@ -363,6 +365,26 @@ static const AVOption argo_cvg_options[] = {
 .max = 1,
 .flags   = AV_OPT_FLAG_ENCODING_PARAM
 },
+{
+.name= "loop",
+.help= "set loop flag",
+.offset  = offsetof(ArgoCVGMuxContext, loop),
+.type= AV_OPT_TYPE_BOOL,
+.default_val = {.i64 = 0},
+.min = 0,
+.max = 1,
+.flags   = AV_OPT_FLAG_ENCODING_PARAM
+},
+{
+.name= "reverb",
+.help= "set reverb flag",
+.offset  = offsetof(ArgoCVGMuxContext, reverb),
+.type= AV_OPT_TYPE_BOOL,
+.default_val = {.i64 = 1},
+.min = 0,
+.max = 1,
+.flags   = AV_OPT_FLAG_ENCODING_PARAM
+},
 { NULL }
 };
 
-- 
2.36.1

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

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


[FFmpeg-devel] [PATCH v2 3/4] avformat/argo_cvg: remove trace logging

2022-07-20 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/argo_cvg.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c
index 32247a06be..12465dcbcc 100644
--- a/libavformat/argo_cvg.c
+++ b/libavformat/argo_cvg.c
@@ -159,13 +159,9 @@ static int argo_cvg_read_header(AVFormatContext *s)
 if (ctx->header.size < 8)
 return AVERROR_INVALIDDATA;
 
-av_log(s, AV_LOG_TRACE, "size   = %u\n", ctx->header.size);
-
 if ((ret = argo_cvg_read_checksum(s->pb, >header, >checksum)) < 
0)
 return ret;
 
-av_log(s, AV_LOG_TRACE, "checksum   = %u\n", ctx->checksum);
-
 par = st->codecpar;
 par->codec_type = AVMEDIA_TYPE_AUDIO;
 par->codec_id   = AV_CODEC_ID_ADPCM_PSX;
-- 
2.36.1

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

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


[FFmpeg-devel] [PATCH v2 4/4] avformat/argo_cvg: expose loop/reverb/checksum via metadata

2022-07-20 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/argo_cvg.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c
index 12465dcbcc..3d4abb4758 100644
--- a/libavformat/argo_cvg.c
+++ b/libavformat/argo_cvg.c
@@ -162,6 +162,15 @@ static int argo_cvg_read_header(AVFormatContext *s)
 if ((ret = argo_cvg_read_checksum(s->pb, >header, >checksum)) < 
0)
 return ret;
 
+if (av_dict_set_int(>metadata, "loop", ctx->header.loop, 0) < 0)
+return AVERROR(ENOMEM);
+
+if (av_dict_set_int(>metadata, "reverb", ctx->header.reverb, 0) < 0)
+return AVERROR(ENOMEM);
+
+if (av_dict_set_int(>metadata, "checksum", ctx->checksum, 0) < 0)
+return AVERROR(ENOMEM);
+
 par = st->codecpar;
 par->codec_type = AVMEDIA_TYPE_AUDIO;
 par->codec_id   = AV_CODEC_ID_ADPCM_PSX;
-- 
2.36.1

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

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


[FFmpeg-devel] [PATCH v2 1/4] avformat/argo_cvg: name unk{1, 2} fields correctly

2022-07-20 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/argo_cvg.c | 31 +++
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c
index f32487023a..be78091f0c 100644
--- a/libavformat/argo_cvg.c
+++ b/libavformat/argo_cvg.c
@@ -40,9 +40,9 @@
 #define ARGO_CVG_SAMPLES_PER_BLOCK  28
 
 typedef struct ArgoCVGHeader {
-uint32_t size; /*< File size -8 (this + trailing checksum) */
-uint32_t unk1; /*< Unknown. Always seems to be 0 or 1. */
-uint32_t unk2; /*< Unknown. Always seems to be 0 or 1. */
+uint32_t size;   /*< File size -8 (this + trailing checksum) */
+uint32_t loop;   /*< Loop flag. */
+uint32_t reverb; /*< Reverb flag. */
 } ArgoCVGHeader;
 
 typedef struct ArgoCVGOverride {
@@ -91,17 +91,17 @@ static int argo_cvg_probe(const AVProbeData *p)
 if (p->buf_size < ARGO_CVG_HEADER_SIZE)
 return 0;
 
-cvg.size = AV_RL32(p->buf + 0);
-cvg.unk1 = AV_RL32(p->buf + 4);
-cvg.unk2 = AV_RL32(p->buf + 8);
+cvg.size   = AV_RL32(p->buf + 0);
+cvg.loop   = AV_RL32(p->buf + 4);
+cvg.reverb = AV_RL32(p->buf + 8);
 
 if (cvg.size < 8)
 return 0;
 
-if (cvg.unk1 != 0 && cvg.unk1 != 1)
+if (cvg.loop != 0 && cvg.loop != 1)
 return 0;
 
-if (cvg.unk2 != 0 && cvg.unk2 != 1)
+if (cvg.reverb != 0 && cvg.reverb != 1)
 return 0;
 
 return AVPROBE_SCORE_MAX / 4 + 1;
@@ -150,15 +150,14 @@ static int argo_cvg_read_header(AVFormatContext *s)
 else if (ret != ARGO_CVG_HEADER_SIZE)
 return AVERROR(EIO);
 
-ctx->header.size = AV_RL32(buf + 0);
-ctx->header.unk1 = AV_RL32(buf + 4);
-ctx->header.unk2 = AV_RL32(buf + 8);
+ctx->header.size   = AV_RL32(buf + 0);
+ctx->header.loop   = AV_RL32(buf + 4);
+ctx->header.reverb = AV_RL32(buf + 8);
 
 if (ctx->header.size < 8)
 return AVERROR_INVALIDDATA;
 
 av_log(s, AV_LOG_TRACE, "size   = %u\n", ctx->header.size);
-av_log(s, AV_LOG_TRACE, "unk= %u, %u\n", ctx->header.unk1, 
ctx->header.unk2);
 
 if ((ret = argo_cvg_read_checksum(s->pb, >header, >checksum)) < 
0)
 return ret;
@@ -172,10 +171,10 @@ static int argo_cvg_read_header(AVFormatContext *s)
 
 for (size_t i = 0; i < FF_ARRAY_ELEMS(overrides); i++) {
 const ArgoCVGOverride *ovr = overrides + i;
-if (ovr->header.size != ctx->header.size ||
-ovr->header.unk1 != ctx->header.unk1 ||
-ovr->header.unk2 != ctx->header.unk2 ||
-ovr->checksum!= ctx->checksum||
+if (ovr->header.size   != ctx->header.size ||
+ovr->header.loop   != ctx->header.loop ||
+ovr->header.reverb != ctx->header.reverb ||
+ovr->checksum  != ctx->checksum||
 av_strcasecmp(filename, ovr->name) != 0)
 continue;
 
-- 
2.36.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 1/2] avformat/argo_cvg: name unk{1, 2} fields correctly

2022-07-20 Thread Zane van Iperen




On 18/7/2022 11:45 pm, Andreas Rheinhardt wrote:


  av_log(s, AV_LOG_TRACE, "size   = %u\n", ctx->header.size);
-av_log(s, AV_LOG_TRACE, "unk= %u, %u\n", ctx->header.unk1, 
ctx->header.unk2);
+av_log(s, AV_LOG_TRACE, "loop   = %u\n", ctx->header.loop);
+av_log(s, AV_LOG_TRACE, "reverb = %u\n", ctx->header.reverb);


%u is for unsigned, yet these variables are of type uint32_t. It is not
guaranteed that these two types are the same (yet they typically are).
That's why the PRI-macros exist.


Good catch, I'll rectify that.


(Apart from that: Does this have to be three separate av_logs?)


I can probably just remove them, now that I know what the fields are.

Although, I wouldn't mind exposing them as additional metadata...
___
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/argo_cvg: add -loop and -reverb options

2022-07-17 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/argo_cvg.c | 28 +---
 1 file changed, 25 insertions(+), 3 deletions(-)

diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c
index 2ee4a64449..36026e562e 100644
--- a/libavformat/argo_cvg.c
+++ b/libavformat/argo_cvg.c
@@ -62,6 +62,8 @@ typedef struct ArgoCVGDemuxContext {
 typedef struct ArgoCVGMuxContext {
 const AVClass *class;
 int   skip_rate_check;
+int   loop;
+int   reverb;
 uint32_t  checksum;
 size_tsize;
 } ArgoCVGMuxContext;
@@ -303,10 +305,10 @@ static int argo_cvg_write_header(AVFormatContext *s)
 ArgoCVGMuxContext *ctx = s->priv_data;
 
 avio_wl32(s->pb, 0); /* Size, fixed later. */
-avio_wl32(s->pb, 0);
-avio_wl32(s->pb, 1);
+avio_wl32(s->pb, !!ctx->loop);
+avio_wl32(s->pb, !!ctx->reverb);
 
-ctx->checksum = 1;
+ctx->checksum = !!ctx->loop + !!ctx->reverb;
 ctx->size = 8;
 return 0;
 }
@@ -365,6 +367,26 @@ static const AVOption argo_cvg_options[] = {
 .max = 1,
 .flags   = AV_OPT_FLAG_ENCODING_PARAM
 },
+{
+.name= "loop",
+.help= "set loop flag",
+.offset  = offsetof(ArgoCVGMuxContext, loop),
+.type= AV_OPT_TYPE_BOOL,
+.default_val = {.i64 = 0},
+.min = 0,
+.max = 1,
+.flags   = AV_OPT_FLAG_ENCODING_PARAM
+},
+{
+.name= "reverb",
+.help= "set reverb flag",
+.offset  = offsetof(ArgoCVGMuxContext, reverb),
+.type= AV_OPT_TYPE_BOOL,
+.default_val = {.i64 = 1},
+.min = 0,
+.max = 1,
+.flags   = AV_OPT_FLAG_ENCODING_PARAM
+},
 { NULL }
 };
 
-- 
2.36.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/argo_cvg: name unk{1, 2} fields correctly

2022-07-17 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/argo_cvg.c | 33 +
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c
index f32487023a..2ee4a64449 100644
--- a/libavformat/argo_cvg.c
+++ b/libavformat/argo_cvg.c
@@ -40,9 +40,9 @@
 #define ARGO_CVG_SAMPLES_PER_BLOCK  28
 
 typedef struct ArgoCVGHeader {
-uint32_t size; /*< File size -8 (this + trailing checksum) */
-uint32_t unk1; /*< Unknown. Always seems to be 0 or 1. */
-uint32_t unk2; /*< Unknown. Always seems to be 0 or 1. */
+uint32_t size;   /*< File size -8 (this + trailing checksum) */
+uint32_t loop;   /*< Loop flag. */
+uint32_t reverb; /*< Reverb flag. */
 } ArgoCVGHeader;
 
 typedef struct ArgoCVGOverride {
@@ -91,17 +91,17 @@ static int argo_cvg_probe(const AVProbeData *p)
 if (p->buf_size < ARGO_CVG_HEADER_SIZE)
 return 0;
 
-cvg.size = AV_RL32(p->buf + 0);
-cvg.unk1 = AV_RL32(p->buf + 4);
-cvg.unk2 = AV_RL32(p->buf + 8);
+cvg.size   = AV_RL32(p->buf + 0);
+cvg.loop   = AV_RL32(p->buf + 4);
+cvg.reverb = AV_RL32(p->buf + 8);
 
 if (cvg.size < 8)
 return 0;
 
-if (cvg.unk1 != 0 && cvg.unk1 != 1)
+if (cvg.loop != 0 && cvg.loop != 1)
 return 0;
 
-if (cvg.unk2 != 0 && cvg.unk2 != 1)
+if (cvg.reverb != 0 && cvg.reverb != 1)
 return 0;
 
 return AVPROBE_SCORE_MAX / 4 + 1;
@@ -150,15 +150,16 @@ static int argo_cvg_read_header(AVFormatContext *s)
 else if (ret != ARGO_CVG_HEADER_SIZE)
 return AVERROR(EIO);
 
-ctx->header.size = AV_RL32(buf + 0);
-ctx->header.unk1 = AV_RL32(buf + 4);
-ctx->header.unk2 = AV_RL32(buf + 8);
+ctx->header.size   = AV_RL32(buf + 0);
+ctx->header.loop   = AV_RL32(buf + 4);
+ctx->header.reverb = AV_RL32(buf + 8);
 
 if (ctx->header.size < 8)
 return AVERROR_INVALIDDATA;
 
 av_log(s, AV_LOG_TRACE, "size   = %u\n", ctx->header.size);
-av_log(s, AV_LOG_TRACE, "unk= %u, %u\n", ctx->header.unk1, 
ctx->header.unk2);
+av_log(s, AV_LOG_TRACE, "loop   = %u\n", ctx->header.loop);
+av_log(s, AV_LOG_TRACE, "reverb = %u\n", ctx->header.reverb);
 
 if ((ret = argo_cvg_read_checksum(s->pb, >header, >checksum)) < 
0)
 return ret;
@@ -172,10 +173,10 @@ static int argo_cvg_read_header(AVFormatContext *s)
 
 for (size_t i = 0; i < FF_ARRAY_ELEMS(overrides); i++) {
 const ArgoCVGOverride *ovr = overrides + i;
-if (ovr->header.size != ctx->header.size ||
-ovr->header.unk1 != ctx->header.unk1 ||
-ovr->header.unk2 != ctx->header.unk2 ||
-ovr->checksum!= ctx->checksum||
+if (ovr->header.size   != ctx->header.size ||
+ovr->header.loop   != ctx->header.loop ||
+ovr->header.reverb != ctx->header.reverb ||
+ovr->checksum  != ctx->checksum||
 av_strcasecmp(filename, ovr->name) != 0)
 continue;
 
-- 
2.36.1

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

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


[FFmpeg-devel] [PATCH 2/2] doc/APIchanges: add missing uuid and csp entries

2022-06-13 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 doc/APIchanges | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/doc/APIchanges b/doc/APIchanges
index 4f7a19d176..3349e94a4f 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -18,6 +18,16 @@ API changes, most recent first:
   Add avio_vprintf(), similar to avio_printf() but allow to use it
   from within a function taking a variable argument list as input.
 
+2022-06-01 - x - lavu 57.27.100 - uuid.c uuid.h
+  Add UUID handling functions.
+  Add av_uuid_parse(), av_uuid_urn_parse(), av_uuid_parse_range(),
+  av_uuid_parse_range(), av_uuid_equal(), av_uuid_copy(), and av_uuid_nil().
+
+2022-05-28 - x - lavu 57.26.100 - csp.c csp.h
+  Add public API for colorspace structs.
+  Add av_csp_luma_coeffs_from_avcsp(), av_csp_primaries_desc_from_id(),
+  and av_csp_primaries_id_from_desc().
+
 2022-05-23 - x - lavu 57.25.100 - avutil.h
   Deprecate av_fopen_utf8() without replacement.
 
-- 
2.36.0

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

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


[FFmpeg-devel] [PATCH 1/2] avutil/version: 57.26.100 -> 57.27.100

2022-06-13 Thread Zane van Iperen
Forgot to bump after the uuid patches.

Signed-off-by: Zane van Iperen 
---
 libavutil/version.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/version.h b/libavutil/version.h
index 2c7f4f6b37..2e9e02dda8 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  57
-#define LIBAVUTIL_VERSION_MINOR  26
+#define LIBAVUTIL_VERSION_MINOR  27
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-- 
2.36.0

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

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


Re: [FFmpeg-devel] [PATCH v4 2/6] avutil/tests/uuid: add uuid tests

2022-06-07 Thread Zane van Iperen




On 2/6/22 10:30, p...@sandflow.com wrote:

From: Pierre-Anthony Lemieux 



Ping, this patchset mostly looks good. Will apply in a few days.
___
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/7] avutil/uuid: add utility library for manipulating UUIDs as specified in RFC 4122

2022-05-11 Thread Zane van Iperen




On 11/5/22 21:53, Anton Khirnov wrote:

Quoting Zane van Iperen (2022-04-24 12:14:03)

+void av_uuid_nil_set(AVUUID uu)

 ^^^
sounds weird

av_uuid_zero()?
av_uuid_reset()?



Good point, `av_uuid_zero()` has a nice ring to 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".


Re: [FFmpeg-devel] [PATCH v2 1/7] avutil/uuid: add utility library for manipulating UUIDs as specified in RFC 4122

2022-05-11 Thread Zane van Iperen




On 10/5/22 23:18, Andreas Rheinhardt wrote:


+int av_uuid_parse_range(const char *in_start, const char *in_end, AVUUID uu)
+{
+int i;
+const char *cp;
+char buf[3];
+
+if ((in_end - in_start) != 36)
+return -1;
+
+for (i = 0, cp = in_start; i < 36; i++, cp++) {
+if (i == 8 || i == 13 || i == 18 || i == 23) {
+if (*cp == '-')
+continue;
+return AVERROR(EINVAL);
+}
+
+if (!av_isxdigit(*cp))
+return AVERROR(EINVAL);
+}
+
+buf[2] = '\0';
+for (i = 0, cp = in_start; i < 16; i++) {
+if (i == 4 || i == 6 || i == 8 || i == 10)
+cp++;
+
+buf[0] = *cp++;
+buf[1] = *cp++;
+
+errno = 0;
+uu[i] = strtoul(buf, NULL, 16);
+if (errno)
+return AVERROR(errno);


How could this ever happen given that you have already checked that the
buffer only contains hex digits? And isn't using strtoul a bit overkill
anyway? I'd just check and parse this stuff in one loop.



Yeah, good point. It's based off libuuid's, which has some time/clock uuid 
handling
between the two loops. I'll tidy it up in the next few days... hopefully...


+/**
+ * @file
+ * UUID parsing and serialization utilities.
+ * The library treat the UUID as an opaque sequence of 16 unsigned bytes,

^
s


Fixed.


+/**
+ * Parses a string representation of a UUID formatted according to IETF RFC 
4122
+ * into an AVUUID. The parsing is case-insensitive. The string must be 37
+ * characters long, including the terminating NULL character.


NUL, NULL is for pointers.



Changed.


+/**
+ * Parses a string representation of a UUID formatted according to IETF RFC 
4122
+ * into an AVUUID. The parsing is case-insensitive. The string must consist of
+ * 36 characters, i.e. `in_end - in_start == 36`
+ *
+ * @param[in]  in_start Pointer to the first character of the string 
representation
+ * @param[in]  in_end   Pointer to the character after the last character of 
the
+ *  string representation. That memory location is never
+ *  accessed
+ * @param[out] uu   AVUUID
+ * @return  A non-zero value in case of an error.
+ */
+int av_uuid_parse_range(const char *in_start, const char *in_end, AVUUID uu);


This sounds like in_end is actually redundant. Does retaining it improve
extensibility?



I believe so. The main difference is av_uuid_parse_range() can handle non 
NUL-termiated
strings. I can just remove the entire last sentence (or change "must" to 
"should").


+
+/**
+ * Serializes a AVUUID into a string representation according to IETF RFC 4122.
+ * The string is lowercase and always 37 characters long, including the
+ * terminating NULL character.
+ *
+ * @param[in]  uu  AVUUID
+ * @param[out] out Pointer to a array of no less than 37 characters.

   ^
   n



Fixed.



+/**
+ * Sets a UUID to nil
+ *
+ * @param[in,out]  uu  UUID to be set to nil
+ */
+void av_uuid_nil_set(AVUUID uu);


Why are these three functions not static inline? Exporting them seems
like a waste.



No particular reason, it's easy enough to change.

___
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 5/7] avcodec/cbs_sei: refactor to use avutil/uuid

2022-05-04 Thread Zane van Iperen




On 2/5/22 07:06, Mark Thompson wrote:


Maybe additional options exist.

I do not have a definitive opinion. Some folks expressed strong
interest in having a consistent scheme for manipulating UUIDs.


I think for now the simplest option is just not to change the CBS header, which 
is completely fine with your current patch set.



Okay, I'll drop the header changes from the patch set.

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

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


[FFmpeg-devel] [PATCH v2 5/7] avcodec/cbs_sei: refactor to use avutil/uuid

2022-04-24 Thread Zane van Iperen
From: Pierre-Anthony Lemieux 

---
 libavcodec/cbs_sei.h   | 3 ++-
 libavcodec/vaapi_encode_h264.c | 8 
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavcodec/cbs_sei.h b/libavcodec/cbs_sei.h
index c7a7a95be0..67c6e6cbbd 100644
--- a/libavcodec/cbs_sei.h
+++ b/libavcodec/cbs_sei.h
@@ -23,6 +23,7 @@
 #include 
 
 #include "libavutil/buffer.h"
+#include "libavutil/uuid.h"
 
 #include "cbs.h"
 #include "sei.h"
@@ -41,7 +42,7 @@ typedef struct SEIRawUserDataRegistered {
 } SEIRawUserDataRegistered;
 
 typedef struct SEIRawUserDataUnregistered {
-uint8_t  uuid_iso_iec_11578[16];
+AVUUID  uuid_iso_iec_11578;
 uint8_t *data;
 AVBufferRef *data_ref;
 size_t   data_length;
diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index 7a6b54ab6f..b3105d6ccc 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -25,6 +25,7 @@
 #include "libavutil/common.h"
 #include "libavutil/internal.h"
 #include "libavutil/opt.h"
+#include "libavutil/uuid.h"
 
 #include "avcodec.h"
 #include "cbs.h"
@@ -43,7 +44,7 @@ enum {
 };
 
 // Random (version 4) ISO 11578 UUID.
-static const uint8_t vaapi_encode_h264_sei_identifier_uuid[16] = {
+static const AVUUID vaapi_encode_h264_sei_identifier_uuid = {
 0x59, 0x94, 0x8b, 0x28, 0x11, 0xec, 0x45, 0xaf,
 0x96, 0x75, 0x19, 0xd4, 0x1f, 0xea, 0xa9, 0x4d,
 };
@@ -1089,9 +1090,8 @@ static av_cold int 
vaapi_encode_h264_configure(AVCodecContext *avctx)
 const char *driver;
 int len;
 
-memcpy(priv->sei_identifier.uuid_iso_iec_11578,
-   vaapi_encode_h264_sei_identifier_uuid,
-   sizeof(priv->sei_identifier.uuid_iso_iec_11578));
+av_uuid_copy(priv->sei_identifier.uuid_iso_iec_11578,
+ vaapi_encode_h264_sei_identifier_uuid);
 
 driver = vaQueryVendorString(ctx->hwctx->display);
 if (!driver)
-- 
2.35.1

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

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


[FFmpeg-devel] [PATCH v2 1/7] avutil/uuid: add utility library for manipulating UUIDs as specified in RFC 4122

2022-04-24 Thread Zane van Iperen
Co-authored-by: Pierre-Anthony Lemieux 
Signed-off-by: Zane van Iperen 
---
 libavutil/Makefile |   2 +
 libavutil/uuid.c   | 155 +
 libavutil/uuid.h   | 137 +++
 3 files changed, 294 insertions(+)
 create mode 100644 libavutil/uuid.c
 create mode 100644 libavutil/uuid.h

diff --git a/libavutil/Makefile b/libavutil/Makefile
index 81df3b0640..29742668b8 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -82,6 +82,7 @@ HEADERS = adler32.h   
  \
   timestamp.h   \
   tree.h\
   twofish.h \
+  uuid.h\
   version.h \
   video_enc_params.h\
   xtea.h\
@@ -174,6 +175,7 @@ OBJS = adler32.o
\
tx_float.o   \
tx_double.o  \
tx_int32.o   \
+   uuid.o   \
video_enc_params.o   \
film_grain_params.o  \
 
diff --git a/libavutil/uuid.c b/libavutil/uuid.c
new file mode 100644
index 00..6cf7a20c23
--- /dev/null
+++ b/libavutil/uuid.c
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2022 Pierre-Anthony Lemieux 
+ *Zane van Iperen 
+ *
+ * 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
+ */
+
+/*
+ * Copyright (C) 1996, 1997 Theodore Ts'o.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, and the entire permission notice in its entirety,
+ *including the disclaimer of warranties.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *products derived from this software without specific prior
+ *written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
+ * WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+
+/**
+ * @file
+ * UUID parsing and serialization utilities.
+ * The library treat the UUID as an opaque sequence of 16 unsigned bytes,
+ * i.e. ignoring the internal layout of the UUID, which depends on the type
+ * of the UUID.
+ *
+ * @author Pierre-Anthony Lemieux 
+ * @author Zane van Iperen 
+ */
+
+#include "uuid.h"
+#include "error.h"
+#include "avstring.h"
+#include 
+#include 
+
+int av_uuid_parse(const char *in, AVUUID uu)
+{
+if (strlen(in) != 36)
+return AVERROR(EINVAL);
+
+return av_uuid_parse_range(in, in + 36, uu);
+}
+
+int av_uuid_parse_range(const char *in_start, const char *in_end, AVUUID uu)
+{
+int i;
+const char *cp;
+char buf[3];
+
+if ((in_end - in_start) != 36)
+  

[FFmpeg-devel] [PATCH v2 7/7] avfilter/showinfo: refactor to use avutil/uuid

2022-04-24 Thread Zane van Iperen
From: Pierre-Anthony Lemieux 

---
 libavfilter/vf_showinfo.c | 17 +
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 12d39310ef..0d6f2805bb 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -42,6 +42,7 @@
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/video_enc_params.h"
 #include "libavutil/detection_bbox.h"
+#include "libavutil/uuid.h"
 
 #include "avfilter.h"
 #include "internal.h"
@@ -421,29 +422,21 @@ static void dump_video_enc_params(AVFilterContext *ctx, 
const AVFrameSideData *s
 
 static void dump_sei_unregistered_metadata(AVFilterContext *ctx, const 
AVFrameSideData *sd)
 {
-const int uuid_size = 16;
 const uint8_t *user_data = sd->data;
 int i;
 
-if (sd->size < uuid_size) {
+if (sd->size < AV_UUID_LEN) {
 av_log(ctx, AV_LOG_ERROR, "invalid data(%"SIZE_SPECIFIER" < "
-   "UUID(%d-bytes))\n", sd->size, uuid_size);
+   "UUID(%d-bytes))\n", sd->size, AV_UUID_LEN);
 return;
 }
 
 av_log(ctx, AV_LOG_INFO, "User Data Unregistered:\n");
-av_log(ctx, AV_LOG_INFO, "UUID=");
-for (i = 0; i < uuid_size; i++) {
-av_log(ctx, AV_LOG_INFO, "%02x", user_data[i]);
-if (i == 3 || i == 5 || i == 7 || i == 9)
-av_log(ctx, AV_LOG_INFO, "-");
-}
-av_log(ctx, AV_LOG_INFO, "\n");
+av_log(ctx, AV_LOG_INFO, "UUID=" AV_PRI_UUID "\n", AV_UUID_ARG(user_data));
 
 av_log(ctx, AV_LOG_INFO, "User Data=");
-for (; i < sd->size; i++) {
+for (i = 16; i < sd->size; i++)
 av_log(ctx, AV_LOG_INFO, "%02x", user_data[i]);
-}
 av_log(ctx, AV_LOG_INFO, "\n");
 }
 
-- 
2.35.1

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

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


[FFmpeg-devel] [PATCH v2 3/7] avformat/mov: refactor to use avutil/uuid

2022-04-24 Thread Zane van Iperen
From: Pierre-Anthony Lemieux 

---
 libavformat/mov.c| 25 +
 libavformat/movenc.c |  9 +
 2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 3e83e54a77..cb6b49d98e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -50,6 +50,7 @@
 #include "libavutil/stereo3d.h"
 #include "libavutil/timecode.h"
 #include "libavutil/dovi_meta.h"
+#include "libavutil/uuid.h"
 #include "libavcodec/ac3tab.h"
 #include "libavcodec/flac.h"
 #include "libavcodec/hevc.h"
@@ -5960,21 +5961,21 @@ static int mov_read_uuid(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 AVStream *st;
 MOVStreamContext *sc;
 int64_t ret;
-uint8_t uuid[16];
-static const uint8_t uuid_isml_manifest[] = {
+AVUUID uuid;
+static const AVUUID uuid_isml_manifest = {
 0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd,
 0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66
 };
-static const uint8_t uuid_xmp[] = {
+static const AVUUID uuid_xmp = {
 0xbe, 0x7a, 0xcf, 0xcb, 0x97, 0xa9, 0x42, 0xe8,
 0x9c, 0x71, 0x99, 0x94, 0x91, 0xe3, 0xaf, 0xac
 };
-static const uint8_t uuid_spherical[] = {
+static const AVUUID uuid_spherical = {
 0xff, 0xcc, 0x82, 0x63, 0xf8, 0x55, 0x4a, 0x93,
 0x88, 0x14, 0x58, 0x7a, 0x02, 0x52, 0x1f, 0xdd,
 };
 
-if (atom.size < sizeof(uuid) || atom.size >= FFMIN(INT_MAX, SIZE_MAX))
+if (atom.size < AV_UUID_LEN || atom.size >= FFMIN(INT_MAX, SIZE_MAX))
 return AVERROR_INVALIDDATA;
 
 if (c->fc->nb_streams < 1)
@@ -5982,13 +5983,13 @@ static int mov_read_uuid(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 st = c->fc->streams[c->fc->nb_streams - 1];
 sc = st->priv_data;
 
-ret = ffio_read_size(pb, uuid, sizeof(uuid));
+ret = ffio_read_size(pb, uuid, AV_UUID_LEN);
 if (ret < 0)
 return ret;
-if (!memcmp(uuid, uuid_isml_manifest, sizeof(uuid))) {
+if (av_uuid_equal(uuid, uuid_isml_manifest)) {
 uint8_t *buffer, *ptr;
 char *endptr;
-size_t len = atom.size - sizeof(uuid);
+size_t len = atom.size - AV_UUID_LEN;
 
 if (len < 4) {
 return AVERROR_INVALIDDATA;
@@ -6026,9 +6027,9 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 }
 
 av_free(buffer);
-} else if (!memcmp(uuid, uuid_xmp, sizeof(uuid))) {
+} else if (av_uuid_equal(uuid, uuid_xmp)) {
 uint8_t *buffer;
-size_t len = atom.size - sizeof(uuid);
+size_t len = atom.size - AV_UUID_LEN;
 if (c->export_xmp) {
 buffer = av_mallocz(len + 1);
 if (!buffer) {
@@ -6048,8 +6049,8 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 if (ret < 0)
 return ret;
 }
-} else if (!memcmp(uuid, uuid_spherical, sizeof(uuid))) {
-size_t len = atom.size - sizeof(uuid);
+} else if (av_uuid_equal(uuid, uuid_spherical)) {
+size_t len = atom.size - AV_UUID_LEN;
 ret = mov_parse_uuid_spherical(sc, pb, len);
 if (ret < 0)
 return ret;
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index b9956e699c..b4de843e49 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -57,6 +57,7 @@
 #include "libavutil/timecode.h"
 #include "libavutil/dovi_meta.h"
 #include "libavutil/color_utils.h"
+#include "libavutil/uuid.h"
 #include "hevc.h"
 #include "rtpenc.h"
 #include "mov_chan.h"
@@ -4319,14 +4320,14 @@ static int mov_write_isml_manifest(AVIOContext *pb, 
MOVMuxContext *mov, AVFormat
 int64_t pos = avio_tell(pb);
 int i;
 
-static const uint8_t uuid[] = {
+static const AVUUID uuid = {
 0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd,
 0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66
 };
 
 avio_wb32(pb, 0);
 ffio_wfourcc(pb, "uuid");
-avio_write(pb, uuid, sizeof(uuid));
+avio_write(pb, uuid, AV_UUID_LEN);
 avio_wb32(pb, 0);
 
 avio_printf(pb, "\n");
@@ -4585,7 +4586,7 @@ static int mov_write_tfxd_tag(AVIOContext *pb, MOVTrack 
*track)
 
 avio_wb32(pb, 0); /* size placeholder */
 ffio_wfourcc(pb, "uuid");
-avio_write(pb, uuid, sizeof(uuid));
+avio_write(pb, uuid, AV_UUID_LEN);
 avio_w8(pb, 1);
 avio_wb24(pb, 0);
 avio_wb64(pb, track->cluster[0].dts + track->cluster[0].cts);
@@ -4611,7 +4612,7 @@ static int mov_write_tfrf_tag(AVIOContext *pb, 
MOVMuxContext *mov,
 avio_seek(pb, track->frag_info[entry].tfrf_offset, SEEK_SET);
 avio_wb32(pb, size);
 ffio_wfourcc(pb, "uuid");
-avio_write(pb, uuid, sizeof(uuid));
+avio_write(pb, uuid, AV_UUID_LEN);
 avio_w8(pb, 1);
 avio_wb24(pb, 0);
 avio_w8(pb, n);
-- 
2.35.1

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

To unsubscribe, visit link above, or 

[FFmpeg-devel] [PATCH v2 4/7] avformat/smoothstreamingenc: refactor to use avutil/uuid

2022-04-24 Thread Zane van Iperen
From: Pierre-Anthony Lemieux 

---
 libavformat/smoothstreamingenc.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c
index c67f0cba43..3d857b932e 100644
--- a/libavformat/smoothstreamingenc.c
+++ b/libavformat/smoothstreamingenc.c
@@ -38,6 +38,7 @@
 #include "libavutil/file.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/intreadwrite.h"
+#include "libavutil/uuid.h"
 
 typedef struct Fragment {
 int64_t start_time, duration;
@@ -420,13 +421,13 @@ static int parse_fragment(AVFormatContext *s, const char 
*filename, int64_t *sta
 if (len < 8 || len >= *moof_size)
 goto fail;
 if (tag == MKTAG('u','u','i','d')) {
-static const uint8_t tfxd[] = {
+static const AVUUID tfxd = {
 0x6d, 0x1d, 0x9b, 0x05, 0x42, 0xd5, 0x44, 0xe6,
 0x80, 0xe2, 0x14, 0x1d, 0xaf, 0xf7, 0x57, 0xb2
 };
-uint8_t uuid[16];
+AVUUID uuid;
 avio_read(in, uuid, 16);
-if (!memcmp(uuid, tfxd, 16) && len >= 8 + 16 + 4 + 16) {
+if (av_uuid_equal(uuid, tfxd) && len >= 8 + 16 + 4 + 16) {
 avio_seek(in, 4, SEEK_CUR);
 *start_ts = avio_rb64(in);
 *duration = avio_rb64(in);
-- 
2.35.1

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

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


[FFmpeg-devel] [PATCH v2 2/7] avutil/tests/uuid: add uuid tests

2022-04-24 Thread Zane van Iperen
From: Pierre-Anthony Lemieux 

---
 libavutil/Makefile |   1 +
 libavutil/tests/.gitignore |   1 +
 libavutil/tests/uuid.c | 139 +
 tests/fate/libavutil.mak   |   5 ++
 4 files changed, 146 insertions(+)
 create mode 100644 libavutil/tests/uuid.c

diff --git a/libavutil/Makefile b/libavutil/Makefile
index 29742668b8..fef726b39a 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -260,6 +260,7 @@ TESTPROGS = adler32 
\
 tree\
 twofish \
 utf8\
+uuid\
 xtea\
 tea \
 
diff --git a/libavutil/tests/.gitignore b/libavutil/tests/.gitignore
index 9d90827954..919010e4fc 100644
--- a/libavutil/tests/.gitignore
+++ b/libavutil/tests/.gitignore
@@ -48,4 +48,5 @@
 /tree
 /twofish
 /utf8
+/uuid
 /xtea
diff --git a/libavutil/tests/uuid.c b/libavutil/tests/uuid.c
new file mode 100644
index 00..0a7a0eb07d
--- /dev/null
+++ b/libavutil/tests/uuid.c
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2022 Pierre-Anthony Lemieux 
+ *Zane van Iperen 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/uuid.h"
+#include "libavutil/log.h"
+
+static const char *UUID_1= "6021b21e-894e-43ff-8317-1ca891c1c49b";
+static const char *UUID_1_UC = "6021B21E-894E-43FF-8317-1CA891C1C49B";
+static const char *UUID_1_MIXED  = "6021b21e-894E-43fF-8317-1CA891C1c49b";
+static const char *UUID_1_URN= 
"urn:uuid:6021b21e-894e-43ff-8317-1ca891c1c49b";
+static const AVUUID UUID_1_BYTES = {0x60, 0x21, 0xb2, 0x1e, 0x89, 0x4e, 0x43, 
0xff,
+0x83, 0x17, 0x1c, 0xa8, 0x91, 0xc1, 0xc4, 
0x9b};
+
+static const AVUUID UUID_NIL = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00};
+
+static const char *UUID_BAD_1 = "16a2c9f8-afbc-4767-8621-8cb2b27599";
+static const char *UUID_BAD_2 = "75df62c2999b4bd38c9d8058fcde9123";
+static const char *UUID_BAD_3 = "a1b9a05e-f1d1-464g-a951-1ba0a374f02";
+static const char *UUID_BAD_4 = "279c66d432-7b39-41d5-966f-5e8138265c20";
+
+int main(int argc, char **argv)
+{
+AVUUID uuid;
+AVUUID uuid2 = {0x32, 0xc7, 0x00, 0xc4, 0xd5, 0xd7, 0x42, 0x0,
+0x93, 0xc0, 0x3b, 0x6d, 0xea, 0x1b, 0x20, 0x5b};
+
+/* test parsing */
+
+if (av_uuid_parse(UUID_1, uuid))
+return 1;
+
+if (!av_uuid_equal(uuid, UUID_1_BYTES))
+return 1;
+
+/* test nil */
+
+av_uuid_nil_set(uuid);
+
+if (!av_uuid_equal(uuid, UUID_NIL))
+return 1;
+
+/* test equality */
+
+if (av_uuid_equal(UUID_1_BYTES, uuid2))
+return 1;
+
+/* test copy */
+
+av_uuid_copy(uuid2, UUID_1_BYTES);
+
+if (!av_uuid_equal(uuid2, UUID_1_BYTES))
+return 1;
+
+/* test uppercase parsing */
+
+if (av_uuid_parse(UUID_1_UC, uuid))
+return 1;
+
+if (!av_uuid_equal(uuid, UUID_1_BYTES))
+return 1;
+
+/* test mixed-case parsing */
+
+if (av_uuid_parse(UUID_1_MIXED, uuid))
+return 1;
+
+if (!av_uuid_equal(uuid, UUID_1_BYTES))
+return 1;
+
+/* test URN uuid parse */
+
+if (av_uuid_urn_parse(UUID_1_URN, uuid))
+return 1;
+
+if (!av_uuid_equal(uuid, UUID_1_BYTES))
+return 1;
+
+/* test parse range */
+
+if (av_uuid_parse_range(UUID_1_URN + 9, UUID_1_URN + 45, uuid))
+return 1;
+
+if (!av_uuid_equal(uuid, UUID_1_BYTES))
+return 1;
+
+/* test bad parse range */
+
+if (!av_uuid_parse_range(UUID_1_URN + 9, UUID_1_URN + 44, uuid))
+return 1;
+
+/* test bad parse range 2 */
+
+if (!av_uuid_parse_range(UUID_1_URN + 8, UUID_1_URN + 44, uuid))
+return 1;
+
+/* test bad pars

[FFmpeg-devel] [PATCH v2 6/7] avformat/imf: refactor to use avutil/uuid

2022-04-24 Thread Zane van Iperen
From: Pierre-Anthony Lemieux 

---
 libavformat/imf.h   | 18 -
 libavformat/imf_cpl.c   | 60 +++--
 libavformat/imfdec.c| 34 +++
 libavformat/tests/imf.c | 18 ++---
 4 files changed, 52 insertions(+), 78 deletions(-)

diff --git a/libavformat/imf.h b/libavformat/imf.h
index 62c4468ce9..4271cd9582 100644
--- a/libavformat/imf.h
+++ b/libavformat/imf.h
@@ -58,17 +58,9 @@
 #include "avformat.h"
 #include "libavformat/avio.h"
 #include "libavutil/rational.h"
+#include "libavutil/uuid.h"
 #include 
 
-#define FF_IMF_UUID_FORMAT\
-"urn:uuid:%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-" \
-"%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
-
-/**
- * UUID as defined in IETF RFC 422
- */
-typedef uint8_t FFIMFUUID[16];
-
 /**
  * IMF Composition Playlist Base Resource
  */
@@ -84,7 +76,7 @@ typedef struct FFIMFBaseResource {
  */
 typedef struct FFIMFTrackFileResource {
 FFIMFBaseResource base;
-FFIMFUUID track_file_uuid; /**< TrackFileResourceType/TrackFileId */
+AVUUID track_file_uuid; /**< TrackFileResourceType/TrackFileId */
 } FFIMFTrackFileResource;
 
 /**
@@ -109,7 +101,7 @@ typedef struct FFIMFMarkerResource {
  * IMF Composition Playlist Virtual Track
  */
 typedef struct FFIMFBaseVirtualTrack {
-FFIMFUUID id_uuid; /**< TrackId associated with the Virtual Track */
+AVUUID id_uuid; /**< TrackId associated with the Virtual Track */
 } FFIMFBaseVirtualTrack;
 
 /**
@@ -135,7 +127,7 @@ typedef struct FFIMFMarkerVirtualTrack {
  * IMF Composition Playlist
  */
 typedef struct FFIMFCPL {
-FFIMFUUID id_uuid;   /**< 
CompositionPlaylist/Id element */
+AVUUID id_uuid;   /**< CompositionPlaylist/Id 
element */
 xmlChar *content_title_utf8; /**< 
CompositionPlaylist/ContentTitle element */
 AVRational edit_rate;/**< 
CompositionPlaylist/EditRate element */
 FFIMFMarkerVirtualTrack *main_markers_track; /**< Main Marker Virtual 
Track */
@@ -196,7 +188,7 @@ int ff_imf_xml_read_rational(xmlNodePtr element, AVRational 
*rational);
  * Reads a UUID from an XML element
  * @return 0 on success, < 0 AVERROR code on error.
  */
-int ff_imf_xml_read_uuid(xmlNodePtr element, uint8_t uuid[16]);
+int ff_imf_xml_read_uuid(xmlNodePtr element, AVUUID uuid);
 
 /**
  * Returns the first child element with the specified local name
diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c
index 102a6b4549..c0d43cbfad 100644
--- a/libavformat/imf_cpl.c
+++ b/libavformat/imf_cpl.c
@@ -70,32 +70,14 @@ xmlNodePtr ff_imf_xml_get_child_element_by_name(xmlNodePtr 
parent, const char *n
 return NULL;
 }
 
-int ff_imf_xml_read_uuid(xmlNodePtr element, uint8_t uuid[16])
+int ff_imf_xml_read_uuid(xmlNodePtr element, AVUUID uuid)
 {
 xmlChar *element_text = NULL;
-int scanf_ret;
 int ret = 0;
 
 element_text = xmlNodeListGetString(element->doc, 
element->xmlChildrenNode, 1);
-scanf_ret = sscanf(element_text,
-   FF_IMF_UUID_FORMAT,
-   [0],
-   [1],
-   [2],
-   [3],
-   [4],
-   [5],
-   [6],
-   [7],
-   [8],
-   [9],
-   [10],
-   [11],
-   [12],
-   [13],
-   [14],
-   [15]);
-if (scanf_ret != 16) {
+ret = av_uuid_urn_parse(element_text, uuid);
+if (ret) {
 av_log(NULL, AV_LOG_ERROR, "Invalid UUID\n");
 ret = AVERROR_INVALIDDATA;
 }
@@ -370,7 +352,7 @@ static int fill_marker_resource(xmlNodePtr 
marker_resource_elem,
 static int push_marker_sequence(xmlNodePtr marker_sequence_elem, FFIMFCPL *cpl)
 {
 int ret = 0;
-uint8_t uuid[16];
+AVUUID uuid;
 xmlNodePtr resource_list_elem = NULL;
 xmlNodePtr resource_elem = NULL;
 xmlNodePtr track_id_elem = NULL;
@@ -388,8 +370,8 @@ static int push_marker_sequence(xmlNodePtr 
marker_sequence_elem, FFIMFCPL *cpl)
 }
 av_log(NULL,
AV_LOG_DEBUG,
-   "Processing IMF CPL Marker Sequence for Virtual Track " 
FF_IMF_UUID_FORMAT "\n",
-   UID_ARG(uuid));
+   "Processing IMF CPL Marker Sequence for Virtual Track " AV_PRI_UUID 
"\n",
+   AV_UUID_ARG(uuid));
 
 /* create main marker virtual track if it does not exist */
 if (!cpl->main_markers_track) {
@@ -397,9 +379,9 @@ static int push_marker_sequence(xmlNodePtr 
marker_sequence_elem, FFIMFCPL *cpl)
 if (!cpl->main_markers_track)
 return AVERROR(ENOMEM);
 imf_marker_virtual_track_init(cpl->main_markers_track);
-memcpy(cpl->main_markers_track->base.id_uuid, uuid, sizeof(uuid));
+   

[FFmpeg-devel] [PATCH v2 0/7] Add UUID functionality to libavutil

2022-04-24 Thread Zane van Iperen
This patchset adds functions for handling UUIDs to libavutil, under the 
av_uuid_*
prefix, and refactors the various ad-hoc handling to use it. This was
proposed in [1].

This is _heavily_ based off libuuid with various parts of the code
simplified to remove unnecessary functionality (e.g. generation, and v1
UUIDs).

v2:
- Removed unnecessary license header in libavutil/uuid.h
- Cosmetic fixes

[1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2022-January/291917.html

Pierre-Anthony Lemieux (6):
  avutil/tests/uuid: add uuid tests
  avformat/mov: refactor to use avutil/uuid
  avformat/smoothstreamingenc: refactor to use avutil/uuid
  avcodec/cbs_sei: refactor to use avutil/uuid
  avformat/imf: refactor to use avutil/uuid
  avfilter/showinfo: refactor to use avutil/uuid

Zane van Iperen (1):
  avutil/uuid: add utility library for manipulating UUIDs as specified
in RFC 4122

 libavcodec/cbs_sei.h |   3 +-
 libavcodec/vaapi_encode_h264.c   |   8 +-
 libavfilter/vf_showinfo.c|  17 +---
 libavformat/imf.h|  18 +---
 libavformat/imf_cpl.c|  60 +---
 libavformat/imfdec.c |  34 +++
 libavformat/mov.c|  25 ++---
 libavformat/movenc.c |   9 +-
 libavformat/smoothstreamingenc.c |   7 +-
 libavformat/tests/imf.c  |  18 ++--
 libavutil/Makefile   |   3 +
 libavutil/tests/.gitignore   |   1 +
 libavutil/tests/uuid.c   | 139 +++
 libavutil/uuid.c | 155 +++
 libavutil/uuid.h | 137 +++
 tests/fate/libavutil.mak |   5 +
 16 files changed, 525 insertions(+), 114 deletions(-)
 create mode 100644 libavutil/tests/uuid.c
 create mode 100644 libavutil/uuid.c
 create mode 100644 libavutil/uuid.h

-- 
2.35.1

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

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


Re: [FFmpeg-devel] [PATCH v4 1/7] avformat/imf: relocate static function imf_time_to_ts()

2022-03-11 Thread Zane van Iperen

lgtm. Will apply in a few days.

___
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/7] avutil/uuid: add utility library for manipulating UUIDs as specified in RFC 4122

2022-02-23 Thread Zane van Iperen





On 23/2/22 19:54, Lynne wrote:

23 Feb 2022, 07:48 by z...@zanevaniperen.com:


Why the double header in the header file? It doesn't contain
any libuuid code.



It does, this was copy/pasted from libuuid, then had things stripped from it.
Some examples:
- 
https://github.com/util-linux/util-linux/blob/d65eb48039a03cdacd5450e644af917a0f08bc88/libuuid/src/unparse.c#L43
- 
https://github.com/util-linux/util-linux/blob/d65eb48039a03cdacd5450e644af917a0f08bc88/libuuid/src/parse.c#L52



I said the header *file*. It's just function definitions, there's no code there.


Oh right, of course. Fixed.
___
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/7] avutil/uuid: add utility library for manipulating UUIDs as specified in RFC 4122

2022-02-22 Thread Zane van Iperen




On 23/2/22 16:48, Zane van Iperen wrote:



On 23/2/22 16:01, Lynne wrote:


Code style



Mostly fixed, do these changes look right?
https://github.com/vs49688/FFmpeg/commit/867fffe04ffedf0609260557d1db0ebbc519c4d2


Uhh, wrong one:
https://github.com/vs49688/FFmpeg/commit/58af67b9bee0b9b235b8be9973b15e3635ad8b96
___
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/7] avutil/uuid: add utility library for manipulating UUIDs as specified in RFC 4122

2022-02-22 Thread Zane van Iperen



On 23/2/22 00:21, James Almer wrote:

+int av_uuid_equal(const AVUUID uu1, const AVUUID uu2)
+{
+    return memcmp(uu1, uu2, AV_UUID_LEN) == 0;
+}
+
+void av_uuid_copy(AVUUID dest, const AVUUID src)
+{
+    memcpy(dest, src, AV_UUID_LEN);
+}
+
+void av_uuid_nil_set(AVUUID uu)
+{
+    memset(uu, 0, AV_UUID_LEN);


These three seem unnecessary. We don't need new public symbols for this when we 
can just state in the doxy that you can copy, compare or zero by assignment or 
zeroing or any such standard method.



Personally, I think it makes the intent clearer, I'd be interested in other's 
opinions on this.

Alternatively, if AVUUID is changed to a struct we could remove av_uuid_copy() 
and av_uuid_nil_set():

typedef struct AVUUID {
uint8_t v[AV_UUID_LEN];
} AVUUID;

AVUUID a;
AVUUID b = {0};
a = b;


___
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/7] avutil/uuid: add utility library for manipulating UUIDs as specified in RFC 4122

2022-02-22 Thread Zane van Iperen




On 23/2/22 16:01, Lynne wrote:


Code style



Mostly fixed, do these changes look right?
https://github.com/vs49688/FFmpeg/commit/867fffe04ffedf0609260557d1db0ebbc519c4d2



Why the double header in the header file? It doesn't contain
any libuuid code.


It does, this was copy/pasted from libuuid, then had things stripped from it.
Some examples:
- 
https://github.com/util-linux/util-linux/blob/d65eb48039a03cdacd5450e644af917a0f08bc88/libuuid/src/unparse.c#L43
- 
https://github.com/util-linux/util-linux/blob/d65eb48039a03cdacd5450e644af917a0f08bc88/libuuid/src/parse.c#L52
___
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/7] avutil/uuid: add utility library for manipulating UUIDs as specified in RFC 4122

2022-02-22 Thread Zane van Iperen




On 22/2/22 23:01, Zane van Iperen wrote:


+int av_uuid_urn_parse(const char *in, AVUUID uu)
+{
+return av_uuid_parse(in + 9, uu);


Self-review: this should check if "strlen(in) == 45", then simply
return av_uuid_parse_range(in + 9).
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 7/7] avfilter/showinfo: refactor to use avutil/uuid

2022-02-22 Thread Zane van Iperen
From: Pierre-Anthony Lemieux 

Signed-off-by: Pierre-Anthony Lemieux 
Signed-off-by: Zane van Iperen 
---
 libavfilter/vf_showinfo.c | 17 +
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 71728bced4..395e87c486 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -41,6 +41,7 @@
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/video_enc_params.h"
 #include "libavutil/detection_bbox.h"
+#include "libavutil/uuid.h"
 
 #include "avfilter.h"
 #include "internal.h"
@@ -337,29 +338,21 @@ static void dump_video_enc_params(AVFilterContext *ctx, 
const AVFrameSideData *s
 
 static void dump_sei_unregistered_metadata(AVFilterContext *ctx, const 
AVFrameSideData *sd)
 {
-const int uuid_size = 16;
 const uint8_t *user_data = sd->data;
 int i;
 
-if (sd->size < uuid_size) {
+if (sd->size < AV_UUID_LEN) {
 av_log(ctx, AV_LOG_ERROR, "invalid data(%"SIZE_SPECIFIER" < "
-   "UUID(%d-bytes))\n", sd->size, uuid_size);
+   "UUID(%d-bytes))\n", sd->size, AV_UUID_LEN);
 return;
 }
 
 av_log(ctx, AV_LOG_INFO, "User Data Unregistered:\n");
-av_log(ctx, AV_LOG_INFO, "UUID=");
-for (i = 0; i < uuid_size; i++) {
-av_log(ctx, AV_LOG_INFO, "%02x", user_data[i]);
-if (i == 3 || i == 5 || i == 7 || i == 9)
-av_log(ctx, AV_LOG_INFO, "-");
-}
-av_log(ctx, AV_LOG_INFO, "\n");
+av_log(ctx, AV_LOG_INFO, "UUID=" AV_PRI_UUID "\n", AV_UUID_ARG(user_data));
 
 av_log(ctx, AV_LOG_INFO, "User Data=");
-for (; i < sd->size; i++) {
+for (i = 16; i < sd->size; i++)
 av_log(ctx, AV_LOG_INFO, "%02x", user_data[i]);
-}
 av_log(ctx, AV_LOG_INFO, "\n");
 }
 
-- 
2.35.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 6/7] avformat/imf: refactor to use avutil/uuid

2022-02-22 Thread Zane van Iperen
From: Pierre-Anthony Lemieux 

Signed-off-by: Pierre-Anthony Lemieux 
Signed-off-by: Zane van Iperen 
---
 libavformat/imf.h   | 18 -
 libavformat/imf_cpl.c   | 60 +++--
 libavformat/imfdec.c| 34 +++
 libavformat/tests/imf.c | 18 ++---
 4 files changed, 52 insertions(+), 78 deletions(-)

diff --git a/libavformat/imf.h b/libavformat/imf.h
index 62c4468ce9..4271cd9582 100644
--- a/libavformat/imf.h
+++ b/libavformat/imf.h
@@ -58,17 +58,9 @@
 #include "avformat.h"
 #include "libavformat/avio.h"
 #include "libavutil/rational.h"
+#include "libavutil/uuid.h"
 #include 
 
-#define FF_IMF_UUID_FORMAT\
-"urn:uuid:%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-" \
-"%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
-
-/**
- * UUID as defined in IETF RFC 422
- */
-typedef uint8_t FFIMFUUID[16];
-
 /**
  * IMF Composition Playlist Base Resource
  */
@@ -84,7 +76,7 @@ typedef struct FFIMFBaseResource {
  */
 typedef struct FFIMFTrackFileResource {
 FFIMFBaseResource base;
-FFIMFUUID track_file_uuid; /**< TrackFileResourceType/TrackFileId */
+AVUUID track_file_uuid; /**< TrackFileResourceType/TrackFileId */
 } FFIMFTrackFileResource;
 
 /**
@@ -109,7 +101,7 @@ typedef struct FFIMFMarkerResource {
  * IMF Composition Playlist Virtual Track
  */
 typedef struct FFIMFBaseVirtualTrack {
-FFIMFUUID id_uuid; /**< TrackId associated with the Virtual Track */
+AVUUID id_uuid; /**< TrackId associated with the Virtual Track */
 } FFIMFBaseVirtualTrack;
 
 /**
@@ -135,7 +127,7 @@ typedef struct FFIMFMarkerVirtualTrack {
  * IMF Composition Playlist
  */
 typedef struct FFIMFCPL {
-FFIMFUUID id_uuid;   /**< 
CompositionPlaylist/Id element */
+AVUUID id_uuid;   /**< CompositionPlaylist/Id 
element */
 xmlChar *content_title_utf8; /**< 
CompositionPlaylist/ContentTitle element */
 AVRational edit_rate;/**< 
CompositionPlaylist/EditRate element */
 FFIMFMarkerVirtualTrack *main_markers_track; /**< Main Marker Virtual 
Track */
@@ -196,7 +188,7 @@ int ff_imf_xml_read_rational(xmlNodePtr element, AVRational 
*rational);
  * Reads a UUID from an XML element
  * @return 0 on success, < 0 AVERROR code on error.
  */
-int ff_imf_xml_read_uuid(xmlNodePtr element, uint8_t uuid[16]);
+int ff_imf_xml_read_uuid(xmlNodePtr element, AVUUID uuid);
 
 /**
  * Returns the first child element with the specified local name
diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c
index 102a6b4549..c0d43cbfad 100644
--- a/libavformat/imf_cpl.c
+++ b/libavformat/imf_cpl.c
@@ -70,32 +70,14 @@ xmlNodePtr ff_imf_xml_get_child_element_by_name(xmlNodePtr 
parent, const char *n
 return NULL;
 }
 
-int ff_imf_xml_read_uuid(xmlNodePtr element, uint8_t uuid[16])
+int ff_imf_xml_read_uuid(xmlNodePtr element, AVUUID uuid)
 {
 xmlChar *element_text = NULL;
-int scanf_ret;
 int ret = 0;
 
 element_text = xmlNodeListGetString(element->doc, 
element->xmlChildrenNode, 1);
-scanf_ret = sscanf(element_text,
-   FF_IMF_UUID_FORMAT,
-   [0],
-   [1],
-   [2],
-   [3],
-   [4],
-   [5],
-   [6],
-   [7],
-   [8],
-   [9],
-   [10],
-   [11],
-   [12],
-   [13],
-   [14],
-   [15]);
-if (scanf_ret != 16) {
+ret = av_uuid_urn_parse(element_text, uuid);
+if (ret) {
 av_log(NULL, AV_LOG_ERROR, "Invalid UUID\n");
 ret = AVERROR_INVALIDDATA;
 }
@@ -370,7 +352,7 @@ static int fill_marker_resource(xmlNodePtr 
marker_resource_elem,
 static int push_marker_sequence(xmlNodePtr marker_sequence_elem, FFIMFCPL *cpl)
 {
 int ret = 0;
-uint8_t uuid[16];
+AVUUID uuid;
 xmlNodePtr resource_list_elem = NULL;
 xmlNodePtr resource_elem = NULL;
 xmlNodePtr track_id_elem = NULL;
@@ -388,8 +370,8 @@ static int push_marker_sequence(xmlNodePtr 
marker_sequence_elem, FFIMFCPL *cpl)
 }
 av_log(NULL,
AV_LOG_DEBUG,
-   "Processing IMF CPL Marker Sequence for Virtual Track " 
FF_IMF_UUID_FORMAT "\n",
-   UID_ARG(uuid));
+   "Processing IMF CPL Marker Sequence for Virtual Track " AV_PRI_UUID 
"\n",
+   AV_UUID_ARG(uuid));
 
 /* create main marker virtual track if it does not exist */
 if (!cpl->main_markers_track) {
@@ -397,9 +379,9 @@ static int push_marker_sequence(xmlNodePtr 
marker_sequence_elem, FFIM

[FFmpeg-devel] [PATCH 5/7] avcodec/cbs_sei: refactor to use avutil/uuid

2022-02-22 Thread Zane van Iperen
From: Pierre-Anthony Lemieux 

Signed-off-by: Pierre-Anthony Lemieux 
Signed-off-by: Zane van Iperen 
---
 libavcodec/cbs_sei.h   | 3 ++-
 libavcodec/vaapi_encode_h264.c | 8 
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavcodec/cbs_sei.h b/libavcodec/cbs_sei.h
index c7a7a95be0..67c6e6cbbd 100644
--- a/libavcodec/cbs_sei.h
+++ b/libavcodec/cbs_sei.h
@@ -23,6 +23,7 @@
 #include 
 
 #include "libavutil/buffer.h"
+#include "libavutil/uuid.h"
 
 #include "cbs.h"
 #include "sei.h"
@@ -41,7 +42,7 @@ typedef struct SEIRawUserDataRegistered {
 } SEIRawUserDataRegistered;
 
 typedef struct SEIRawUserDataUnregistered {
-uint8_t  uuid_iso_iec_11578[16];
+AVUUID  uuid_iso_iec_11578;
 uint8_t *data;
 AVBufferRef *data_ref;
 size_t   data_length;
diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index ff37de1f7e..8d216b2595 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -25,6 +25,7 @@
 #include "libavutil/common.h"
 #include "libavutil/internal.h"
 #include "libavutil/opt.h"
+#include "libavutil/uuid.h"
 
 #include "avcodec.h"
 #include "cbs.h"
@@ -42,7 +43,7 @@ enum {
 };
 
 // Random (version 4) ISO 11578 UUID.
-static const uint8_t vaapi_encode_h264_sei_identifier_uuid[16] = {
+static const AVUUID vaapi_encode_h264_sei_identifier_uuid = {
 0x59, 0x94, 0x8b, 0x28, 0x11, 0xec, 0x45, 0xaf,
 0x96, 0x75, 0x19, 0xd4, 0x1f, 0xea, 0xa9, 0x4d,
 };
@@ -1088,9 +1089,8 @@ static av_cold int 
vaapi_encode_h264_configure(AVCodecContext *avctx)
 const char *driver;
 int len;
 
-memcpy(priv->sei_identifier.uuid_iso_iec_11578,
-   vaapi_encode_h264_sei_identifier_uuid,
-   sizeof(priv->sei_identifier.uuid_iso_iec_11578));
+av_uuid_copy(priv->sei_identifier.uuid_iso_iec_11578,
+ vaapi_encode_h264_sei_identifier_uuid);
 
 driver = vaQueryVendorString(ctx->hwctx->display);
 if (!driver)
-- 
2.35.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/7] avformat/smoothstreamingenc: refactor to use avutil/uuid

2022-02-22 Thread Zane van Iperen
From: Pierre-Anthony Lemieux 

Signed-off-by: Pierre-Anthony Lemieux 
Signed-off-by: Zane van Iperen 
---
 libavformat/smoothstreamingenc.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c
index a0ea5b8fa8..6c36ae2eaa 100644
--- a/libavformat/smoothstreamingenc.c
+++ b/libavformat/smoothstreamingenc.c
@@ -38,6 +38,7 @@
 #include "libavutil/file.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/intreadwrite.h"
+#include "libavutil/uuid.h"
 
 typedef struct Fragment {
 int64_t start_time, duration;
@@ -418,13 +419,13 @@ static int parse_fragment(AVFormatContext *s, const char 
*filename, int64_t *sta
 if (len < 8 || len >= *moof_size)
 goto fail;
 if (tag == MKTAG('u','u','i','d')) {
-static const uint8_t tfxd[] = {
+static const AVUUID tfxd = {
 0x6d, 0x1d, 0x9b, 0x05, 0x42, 0xd5, 0x44, 0xe6,
 0x80, 0xe2, 0x14, 0x1d, 0xaf, 0xf7, 0x57, 0xb2
 };
-uint8_t uuid[16];
+AVUUID uuid;
 avio_read(in, uuid, 16);
-if (!memcmp(uuid, tfxd, 16) && len >= 8 + 16 + 4 + 16) {
+if (av_uuid_equal(uuid, tfxd) && len >= 8 + 16 + 4 + 16) {
 avio_seek(in, 4, SEEK_CUR);
 *start_ts = avio_rb64(in);
 *duration = avio_rb64(in);
-- 
2.35.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/7] avformat/mov: refactor to use avutil/uuid

2022-02-22 Thread Zane van Iperen
From: Pierre-Anthony Lemieux 

Signed-off-by: Pierre-Anthony Lemieux 
Signed-off-by: Zane van Iperen 
---
 libavformat/mov.c| 25 +
 libavformat/movenc.c |  9 +
 2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 5e26267810..728d44b19d 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -48,6 +48,7 @@
 #include "libavutil/stereo3d.h"
 #include "libavutil/timecode.h"
 #include "libavutil/dovi_meta.h"
+#include "libavutil/uuid.h"
 #include "libavcodec/ac3tab.h"
 #include "libavcodec/flac.h"
 #include "libavcodec/mpegaudiodecheader.h"
@@ -5796,21 +5797,21 @@ static int mov_read_uuid(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 AVStream *st;
 MOVStreamContext *sc;
 int64_t ret;
-uint8_t uuid[16];
-static const uint8_t uuid_isml_manifest[] = {
+AVUUID uuid;
+static const AVUUID uuid_isml_manifest = {
 0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd,
 0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66
 };
-static const uint8_t uuid_xmp[] = {
+static const AVUUID uuid_xmp = {
 0xbe, 0x7a, 0xcf, 0xcb, 0x97, 0xa9, 0x42, 0xe8,
 0x9c, 0x71, 0x99, 0x94, 0x91, 0xe3, 0xaf, 0xac
 };
-static const uint8_t uuid_spherical[] = {
+static const AVUUID uuid_spherical = {
 0xff, 0xcc, 0x82, 0x63, 0xf8, 0x55, 0x4a, 0x93,
 0x88, 0x14, 0x58, 0x7a, 0x02, 0x52, 0x1f, 0xdd,
 };
 
-if (atom.size < sizeof(uuid) || atom.size >= FFMIN(INT_MAX, SIZE_MAX))
+if (atom.size < AV_UUID_LEN || atom.size >= FFMIN(INT_MAX, SIZE_MAX))
 return AVERROR_INVALIDDATA;
 
 if (c->fc->nb_streams < 1)
@@ -5818,13 +5819,13 @@ static int mov_read_uuid(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 st = c->fc->streams[c->fc->nb_streams - 1];
 sc = st->priv_data;
 
-ret = ffio_read_size(pb, uuid, sizeof(uuid));
+ret = ffio_read_size(pb, uuid, AV_UUID_LEN);
 if (ret < 0)
 return ret;
-if (!memcmp(uuid, uuid_isml_manifest, sizeof(uuid))) {
+if (av_uuid_equal(uuid, uuid_isml_manifest)) {
 uint8_t *buffer, *ptr;
 char *endptr;
-size_t len = atom.size - sizeof(uuid);
+size_t len = atom.size - AV_UUID_LEN;
 
 if (len < 4) {
 return AVERROR_INVALIDDATA;
@@ -5862,9 +5863,9 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 }
 
 av_free(buffer);
-} else if (!memcmp(uuid, uuid_xmp, sizeof(uuid))) {
+} else if (av_uuid_equal(uuid, uuid_xmp)) {
 uint8_t *buffer;
-size_t len = atom.size - sizeof(uuid);
+size_t len = atom.size - AV_UUID_LEN;
 if (c->export_xmp) {
 buffer = av_mallocz(len + 1);
 if (!buffer) {
@@ -5884,8 +5885,8 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 if (ret < 0)
 return ret;
 }
-} else if (!memcmp(uuid, uuid_spherical, sizeof(uuid))) {
-size_t len = atom.size - sizeof(uuid);
+} else if (av_uuid_equal(uuid, uuid_spherical)) {
+size_t len = atom.size - AV_UUID_LEN;
 ret = mov_parse_uuid_spherical(sc, pb, len);
 if (ret < 0)
 return ret;
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 4c868919ae..a3bb9b9af8 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -55,6 +55,7 @@
 #include "libavutil/timecode.h"
 #include "libavutil/dovi_meta.h"
 #include "libavutil/color_utils.h"
+#include "libavutil/uuid.h"
 #include "hevc.h"
 #include "rtpenc.h"
 #include "mov_chan.h"
@@ -4288,14 +4289,14 @@ static int mov_write_isml_manifest(AVIOContext *pb, 
MOVMuxContext *mov, AVFormat
 int64_t pos = avio_tell(pb);
 int i;
 
-static const uint8_t uuid[] = {
+static const AVUUID uuid = {
 0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd,
 0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66
 };
 
 avio_wb32(pb, 0);
 ffio_wfourcc(pb, "uuid");
-avio_write(pb, uuid, sizeof(uuid));
+avio_write(pb, uuid, AV_UUID_LEN);
 avio_wb32(pb, 0);
 
 avio_printf(pb, "\n");
@@ -4554,7 +4555,7 @@ static int mov_write_tfxd_tag(AVIOContext *pb, MOVTrack 
*track)
 
 avio_wb32(pb, 0); /* size placeholder */
 ffio_wfourcc(pb, "uuid");
-avio_write(pb, uuid, sizeof(uuid));
+avio_write(pb, uuid, AV_UUID_LEN);
 avio_w8(pb, 1);
 avio_wb24(pb, 0);
 avio_wb64(pb, track->cluster[0].dts + track->cluster[0].cts);
@@ -4580,7 +4581,7 @@ static int mov_write_tfrf_tag(AVIOContext *pb, 
MOVMuxContext *mov,
 avio_seek(pb, track->frag_info[entry].tfrf_offset, SEEK_SET);
 avio_wb32(pb, size);
 ffio_wfourcc(pb, "uuid");
-avio_write

[FFmpeg-devel] [PATCH 2/7] avutil/tests/uuid: add uuid tests

2022-02-22 Thread Zane van Iperen
From: Pierre-Anthony Lemieux 

Signed-off-by: Pierre-Anthony Lemieux 
Signed-off-by: Zane van Iperen 
---
 libavutil/Makefile |   1 +
 libavutil/tests/.gitignore |   1 +
 libavutil/tests/uuid.c | 139 +
 tests/fate/libavutil.mak   |   5 ++
 4 files changed, 146 insertions(+)
 create mode 100644 libavutil/tests/uuid.c

diff --git a/libavutil/Makefile b/libavutil/Makefile
index e0f40412d0..76f8023ce2 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -258,6 +258,7 @@ TESTPROGS = adler32 
\
 tree\
 twofish \
 utf8\
+uuid\
 xtea\
 tea \
 
diff --git a/libavutil/tests/.gitignore b/libavutil/tests/.gitignore
index 9d90827954..919010e4fc 100644
--- a/libavutil/tests/.gitignore
+++ b/libavutil/tests/.gitignore
@@ -48,4 +48,5 @@
 /tree
 /twofish
 /utf8
+/uuid
 /xtea
diff --git a/libavutil/tests/uuid.c b/libavutil/tests/uuid.c
new file mode 100644
index 00..0a7a0eb07d
--- /dev/null
+++ b/libavutil/tests/uuid.c
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2022 Pierre-Anthony Lemieux 
+ *Zane van Iperen 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/uuid.h"
+#include "libavutil/log.h"
+
+static const char *UUID_1= "6021b21e-894e-43ff-8317-1ca891c1c49b";
+static const char *UUID_1_UC = "6021B21E-894E-43FF-8317-1CA891C1C49B";
+static const char *UUID_1_MIXED  = "6021b21e-894E-43fF-8317-1CA891C1c49b";
+static const char *UUID_1_URN= 
"urn:uuid:6021b21e-894e-43ff-8317-1ca891c1c49b";
+static const AVUUID UUID_1_BYTES = {0x60, 0x21, 0xb2, 0x1e, 0x89, 0x4e, 0x43, 
0xff,
+0x83, 0x17, 0x1c, 0xa8, 0x91, 0xc1, 0xc4, 
0x9b};
+
+static const AVUUID UUID_NIL = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00};
+
+static const char *UUID_BAD_1 = "16a2c9f8-afbc-4767-8621-8cb2b27599";
+static const char *UUID_BAD_2 = "75df62c2999b4bd38c9d8058fcde9123";
+static const char *UUID_BAD_3 = "a1b9a05e-f1d1-464g-a951-1ba0a374f02";
+static const char *UUID_BAD_4 = "279c66d432-7b39-41d5-966f-5e8138265c20";
+
+int main(int argc, char **argv)
+{
+AVUUID uuid;
+AVUUID uuid2 = {0x32, 0xc7, 0x00, 0xc4, 0xd5, 0xd7, 0x42, 0x0,
+0x93, 0xc0, 0x3b, 0x6d, 0xea, 0x1b, 0x20, 0x5b};
+
+/* test parsing */
+
+if (av_uuid_parse(UUID_1, uuid))
+return 1;
+
+if (!av_uuid_equal(uuid, UUID_1_BYTES))
+return 1;
+
+/* test nil */
+
+av_uuid_nil_set(uuid);
+
+if (!av_uuid_equal(uuid, UUID_NIL))
+return 1;
+
+/* test equality */
+
+if (av_uuid_equal(UUID_1_BYTES, uuid2))
+return 1;
+
+/* test copy */
+
+av_uuid_copy(uuid2, UUID_1_BYTES);
+
+if (!av_uuid_equal(uuid2, UUID_1_BYTES))
+return 1;
+
+/* test uppercase parsing */
+
+if (av_uuid_parse(UUID_1_UC, uuid))
+return 1;
+
+if (!av_uuid_equal(uuid, UUID_1_BYTES))
+return 1;
+
+/* test mixed-case parsing */
+
+if (av_uuid_parse(UUID_1_MIXED, uuid))
+return 1;
+
+if (!av_uuid_equal(uuid, UUID_1_BYTES))
+return 1;
+
+/* test URN uuid parse */
+
+if (av_uuid_urn_parse(UUID_1_URN, uuid))
+return 1;
+
+if (!av_uuid_equal(uuid, UUID_1_BYTES))
+return 1;
+
+/* test parse range */
+
+if (av_uuid_parse_range(UUID_1_URN + 9, UUID_1_URN + 45, uuid))
+return 1;
+
+if (!av_uuid_equal(uuid, UUID_1_BYTES))
+return 1;
+
+/* test bad parse range */
+
+if (!av_uuid_parse_range(UUID_1_URN + 9, UUID_1_URN + 44, uuid))
+return 1;
+
+/* test bad parse range 2 */
+
+if (!av_uuid_par

[FFmpeg-devel] [PATCH 1/7] avutil/uuid: add utility library for manipulating UUIDs as specified in RFC 4122

2022-02-22 Thread Zane van Iperen
Loosely based on libuuid

Co-authored-by: Pierre-Anthony Lemieux 
Signed-off-by: Pierre-Anthony Lemieux 
Signed-off-by: Zane van Iperen 
---
 libavutil/Makefile |   2 +
 libavutil/uuid.c   | 156 ++
 libavutil/uuid.h   | 167 +
 3 files changed, 325 insertions(+)
 create mode 100644 libavutil/uuid.c
 create mode 100644 libavutil/uuid.h

diff --git a/libavutil/Makefile b/libavutil/Makefile
index d17876df1a..e0f40412d0 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -80,6 +80,7 @@ HEADERS = adler32.h   
  \
   timestamp.h   \
   tree.h\
   twofish.h \
+  uuid.h\
   version.h \
   video_enc_params.h\
   xtea.h\
@@ -172,6 +173,7 @@ OBJS = adler32.o
\
tx_float.o   \
tx_double.o  \
tx_int32.o   \
+   uuid.o   \
video_enc_params.o   \
film_grain_params.o  \
 
diff --git a/libavutil/uuid.c b/libavutil/uuid.c
new file mode 100644
index 00..7bcbbe487f
--- /dev/null
+++ b/libavutil/uuid.c
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2022 Pierre-Anthony Lemieux 
+ *Zane van Iperen 
+ *
+ * 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
+ */
+
+/*
+ * Copyright (C) 1996, 1997 Theodore Ts'o.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, and the entire permission notice in its entirety,
+ *including the disclaimer of warranties.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *products derived from this software without specific prior
+ *written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
+ * WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+
+/**
+ * @file
+ * UUID parsing and serialization utilities.
+ * The library treat the UUID as an opaque sequence of 16 unsigned bytes,
+ * i.e. ignoring the internal layout of the UUID, which depends on the type
+ * of the UUID.
+ *
+ * @author Pierre-Anthony Lemieux 
+ * @author Zane van Iperen 
+ */
+
+#include "uuid.h"
+#include "error.h"
+#include "avstring.h"
+#include 
+#include 
+
+int av_uuid_parse(const char *in, AVUUID uu)
+{
+size_t len = strlen(in);
+if (len != 36)
+return -1;
+
+return av_uuid_parse_range(in, in + len, uu);
+}
+
+int av_uuid_parse_range(const char *in_start, const char *in_end, AVUUID uu)
+{
+int i;
+   

[FFmpeg-devel] [PATCH 0/7] Add UUID functionality to libavutil

2022-02-22 Thread Zane van Iperen
This patchset adds functions for handling UUIDs to libavutil, under the 
av_uuid_*
prefix, and refactors the various ad-hoc handling to use it. This was
proposed in [1].

This is _heavily_ based off libuuid with various parts of the code
simplified to remove unnecessary functionality (e.g. generation, and v1
UUIDs).

Why not use libuuid directly?
* It introduces yet another external dependency,
* has issues building on Windows, and
* the code is relatively small, stable, and unlikely to change.

[1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2022-January/291917.html


Pierre-Anthony Lemieux (6):
  avutil/tests/uuid: add uuid tests
  avformat/mov: refactor to use avutil/uuid
  avformat/smoothstreamingenc: refactor to use avutil/uuid
  avcodec/cbs_sei: refactor to use avutil/uuid
  avformat/imf: refactor to use avutil/uuid
  avfilter/showinfo: refactor to use avutil/uuid

Zane van Iperen (1):
  avutil/uuid: add utility library for manipulating UUIDs as specified
in RFC 4122

 libavcodec/cbs_sei.h |   3 +-
 libavcodec/vaapi_encode_h264.c   |   8 +-
 libavfilter/vf_showinfo.c|  17 +---
 libavformat/imf.h|  18 +---
 libavformat/imf_cpl.c|  60 ---
 libavformat/imfdec.c |  34 +++
 libavformat/mov.c|  25 ++---
 libavformat/movenc.c |   9 +-
 libavformat/smoothstreamingenc.c |   7 +-
 libavformat/tests/imf.c  |  18 ++--
 libavutil/Makefile   |   3 +
 libavutil/tests/.gitignore   |   1 +
 libavutil/tests/uuid.c   | 139 +
 libavutil/uuid.c | 156 +
 libavutil/uuid.h | 167 +++
 tests/fate/libavutil.mak |   5 +
 16 files changed, 556 insertions(+), 114 deletions(-)
 create mode 100644 libavutil/tests/uuid.c
 create mode 100644 libavutil/uuid.c
 create mode 100644 libavutil/uuid.h

-- 
2.35.1

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

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


Re: [FFmpeg-devel] [PATCH v4 2/3] avformat/imf: fix packet pts, dts and muxing

2022-02-17 Thread Zane van Iperen




On 17/2/22 02:54, p...@sandflow.com wrote:

  av_log(s,
 AV_LOG_DEBUG,
 "Switch resource on track %d: re-open context\n",
 track->index);
-if (open_track_resource_context(s, &(track->resources[i])) != 
0)
-return NULL;
+
+ret = open_track_resource_context(s, &(track->resources[i]));


Nit: "track->resources + i" is easier to read imo


+if (ret != 0)
+return ret;
  if (track->current_resource_index > 0)
  
avformat_close_input(>resources[track->current_resource_index].ctx);
  track->current_resource_index = i;
  }
  
-return &(track->resources[track->current_resource_index]);

+*resource = &(track->resources[track->current_resource_index]);


Nit: track->resources + track->current_resource_index



The rest lgtm.

Will apply (with nits fixed) in a few days of no objections.

___
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/4] avformat/imf: fix missing error reporting when opening resources

2022-02-16 Thread Zane van Iperen





On 3/2/22 14:07, p...@sandflow.com wrote:

From: Pierre-Anthony Lemieux 

---
  libavformat/imfdec.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c
index e6a1020ecc..658ddc40f2 100644
--- a/libavformat/imfdec.c
+++ b/libavformat/imfdec.c
@@ -550,7 +550,9 @@ static int set_context_streams_from_tracks(AVFormatContext 
*s)
  AVStream *first_resource_stream;
  
  /* Open the first resource of the track to get stream information */

-open_track_resource_context(s, >tracks[i]->resources[0]);
+ret = open_track_resource_context(s, >tracks[i]->resources[0]);
+if (ret)
+return ret;
  first_resource_stream = c->tracks[i]->resources[0].ctx->streams[0];
  av_log(s, AV_LOG_DEBUG, "Open the first resource of track %d\n", 
c->tracks[i]->index);
  


Can you please squash this into the previous patch?

The rest looks mostly okay.
___
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/argo_cvg: Fix checksum

2022-02-15 Thread Zane van Iperen




On 15/2/22 23:05, Michael Niedermayer wrote:

Signed-off-by: Michael Niedermayer 
---
  libavformat/argo_cvg.c | 15 +--
  libavformat/version.h  |  2 +-
  2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c
index c5da32536d..dfdf126c17 100644
--- a/libavformat/argo_cvg.c
+++ b/libavformat/argo_cvg.c
@@ -335,19 +335,14 @@ static int argo_cvg_write_trailer(AVFormatContext *s)
  ArgoCVGMuxContext *ctx = s->priv_data;
  int64_t ret;
  
+ctx->checksum +=  (ctx->size  & 255)

+   + ((ctx->size>> 8) & 255)
+   + ((ctx->size>>16) & 255)
+   +  (ctx->size>>24);
+


...because of course it's that simple. How did I miss that?
No matter, lgtm!
___
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 4/4] avformat: add Argonaut Games CVG muxer

2022-02-14 Thread Zane van Iperen




On 15/2/22 05:32, Michael Niedermayer wrote:


+static int argo_cvg_write_trailer(AVFormatContext *s)
+{
+ArgoCVGMuxContext *ctx = s->priv_data;
+int64_t ret;
+
+av_log(s, AV_LOG_TRACE, "size = %zu\n", ctx->size);
+av_log(s, AV_LOG_TRACE, "checksum = %u\n",  ctx->checksum);
+
+/*
+ * NB: This is wrong. We're always slightly under the original.
+ * Verified by remuxing. For reference (orig - remuxed):



+ * - TCLD.CVG: 4706074 - 4705696 = 378
+ * - DANLOOP1.CVG: 5684641 - 5684212 = 429
+ * - CRYS.CVG: 2495499 - 2495367 = 132
+ * - PICKUP88.CVG: 1348091 - 1347937 = 154
+ * - SELECT1.CVG:   549987 - 549752  = 235


Are these files available somewhere ?



Yup, here you go: https://0x0.st/o8NK.xz

That's a .tar.xz, the extension was stripped.

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

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


[FFmpeg-devel] [PATCH] avformat/mxfdec: add avlanguage dependency

2022-02-05 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 3dc6a479cc..6566e40cac 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -374,7 +374,7 @@ OBJS-$(CONFIG_MTV_DEMUXER)   += mtv.o
 OBJS-$(CONFIG_MUSX_DEMUXER)  += musx.o
 OBJS-$(CONFIG_MV_DEMUXER)+= mvdec.o
 OBJS-$(CONFIG_MVI_DEMUXER)   += mvi.o
-OBJS-$(CONFIG_MXF_DEMUXER)   += mxfdec.o mxf.o
+OBJS-$(CONFIG_MXF_DEMUXER)   += mxfdec.o mxf.o avlanguage.o
 OBJS-$(CONFIG_MXF_MUXER) += mxfenc.o mxf.o avc.o
 OBJS-$(CONFIG_MXG_DEMUXER)   += mxg.o
 OBJS-$(CONFIG_NC_DEMUXER)+= ncdec.o
-- 
2.33.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] Refactoring UUID functionality

2022-02-04 Thread Zane van Iperen




On 21/1/22 03:45, Pierre-Anthony Lemieux wrote:

Hi all,

It was recently suggested that UUID functionality in the codebase
could be refactored into a single library.

Below is short explainer.

I would appreciate your review/feedback before I/we start writing code.

Best,

-- Pierre



I have no complaints, the approach looks good.

From what Pierre, Lynne, and myself discussed privately, basically the plan is 
to:
* Rip out uuid_{un,}parse() from libuuid into av_uuid_{un,}parse(), and
* Use it to dedup the existing ad-hoc UUID handling littered around the place.
___
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/tests: add /imf to .gitignore

2022-02-04 Thread Zane van Iperen





On 5/2/22 12:07, p...@sandflow.com wrote:

From: Pierre-Anthony Lemieux 

---
  libavformat/tests/.gitignore | 1 +
  1 file changed, 1 insertion(+)

diff --git a/libavformat/tests/.gitignore b/libavformat/tests/.gitignore
index 7ceb7a356b..aabf76345e 100644
--- a/libavformat/tests/.gitignore
+++ b/libavformat/tests/.gitignore
@@ -1,4 +1,5 @@
  /fifo_muxer
+/imf
  /movenc
  /noproxy
  /rtmpdh


lgtm, I'll apply this soon.
___
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/imf: s/++i/i++/g

2022-02-04 Thread Zane van Iperen





On 4/2/22 17:58, Paul B Mahol wrote:

Never apply this. Very sorry state of project.


Iirc, there was some discussion on IRC about it. If you're okay with it, then 
I'll apply 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".


Re: [FFmpeg-devel] [PATCH] Add libavformat/tests/imf to .gitignore

2022-02-04 Thread Zane van Iperen





On 7/1/22 13:55, p...@sandflow.com wrote:

From: Pierre-Anthony Lemieux 

Signed-off-by: Pierre-Anthony Lemieux 
---
  libavformat/tests/.gitignore | 1 +
  1 file changed, 1 insertion(+)

diff --git a/libavformat/tests/.gitignore b/libavformat/tests/.gitignore
index 7ceb7a356b..aabf76345e 100644
--- a/libavformat/tests/.gitignore
+++ b/libavformat/tests/.gitignore
@@ -1,4 +1,5 @@
  /fifo_muxer
+/imf
  /movenc
  /noproxy
  /rtmpdh


Could you please change the subject something like:
  avformat/tests: add /imf to .gitignore


After that, lgtm.
___
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/imf: s/++i/i++/g

2022-01-07 Thread Zane van Iperen
---
 libavformat/imfdec.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c
index 023f3556f6..3925462a26 100644
--- a/libavformat/imfdec.c
+++ b/libavformat/imfdec.c
@@ -263,7 +263,7 @@ static void imf_asset_locator_map_init(IMFAssetLocatorMap 
*asset_map)
  */
 static void imf_asset_locator_map_deinit(IMFAssetLocatorMap *asset_map)
 {
-for (uint32_t i = 0; i < asset_map->asset_count; ++i)
+for (uint32_t i = 0; i < asset_map->asset_count; i++)
 av_freep(_map->assets[i].absolute_uri);
 
 av_freep(_map->assets);
@@ -334,7 +334,7 @@ clean_up:
 
 static IMFAssetLocator *find_asset_map_locator(IMFAssetLocatorMap *asset_map, 
FFIMFUUID uuid)
 {
-for (uint32_t i = 0; i < asset_map->asset_count; ++i) {
+for (uint32_t i = 0; i < asset_map->asset_count; i++) {
 if (memcmp(asset_map->assets[i].uuid, uuid, 16) == 0)
 return &(asset_map->assets[i]);
 }
@@ -471,7 +471,7 @@ static int open_track_file_resource(AVFormatContext *s,
 return AVERROR(ENOMEM);
 track->resources = tmp;
 
-for (uint32_t i = 0; i < track_file_resource->base.repeat_count; ++i) {
+for (uint32_t i = 0; i < track_file_resource->base.repeat_count; i++) {
 IMFVirtualTrackResourcePlaybackCtx vt_ctx;
 
 vt_ctx.locator = asset_locator;
@@ -491,7 +491,7 @@ static int open_track_file_resource(AVFormatContext *s,
 
 static void 
imf_virtual_track_playback_context_deinit(IMFVirtualTrackPlaybackCtx *track)
 {
-for (uint32_t i = 0; i < track->resource_count; ++i)
+for (uint32_t i = 0; i < track->resource_count; i++)
 avformat_close_input(>resources[i].ctx);
 
 av_freep(>resources);
@@ -553,7 +553,7 @@ static int set_context_streams_from_tracks(AVFormatContext 
*s)
 IMFContext *c = s->priv_data;
 int ret = 0;
 
-for (uint32_t i = 0; i < c->track_count; ++i) {
+for (uint32_t i = 0; i < c->track_count; i++) {
 AVStream *asset_stream;
 AVStream *first_resource_stream;
 
@@ -600,7 +600,7 @@ static int open_cpl_tracks(AVFormatContext *s)
 }
 }
 
-for (uint32_t i = 0; i < c->cpl->main_audio_track_count; ++i) {
+for (uint32_t i = 0; i < c->cpl->main_audio_track_count; i++) {
 if ((ret = open_virtual_track(s, >cpl->main_audio_tracks[i], 
track_index++)) != 0) {
 av_log(s,
AV_LOG_ERROR,
@@ -718,7 +718,7 @@ static IMFVirtualTrackResourcePlaybackCtx 
*get_resource_context_for_timestamp(AV
track->index,
av_q2d(track->current_timestamp),
av_q2d(track->duration));
-for (uint32_t i = 0; i < track->resource_count; ++i) {
+for (uint32_t i = 0; i < track->resource_count; i++) {
 cumulated_duration = av_add_q(cumulated_duration,
   
av_make_q((int)track->resources[i].resource->base.duration
 * edit_unit_duration.num,
@@ -843,7 +843,7 @@ static int imf_close(AVFormatContext *s)
 imf_asset_locator_map_deinit(>asset_locator_map);
 ff_imf_cpl_free(c->cpl);
 
-for (uint32_t i = 0; i < c->track_count; ++i) {
+for (uint32_t i = 0; i < c->track_count; i++) {
 imf_virtual_track_playback_context_deinit(c->tracks[i]);
 av_freep(>tracks[i]);
 }
-- 
Just for you Paul...

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

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


Re: [FFmpeg-devel] [PATCH] avcodec/Makefile: Add missing entry for ADPCM_IMA_AMV_ENCODER

2022-01-05 Thread Zane van Iperen




On 6/1/22 04:44, Andreas Rheinhardt wrote:

Forgotten in 555f5c1fc5ae0c4e7b0431dc3166c3fcf3f4e979.



...how did I miss this? LGTM.
___
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/2] avformat/imf: fix CPL parsing error handling

2022-01-04 Thread Zane van Iperen




On 5/1/22 12:42, p...@sandflow.com wrote:

From: Pierre-Anthony Lemieux 

Signed-off-by: Pierre-Anthony Lemieux 
---
  libavformat/imf_cpl.c | 7 +--
  1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c
index 7055b49ae8..f49469f56e 100644
--- a/libavformat/imf_cpl.c
+++ b/libavformat/imf_cpl.c
@@ -807,7 +807,9 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl)
  av_log(NULL, AV_LOG_ERROR, "Cannot read IMF CPL\n");
  if (ret == 0)
  ret = AVERROR_INVALIDDATA;
-} else {
+goto clean_up;
+}
+


Patchset lgtm
___
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] avcodec/Makefile: fix mp2float and mp3 dependencies

2022-01-04 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavcodec/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 7dc4ccb85f..8cd2d6f849 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -481,8 +481,8 @@ OBJS-$(CONFIG_MP2_ENCODER) += 
mpegaudioenc_float.o mpegaudio.o \
 OBJS-$(CONFIG_MP2FIXED_ENCODER)+= mpegaudioenc_fixed.o mpegaudio.o \
   mpegaudiodata.o mpegaudiodsp_data.o \
   mpegaudiotabs.o
-OBJS-$(CONFIG_MP2FLOAT_DECODER)+= mpegaudiodec_float.o
-OBJS-$(CONFIG_MP3_DECODER) += mpegaudiodec_fixed.o
+OBJS-$(CONFIG_MP2FLOAT_DECODER)+= mpegaudiodec_float.o mpegaudiodata.o
+OBJS-$(CONFIG_MP3_DECODER) += mpegaudiodec_fixed.o mpegaudiodata.o
 OBJS-$(CONFIG_MP3_MF_ENCODER)  += mfenc.o mf_utils.o
 OBJS-$(CONFIG_MP3ADU_DECODER)  += mpegaudiodec_fixed.o
 OBJS-$(CONFIG_MP3ADUFLOAT_DECODER) += mpegaudiodec_float.o
-- 
2.33.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 v1] avformat/imf: fix bad free() when directory name of the input url is empty

2022-01-04 Thread Zane van Iperen




On 5/1/22 11:44, Pierre-Anthony Lemieux wrote:

On Tue, Jan 4, 2022 at 5:39 PM Zane van Iperen  wrote:




On 4/1/22 01:59, p...@sandflow.com wrote:

From: Pierre-Anthony Lemieux 

Signed-off-by: Pierre-Anthony Lemieux 
---

Notes:
  Found through manual fuzzing.

   libavformat/imfdec.c | 6 +-
   1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c
index f17064cfcd..4e42db8d30 100644
--- a/libavformat/imfdec.c
+++ b/libavformat/imfdec.c
@@ -622,11 +622,15 @@ static int imf_read_header(AVFormatContext *s)
   int ret = 0;

   c->interrupt_callback = >interrupt_callback;
+
   tmp_str = av_strdup(s->url);
   if (!tmp_str)
   return AVERROR(ENOMEM);
+c->base_url = av_strdup(av_dirname(tmp_str));


Is the second av_strdup() here required? You've already done it above
and av_dirname() just sticks a '\0' at the last separator,


This is what I thought.


so it should
be safe to remove it:


As I understand it, av_dirname() actually returns a pointer to its own
"." string when the input is either empty or does not contain, in
which case we must make a copy.



You're right. This is ugly, but I don't see a nicer way to do it.

This lgtm then.



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

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


Re: [FFmpeg-devel] [PATCH v1] avformat/imf: fix bad free() when directory name of the input url is empty

2022-01-04 Thread Zane van Iperen




On 4/1/22 01:59, p...@sandflow.com wrote:

From: Pierre-Anthony Lemieux 

Signed-off-by: Pierre-Anthony Lemieux 
---

Notes:
 Found through manual fuzzing.

  libavformat/imfdec.c | 6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c
index f17064cfcd..4e42db8d30 100644
--- a/libavformat/imfdec.c
+++ b/libavformat/imfdec.c
@@ -622,11 +622,15 @@ static int imf_read_header(AVFormatContext *s)
  int ret = 0;
  
  c->interrupt_callback = >interrupt_callback;

+
  tmp_str = av_strdup(s->url);
  if (!tmp_str)
  return AVERROR(ENOMEM);
+c->base_url = av_strdup(av_dirname(tmp_str));


Is the second av_strdup() here required? You've already done it above
and av_dirname() just sticks a '\0' at the last separator, so it should
be safe to remove it:

  if (!(c->base_url = av_strdup(s->url)))
  return AVERROR(ENOMEM);

  c->base_url = av_dirname(c->base_url);
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH v1] avformat/imf: fix CPL parsing error handling

2022-01-04 Thread Zane van Iperen




On 4/1/22 16:10, p...@sandflow.com wrote:

From: Pierre-Anthony Lemieux 

Signed-off-by: Pierre-Anthony Lemieux 
---
  libavformat/imf_cpl.c | 51 +++
  1 file changed, 27 insertions(+), 24 deletions(-)


Could you please resend this as two separate commits? One with the change, one
with the re-indenting? It makes it easier to review (and bisect) in the future.

For reference, the effective change is:

diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c
index 28798d3e36..366a1be9e2 100644
--- a/libavformat/imf_cpl.c
+++ b/libavformat/imf_cpl.c
@@ -807,7 +807,9 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl)
 av_log(NULL, AV_LOG_ERROR, "Cannot read IMF CPL\n");
 if (ret == 0)
 ret = AVERROR_INVALIDDATA;
-} else {
+goto clean_up;
+}
+
 LIBXML_TEST_VERSION
 
 filesize = buf.len;

@@ -817,6 +819,7 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl)
AV_LOG_ERROR,
"XML parsing failed when reading the IMF CPL\n");
 ret = AVERROR_INVALIDDATA;
+goto clean_up;
 }
 
 if ((ret = ff_imf_parse_cpl_from_xml_dom(doc, cpl))) {

@@ -833,8 +836,8 @@ int ff_imf_parse_cpl(AVIOContext *in, FFIMFCPL **cpl)
 }
 
 xmlFreeDoc(doc);

-}
 
+clean_up:

 av_bprint_finalize(, NULL);
 
 return ret;




+av_log(NULL,
+AV_LOG_INFO,
+"IMF CPL Id: " FF_IMF_UUID_FORMAT "\n",
+UID_ARG((*cpl)->id_uuid));
+}
+
+xmlFreeDoc(doc);
+


Trailing whitespace here.


___
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] Changelog: add IMF demuxer

2022-01-04 Thread Zane van Iperen
Suggested-By: Pierre-Anthony Lemieux 
Signed-off-by: Zane van Iperen 
---
 Changelog | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Changelog b/Changelog
index edb4152d0f..8e11fe6d35 100644
--- a/Changelog
+++ b/Changelog
@@ -44,6 +44,7 @@ version :
 - yadif_videotoolbox filter
 - VideoToolbox ProRes encoder
 - anlmf audio filter
+- IMF demuxer (experimental)
 
 
 version 4.4:
-- 
2.33.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 v1] avformat/imf: fix error CPL root element is absent

2022-01-04 Thread Zane van Iperen




On 4/1/22 16:11, p...@sandflow.com wrote:

  cpl_element = xmlDocGetRootElement(doc);
-if (xmlStrcmp(cpl_element->name, "CompositionPlaylist")) {
+if ((!cpl_element) || xmlStrcmp(cpl_element->name, "CompositionPlaylist")) 
{


Nit: Extra set of parens around "!cpl_element".

Otherwise, this lgtm, I'll apply and backport this soon with that change.


___
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/tests/imf: Don't use uninitialized value

2022-01-04 Thread Zane van Iperen




On 4/1/22 19:25, Andreas Rheinhardt wrote:

Signed-off-by: Andreas Rheinhardt 
---
I'll apply this pretty soon.


lgtm, Please do.

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

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


Re: [FFmpeg-devel] [PATCH v1] avformat/imf: Fix error handling in set_context_streams_from_tracks()

2022-01-03 Thread Zane van Iperen
On Monday, 3 January 2022 3:22:26 AM AEST p...@sandflow.com wrote:
> From: Pierre-Anthony Lemieux 
> 
> Signed-off-by: Pierre-Anthony Lemieux 
> ---
>  libavformat/imfdec.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c
> index f17064cfcd..da8c6cddea 100644
> --- a/libavformat/imfdec.c
> +++ b/libavformat/imfdec.c
> @@ -564,9 +564,8 @@ static int 
> set_context_streams_from_tracks(AVFormatContext *s)
>  /* Copy stream information */
>  asset_stream = avformat_new_stream(s, NULL);
>  if (!asset_stream) {
> -ret = AVERROR(ENOMEM);
>  av_log(s, AV_LOG_ERROR, "Could not create stream\n");
> -break;
> +return AVERROR(ENOMEM);
>  }
>  asset_stream->id = i;
>  ret = avcodec_parameters_copy(asset_stream->codecpar, 
> first_resource_stream->codecpar);
> 

lgtm


___
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] configure: Make IMF demuxer require MXF demuxer

2022-01-03 Thread Zane van Iperen
On Monday, 3 January 2022 4:19:05 PM AEST Andreas Rheinhardt wrote:
> The former is useless without the latter.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  configure | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/configure b/configure
> index 6ad70b9f7b..e2ea473565 100755
> --- a/configure
> +++ b/configure
> @@ -3416,6 +3416,7 @@ hls_muxer_suggest="gcrypt openssl"
>  image2_alias_pix_demuxer_select="image2_demuxer"
>  image2_brender_pix_demuxer_select="image2_demuxer"
>  imf_demuxer_deps="libxml2"
> +imf_demuxer_select="mxf_demuxer"
>  ipod_muxer_select="mov_muxer"
>  ismv_muxer_select="mov_muxer"
>  ivf_muxer_select="av1_metadata_bsf vp9_superframe_bsf"
> 

lgtm


___
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] 5.0 release

2022-01-02 Thread Zane van Iperen




On 3/1/22 01:09, James Almer wrote:



Reverting something in the release branch is already going to be dirty
no matter what, because we do a minor bump to ensure the release has its
own soname. Right now that'd mean 5.0 will be lavf 59.13, while lacking
a demuxer available in lavf 59.12


Depends on what you mean by "lacking a demuxer"... One (hacky) option would
be to replace it with a stub implementation that always fails.


Or tag it as experimental.



That's much better. If we're not willing to wait, then I suggest we do this.



Also, unless ossfuzz compiles with libxml2 enabled, we're not going to see any 
kind of fuzzing for imf from it.



I just checked - it doesn't. I'm adding it and will send a PR.
___
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] 5.0 release

2022-01-02 Thread Zane van Iperen
On Monday, 3 January 2022 12:29:02 AM AEST James Almer wrote:

> > There were some disagreements on IRC a few days ago about what should
> > and should not go into the release because of insufficient fuzzing and
> > the danger of introducing security issues.
> > 
> > To avoid conflicts around this in the future, I'd suggest (for future
> > releases) to create the release branch a significant time (e.g. a month)
> > before doing the actual release.
> > 
> > Opinions?
> 
> It's a good idea, but we need to be strict about it. As in, we need to 
> state that the moment the branch is made it's a definite feature freeze, 
> and only fixes, documentation changes and similar may be cherry-picked 
> into it (meaning nothing that usually comes with a version bump, even if 
> micro), much like we do for a point release, even if the initial release 
> was not tagged yet.
> 

I completely agree, this is a *very* good idea. If people treat it like
an existing release branch, i.e. only bugfixes, etc., then it would
save this from happening again.

Also means there wouldn't need to be a "don't add big things" announcement
_somewhere_ on the ML.

> Reverting something in the release branch is already going to be dirty 
> no matter what, because we do a minor bump to ensure the release has its 
> own soname. Right now that'd mean 5.0 will be lavf 59.13, while lacking 
> a demuxer available in lavf 59.12

Depends on what you mean by "lacking a demuxer"... One (hacky) option would
be to replace it with a stub implementation that always fails.

Or we could just branch off at 7cee3b3718 and cherry-pick anything we need back.
There's only like four commits that need it (so far): 2f6360ff21, 9cfc7a2440,
c417616762, and d6b2357edd.




___
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 v15 1/2] avformat/imf: Demuxer

2021-12-31 Thread Zane van Iperen




On 31/12/21 21:19, Paul B Mahol wrote:

++i instead of i++



You're right, I missed that. I'll submit a patch.
___
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 v15 1/2] avformat/imf: Demuxer

2021-12-31 Thread Zane van Iperen




On 31/12/21 19:40, Paul B Mahol wrote:

Why was this applied?




Both patches lgtm, I'll apply in a few days if no objections.



No one objected.



It still breaks style of ffmpeg code, just from quick glance.


Which parts specifically?

The main potential issue I can see is the long scanf() in 
ff_imf_xml_read_uuid().
This, however, is only temporary as Pierre is working on replacing all the 
ad-hoc UUID
stuff in ffmpeg with libuuid.

If it's the av_log()s with parameters on newlines, that's also done in 
libavcodec/videotoolboxenc.c.

If we're really *that* pedantic about it, I'll reformat things myself and 
submit a patch...


Please revert or I leave this project forever.



This is the internet, humor doesn't survive over email.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] avcodec: add ADPCM IMA Ubisoft decoder

2021-12-30 Thread Zane van Iperen

Ping. Will apply (with the minor version bump I forgot) in a few days.

On 28/12/21 15:37, Zane van Iperen wrote:

A simple, interleaved variant, but with initial state and
extra, uncompressed samples. Found in Ubisoft soundbanks from
early-2000's games (Splinter Cell, RS3, etc.)

Signed-off-by: Zane van Iperen 
---
  Changelog |  1 +
  doc/general_contents.texi |  1 +
  libavcodec/Makefile   |  1 +
  libavcodec/adpcm.c| 69 +++
  libavcodec/allcodecs.c|  1 +
  libavcodec/codec_desc.c   |  7 
  libavcodec/codec_id.h |  1 +
  7 files changed, 81 insertions(+)

diff --git a/Changelog b/Changelog
index edb4152d0f..58be0b9da5 100644
--- a/Changelog
+++ b/Changelog
@@ -44,6 +44,7 @@ version :
  - yadif_videotoolbox filter
  - VideoToolbox ProRes encoder
  - anlmf audio filter
+- ADPCM IMA Ubisoft decoder
  
  
  version 4.4:

diff --git a/doc/general_contents.texi b/doc/general_contents.texi
index df1692c8df..80506e8ab4 100644
--- a/doc/general_contents.texi
+++ b/doc/general_contents.texi
@@ -1139,6 +1139,7 @@ following image formats are supported:
  @item ADPCM IMA High Voltage Software ALP  @tab  X  @tab  X
  @item ADPCM IMA QuickTime@tab  X  @tab  X
  @item ADPCM IMA Simon & Schuster Interactive   @tab  X  @tab  X
+@item ADPCM IMA Ubisoft  @tab @tab  X
  @item ADPCM IMA Ubisoft APM  @tab  X  @tab  X
  @item ADPCM IMA Loki SDL MJPEG  @tab @tab  X
  @item ADPCM IMA WAV  @tab  X  @tab  X
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 9577062eec..52839e1994 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -899,6 +899,7 @@ OBJS-$(CONFIG_ADPCM_IMA_RAD_DECODER)  += adpcm.o 
adpcm_data.o
  OBJS-$(CONFIG_ADPCM_IMA_SSI_DECODER)  += adpcm.o adpcm_data.o
  OBJS-$(CONFIG_ADPCM_IMA_SSI_ENCODER)  += adpcmenc.o adpcm_data.o
  OBJS-$(CONFIG_ADPCM_IMA_SMJPEG_DECODER)   += adpcm.o adpcm_data.o
+OBJS-$(CONFIG_ADPCM_IMA_UBISOFT_DECODER)  += adpcm.o adpcm_data.o
  OBJS-$(CONFIG_ADPCM_IMA_WAV_DECODER)  += adpcm.o adpcm_data.o
  OBJS-$(CONFIG_ADPCM_IMA_WAV_ENCODER)  += adpcmenc.o adpcm_data.o
  OBJS-$(CONFIG_ADPCM_IMA_WS_DECODER)   += adpcm.o adpcm_data.o
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index cfde5f58b9..410fea8e21 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -239,6 +239,7 @@ static const int8_t mtf_index_table[16] = {
  typedef struct ADPCMDecodeContext {
  ADPCMChannelStatus status[14];
  int vqa_version;/**< VQA version. Used for ADPCM_IMA_WS */
+int extra_count;/**< Number of raw PCM samples to send */
  int has_status; /**< Status flag. Reset to 0 after a 
flush. */
  } ADPCMDecodeContext;
  
@@ -301,6 +302,13 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)

  if (avctx->bits_per_coded_sample != 4 || avctx->block_align != 17 * 
avctx->channels)
  return AVERROR_INVALIDDATA;
  break;
+case AV_CODEC_ID_ADPCM_IMA_UBISOFT:
+if (c->extra_count < 0)
+return AVERROR_INVALIDDATA;
+
+if (c->extra_count > 0 && c->extra_count % avctx->channels != 0)
+return AVERROR_INVALIDDATA;
+break;
  case AV_CODEC_ID_ADPCM_ZORK:
  if (avctx->bits_per_coded_sample != 8)
  return AVERROR_INVALIDDATA;
@@ -877,6 +885,10 @@ static int get_nb_samples(AVCodecContext *avctx, 
GetByteContext *gb,
  case AV_CODEC_ID_ADPCM_IMA_MTF:
  nb_samples = buf_size * 2 / ch;
  break;
+/* simple 4-bit adpcm, with extra uncompressed samples */
+case AV_CODEC_ID_ADPCM_IMA_UBISOFT:
+nb_samples = (buf_size * 2 + s->extra_count) / ch;
+break;
  }
  if (nb_samples)
  return nb_samples;
@@ -1460,6 +1472,35 @@ static int adpcm_decode_frame(AVCodecContext *avctx, 
void *data,
  *samples++ = adpcm_ima_qt_expand_nibble(>status[st], v & 0x0F);
  }
  ) /* End of CASE */
+CASE(ADPCM_IMA_UBISOFT,
+if (c->extra_count) {
+int offset = avctx->extradata[0] == 6 ? 36 : 28;
+nb_samples -= c->extra_count / avctx->channels;
+
+for (uint8_t *extra = avctx->extradata + offset; c->extra_count--; 
extra += 2) {
+if (avctx->extradata[0] == 3)
+*samples++ = AV_RB16(extra);
+else
+*samples++ = AV_RL16(extra);
+}
+
+/* NB: This is enforced above. */
+if (avctx->channels == 1) {
+c->status[0].predictor = samples[-1];
+} else {
+c->status[0].predictor = samples[-2];
+c->status[1].predictor = samples[-1];
+}
+
+c->extra_count = 0;
+}
+
+for (int n = nb_samples >> (1 - st); n > 0; n--) {
+   

[FFmpeg-devel] [PATCH] avcodec: add ADPCM IMA Ubisoft decoder

2021-12-27 Thread Zane van Iperen
A simple, interleaved variant, but with initial state and
extra, uncompressed samples. Found in Ubisoft soundbanks from
early-2000's games (Splinter Cell, RS3, etc.)

Signed-off-by: Zane van Iperen 
---
 Changelog |  1 +
 doc/general_contents.texi |  1 +
 libavcodec/Makefile   |  1 +
 libavcodec/adpcm.c| 69 +++
 libavcodec/allcodecs.c|  1 +
 libavcodec/codec_desc.c   |  7 
 libavcodec/codec_id.h |  1 +
 7 files changed, 81 insertions(+)

diff --git a/Changelog b/Changelog
index edb4152d0f..58be0b9da5 100644
--- a/Changelog
+++ b/Changelog
@@ -44,6 +44,7 @@ version :
 - yadif_videotoolbox filter
 - VideoToolbox ProRes encoder
 - anlmf audio filter
+- ADPCM IMA Ubisoft decoder
 
 
 version 4.4:
diff --git a/doc/general_contents.texi b/doc/general_contents.texi
index df1692c8df..80506e8ab4 100644
--- a/doc/general_contents.texi
+++ b/doc/general_contents.texi
@@ -1139,6 +1139,7 @@ following image formats are supported:
 @item ADPCM IMA High Voltage Software ALP  @tab  X  @tab  X
 @item ADPCM IMA QuickTime@tab  X  @tab  X
 @item ADPCM IMA Simon & Schuster Interactive   @tab  X  @tab  X
+@item ADPCM IMA Ubisoft  @tab @tab  X
 @item ADPCM IMA Ubisoft APM  @tab  X  @tab  X
 @item ADPCM IMA Loki SDL MJPEG  @tab @tab  X
 @item ADPCM IMA WAV  @tab  X  @tab  X
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 9577062eec..52839e1994 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -899,6 +899,7 @@ OBJS-$(CONFIG_ADPCM_IMA_RAD_DECODER)  += adpcm.o 
adpcm_data.o
 OBJS-$(CONFIG_ADPCM_IMA_SSI_DECODER)  += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_IMA_SSI_ENCODER)  += adpcmenc.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_IMA_SMJPEG_DECODER)   += adpcm.o adpcm_data.o
+OBJS-$(CONFIG_ADPCM_IMA_UBISOFT_DECODER)  += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_IMA_WAV_DECODER)  += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_IMA_WAV_ENCODER)  += adpcmenc.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_IMA_WS_DECODER)   += adpcm.o adpcm_data.o
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index cfde5f58b9..410fea8e21 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -239,6 +239,7 @@ static const int8_t mtf_index_table[16] = {
 typedef struct ADPCMDecodeContext {
 ADPCMChannelStatus status[14];
 int vqa_version;/**< VQA version. Used for ADPCM_IMA_WS */
+int extra_count;/**< Number of raw PCM samples to send */
 int has_status; /**< Status flag. Reset to 0 after a 
flush. */
 } ADPCMDecodeContext;
 
@@ -301,6 +302,13 @@ static av_cold int adpcm_decode_init(AVCodecContext * 
avctx)
 if (avctx->bits_per_coded_sample != 4 || avctx->block_align != 17 * 
avctx->channels)
 return AVERROR_INVALIDDATA;
 break;
+case AV_CODEC_ID_ADPCM_IMA_UBISOFT:
+if (c->extra_count < 0)
+return AVERROR_INVALIDDATA;
+
+if (c->extra_count > 0 && c->extra_count % avctx->channels != 0)
+return AVERROR_INVALIDDATA;
+break;
 case AV_CODEC_ID_ADPCM_ZORK:
 if (avctx->bits_per_coded_sample != 8)
 return AVERROR_INVALIDDATA;
@@ -877,6 +885,10 @@ static int get_nb_samples(AVCodecContext *avctx, 
GetByteContext *gb,
 case AV_CODEC_ID_ADPCM_IMA_MTF:
 nb_samples = buf_size * 2 / ch;
 break;
+/* simple 4-bit adpcm, with extra uncompressed samples */
+case AV_CODEC_ID_ADPCM_IMA_UBISOFT:
+nb_samples = (buf_size * 2 + s->extra_count) / ch;
+break;
 }
 if (nb_samples)
 return nb_samples;
@@ -1460,6 +1472,35 @@ static int adpcm_decode_frame(AVCodecContext *avctx, 
void *data,
 *samples++ = adpcm_ima_qt_expand_nibble(>status[st], v & 0x0F);
 }
 ) /* End of CASE */
+CASE(ADPCM_IMA_UBISOFT,
+if (c->extra_count) {
+int offset = avctx->extradata[0] == 6 ? 36 : 28;
+nb_samples -= c->extra_count / avctx->channels;
+
+for (uint8_t *extra = avctx->extradata + offset; c->extra_count--; 
extra += 2) {
+if (avctx->extradata[0] == 3)
+*samples++ = AV_RB16(extra);
+else
+*samples++ = AV_RL16(extra);
+}
+
+/* NB: This is enforced above. */
+if (avctx->channels == 1) {
+c->status[0].predictor = samples[-1];
+} else {
+c->status[0].predictor = samples[-2];
+c->status[1].predictor = samples[-1];
+}
+
+c->extra_count = 0;
+}
+
+for (int n = nb_samples >> (1 - st); n > 0; n--) {
+int v = bytestream2_get_byteu();
+*samples++ = adpcm_ima_expand_nibble(>status[0],  v >> 4,   3);
+*samples++ =

Re: [FFmpeg-devel] [PATCH v15 1/2] avformat/imf: Demuxer

2021-12-27 Thread Zane van Iperen




On 27/12/21 10:47, p...@sandflow.com wrote:

From: Pierre-Anthony Lemieux 

Signed-off-by: Pierre-Anthony Lemieux 
---

Notes:
 The IMF demuxer accepts as input an IMF CPL. The assets referenced by the 
CPL can be
 contained in multiple deliveries, each defined by an ASSETMAP file:
 
 ffmpeg -assetmaps ,,... -i 
 
 If -assetmaps is not specified, FFMPEG looks for a file called ASSETMAP.xml in the same directory as the CPL.
 
 EXAMPLE:

 ffmpeg -i 
http://ffmpeg-imf-samples-public.s3-website-us-west-1.amazonaws.com/countdown/CPL_f5095caa-f204-4e1c-8a84-7af48c7ae16b.xml
 out.mp4
 
 The Interoperable Master Format (IMF) is a file-based media format for the

 delivery and storage of professional audio-visual masters.
 An IMF Composition consists of an XML playlist (the Composition Playlist)
 and a collection of MXF files (the Track Files). The Composition Playlist 
(CPL)
 assembles the Track Files onto a timeline, which consists of multiple 
tracks.
 The location of the Track Files referenced by the Composition Playlist is 
stored
 in one or more XML documents called Asset Maps. More details at 
https://www.imfug.com/explainer.
 The IMF standard was first introduced in 2013 and is managed by the SMPTE.
 
 CHANGE NOTES:
 
 - improve code style


  MAINTAINERS  |   1 +
  configure|   3 +-
  doc/demuxers.texi|   6 +
  libavformat/Makefile |   1 +
  libavformat/allformats.c |   1 +
  libavformat/imf.h| 207 +
  libavformat/imf_cpl.c| 841 
  libavformat/imfdec.c | 899 +++
  8 files changed, 1958 insertions(+), 1 deletion(-)
  create mode 100644 libavformat/imf.h
  create mode 100644 libavformat/imf_cpl.c
  create mode 100644 libavformat/imfdec.c



Both patches lgtm, I'll apply in a few days if no objections.

___
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] GitHub Integration

2021-12-27 Thread Zane van Iperen




On 27/12/21 11:41, lance.lmw...@gmail.com wrote:

On Sun, Dec 26, 2021 at 04:37:54PM -0500, Ronald S. Bultje wrote:

Hi,

On Sun, Dec 26, 2021 at 3:21 PM Soft Works  wrote:


I'm not sure. My interpretation of Lance' and Steven's comments would
be that they'd prefer to stick to the ML.



No, it's not strictly related to that - they want something that is CLI
accessible. Gitlab has this here: https://glab.readthedocs.io/en/latest/
and github has this here: https://github.com/cli/cli - the next question is
whether the gitlab/hub hosts are blocked by a firewall (no idea) and/or
whether the instances are self-hosted (github: no, gitlab-videolan: yes).


Yes, self-hosted is more preferable, I recall github has blocked devleopers
in some country by US trade controls. Who knows what's the rules will be
changed someday as it's controlled by company.



Something that doesn't require another account would be nice, which is why
I like mailing lists. Although in this case a move to GitHub wouldn't affect me
personally (I use it a lot) - if I didn't, I would seriously reconsider if the 
mental
overhead of yet another account (and all the baggage that comes with it - 
passwords, MFA,
data breaches, etc.) is worth contributing to the project.

Ideally, something self-hosted like Gitea or GitLab with a federated approach 
(i.e. ForgeFed)
would be fantastic for a case such as this. I'm not sure about GitLab, but I 
know Gitea is
working towards this.


___
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 v14 1/2] avformat/imf: Demuxer

2021-12-24 Thread Zane van Iperen
Looks mostly alright, just some style nits. Once they're fixed, lgtm.

On Wednesday, 22 December 2021 4:42:08 AM AEST p...@sandflow.com wrote:

> +
> +int ff_imf_xml_read_uuid(xmlNodePtr element, uint8_t uuid[16])
> +{
> +xmlChar *element_text = NULL;
> +int scanf_ret;
> +int ret = 0;
> +
> +element_text = xmlNodeListGetString(element->doc, 
> element->xmlChildrenNode, 1);
> +scanf_ret = sscanf(element_text,
> +   FF_IMF_UUID_FORMAT,
> +   [0],
> +   [1],
> +   [2],
> +   [3],
> +   [4],
> +   [5],
> +   [6],
> +   [7],
> +   [8],
> +   [9],
> +   [10],
> +   [11],
> +   [12],
> +   [13],
> +   [14],
> +   [15]);

I'm not the biggest fan of this, but if you're doing the libuuid refactoring 
afterwards, then I'm inclined
to let it be.

> +static int fill_base_resource(xmlNodePtr resource_elem, FFIMFBaseResource 
> *resource, FFIMFCPL *cpl)
> +{
> +xmlNodePtr element = NULL;
> +int ret = 0;
> +
> +/* read EditRate */
> +if (!(element = ff_imf_xml_get_child_element_by_name(resource_elem, 
> "EditRate"))) {
> +resource->edit_rate = cpl->edit_rate;
> +} else if (ret = ff_imf_xml_read_rational(element, 
> >edit_rate)) {

When doing inline assignments, use an extra (), e.g. 
if ((ret = ff_imf_xml_read_rational(element, >edit_rate)))

> +av_log(NULL, AV_LOG_ERROR, "Invalid EditRate element found in a 
> Resource\n");
> +return ret;
> +}
> +
> +/* read EntryPoint */
> +if (element = ff_imf_xml_get_child_element_by_name(resource_elem, 
> "EntryPoint")) {
> +if (ret = ff_imf_xml_read_uint32(element, >entry_point)) {

()

> +av_log(NULL, AV_LOG_ERROR, "Invalid EntryPoint element found in 
> a Resource\n");
> +return ret;
> +}
> +} else {
> +resource->entry_point = 0;
> +}
> +
> +/* read IntrinsicDuration */
> +if (!(element = ff_imf_xml_get_child_element_by_name(resource_elem, 
> "IntrinsicDuration"))) {
> +av_log(NULL, AV_LOG_ERROR, "IntrinsicDuration element missing from 
> Resource\n");
> +return AVERROR_INVALIDDATA;
> +}
> +if (ret = ff_imf_xml_read_uint32(element, >duration)) {

()

> +av_log(NULL, AV_LOG_ERROR, "Invalid IntrinsicDuration element found 
> in a Resource\n");
> +return ret;
> +}
> +resource->duration -= resource->entry_point;
> +
> +/* read SourceDuration */
> +if (element = ff_imf_xml_get_child_element_by_name(resource_elem, 
> "SourceDuration")) {

()

> +if (ret = ff_imf_xml_read_uint32(element, >duration)) {

()

> +av_log(NULL, AV_LOG_ERROR, "SourceDuration element missing from 
> Resource\n");
> +return ret;
> +}
> +}
> +
> +/* read RepeatCount */
> +if (element = ff_imf_xml_get_child_element_by_name(resource_elem, 
> "RepeatCount"))

()

> +ret = ff_imf_xml_read_uint32(element, >repeat_count);
> +
> +return ret;
> +}
> +
> +static int fill_trackfile_resource(xmlNodePtr tf_resource_elem,
> +   FFIMFTrackFileResource *tf_resource,
> +   FFIMFCPL *cpl)
> +{
> +xmlNodePtr element = NULL;
> +int ret = 0;
> +
> +if (ret = fill_base_resource(tf_resource_elem, (FFIMFBaseResource 
> *)tf_resource, cpl))

()

> +return ret;
> +
> +/* read TrackFileId */
> +if (element = ff_imf_xml_get_child_element_by_name(tf_resource_elem, 
> "TrackFileId")) {
> +if (ret = ff_imf_xml_read_uuid(element, 
> tf_resource->track_file_uuid)) {

()

> +av_log(NULL, AV_LOG_ERROR, "Invalid TrackFileId element found in 
> Resource\n");
> +return ret;
> +}
> +} else {
> +av_log(NULL, AV_LOG_ERROR, "TrackFileId element missing from 
> Resource\n");
> +return AVERROR_INVALIDDATA;
> +}
> +
> +return ret;
> +}
> +
> +static int fill_marker_resource(xmlNodePtr marker_resource_elem,
> +FFIMFMarkerResource *marker_resource,
> +FFIMFCPL *cpl)
> +{
> +xmlNodePtr element = NULL;
> +int ret = 0;
> +
> +if (ret = fill_base_resource(marker_resource_elem, (FFIMFBaseResource 
> *)marker_resource, cpl))
> +return ret;
> +
> +/* read markers */
> +element = xmlFirstElementChild(marker_resource_elem);
> +while (element) {
> +if (xmlStrcmp(element->name, "Marker") == 0) {
> +void *tmp;
> +
> +if (marker_resource->marker_count == UINT32_MAX)
> +return AVERROR(ENOMEM);
> +tmp = av_realloc_array(marker_resource->markers,
> +   

Re: [FFmpeg-devel] [PATCH v1] avformat/aviobuf: ffio_copy_url_options

2021-12-17 Thread Zane van Iperen

Will apply tomorrow unless there are objections.



On 15/12/21 10:35, p...@sandflow.com wrote:

From: Pierre-Anthony Lemieux 

Signed-off-by: Pierre-Anthony Lemieux 
---

Notes:
 Refactors save_avio_options() from dashdec.c and hls.c
 into a common ffio_copy_url_options() in libavformat/aviobuf.c.
 
 Co-authored: Nicholas Vanderzwet 


  libavformat/avio_internal.h |  6 ++
  libavformat/aviobuf.c   | 24 
  libavformat/dashdec.c   | 27 +--
  libavformat/hls.c   | 24 +---
  4 files changed, 32 insertions(+), 49 deletions(-)

diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h
index 187433f283..1f5e3d474b 100644
--- a/libavformat/avio_internal.h
+++ b/libavformat/avio_internal.h
@@ -206,6 +206,12 @@ int ffio_fdopen(AVIOContext **s, URLContext *h);
   */
  URLContext *ffio_geturlcontext(AVIOContext *s);
  
+

+/**
+ * Read url related dictionary options from the AVIOContext and write to the 
given dictionary
+ */
+int ffio_copy_url_options(AVIOContext* pb, AVDictionary** avio_opts);
+
  /**
   * Open a write-only fake memory stream. The written data is not stored
   * anywhere - this is only used for measuring the amount of data
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 969c127b23..096f37ae23 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -1022,6 +1022,30 @@ URLContext* ffio_geturlcontext(AVIOContext *s)
  return NULL;
  }
  
+int ffio_copy_url_options(AVIOContext* pb, AVDictionary** avio_opts)

+{
+const char *opts[] = {
+"headers", "user_agent", "cookies", "http_proxy", "referer", "rw_timeout", 
"icy", NULL };
+const char **opt = opts;
+uint8_t *buf = NULL;
+int ret = 0;
+
+while (*opt) {
+if (av_opt_get(pb, *opt, AV_OPT_SEARCH_CHILDREN, ) >= 0) {
+if (buf[0] != '\0') {
+ret = av_dict_set(avio_opts, *opt, buf, 
AV_DICT_DONT_STRDUP_VAL);
+if (ret < 0)
+return ret;
+} else {
+av_freep();
+}
+}
+opt++;
+}
+
+return ret;
+}
+
  static void update_checksum(AVIOContext *s)
  {
  if (s->update_checksum && s->buf_ptr > s->checksum_ptr) {
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 983dc85d65..797fe74157 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1833,31 +1833,6 @@ end:
  return ret;
  }
  
-static int save_avio_options(AVFormatContext *s)

-{
-DASHContext *c = s->priv_data;
-const char *opts[] = {
-"headers", "user_agent", "cookies", "http_proxy", "referer", "rw_timeout", 
"icy", NULL };
-const char **opt = opts;
-uint8_t *buf = NULL;
-int ret = 0;
-
-while (*opt) {
-if (av_opt_get(s->pb, *opt, AV_OPT_SEARCH_CHILDREN, ) >= 0) {
-if (buf[0] != '\0') {
-ret = av_dict_set(>avio_opts, *opt, buf, 
AV_DICT_DONT_STRDUP_VAL);
-if (ret < 0)
-return ret;
-} else {
-av_freep();
-}
-}
-opt++;
-}
-
-return ret;
-}
-
  static int nested_io_open(AVFormatContext *s, AVIOContext **pb, const char 
*url,
int flags, AVDictionary **opts)
  {
@@ -2057,7 +2032,7 @@ static int dash_read_header(AVFormatContext *s)
  
  c->interrupt_callback = >interrupt_callback;
  
-if ((ret = save_avio_options(s)) < 0)

+if ((ret = ffio_copy_url_options(s->pb, >avio_opts)) < 0)
  return ret;
  
  if ((ret = parse_manifest(s, s->url, s->pb)) < 0)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 557faf8e8d..8c526f748f 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1717,28 +1717,6 @@ static int64_t select_cur_seq_no(HLSContext *c, struct 
playlist *pls)
  return pls->start_seq_no;
  }
  
-static int save_avio_options(AVFormatContext *s)

-{
-HLSContext *c = s->priv_data;
-static const char * const opts[] = {
-"headers", "http_proxy", "user_agent", "cookies", "referer", "rw_timeout", 
"icy", NULL };
-const char * const * opt = opts;
-uint8_t *buf;
-int ret = 0;
-
-while (*opt) {
-if (av_opt_get(s->pb, *opt, AV_OPT_SEARCH_CHILDREN | AV_OPT_ALLOW_NULL, 
) >= 0) {
-ret = av_dict_set(>avio_opts, *opt, buf,
-  AV_DICT_DONT_STRDUP_VAL);
-if (ret < 0)
-return ret;
-}
-opt++;
-}
-
-return ret;
-}
-
  static int nested_io_open(AVFormatContext *s, AVIOContext **pb, const char 
*url,
int flags, AVDictionary **opts)
  {
@@ -1884,7 +1862,7 @@ static int hls_read_header(AVFormatContext *s)
  c->first_timestamp = AV_NOPTS_VALUE;
  c->cur_timestamp = AV_NOPTS_VALUE;
  
-if ((ret = save_avio_options(s)) < 0)

+if ((ret = 

Re: [FFmpeg-devel] [PATCH v1] avformat/aviobuf: ffio_copy_url_options

2021-12-16 Thread Zane van Iperen

Dedup is always good, lgtm.


On 15/12/21 10:35, p...@sandflow.com wrote:

From: Pierre-Anthony Lemieux 

Signed-off-by: Pierre-Anthony Lemieux 
---

Notes:
 Refactors save_avio_options() from dashdec.c and hls.c
 into a common ffio_copy_url_options() in libavformat/aviobuf.c.
 
 Co-authored: Nicholas Vanderzwet 


  libavformat/avio_internal.h |  6 ++
  libavformat/aviobuf.c   | 24 
  libavformat/dashdec.c   | 27 +--
  libavformat/hls.c   | 24 +---
  4 files changed, 32 insertions(+), 49 deletions(-)

diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h
index 187433f283..1f5e3d474b 100644
--- a/libavformat/avio_internal.h
+++ b/libavformat/avio_internal.h
@@ -206,6 +206,12 @@ int ffio_fdopen(AVIOContext **s, URLContext *h);
   */
  URLContext *ffio_geturlcontext(AVIOContext *s);
  
+

+/**
+ * Read url related dictionary options from the AVIOContext and write to the 
given dictionary
+ */
+int ffio_copy_url_options(AVIOContext* pb, AVDictionary** avio_opts);
+
  /**
   * Open a write-only fake memory stream. The written data is not stored
   * anywhere - this is only used for measuring the amount of data
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 969c127b23..096f37ae23 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -1022,6 +1022,30 @@ URLContext* ffio_geturlcontext(AVIOContext *s)
  return NULL;
  }
  
+int ffio_copy_url_options(AVIOContext* pb, AVDictionary** avio_opts)

+{
+const char *opts[] = {
+"headers", "user_agent", "cookies", "http_proxy", "referer", "rw_timeout", 
"icy", NULL };
+const char **opt = opts;
+uint8_t *buf = NULL;
+int ret = 0;
+
+while (*opt) {
+if (av_opt_get(pb, *opt, AV_OPT_SEARCH_CHILDREN, ) >= 0) {
+if (buf[0] != '\0') {
+ret = av_dict_set(avio_opts, *opt, buf, 
AV_DICT_DONT_STRDUP_VAL);
+if (ret < 0)
+return ret;
+} else {
+av_freep();
+}
+}
+opt++;
+}
+
+return ret;
+}
+
  static void update_checksum(AVIOContext *s)
  {
  if (s->update_checksum && s->buf_ptr > s->checksum_ptr) {
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 983dc85d65..797fe74157 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1833,31 +1833,6 @@ end:
  return ret;
  }
  
-static int save_avio_options(AVFormatContext *s)

-{
-DASHContext *c = s->priv_data;
-const char *opts[] = {
-"headers", "user_agent", "cookies", "http_proxy", "referer", "rw_timeout", 
"icy", NULL };
-const char **opt = opts;
-uint8_t *buf = NULL;
-int ret = 0;
-
-while (*opt) {
-if (av_opt_get(s->pb, *opt, AV_OPT_SEARCH_CHILDREN, ) >= 0) {
-if (buf[0] != '\0') {
-ret = av_dict_set(>avio_opts, *opt, buf, 
AV_DICT_DONT_STRDUP_VAL);
-if (ret < 0)
-return ret;
-} else {
-av_freep();
-}
-}
-opt++;
-}
-
-return ret;
-}
-
  static int nested_io_open(AVFormatContext *s, AVIOContext **pb, const char 
*url,
int flags, AVDictionary **opts)
  {
@@ -2057,7 +2032,7 @@ static int dash_read_header(AVFormatContext *s)
  
  c->interrupt_callback = >interrupt_callback;
  
-if ((ret = save_avio_options(s)) < 0)

+if ((ret = ffio_copy_url_options(s->pb, >avio_opts)) < 0)
  return ret;
  
  if ((ret = parse_manifest(s, s->url, s->pb)) < 0)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 557faf8e8d..8c526f748f 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1717,28 +1717,6 @@ static int64_t select_cur_seq_no(HLSContext *c, struct 
playlist *pls)
  return pls->start_seq_no;
  }
  
-static int save_avio_options(AVFormatContext *s)

-{
-HLSContext *c = s->priv_data;
-static const char * const opts[] = {
-"headers", "http_proxy", "user_agent", "cookies", "referer", "rw_timeout", 
"icy", NULL };
-const char * const * opt = opts;
-uint8_t *buf;
-int ret = 0;
-
-while (*opt) {
-if (av_opt_get(s->pb, *opt, AV_OPT_SEARCH_CHILDREN | AV_OPT_ALLOW_NULL, 
) >= 0) {
-ret = av_dict_set(>avio_opts, *opt, buf,
-  AV_DICT_DONT_STRDUP_VAL);
-if (ret < 0)
-return ret;
-}
-opt++;
-}
-
-return ret;
-}
-
  static int nested_io_open(AVFormatContext *s, AVIOContext **pb, const char 
*url,
int flags, AVDictionary **opts)
  {
@@ -1884,7 +1862,7 @@ static int hls_read_header(AVFormatContext *s)
  c->first_timestamp = AV_NOPTS_VALUE;
  c->cur_timestamp = AV_NOPTS_VALUE;
  
-if ((ret = save_avio_options(s)) < 0)

+if ((ret = ffio_copy_url_options(s->pb, 

Re: [FFmpeg-devel] [PATCH v10 1/2] avformat/imf: Demuxer

2021-12-14 Thread Zane van Iperen

Does anyone have any particularly strong feelings against this?

I see nothing obviously wrong with it. The UUID and XML discussion can be 
finished later,
so I see no reason why this shouldn't make it in time for the 5.0 release.

I'll apply this weekend if no objections.

On 13/12/21 15:43, p...@sandflow.com wrote:

From: Pierre-Anthony Lemieux 

Signed-off-by: Pierre-Anthony Lemieux 
---

Notes:
 The IMF demuxer accepts as input an IMF CPL. The assets referenced by the 
CPL can be
 contained in multiple deliveries, each defined by an ASSETMAP file:
 
 ffmpeg -assetmaps ,,... -i 
 
 If -assetmaps is not specified, FFMPEG looks for a file called ASSETMAP.xml in the same directory as the CPL.
 
 EXAMPLE:

 ffmpeg -i 
http://ffmpeg-imf-samples-public.s3-website-us-west-1.amazonaws.com/countdown/CPL_f5095caa-f204-4e1c-8a84-7af48c7ae16b.xml
 out.mp4
 
 The Interoperable Master Format (IMF) is a file-based media format for the

 delivery and storage of professional audio-visual masters.
 An IMF Composition consists of an XML playlist (the Composition Playlist)
 and a collection of MXF files (the Track Files). The Composition Playlist 
(CPL)
 assembles the Track Files onto a timeline, which consists of multiple 
tracks.
 The location of the Track Files referenced by the Composition Playlist is 
stored
 in one or more XML documents called Asset Maps. More details at 
https://www.imfug.com/explainer.
 The IMF standard was first introduced in 2013 and is managed by the SMPTE.
 
 CHANGE NOTES:
 
 - add imf_probe

 - improve imf-specific function names

  MAINTAINERS  |   1 +
  configure|   3 +-
  doc/demuxers.texi|   6 +
  libavformat/Makefile |   1 +
  libavformat/allformats.c |   1 +
  libavformat/imf.h| 207 +
  libavformat/imf_cpl.c| 782 +
  libavformat/imfdec.c | 905 +++
  8 files changed, 1905 insertions(+), 1 deletion(-)
  create mode 100644 libavformat/imf.h
  create mode 100644 libavformat/imf_cpl.c
  create mode 100644 libavformat/imfdec.c

diff --git a/MAINTAINERS b/MAINTAINERS
index dcac46003e..7a6972fe1a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -433,6 +433,7 @@ Muxers/Demuxers:
idroqdec.cMike Melanson
iff.c Jaikrishnan Menon
img2*.c   Michael Niedermayer
+  imf*.cMarc-Antoine Arnaud, Pierre-Anthony 
Lemieux, Valentin Noël
ipmovie.c Mike Melanson
ircam*Paul B Mahol
iss.c Stefan Gehrer
diff --git a/configure b/configure
index a7593ec2db..aa8bae4d62 100755
--- a/configure
+++ b/configure
@@ -298,7 +298,7 @@ External library support:
--enable-libxvid enable Xvid encoding via xvidcore,
 native MPEG-4/Xvid encoder exists [no]
--enable-libxml2 enable XML parsing using the C library libxml2, 
needed
-   for dash demuxing support [no]
+   for dash and imf demuxing support [no]
--enable-libzimg enable z.lib, needed for zscale filter [no]
--enable-libzmq  enable message passing via libzmq [no]
--enable-libzvbi enable teletext support via libzvbi [no]
@@ -3400,6 +3400,7 @@ hls_muxer_select="mpegts_muxer"
  hls_muxer_suggest="gcrypt openssl"
  image2_alias_pix_demuxer_select="image2_demuxer"
  image2_brender_pix_demuxer_select="image2_demuxer"
+imf_demuxer_deps="libxml2"
  ipod_muxer_select="mov_muxer"
  ismv_muxer_select="mov_muxer"
  ivf_muxer_select="av1_metadata_bsf vp9_superframe_bsf"
diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index cab8a7072c..655704d2c4 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -267,6 +267,12 @@ which streams to actually receive.
  Each stream mirrors the @code{id} and @code{bandwidth} properties from the
  @code{} as metadata keys named "id" and "variant_bitrate" 
respectively.
  
+@section imf

+
+Interoperable Master Format demuxer.
+
+This demuxer presents audio and video streams found in an IMF Composition.
+
  @section flv, live_flv, kux
  
  Adobe Flash Video Format demuxer.

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 2b5caf9d33..7f058f3ea0 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -285,6 +285,7 @@ OBJS-$(CONFIG_IMAGE_WEBP_PIPE_DEMUXER)+= img2dec.o 
img2.o
  OBJS-$(CONFIG_IMAGE_XBM_PIPE_DEMUXER) += img2dec.o img2.o
  OBJS-$(CONFIG_IMAGE_XPM_PIPE_DEMUXER) += img2dec.o img2.o
  OBJS-$(CONFIG_IMAGE_XWD_PIPE_DEMUXER) += img2dec.o img2.o
+OBJS-$(CONFIG_IMF_DEMUXER)   += imfdec.o imf_cpl.o
  OBJS-$(CONFIG_INGENIENT_DEMUXER) += ingenientdec.o rawdec.o
  OBJS-$(CONFIG_IPMOVIE_DEMUXER)   += 

Re: [FFmpeg-devel] [PATCH v9 1/2] avformat/imf: Demuxer

2021-12-12 Thread Zane van Iperen



On 9/12/21 13:55, p...@sandflow.com wrote:


+
+#define FF_UUID_FORMAT\
+"urn:uuid:%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-" \
+"%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
+
+/**
+ * UUID as defined in IETF RFC 422
+ */
+typedef uint8_t FFUUID[16];
+


Perhaps change to FF_IMF_UUID_FORMAT and FFIMFUUID, unless you intend these
to be used for all of FFmpeg?

I also agree with Lynne that we shouldn't ad-hoc UUIDs. libuuid is nice
and wouldn't be too bad to add as a dependency. It'll also be handy if
some other part needs to handle UUIDs in the future.

Even though it might not support "urn:uuid:", you can just offset the pointer
before giving it to uuid_parse (or uuid_parse_range).

Alternatively, if all you need to do is compare them, could you not
just compare the raw strings, skipping the parsing entirely?


+/**
+ * Parse an IMF CompositionPlaylist element into the FFIMFCPL data structure.
+ * @param[in] doc An XML document from which the CPL is read.
+ * @param[out] cpl Pointer to a memory area (allocated by the client), where 
the
+ *  function writes a pointer to the newly constructed FFIMFCPL structure (or
+ *  NULL if the CPL could not be parsed). The client is responsible for freeing
+ *  the FFIMFCPL structure using ff_imf_cpl_free().
+ * @return A non-zero value in case of an error.
+ */
+int ff_parse_imf_cpl_from_xml_dom(xmlDocPtr doc, FFIMFCPL **cpl);
+


ff_imf_parse_cpl_from_xml_dom(), ff_parse_* is taken.
Also for consistency with everything else.


+/**
+ * Parse an IMF Composition Playlist document into the FFIMFCPL data structure.
+ * @param[in] in The context from which the CPL is read.
+ * @param[out] cpl Pointer to a memory area (allocated by the client), where 
the
+ * function writes a pointer to the newly constructed FFIMFCPL structure (or
+ * NULL if the CPL could not be parsed). The client is responsible for freeing
+ * the FFIMFCPL structure using ff_imf_cpl_free().
+ * @return A non-zero value in case of an error.
+ */
+int ff_parse_imf_cpl(AVIOContext *in, FFIMFCPL **cpl);
+


Ditto.


+/**
+ * Reads an unsigned 32-bit integer from an XML element
+ * @return 0 on success, < 0 AVERROR code on error.
+ */
+int ff_xml_read_uint32(xmlNodePtr element, uint32_t *number);
+
+/**
+ * Reads an AVRational from an XML element
+ * @return 0 on success, < 0 AVERROR code on error.
+ */
+int ff_xml_read_rational(xmlNodePtr element, AVRational *rational);
+
+/**
+ * Reads a UUID from an XML element
+ * @return 0 on success, < 0 AVERROR code on error.
+ */
+int ff_xml_read_uuid(xmlNodePtr element, uint8_t uuid[16]);
+
+/**
+ * Returns the first child element with the specified local name
+ * @return A pointer to the child element, or NULL if no such child element 
exists.
+ */
+xmlNodePtr ff_xml_get_child_element_by_name(xmlNodePtr parent, const char 
*name_utf8);
+


If these are only used for IMF, then ff_imf_xml_*().
Afaik FFmpeg doesn't have any centralised XML helpers (and perhaps it should, 
there's a few
things that use libxml from a quick grep).


+
+const AVInputFormat ff_imf_demuxer = {
+.name   = "imf",
+.long_name  = NULL_IF_CONFIG_SMALL("IMF (Interoperable Master 
Format)"),
+.flags_internal = FF_FMT_INIT_CLEANUP,
+.priv_class = _class,
+.priv_data_size = sizeof(IMFContext),
+.read_header= imf_read_header,
+.read_packet= imf_read_packet,
+.read_close = imf_close,
+.extensions = "xml",


I'm a bit apprehensive about this. This will unconditionally set all XML files 
as imf.
How difficult would it be to add a probe function?


+.mime_type  = "application/xml,text/xml",
+};


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

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


Re: [FFmpeg-devel] [PATCH v2] avformat/scd: add demuxer

2021-11-29 Thread Zane van Iperen

Ping, will apply in a few days if no objections.



On 27/11/21 13:51, Zane van Iperen wrote:

Adds demuxer for Square Enux SCD files.

Based off [1] and personal investigation.

This has only been tested against Drakengard 3 (PS3) *_SCD.XXX files
(big-endian). As it is highly likely that FFXIV (PC) files are little-endian,
this demuxer is marked as experimental until this can be confirmed.

[1]: http://ffxivexplorer.fragmenterworks.com/research/scd%20files.txt

Signed-off-by: Zane van Iperen 
---
  libavformat/Makefile |   1 +
  libavformat/allformats.c |   1 +
  libavformat/scd.c| 378 +++
  3 files changed, 380 insertions(+)
  create mode 100644 libavformat/scd.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index a19d2e0c88..2b5caf9d33 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -501,6 +501,7 @@ OBJS-$(CONFIG_SBC_MUXER) += rawenc.o
  OBJS-$(CONFIG_SBG_DEMUXER)   += sbgdec.o
  OBJS-$(CONFIG_SCC_DEMUXER)   += sccdec.o subtitles.o
  OBJS-$(CONFIG_SCC_MUXER) += sccenc.o subtitles.o
+OBJS-$(CONFIG_SCD_DEMUXER)   += scd.o
  OBJS-$(CONFIG_SDP_DEMUXER)   += rtsp.o
  OBJS-$(CONFIG_SDR2_DEMUXER)  += sdr2.o
  OBJS-$(CONFIG_SDS_DEMUXER)   += sdsdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index cbfadcb639..1054ac9667 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -392,6 +392,7 @@ extern const AVOutputFormat ff_sbc_muxer;
  extern const AVInputFormat  ff_sbg_demuxer;
  extern const AVInputFormat  ff_scc_demuxer;
  extern const AVOutputFormat ff_scc_muxer;
+extern const AVInputFormat  ff_scd_demuxer;
  extern const AVInputFormat  ff_sdp_demuxer;
  extern const AVInputFormat  ff_sdr2_demuxer;
  extern const AVInputFormat  ff_sds_demuxer;
diff --git a/libavformat/scd.c b/libavformat/scd.c
new file mode 100644
index 00..0ed5322a14
--- /dev/null
+++ b/libavformat/scd.c
@@ -0,0 +1,378 @@
+/*
+ * Square Enix SCD demuxer
+ * Copyright (C) 2021 Zane van Iperen (z...@zanevaniperen.com)
+ *
+ * Based off documentation:
+ *   http://ffxivexplorer.fragmenterworks.com/research/scd%20files.txt
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include "libavutil/avstring.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/internal.h"
+#include "libavutil/macros.h"
+#include "libavutil/avassert.h"
+#include "libavformat/internal.h"
+#include "avformat.h"
+
+#define SCD_MAGIC  ((uint64_t)MKBETAG('S', 'E', 'D', 'B') << 32 | \
+  MKBETAG('S', 'S', 'C', 'F'))
+#define SCD_MIN_HEADER_SIZE20
+#define SCD_OFFSET_HEADER_SIZE 28
+#define SCD_TRACK_HEADER_SIZE  32
+
+#define SCD_TRACK_ID_PCM0
+#define SCD_TRACK_ID_OGG6
+#define SCD_TRACK_ID_MP37
+#define SCD_TRACK_ID_MS_ADPCM  12
+
+typedef struct SCDOffsetTable {
+uint16_t  count;
+uint32_t  offset;
+uint32_t *entries;
+} SCDOffsetTable;
+
+typedef struct SCDHeader {
+uint64_t magic; /* SEDBSSCF */
+uint32_t version;   /* Verison number. We only know about 3.*/
+uint16_t unk1;  /* Unknown, 260 in Drakengard 3, 1024 in FFXIV. */
+uint16_t header_size;   /* Total size of this header.   */
+uint32_t file_size; /* Is often 0, just ignore it.  */
+
+SCDOffsetTable table0;  /* Table 0, no idea. 56 uint32's/entry. */
+SCDOffsetTable table1;  /* Table 1, contains the track info.*/
+SCDOffsetTable table2;  /* Table 2, no idea. 40 uint32's/entry. */
+uint16_t unk2;  /* Unknown, not a count.*/
+uint32_t unk3;  /* Unknown, not an offset.  */
+uint32_t unk4;  /* Unknown, offset to offset.   */
+} SCDHeader;
+
+typedef struct SCDTrackHeader {
+uint32_t length;
+uint32_t num_channels;
+uint32_t sample_rate;
+uint32_t data_type;
+uint32_t loop_start;
+uint32_t loop_end;
+uint32_t data_offset; 

[FFmpeg-devel] [PATCH v2] avformat/scd: add demuxer

2021-11-26 Thread Zane van Iperen
Adds demuxer for Square Enux SCD files.

Based off [1] and personal investigation.

This has only been tested against Drakengard 3 (PS3) *_SCD.XXX files
(big-endian). As it is highly likely that FFXIV (PC) files are little-endian,
this demuxer is marked as experimental until this can be confirmed.

[1]: http://ffxivexplorer.fragmenterworks.com/research/scd%20files.txt

Signed-off-by: Zane van Iperen 
---
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/scd.c| 378 +++
 3 files changed, 380 insertions(+)
 create mode 100644 libavformat/scd.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index a19d2e0c88..2b5caf9d33 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -501,6 +501,7 @@ OBJS-$(CONFIG_SBC_MUXER) += rawenc.o
 OBJS-$(CONFIG_SBG_DEMUXER)   += sbgdec.o
 OBJS-$(CONFIG_SCC_DEMUXER)   += sccdec.o subtitles.o
 OBJS-$(CONFIG_SCC_MUXER) += sccenc.o subtitles.o
+OBJS-$(CONFIG_SCD_DEMUXER)   += scd.o
 OBJS-$(CONFIG_SDP_DEMUXER)   += rtsp.o
 OBJS-$(CONFIG_SDR2_DEMUXER)  += sdr2.o
 OBJS-$(CONFIG_SDS_DEMUXER)   += sdsdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index cbfadcb639..1054ac9667 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -392,6 +392,7 @@ extern const AVOutputFormat ff_sbc_muxer;
 extern const AVInputFormat  ff_sbg_demuxer;
 extern const AVInputFormat  ff_scc_demuxer;
 extern const AVOutputFormat ff_scc_muxer;
+extern const AVInputFormat  ff_scd_demuxer;
 extern const AVInputFormat  ff_sdp_demuxer;
 extern const AVInputFormat  ff_sdr2_demuxer;
 extern const AVInputFormat  ff_sds_demuxer;
diff --git a/libavformat/scd.c b/libavformat/scd.c
new file mode 100644
index 00..0ed5322a14
--- /dev/null
+++ b/libavformat/scd.c
@@ -0,0 +1,378 @@
+/*
+ * Square Enix SCD demuxer
+ * Copyright (C) 2021 Zane van Iperen (z...@zanevaniperen.com)
+ *
+ * Based off documentation:
+ *   http://ffxivexplorer.fragmenterworks.com/research/scd%20files.txt
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include "libavutil/avstring.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/internal.h"
+#include "libavutil/macros.h"
+#include "libavutil/avassert.h"
+#include "libavformat/internal.h"
+#include "avformat.h"
+
+#define SCD_MAGIC  ((uint64_t)MKBETAG('S', 'E', 'D', 'B') << 32 | \
+  MKBETAG('S', 'S', 'C', 'F'))
+#define SCD_MIN_HEADER_SIZE20
+#define SCD_OFFSET_HEADER_SIZE 28
+#define SCD_TRACK_HEADER_SIZE  32
+
+#define SCD_TRACK_ID_PCM0
+#define SCD_TRACK_ID_OGG6
+#define SCD_TRACK_ID_MP37
+#define SCD_TRACK_ID_MS_ADPCM  12
+
+typedef struct SCDOffsetTable {
+uint16_t  count;
+uint32_t  offset;
+uint32_t *entries;
+} SCDOffsetTable;
+
+typedef struct SCDHeader {
+uint64_t magic; /* SEDBSSCF */
+uint32_t version;   /* Verison number. We only know about 3.*/
+uint16_t unk1;  /* Unknown, 260 in Drakengard 3, 1024 in FFXIV. */
+uint16_t header_size;   /* Total size of this header.   */
+uint32_t file_size; /* Is often 0, just ignore it.  */
+
+SCDOffsetTable table0;  /* Table 0, no idea. 56 uint32's/entry. */
+SCDOffsetTable table1;  /* Table 1, contains the track info.*/
+SCDOffsetTable table2;  /* Table 2, no idea. 40 uint32's/entry. */
+uint16_t unk2;  /* Unknown, not a count.*/
+uint32_t unk3;  /* Unknown, not an offset.  */
+uint32_t unk4;  /* Unknown, offset to offset.   */
+} SCDHeader;
+
+typedef struct SCDTrackHeader {
+uint32_t length;
+uint32_t num_channels;
+uint32_t sample_rate;
+uint32_t data_type;
+uint32_t loop_start;
+uint32_t loop_end;
+uint32_t data_offset; /* Offset to data + this header. */
+uint32_t aux_count;
+
+uint32_t absolute_offset;
+uint32_t bytes

Re: [FFmpeg-devel] [PATCH] avformat/scd: add demuxer

2021-11-26 Thread Zane van Iperen




On 27/11/21 01:32, Andreas Rheinhardt wrote:

Zane van Iperen:

+
+static int scd_seek(AVFormatContext *s, int stream_index,
+int64_t pts, int flags)
+{
+SCDDemuxContext *ctx = s->priv_data;
+SCDTrackHeader  *trk = ctx->tracks + stream_index;
+
+if (pts != 0)
+return AVERROR(EINVAL);
+
+trk->bytes_read = 0;


You are only resetting the one track that the user explicitly specified.
This is not in line with how this flag is generally understood.



How it it meant to be understood? Do I reset the entire file, regardless
of what's in stream_index?



+return 0;
+
+}


Weird empty lines.



Fixed, my bad.

___
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/scd: add demuxer

2021-11-22 Thread Zane van Iperen



On 23/11/21 16:18, Peter Ross wrote:


index cbfadcb639..1054ac9667 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -392,6 +392,7 @@ extern const AVOutputFormat ff_sbc_muxer;
   extern const AVInputFormat  ff_sbg_demuxer;
   extern const AVInputFormat  ff_scc_demuxer;
   extern const AVOutputFormat ff_scc_muxer;
+extern const AVInputFormat  ff_scd_demuxer;
   extern const AVInputFormat  ff_sdp_demuxer;
   extern const AVInputFormat  ff_sdr2_demuxer;
   extern const AVInputFormat  ff_sds_demuxer;


the indentation here is inconsistent.



I think there may be something wrong with your viewer, all the indentation 
looks fine to me.

Does it look fine here? 
https://ffmpeg.org/pipermail/ffmpeg-devel/2021-November/287508.html



+static int scd_read_offsets(AVFormatContext *s)
+{
+    int64_t ret;
+    SCDDemuxContext  *ctx = s->priv_data;
+    uint8_t buf[SCD_OFFSET_HEADER_SIZE];
+
+    if ((ret = avio_read(s->pb, buf, SCD_OFFSET_HEADER_SIZE)) < 0)
+    return ret;
+
+    ctx->hdr.table0.count  = AV_RB16(buf +  0);
+    ctx->hdr.table1.count  = AV_RB16(buf +  2);
+    ctx->hdr.table2.count  = AV_RB16(buf +  4);
+    ctx->hdr.unk2  = AV_RB16(buf +  6);
+    ctx->hdr.table0.offset = AV_RB32(buf +  8);
+    ctx->hdr.table1.offset = AV_RB32(buf + 12);
+    ctx->hdr.table2.offset = AV_RB32(buf + 16);
+    ctx->hdr.unk3  = AV_RB32(buf + 20);
+    ctx->hdr.unk4  = AV_RB32(buf + 24);


is there any reason why you read the values into buf?

why not use avio_rb16/32(pb) to directly read the values. this is how other 
demuxers do it.
also use avio_skip(pb, xxx) to skip over the unknown values.
this saves having to define the structures and defining xxx_HEADER_SIZE.



#notalldemuxers - See argo_{asf,cvg,brp}, pp_bnk, kvag, alp, etc.

Jokes aside, I've always avoided avio_rbxx() because of the potential need for 
error handling.
I find it nicer to do one big read and AV_RBXX() it out, than avio_rbxx() each 
field.

As for structures and xxx_HEADER_SIZE - I find it's helpful for future 
documentation and
debugging purposes. It's nice to be able to look at the header structure when 
debugging,
for example.

The `buf + XX` also makes it clear what the field offsets are.


+
+    track->length   = AV_RB32(buf +  0);
+    track->num_channels = AV_RB32(buf +  4);
+    track->sample_rate  = AV_RB32(buf +  8);
+    track->data_type    = AV_RB32(buf + 12);
+    track->loop_start   = AV_RB32(buf + 16);
+    track->loop_end = AV_RB32(buf + 20);
+    track->data_offset  = AV_RB32(buf + 24);
+    track->aux_count    = AV_RB32(buf + 28);


ditto



Ditto to your ditto.
___
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/scd: add demuxer

2021-11-22 Thread Zane van Iperen

Ping again?

I'll merge in a few days if no objections.


On 13/11/21 04:22, Zane van Iperen wrote:

Ping?

Pretty sure most people didn't get this as I was making DMARC changes at the 
time. I can re-send if necessary.

On 4/11/21 00:29, Zane van Iperen wrote:

Adds demuxer for Square Enux SCD files.



s/Enux/Enix/


Based off [1] and personal investigation.

This has only been tested against Drakengard 3 (PS3) *_SCD.XXX files
(big-endian). As it is highly likely that FFXIV (PC) files are little-endian,
this demuxer is marked as experimental until this can be confirmed.

[1]: http://ffxivexplorer.fragmenterworks.com/research/scd%20files.txt

Signed-off-by: Zane van Iperen 
---
  libavformat/Makefile |   1 +
  libavformat/allformats.c |   1 +
  libavformat/scd.c    | 377 +++
  3 files changed, 379 insertions(+)
  create mode 100644 libavformat/scd.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 3d6c8ef8f5..725e8c0ed6 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -500,6 +500,7 @@ OBJS-$(CONFIG_SBC_MUXER) += rawenc.o
  OBJS-$(CONFIG_SBG_DEMUXER)   += sbgdec.o
  OBJS-$(CONFIG_SCC_DEMUXER)   += sccdec.o subtitles.o
  OBJS-$(CONFIG_SCC_MUXER) += sccenc.o subtitles.o
+OBJS-$(CONFIG_SCD_DEMUXER)   += scd.o
  OBJS-$(CONFIG_SDP_DEMUXER)   += rtsp.o
  OBJS-$(CONFIG_SDR2_DEMUXER)  += sdr2.o
  OBJS-$(CONFIG_SDS_DEMUXER)   += sdsdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index cbfadcb639..1054ac9667 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -392,6 +392,7 @@ extern const AVOutputFormat ff_sbc_muxer;
  extern const AVInputFormat  ff_sbg_demuxer;
  extern const AVInputFormat  ff_scc_demuxer;
  extern const AVOutputFormat ff_scc_muxer;
+extern const AVInputFormat  ff_scd_demuxer;
  extern const AVInputFormat  ff_sdp_demuxer;
  extern const AVInputFormat  ff_sdr2_demuxer;
  extern const AVInputFormat  ff_sds_demuxer;
diff --git a/libavformat/scd.c b/libavformat/scd.c
new file mode 100644
index 00..5bb01d2114
--- /dev/null
+++ b/libavformat/scd.c
@@ -0,0 +1,377 @@
+/*
+ * Square Enix SCD demuxer
+ * Copyright (C) 2021 Zane van Iperen (z...@zanevaniperen.com)
+ *
+ * Based off documentation:
+ *   http://ffxivexplorer.fragmenterworks.com/research/scd%20files.txt
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include "libavutil/avstring.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/internal.h"
+#include "libavutil/macros.h"
+#include "libavutil/avassert.h"
+#include "libavformat/internal.h"
+#include "avformat.h"
+
+#define SCD_MAGIC  ((uint64_t)MKBETAG('S', 'E', 'D', 'B') << 32 | \
+  MKBETAG('S', 'S', 'C', 'F'))
+#define SCD_MIN_HEADER_SIZE    20
+#define SCD_OFFSET_HEADER_SIZE 28
+#define SCD_TRACK_HEADER_SIZE  32
+
+#define SCD_TRACK_ID_PCM    0
+#define SCD_TRACK_ID_OGG    6
+#define SCD_TRACK_ID_MP3    7
+#define SCD_TRACK_ID_MS_ADPCM  12
+
+typedef struct SCDOffsetTable {
+    uint16_t  count;
+    uint32_t  offset;
+    uint32_t *entries;
+} SCDOffsetTable;
+
+typedef struct SCDHeader {
+    uint64_t magic; /* SEDBSSCF */
+    uint32_t version;   /* Verison number. We only know about 3.    */
+    uint16_t unk1;  /* Unknown, 260 in Drakengard 3, 1024 in FFXIV. */
+    uint16_t header_size;   /* Total size of this header.   */
+    uint32_t file_size; /* Is often 0, just ignore it.  */
+
+    SCDOffsetTable table0;  /* Table 0, no idea. 56 uint32's/entry. */
+    SCDOffsetTable table1;  /* Table 1, contains the track info.    */
+    SCDOffsetTable table2;  /* Table 2, no idea. 40 uint32's/entry. */
+    uint16_t unk2;  /* Unknown, not a count.    */
+    uint32_t unk3;  /* Unknown, not an offset.  */
+    uint32_t unk4;  /* Unknown, offset to offset.   */
+} SCDHeader;
+
+typedef struct SCDT

Re: [FFmpeg-devel] [PATCH] avformat/scd: add demuxer

2021-11-12 Thread Zane van Iperen

Ping?

Pretty sure most people didn't get this as I was making DMARC changes at the 
time. I can re-send if necessary.

On 4/11/21 00:29, Zane van Iperen wrote:

Adds demuxer for Square Enux SCD files.



s/Enux/Enix/


Based off [1] and personal investigation.

This has only been tested against Drakengard 3 (PS3) *_SCD.XXX files
(big-endian). As it is highly likely that FFXIV (PC) files are little-endian,
this demuxer is marked as experimental until this can be confirmed.

[1]: http://ffxivexplorer.fragmenterworks.com/research/scd%20files.txt

Signed-off-by: Zane van Iperen 
---
  libavformat/Makefile |   1 +
  libavformat/allformats.c |   1 +
  libavformat/scd.c| 377 +++
  3 files changed, 379 insertions(+)
  create mode 100644 libavformat/scd.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 3d6c8ef8f5..725e8c0ed6 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -500,6 +500,7 @@ OBJS-$(CONFIG_SBC_MUXER) += rawenc.o
  OBJS-$(CONFIG_SBG_DEMUXER)   += sbgdec.o
  OBJS-$(CONFIG_SCC_DEMUXER)   += sccdec.o subtitles.o
  OBJS-$(CONFIG_SCC_MUXER) += sccenc.o subtitles.o
+OBJS-$(CONFIG_SCD_DEMUXER)   += scd.o
  OBJS-$(CONFIG_SDP_DEMUXER)   += rtsp.o
  OBJS-$(CONFIG_SDR2_DEMUXER)  += sdr2.o
  OBJS-$(CONFIG_SDS_DEMUXER)   += sdsdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index cbfadcb639..1054ac9667 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -392,6 +392,7 @@ extern const AVOutputFormat ff_sbc_muxer;
  extern const AVInputFormat  ff_sbg_demuxer;
  extern const AVInputFormat  ff_scc_demuxer;
  extern const AVOutputFormat ff_scc_muxer;
+extern const AVInputFormat  ff_scd_demuxer;
  extern const AVInputFormat  ff_sdp_demuxer;
  extern const AVInputFormat  ff_sdr2_demuxer;
  extern const AVInputFormat  ff_sds_demuxer;
diff --git a/libavformat/scd.c b/libavformat/scd.c
new file mode 100644
index 00..5bb01d2114
--- /dev/null
+++ b/libavformat/scd.c
@@ -0,0 +1,377 @@
+/*
+ * Square Enix SCD demuxer
+ * Copyright (C) 2021 Zane van Iperen (z...@zanevaniperen.com)
+ *
+ * Based off documentation:
+ *   http://ffxivexplorer.fragmenterworks.com/research/scd%20files.txt
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include "libavutil/avstring.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/internal.h"
+#include "libavutil/macros.h"
+#include "libavutil/avassert.h"
+#include "libavformat/internal.h"
+#include "avformat.h"
+
+#define SCD_MAGIC  ((uint64_t)MKBETAG('S', 'E', 'D', 'B') << 32 | \
+  MKBETAG('S', 'S', 'C', 'F'))
+#define SCD_MIN_HEADER_SIZE20
+#define SCD_OFFSET_HEADER_SIZE 28
+#define SCD_TRACK_HEADER_SIZE  32
+
+#define SCD_TRACK_ID_PCM0
+#define SCD_TRACK_ID_OGG6
+#define SCD_TRACK_ID_MP37
+#define SCD_TRACK_ID_MS_ADPCM  12
+
+typedef struct SCDOffsetTable {
+uint16_t  count;
+uint32_t  offset;
+uint32_t *entries;
+} SCDOffsetTable;
+
+typedef struct SCDHeader {
+uint64_t magic; /* SEDBSSCF */
+uint32_t version;   /* Verison number. We only know about 3.*/
+uint16_t unk1;  /* Unknown, 260 in Drakengard 3, 1024 in FFXIV. */
+uint16_t header_size;   /* Total size of this header.   */
+uint32_t file_size; /* Is often 0, just ignore it.  */
+
+SCDOffsetTable table0;  /* Table 0, no idea. 56 uint32's/entry. */
+SCDOffsetTable table1;  /* Table 1, contains the track info.*/
+SCDOffsetTable table2;  /* Table 2, no idea. 40 uint32's/entry. */
+uint16_t unk2;  /* Unknown, not a count.*/
+uint32_t unk3;  /* Unknown, not an offset.  */
+uint32_t unk4;  /* Unknown, offset to offset.   */
+} SCDHeader;
+
+typedef struct SCDTrackHeader {
+uint32_t length;
+uint32_t num_channels;
+uint32_t sample_rate;
+uint32_

[FFmpeg-devel] [PATCH] fftools/ffplay: don't disable x11 compositing

2021-10-26 Thread Zane van Iperen
Prevents desktop stutters caused by the change (specifically on KDE).
We're not a game, we don't actually need it disabled.

Signed-off-by: Zane van Iperen 
---
 fftools/ffplay.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index ccea0e4578..4b2e69e613 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -3746,6 +3746,10 @@ int main(int argc, char **argv)
 flags |= SDL_WINDOW_BORDERLESS;
 else
 flags |= SDL_WINDOW_RESIZABLE;
+
+#ifdef SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR
+SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0");
+#endif
 window = SDL_CreateWindow(program_name, SDL_WINDOWPOS_UNDEFINED, 
SDL_WINDOWPOS_UNDEFINED, default_width, default_height, flags);
 SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
 if (window) {
-- 
2.31.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 1/3] avformat/argo_asf: cleanup and NULL-terminate name field in header

2021-10-14 Thread Zane van Iperen



On 14/10/21 10:45 pm, "zhilizhao(赵志立)" wrote:


} ArgoASFFileHeader;

I failed to see why null-terminator is needed from the commit message or from 
the source code.


See https://ffmpeg.org/pipermail/ffmpeg-devel/2021-October/286939.html


Sorry for the noise, email client doesn’t show the patch set together.
Add some description will be helpful when reading the patch alone.



No worries, will do before I push.

___
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] avformat/argo_asf: cleanup and NULL-terminate name field in header

2021-10-14 Thread Zane van Iperen



On 14/10/21 10:11 pm, "zhilizhao(赵志立)" wrote:


typedef struct ArgoASFFileHeader {
 uint32_tmagic;  /*< Magic Number, {'A', 'S', 'F', '\0'} */
@@ -40,7 +41,7 @@ typedef struct ArgoASFFileHeader {
 uint16_tversion_minor;  /*< File Minor Version. */
 uint32_tnum_chunks; /*< No. chunks in the file. */
 uint32_tchunk_offset;   /*< Offset to the first chunk from the start 
of the file. */
-int8_t  name[8];/*< Name. */
+charname[ASF_NAME_SIZE + 1]; /*< Name, +1 for NULL-terminator. */
} ArgoASFFileHeader;



I failed to see why null-terminator is needed from the commit message or from 
the source code.



See https://ffmpeg.org/pipermail/ffmpeg-devel/2021-October/286939.html
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH v2 1/3] avformat/argo_asf: cleanup and NULL-terminate name field in header

2021-10-14 Thread Zane van Iperen

Will apply tomorrow if no objections.

Zane

On 12/10/21 9:02 pm, Zane van Iperen wrote:

Signed-off-by: Zane van Iperen 
---
  libavformat/argo_asf.c | 8 
  libavformat/argo_asf.h | 3 ++-
  2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
index 7e759c7c0c..acf30839b9 100644
--- a/libavformat/argo_asf.c
+++ b/libavformat/argo_asf.c
@@ -52,8 +52,8 @@ void ff_argo_asf_parse_file_header(ArgoASFFileHeader *hdr, 
const uint8_t *buf)
  hdr->version_minor  = AV_RL16(buf + 6);
  hdr->num_chunks = AV_RL32(buf + 8);
  hdr->chunk_offset   = AV_RL32(buf + 12);
-for (int i = 0; i < FF_ARRAY_ELEMS(hdr->name); i++)
-hdr->name[i]= AV_RL8(buf + 16 + i);
+memcpy(hdr->name, buf + 16, ASF_NAME_SIZE);
+hdr->name[ASF_NAME_SIZE] = '\0';
  }
  
  int ff_argo_asf_validate_file_header(AVFormatContext *s, const ArgoASFFileHeader *hdr)

@@ -331,7 +331,7 @@ static void argo_asf_write_file_header(const 
ArgoASFFileHeader *fhdr, AVIOContex
  avio_wl16( pb, fhdr->version_minor);
  avio_wl32( pb, fhdr->num_chunks);
  avio_wl32( pb, fhdr->chunk_offset);
-avio_write(pb, fhdr->name, sizeof(fhdr->name));
+avio_write(pb, fhdr->name, ASF_NAME_SIZE);
  }
  
  static void argo_asf_write_chunk_header(const ArgoASFChunkHeader *ckhdr, AVIOContext *pb)

@@ -368,7 +368,7 @@ static int argo_asf_write_header(AVFormatContext *s)
  } else {
  len = end - name;
  }
-memcpy(fhdr.name, name, FFMIN(len, sizeof(fhdr.name)));
+memcpy(fhdr.name, name, FFMIN(len, ASF_NAME_SIZE));
  
  chdr.num_blocks= 0;

  chdr.num_samples   = ASF_SAMPLE_COUNT;
diff --git a/libavformat/argo_asf.h b/libavformat/argo_asf.h
index e65125fb79..1fab31a90b 100644
--- a/libavformat/argo_asf.h
+++ b/libavformat/argo_asf.h
@@ -33,6 +33,7 @@
  #define ASF_CHUNK_HEADER_SIZE   20
  #define ASF_SAMPLE_COUNT32
  #define ASF_MIN_BUFFER_SIZE FFMAX(ASF_FILE_HEADER_SIZE, 
ASF_CHUNK_HEADER_SIZE)
+#define ASF_NAME_SIZE   8
  
  typedef struct ArgoASFFileHeader {

  uint32_tmagic;  /*< Magic Number, {'A', 'S', 'F', '\0'} */
@@ -40,7 +41,7 @@ typedef struct ArgoASFFileHeader {
  uint16_tversion_minor;  /*< File Minor Version. */
  uint32_tnum_chunks; /*< No. chunks in the file. */
  uint32_tchunk_offset;   /*< Offset to the first chunk from the start 
of the file. */
-int8_t  name[8];/*< Name. */
+charname[ASF_NAME_SIZE + 1]; /*< Name, +1 for NULL-terminator. */
  } ArgoASFFileHeader;
  
  typedef struct ArgoASFChunkHeader {



___
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/3] avformat/argo_asf: pass name through as metadata

2021-10-12 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/argo_asf.c  | 2 ++
 tests/ref/acodec/adpcm-argo | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
index acf30839b9..740680ece1 100644
--- a/libavformat/argo_asf.c
+++ b/libavformat/argo_asf.c
@@ -209,6 +209,8 @@ static int argo_asf_read_header(AVFormatContext *s)
 
 ff_argo_asf_parse_chunk_header(>ckhdr, buf);
 
+av_dict_set(>metadata, "title", asf->fhdr.name, 0);
+
 return ff_argo_asf_fill_stream(s, st, >fhdr, >ckhdr);
 }
 
diff --git a/tests/ref/acodec/adpcm-argo b/tests/ref/acodec/adpcm-argo
index 127153c081..4032a8f1fe 100644
--- a/tests/ref/acodec/adpcm-argo
+++ b/tests/ref/acodec/adpcm-argo
@@ -1,4 +1,4 @@
 14b2507d14e95c20bb7ae49b4fcbcbf1 *tests/data/fate/acodec-adpcm-argo.argo_asf
 281190 tests/data/fate/acodec-adpcm-argo.argo_asf
-cc5e5c695adeaebaa2b1f0df5ebd59ee *tests/data/fate/acodec-adpcm-argo.out.wav
+446f28460bdb7ff4361cf7d82ac22c3e *tests/data/fate/acodec-adpcm-argo.out.wav
 stddev: 1542.05 PSNR: 32.57 MAXDIFF:59667 bytes:  1058400/  1058432
-- 
2.31.1

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

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


[FFmpeg-devel] [PATCH v2 3/3] avformat/argo_asf: use title metadata when muxing

2021-10-12 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/argo_asf.c | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
index 740680ece1..2b3569ebc3 100644
--- a/libavformat/argo_asf.c
+++ b/libavformat/argo_asf.c
@@ -358,14 +358,22 @@ static int argo_asf_write_header(AVFormatContext *s)
 .num_chunks= 1,
 .chunk_offset  = ASF_FILE_HEADER_SIZE
 };
-const char *name = ctx->name, *end;
+AVDictionaryEntry *t;
+const char *name, *end;
 size_t len;
 
 /*
- * If the user specified a name, use it as is. Otherwise take the
- * basename and lop off the extension (if any).
+ * If the user specified a name, use it as is. Otherwise,
+ * try to use metadata (if present), then fall back to the
+ * filename (minus extension).
  */
-if (name || !(end = strrchr((name = av_basename(s->url)), '.'))) {
+if (ctx->name) {
+name = ctx->name;
+len  = strlen(ctx->name);
+} else if ((t = av_dict_get(s->metadata, "title", NULL, 0))) {
+name = t->value;
+len  = strlen(t->value);
+} else if (!(end = strrchr((name = av_basename(s->url)), '.'))) {
 len = strlen(name);
 } else {
 len = end - name;
-- 
2.31.1

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

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


[FFmpeg-devel] [PATCH v2 1/3] avformat/argo_asf: cleanup and NULL-terminate name field in header

2021-10-12 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/argo_asf.c | 8 
 libavformat/argo_asf.h | 3 ++-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
index 7e759c7c0c..acf30839b9 100644
--- a/libavformat/argo_asf.c
+++ b/libavformat/argo_asf.c
@@ -52,8 +52,8 @@ void ff_argo_asf_parse_file_header(ArgoASFFileHeader *hdr, 
const uint8_t *buf)
 hdr->version_minor  = AV_RL16(buf + 6);
 hdr->num_chunks = AV_RL32(buf + 8);
 hdr->chunk_offset   = AV_RL32(buf + 12);
-for (int i = 0; i < FF_ARRAY_ELEMS(hdr->name); i++)
-hdr->name[i]= AV_RL8(buf + 16 + i);
+memcpy(hdr->name, buf + 16, ASF_NAME_SIZE);
+hdr->name[ASF_NAME_SIZE] = '\0';
 }
 
 int ff_argo_asf_validate_file_header(AVFormatContext *s, const 
ArgoASFFileHeader *hdr)
@@ -331,7 +331,7 @@ static void argo_asf_write_file_header(const 
ArgoASFFileHeader *fhdr, AVIOContex
 avio_wl16( pb, fhdr->version_minor);
 avio_wl32( pb, fhdr->num_chunks);
 avio_wl32( pb, fhdr->chunk_offset);
-avio_write(pb, fhdr->name, sizeof(fhdr->name));
+avio_write(pb, fhdr->name, ASF_NAME_SIZE);
 }
 
 static void argo_asf_write_chunk_header(const ArgoASFChunkHeader *ckhdr, 
AVIOContext *pb)
@@ -368,7 +368,7 @@ static int argo_asf_write_header(AVFormatContext *s)
 } else {
 len = end - name;
 }
-memcpy(fhdr.name, name, FFMIN(len, sizeof(fhdr.name)));
+memcpy(fhdr.name, name, FFMIN(len, ASF_NAME_SIZE));
 
 chdr.num_blocks= 0;
 chdr.num_samples   = ASF_SAMPLE_COUNT;
diff --git a/libavformat/argo_asf.h b/libavformat/argo_asf.h
index e65125fb79..1fab31a90b 100644
--- a/libavformat/argo_asf.h
+++ b/libavformat/argo_asf.h
@@ -33,6 +33,7 @@
 #define ASF_CHUNK_HEADER_SIZE   20
 #define ASF_SAMPLE_COUNT32
 #define ASF_MIN_BUFFER_SIZE FFMAX(ASF_FILE_HEADER_SIZE, 
ASF_CHUNK_HEADER_SIZE)
+#define ASF_NAME_SIZE   8
 
 typedef struct ArgoASFFileHeader {
 uint32_tmagic;  /*< Magic Number, {'A', 'S', 'F', '\0'} */
@@ -40,7 +41,7 @@ typedef struct ArgoASFFileHeader {
 uint16_tversion_minor;  /*< File Minor Version. */
 uint32_tnum_chunks; /*< No. chunks in the file. */
 uint32_tchunk_offset;   /*< Offset to the first chunk from the start 
of the file. */
-int8_t  name[8];/*< Name. */
+charname[ASF_NAME_SIZE + 1]; /*< Name, +1 for NULL-terminator. */
 } ArgoASFFileHeader;
 
 typedef struct ArgoASFChunkHeader {
-- 
2.31.1

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

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


[FFmpeg-devel] [PATCH 2/2] avformat/argo_asf: use title metadata when muxing

2021-10-11 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/argo_asf.c | 17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
index f729a393ad..1171d9b7a7 100644
--- a/libavformat/argo_asf.c
+++ b/libavformat/argo_asf.c
@@ -361,18 +361,27 @@ static int argo_asf_write_header(AVFormatContext *s)
 .num_chunks= 1,
 .chunk_offset  = ASF_FILE_HEADER_SIZE
 };
-const char *name = ctx->name, *end;
+AVDictionaryEntry *t;
+const char *name, *end;
 size_t len;
 
 /*
- * If the user specified a name, use it as is. Otherwise take the
- * basename and lop off the extension (if any).
+ * If the user specified a name, use it as is. Otherwise,
+ * try to use metadata (if present), then fall back to the
+ * filename (minus extension).
  */
-if (name || !(end = strrchr((name = av_basename(s->url)), '.'))) {
+if (ctx->name) {
+name = ctx->name;
+len  = strlen(ctx->name);
+} else if ((t = av_dict_get(s->metadata, "title", NULL, 0))) {
+name = t->value;
+len  = strlen(t->value);
+} else if (!(end = strrchr((name = av_basename(s->url)), '.'))) {
 len = strlen(name);
 } else {
 len = end - name;
 }
+
 memcpy(fhdr.name, name, FFMIN(len, sizeof(fhdr.name)));
 
 chdr.num_blocks= 0;
-- 
2.31.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/argo_asf: pass name through as metadata

2021-10-11 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/argo_asf.c  | 5 +
 libavformat/argo_asf.h  | 3 ++-
 tests/ref/acodec/adpcm-argo | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
index 7e759c7c0c..f729a393ad 100644
--- a/libavformat/argo_asf.c
+++ b/libavformat/argo_asf.c
@@ -181,6 +181,7 @@ static int argo_asf_read_header(AVFormatContext *s)
 AVStream *st;
 ArgoASFDemuxContext *asf = s->priv_data;
 uint8_t buf[ASF_MIN_BUFFER_SIZE];
+char namebuf[ASF_MAX_NAME_SIZE + 1];
 
 if (!(st = avformat_new_stream(s, NULL)))
 return AVERROR(ENOMEM);
@@ -209,6 +210,10 @@ static int argo_asf_read_header(AVFormatContext *s)
 
 ff_argo_asf_parse_chunk_header(>ckhdr, buf);
 
+memcpy(namebuf, asf->fhdr.name, ASF_MAX_NAME_SIZE);
+namebuf[ASF_MAX_NAME_SIZE] = '\0';
+av_dict_set(>metadata, "title", namebuf, 0);
+
 return ff_argo_asf_fill_stream(s, st, >fhdr, >ckhdr);
 }
 
diff --git a/libavformat/argo_asf.h b/libavformat/argo_asf.h
index e65125fb79..f0607c7859 100644
--- a/libavformat/argo_asf.h
+++ b/libavformat/argo_asf.h
@@ -33,6 +33,7 @@
 #define ASF_CHUNK_HEADER_SIZE   20
 #define ASF_SAMPLE_COUNT32
 #define ASF_MIN_BUFFER_SIZE FFMAX(ASF_FILE_HEADER_SIZE, 
ASF_CHUNK_HEADER_SIZE)
+#define ASF_MAX_NAME_SIZE   8
 
 typedef struct ArgoASFFileHeader {
 uint32_tmagic;  /*< Magic Number, {'A', 'S', 'F', '\0'} */
@@ -40,7 +41,7 @@ typedef struct ArgoASFFileHeader {
 uint16_tversion_minor;  /*< File Minor Version. */
 uint32_tnum_chunks; /*< No. chunks in the file. */
 uint32_tchunk_offset;   /*< Offset to the first chunk from the start 
of the file. */
-int8_t  name[8];/*< Name. */
+int8_t  name[ASF_MAX_NAME_SIZE]; /*< Name. */
 } ArgoASFFileHeader;
 
 typedef struct ArgoASFChunkHeader {
diff --git a/tests/ref/acodec/adpcm-argo b/tests/ref/acodec/adpcm-argo
index 127153c081..4032a8f1fe 100644
--- a/tests/ref/acodec/adpcm-argo
+++ b/tests/ref/acodec/adpcm-argo
@@ -1,4 +1,4 @@
 14b2507d14e95c20bb7ae49b4fcbcbf1 *tests/data/fate/acodec-adpcm-argo.argo_asf
 281190 tests/data/fate/acodec-adpcm-argo.argo_asf
-cc5e5c695adeaebaa2b1f0df5ebd59ee *tests/data/fate/acodec-adpcm-argo.out.wav
+446f28460bdb7ff4361cf7d82ac22c3e *tests/data/fate/acodec-adpcm-argo.out.wav
 stddev: 1542.05 PSNR: 32.57 MAXDIFF:59667 bytes:  1058400/  1058432
-- 
2.31.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] avformat/argo_asf: Use memcpy to copy string without its NUL

2021-09-25 Thread Zane van Iperen




On 26/9/21 1:09 pm, Andreas Rheinhardt wrote:

This avoids a -Wstringop-truncation warning from GCC which takes
issue with the fact that the destination might not be NUL terminated.

Signed-off-by: Andreas Rheinhardt 
---
  libavformat/argo_asf.c | 20 +++-
  1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
index 5adafb7230..0ef970df8a 100644
--- a/libavformat/argo_asf.c
+++ b/libavformat/argo_asf.c
@@ -356,25 +356,19 @@ static int argo_asf_write_header(AVFormatContext *s)
  .num_chunks= 1,
  .chunk_offset  = ASF_FILE_HEADER_SIZE
  };
+const char *name = ctx->name, *end;
+size_t len;
  
  /*

   * If the user specified a name, use it as is. Otherwise take the
   * basename and lop off the extension (if any).
   */
-if (ctx->name) {
-strncpy(fhdr.name, ctx->name, sizeof(fhdr.name));
-} else {
-const char *start = av_basename(s->url);
-const char *end   = strrchr(start, '.');
-size_t  len;
-
-if (end)
-len = end - start;
-else
-len = strlen(start);
+if (name || !(end = strrchr(name = av_basename(s->url), '.'))) {
+len = strlen(name);
+} else
+len = end - name;
  
-memcpy(fhdr.name, start, FFMIN(len, sizeof(fhdr.name)));

-}
+memcpy(fhdr.name, name, FFMIN(len, sizeof(fhdr.name)));
  


Minor formatting nits:
* The first statement has braces, the second doesn't.
* A set of parentheses around "name = av_basename(s->url)" would make things 
clearer.

Otherwise, lgtm.

Zane
___
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] [RFC] Suggestion for a Nicer Integration with GitHub

2021-08-12 Thread Zane van Iperen

I say leave it as is.

There's nothing stopping people from submitting a GitHub PR to the mirror repo. 
If a maintainer
sees it and decides to pick it up, then they can re-post it to the ML. Imo, 
that's completely up to them.

Also, git send-email takes about 2 minutes to configure. Gmail, Yahoo, Outlook 
all provide SMTP access with
"app passwords", there's really no excuse...

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

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


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/argo: use bits_per_coded_sample instead of bits_per_raw_sample

2021-07-18 Thread Zane van Iperen

Will apply this and parts 3-8 of part 1 soon.

On 18/7/21 7:01 pm, Zane van Iperen wrote:

Signed-off-by: Zane van Iperen 
---
  libavcodec/argo.c| 4 ++--
  libavcodec/version.h | 2 +-
  2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/argo.c b/libavcodec/argo.c
index 87c646f56c..057100bd12 100644
--- a/libavcodec/argo.c
+++ b/libavcodec/argo.c
@@ -676,12 +676,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
  {
  ArgoContext *s = avctx->priv_data;
  
-switch (avctx->bits_per_raw_sample) {

+switch (avctx->bits_per_coded_sample) {
  case  8: s->bpp = 1;
   avctx->pix_fmt = AV_PIX_FMT_PAL8; break;
  case 24: s->bpp = 4;
   avctx->pix_fmt = AV_PIX_FMT_BGR0; break;
-default: avpriv_request_sample(s, "depth == %u", 
avctx->bits_per_raw_sample);
+default: avpriv_request_sample(s, "depth == %u", 
avctx->bits_per_coded_sample);
   return AVERROR_PATCHWELCOME;
  }
  
diff --git a/libavcodec/version.h b/libavcodec/version.h

index c660f70669..91325ce4e7 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
  
  #define LIBAVCODEC_VERSION_MAJOR  59

  #define LIBAVCODEC_VERSION_MINOR   3
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
  
  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

 LIBAVCODEC_VERSION_MINOR, \


___
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/8] avcodec/argo: use pixel format provided by the demuxer

2021-07-18 Thread Zane van Iperen




On 18/7/21 11:18 pm, James Almer wrote:

On 7/17/2021 10:21 PM, Zane van Iperen wrote:

But fall back to bits_per_raw_sample, in case we're with older
libavformat.


What older libavformat? We bumped major version a few months ago, so you can't 
link git head lavc with lavf <= 58.
Or is this about changes in the following patches? If so, the bump is recent 
and we haven't made a release yet, so don't bother with this kind of backwards 
compat.



Yup, I've already changed this. See v2 of parts 1 & 2:
https://ffmpeg.org/pipermail/ffmpeg-devel/2021-July/282401.html
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 2/2] avformat/argo_brp: use bits_per_coded_sample instead of bits_per_raw_sample

2021-07-18 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/argo_brp.c | 2 +-
 libavformat/version.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/argo_brp.c b/libavformat/argo_brp.c
index 059418cd1d..2ccdbd3e5b 100644
--- a/libavformat/argo_brp.c
+++ b/libavformat/argo_brp.c
@@ -230,7 +230,7 @@ static int argo_brp_read_header(AVFormatContext *s)
 st->codecpar->width  = bvid->width;
 st->codecpar->height = bvid->height;
 st->nb_frames = bvid->num_frames;
-st->codecpar->bits_per_raw_sample = bvid->depth;
+st->codecpar->bits_per_coded_sample = bvid->depth;
 } else if (hdr->codec_id == BRP_CODEC_ID_BASF) {
 /*
  * It would make the demuxer significantly more complicated
diff --git a/libavformat/version.h b/libavformat/version.h
index 6519bba101..03eb20ad82 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -33,7 +33,7 @@
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  59
 #define LIBAVFORMAT_VERSION_MINOR   4
-#define LIBAVFORMAT_VERSION_MICRO 100
+#define LIBAVFORMAT_VERSION_MICRO 101
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
-- 
2.31.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] avcodec/argo: use bits_per_coded_sample instead of bits_per_raw_sample

2021-07-18 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavcodec/argo.c| 4 ++--
 libavcodec/version.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/argo.c b/libavcodec/argo.c
index 87c646f56c..057100bd12 100644
--- a/libavcodec/argo.c
+++ b/libavcodec/argo.c
@@ -676,12 +676,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
 {
 ArgoContext *s = avctx->priv_data;
 
-switch (avctx->bits_per_raw_sample) {
+switch (avctx->bits_per_coded_sample) {
 case  8: s->bpp = 1;
  avctx->pix_fmt = AV_PIX_FMT_PAL8; break;
 case 24: s->bpp = 4;
  avctx->pix_fmt = AV_PIX_FMT_BGR0; break;
-default: avpriv_request_sample(s, "depth == %u", 
avctx->bits_per_raw_sample);
+default: avpriv_request_sample(s, "depth == %u", 
avctx->bits_per_coded_sample);
  return AVERROR_PATCHWELCOME;
 }
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index c660f70669..91325ce4e7 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  59
 #define LIBAVCODEC_VERSION_MINOR   3
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
-- 
2.31.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 1/8] avcodec/argo: use pixel format provided by the demuxer

2021-07-18 Thread Zane van Iperen

I really doubt this is correct approach. No other video decoder use pix
format set from demuxer.



I could change it to use bits_per_coded_sample instead, would that be better?
I see that's what Cinepak does.

Zane

___
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 8/8] avformat/pp_bnk: don't set bits_per_raw_sample

2021-07-17 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/pp_bnk.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavformat/pp_bnk.c b/libavformat/pp_bnk.c
index dfe5343cde..821d14a4aa 100644
--- a/libavformat/pp_bnk.c
+++ b/libavformat/pp_bnk.c
@@ -214,7 +214,6 @@ static int pp_bnk_read_header(AVFormatContext *s)
 
 par->sample_rate= hdr.sample_rate;
 par->bits_per_coded_sample  = 4;
-par->bits_per_raw_sample= 16;
 par->block_align= 1;
 par->bit_rate   = par->sample_rate * 
(int64_t)par->bits_per_coded_sample * par->channels;
 
-- 
2.31.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 7/8] avformat/kvag: don't set bits_per_raw_sample

2021-07-17 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/kvag.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavformat/kvag.c b/libavformat/kvag.c
index 94dc1ddc04..b5ebe418e6 100644
--- a/libavformat/kvag.c
+++ b/libavformat/kvag.c
@@ -80,7 +80,6 @@ static int kvag_read_header(AVFormatContext *s)
 
 par->sample_rate= hdr.sample_rate;
 par->bits_per_coded_sample  = 4;
-par->bits_per_raw_sample= 16;
 par->block_align= 1;
 par->bit_rate   = par->channels *
   (uint64_t)par->sample_rate *
-- 
2.31.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 6/8] avformat/apm: don't set bits_per_raw_sample

2021-07-17 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/apm.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavformat/apm.c b/libavformat/apm.c
index 6ae53b8712..6a047c5095 100644
--- a/libavformat/apm.c
+++ b/libavformat/apm.c
@@ -146,7 +146,6 @@ static int apm_read_header(AVFormatContext *s)
 par->codec_type= AVMEDIA_TYPE_AUDIO;
 par->codec_id  = AV_CODEC_ID_ADPCM_IMA_APM;
 par->format= AV_SAMPLE_FMT_S16;
-par->bits_per_raw_sample   = 16;
 par->bit_rate  = par->channels *
  par->sample_rate *
  par->bits_per_coded_sample;
-- 
2.31.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/8] avformat/alp: don't set bits_per_raw_sample

2021-07-17 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavformat/alp.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavformat/alp.c b/libavformat/alp.c
index bc19f02083..4876015f4b 100644
--- a/libavformat/alp.c
+++ b/libavformat/alp.c
@@ -127,7 +127,6 @@ static int alp_read_header(AVFormatContext *s)
 return AVERROR_INVALIDDATA;
 
 par->bits_per_coded_sample  = 4;
-par->bits_per_raw_sample= 16;
 par->block_align= 1;
 par->bit_rate   = par->channels *
   par->sample_rate *
-- 
2.31.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".


  1   2   3   4   5   6   7   >