Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/3] fate/lavf-audio: Test writing AIFF-native tags
@ 2024-03-14  0:35 Andreas Rheinhardt
  2024-03-14  0:36 ` [FFmpeg-devel] [PATCH 2/3] avformat/aiffenc: Simplify padding tag Andreas Rheinhardt
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2024-03-14  0:35 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

In particular, test writing tags with odd strlen.
(These tags are zero-padded to even size.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 tests/fate/lavf-audio.mak | 1 +
 tests/ref/lavf/aiff       | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/fate/lavf-audio.mak b/tests/fate/lavf-audio.mak
index d54cd107e0..7ea0c41da9 100644
--- a/tests/fate/lavf-audio.mak
+++ b/tests/fate/lavf-audio.mak
@@ -28,6 +28,7 @@ $(FATE_LAVF_AUDIO): CMD = lavf_audio
 $(FATE_LAVF_AUDIO): REF = $(SRC_PATH)/tests/ref/lavf/$(@:fate-lavf-%=%)
 $(FATE_LAVF_AUDIO): $(AREF)
 
+fate-lavf-aiff: CMD = lavf_audio "" "-metadata copyright=noone"
 fate-lavf-al fate-lavf-ul: CMD = lavf_audio "" "" "-ar 44100"
 fate-lavf-dfpwm: CMD = lavf_audio "" "" "-sample_rate 44100"
 fate-lavf-ogg: CMD = lavf_audio "" "-c:a flac"
diff --git a/tests/ref/lavf/aiff b/tests/ref/lavf/aiff
index d72ec85150..e208ff3e16 100644
--- a/tests/ref/lavf/aiff
+++ b/tests/ref/lavf/aiff
@@ -1,3 +1,3 @@
-2c129d88acef834e32869145fe792b9c *tests/data/lavf/lavf.aiff
-88270 tests/data/lavf/lavf.aiff
+655b5bd68e7a59599ab6663de0015324 *tests/data/lavf/lavf.aiff
+88284 tests/data/lavf/lavf.aiff
 tests/data/lavf/lavf.aiff CRC=0x3a1da17e
-- 
2.40.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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [FFmpeg-devel] [PATCH 2/3] avformat/aiffenc: Simplify padding tag
  2024-03-14  0:35 [FFmpeg-devel] [PATCH 1/3] fate/lavf-audio: Test writing AIFF-native tags Andreas Rheinhardt
@ 2024-03-14  0:36 ` Andreas Rheinhardt
  2024-03-14  0:36 ` [FFmpeg-devel] [PATCH 3/3] avformat/aiffenc: Usw avio_wb32() where possible Andreas Rheinhardt
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2024-03-14  0:36 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/aiffenc.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
index 11a5b18d57..37aca41847 100644
--- a/libavformat/aiffenc.c
+++ b/libavformat/aiffenc.c
@@ -87,13 +87,15 @@ static void put_meta(AVFormatContext *s, const char *key, uint32_t id)
     AVIOContext *pb = s->pb;
 
     if (tag = av_dict_get(s->metadata, key, NULL, 0)) {
-        int size = strlen(tag->value);
+        size_t size = strlen(tag->value);
+
+        // AIFF tags are zero-padded to an even length.
+        // So simply copy the terminating \0 if the length is odd.
+        size = FFALIGN(size, 2);
 
         avio_wl32(pb, id);
-        avio_wb32(pb, FFALIGN(size, 2));
+        avio_wb32(pb, size);
         avio_write(pb, tag->value, size);
-        if (size & 1)
-            avio_w8(pb, 0);
     }
 }
 
-- 
2.40.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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [FFmpeg-devel] [PATCH 3/3] avformat/aiffenc: Usw avio_wb32() where possible
  2024-03-14  0:35 [FFmpeg-devel] [PATCH 1/3] fate/lavf-audio: Test writing AIFF-native tags Andreas Rheinhardt
  2024-03-14  0:36 ` [FFmpeg-devel] [PATCH 2/3] avformat/aiffenc: Simplify padding tag Andreas Rheinhardt
@ 2024-03-14  0:36 ` Andreas Rheinhardt
  2024-03-14 21:45 ` [FFmpeg-devel] [PATCH 1/3] fate/lavf-audio: Test writing AIFF-native tags Michael Niedermayer
  2024-03-17 14:48 ` Andreas Rheinhardt
  3 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2024-03-14  0:36 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

AIFF is a big-endian format, so this is more natural.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/aiffenc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
index 37aca41847..2cd1119409 100644
--- a/libavformat/aiffenc.c
+++ b/libavformat/aiffenc.c
@@ -54,7 +54,7 @@ static int put_id3v2_tags(AVFormatContext *s, AIFFOutputContext *aiff)
     if (!s->metadata && !s->nb_chapters && !list_entry)
         return 0;
 
-    avio_wl32(pb, MKTAG('I', 'D', '3', ' '));
+    avio_wb32(pb, MKBETAG('I', 'D', '3', ' '));
     avio_wb32(pb, 0);
     pos = avio_tell(pb);
 
@@ -93,7 +93,7 @@ static void put_meta(AVFormatContext *s, const char *key, uint32_t id)
         // So simply copy the terminating \0 if the length is odd.
         size = FFALIGN(size, 2);
 
-        avio_wl32(pb, id);
+        avio_wb32(pb, id);
         avio_wb32(pb, size);
         avio_write(pb, tag->value, size);
     }
@@ -153,10 +153,10 @@ static int aiff_write_header(AVFormatContext *s)
         ff_mov_write_chan(pb, par->ch_layout.u.mask);
     }
 
-    put_meta(s, "title",     MKTAG('N', 'A', 'M', 'E'));
-    put_meta(s, "author",    MKTAG('A', 'U', 'T', 'H'));
-    put_meta(s, "copyright", MKTAG('(', 'c', ')', ' '));
-    put_meta(s, "comment",   MKTAG('A', 'N', 'N', 'O'));
+    put_meta(s, "title",     MKBETAG('N', 'A', 'M', 'E'));
+    put_meta(s, "author",    MKBETAG('A', 'U', 'T', 'H'));
+    put_meta(s, "copyright", MKBETAG('(', 'c', ')', ' '));
+    put_meta(s, "comment",   MKBETAG('A', 'N', 'N', 'O'));
 
     /* Common chunk */
     ffio_wfourcc(pb, "COMM");
-- 
2.40.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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/3] fate/lavf-audio: Test writing AIFF-native tags
  2024-03-14  0:35 [FFmpeg-devel] [PATCH 1/3] fate/lavf-audio: Test writing AIFF-native tags Andreas Rheinhardt
  2024-03-14  0:36 ` [FFmpeg-devel] [PATCH 2/3] avformat/aiffenc: Simplify padding tag Andreas Rheinhardt
  2024-03-14  0:36 ` [FFmpeg-devel] [PATCH 3/3] avformat/aiffenc: Usw avio_wb32() where possible Andreas Rheinhardt
@ 2024-03-14 21:45 ` Michael Niedermayer
  2024-03-14 21:46   ` Andreas Rheinhardt
  2024-03-17 14:48 ` Andreas Rheinhardt
  3 siblings, 1 reply; 6+ messages in thread
From: Michael Niedermayer @ 2024-03-14 21:45 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 1581 bytes --]

On Thu, Mar 14, 2024 at 01:35:36AM +0100, Andreas Rheinhardt wrote:
> In particular, test writing tags with odd strlen.
> (These tags are zero-padded to even size.)
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  tests/fate/lavf-audio.mak | 1 +
>  tests/ref/lavf/aiff       | 4 ++--
>  2 files changed, 3 insertions(+), 2 deletions(-)

needs to update seek test too:


--- ./tests/ref/seek/lavf-aiff	2024-03-05 02:37:36.243300240 +0100
+++ tests/data/fate/seek-lavf-aiff	2024-03-14 22:24:47.357654173 +0100
@@ -1,53 +1,53 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     70 size:  4096
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     84 size:  4096
 ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     70 size:  4096
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     84 size:  4096
 ret: 0         st:-1 flags:1  ts: 1.894167
 ret:-EOF
 ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos:  69602 size:  4096
+ret: 0         st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos:  69616 size:  4096
 ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     70 size:  4096
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     84 size:  4096
...

thx

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

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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/3] fate/lavf-audio: Test writing AIFF-native tags
  2024-03-14 21:45 ` [FFmpeg-devel] [PATCH 1/3] fate/lavf-audio: Test writing AIFF-native tags Michael Niedermayer
@ 2024-03-14 21:46   ` Andreas Rheinhardt
  0 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2024-03-14 21:46 UTC (permalink / raw)
  To: ffmpeg-devel

Michael Niedermayer:
> On Thu, Mar 14, 2024 at 01:35:36AM +0100, Andreas Rheinhardt wrote:
>> In particular, test writing tags with odd strlen.
>> (These tags are zero-padded to even size.)
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
>> ---
>>  tests/fate/lavf-audio.mak | 1 +
>>  tests/ref/lavf/aiff       | 4 ++--
>>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> needs to update seek test too:
> 

Yeah, I already did it locally. Sorry for this.

- Andreas

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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/3] fate/lavf-audio: Test writing AIFF-native tags
  2024-03-14  0:35 [FFmpeg-devel] [PATCH 1/3] fate/lavf-audio: Test writing AIFF-native tags Andreas Rheinhardt
                   ` (2 preceding siblings ...)
  2024-03-14 21:45 ` [FFmpeg-devel] [PATCH 1/3] fate/lavf-audio: Test writing AIFF-native tags Michael Niedermayer
@ 2024-03-17 14:48 ` Andreas Rheinhardt
  3 siblings, 0 replies; 6+ messages in thread
From: Andreas Rheinhardt @ 2024-03-17 14:48 UTC (permalink / raw)
  To: ffmpeg-devel

Andreas Rheinhardt:
> In particular, test writing tags with odd strlen.
> (These tags are zero-padded to even size.)
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  tests/fate/lavf-audio.mak | 1 +
>  tests/ref/lavf/aiff       | 4 ++--
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/fate/lavf-audio.mak b/tests/fate/lavf-audio.mak
> index d54cd107e0..7ea0c41da9 100644
> --- a/tests/fate/lavf-audio.mak
> +++ b/tests/fate/lavf-audio.mak
> @@ -28,6 +28,7 @@ $(FATE_LAVF_AUDIO): CMD = lavf_audio
>  $(FATE_LAVF_AUDIO): REF = $(SRC_PATH)/tests/ref/lavf/$(@:fate-lavf-%=%)
>  $(FATE_LAVF_AUDIO): $(AREF)
>  
> +fate-lavf-aiff: CMD = lavf_audio "" "-metadata copyright=noone"
>  fate-lavf-al fate-lavf-ul: CMD = lavf_audio "" "" "-ar 44100"
>  fate-lavf-dfpwm: CMD = lavf_audio "" "" "-sample_rate 44100"
>  fate-lavf-ogg: CMD = lavf_audio "" "-c:a flac"
> diff --git a/tests/ref/lavf/aiff b/tests/ref/lavf/aiff
> index d72ec85150..e208ff3e16 100644
> --- a/tests/ref/lavf/aiff
> +++ b/tests/ref/lavf/aiff
> @@ -1,3 +1,3 @@
> -2c129d88acef834e32869145fe792b9c *tests/data/lavf/lavf.aiff
> -88270 tests/data/lavf/lavf.aiff
> +655b5bd68e7a59599ab6663de0015324 *tests/data/lavf/lavf.aiff
> +88284 tests/data/lavf/lavf.aiff
>  tests/data/lavf/lavf.aiff CRC=0x3a1da17e

Will apply this patchset with the fate references updated.

- Andreas

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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-17 14:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-14  0:35 [FFmpeg-devel] [PATCH 1/3] fate/lavf-audio: Test writing AIFF-native tags Andreas Rheinhardt
2024-03-14  0:36 ` [FFmpeg-devel] [PATCH 2/3] avformat/aiffenc: Simplify padding tag Andreas Rheinhardt
2024-03-14  0:36 ` [FFmpeg-devel] [PATCH 3/3] avformat/aiffenc: Usw avio_wb32() where possible Andreas Rheinhardt
2024-03-14 21:45 ` [FFmpeg-devel] [PATCH 1/3] fate/lavf-audio: Test writing AIFF-native tags Michael Niedermayer
2024-03-14 21:46   ` Andreas Rheinhardt
2024-03-17 14:48 ` Andreas Rheinhardt

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git