diff mbox series

[FFmpeg-devel,1/3] avformat/aeadec: Export title

Message ID AS8P250MB07449B9C77EBEA759D1F775F8F282@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 103965053bb73e6be8b648a442b258d13ca99f88
Headers show
Series [FFmpeg-devel,1/3] avformat/aeadec: Export title | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt March 15, 2024, 4:42 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/aeadec.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

Comments

Andreas Rheinhardt March 18, 2024, 12:52 a.m. UTC | #1
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavformat/aeadec.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/aeadec.c b/libavformat/aeadec.c
> index 4cb2da6639..20170a89b3 100644
> --- a/libavformat/aeadec.c
> +++ b/libavformat/aeadec.c
> @@ -23,6 +23,7 @@
>  #include "libavutil/channel_layout.h"
>  #include "libavutil/intreadwrite.h"
>  #include "avformat.h"
> +#include "avio_internal.h"
>  #include "demux.h"
>  #include "pcm.h"
>  
> @@ -59,12 +60,20 @@ static int aea_read_probe(const AVProbeData *p)
>  static int aea_read_header(AVFormatContext *s)
>  {
>      AVStream *st = avformat_new_stream(s, NULL);
> -    int channels;
> +    char title[256 + 1];
> +    int channels, ret;
>      if (!st)
>          return AVERROR(ENOMEM);
>  
> -    /* Parse the amount of channels and skip to pos 2048(0x800) */
> -    avio_skip(s->pb, 264);
> +    /* Read the title, parse the number of channels and skip to pos 2048(0x800) */
> +    avio_rl32(s->pb); // magic
> +    ret = ffio_read_size(s->pb, title, sizeof(title) - 1);
> +    if (ret < 0)
> +        return ret;
> +    title[sizeof(title) - 1] = '\0';
> +    if (title[0] != '\0')
> +        av_dict_set(&st->metadata, "title", title, 0);
> +    avio_rl32(s->pb); // Block count
>      channels = avio_r8(s->pb);
>      avio_skip(s->pb, 1783);
>  

Will apply this patchset tonight unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavformat/aeadec.c b/libavformat/aeadec.c
index 4cb2da6639..20170a89b3 100644
--- a/libavformat/aeadec.c
+++ b/libavformat/aeadec.c
@@ -23,6 +23,7 @@ 
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "avio_internal.h"
 #include "demux.h"
 #include "pcm.h"
 
@@ -59,12 +60,20 @@  static int aea_read_probe(const AVProbeData *p)
 static int aea_read_header(AVFormatContext *s)
 {
     AVStream *st = avformat_new_stream(s, NULL);
-    int channels;
+    char title[256 + 1];
+    int channels, ret;
     if (!st)
         return AVERROR(ENOMEM);
 
-    /* Parse the amount of channels and skip to pos 2048(0x800) */
-    avio_skip(s->pb, 264);
+    /* Read the title, parse the number of channels and skip to pos 2048(0x800) */
+    avio_rl32(s->pb); // magic
+    ret = ffio_read_size(s->pb, title, sizeof(title) - 1);
+    if (ret < 0)
+        return ret;
+    title[sizeof(title) - 1] = '\0';
+    if (title[0] != '\0')
+        av_dict_set(&st->metadata, "title", title, 0);
+    avio_rl32(s->pb); // Block count
     channels = avio_r8(s->pb);
     avio_skip(s->pb, 1783);