diff mbox series

[FFmpeg-devel] dash metadata: Added other supported fields besides title only

Message ID 7c1044ba-4ec9-ac5b-8bbb-28a28941f7c8@davyandbeth.com
State New
Headers show
Series [FFmpeg-devel] dash metadata: Added other supported fields besides title only | expand

Checks

Context Check Description
andriy/configure_x86 warning Failed to apply patch
yinshiyou/configure_loongarch64 warning Failed to apply patch

Commit Message

Davy Durham Feb. 23, 2023, 1:15 a.m. UTC
Now metadata fields for source, copyright, lang and moreInformationURL 
are supported too.  Evidence for the need of such support: 
https://docs.rs/dash-mpd/0.6.3/dash_mpd/struct.ProgramInformation.html 
and 
https://github.com/DroidFreak32/myjio_unrestrict/blob/805a8b48d02c5618608bf6fb2bfc2b450f1f057a/smali_classes2/com/google/android/exoplayer2/source/dash/manifest/ProgramInformation.smali#L19

Signed-off-by: Davy Durham <ddurham@users.sourceforge.net>
---
  libavformat/dashenc.c | 24 ++++++++++++++++++++++++
  1 file changed, 24 insertions(+)

"moreInformationURL", NULL, 0);
      AVDictionary *opts = NULL;
       if (!use_rename && !warned_non_file++)
@@ -1203,6 +1207,26 @@ static int write_manifest(AVFormatContext *s, int 
final)
          avio_printf(out, "\t\t<Title>%s</Title>\n", escaped);
          av_free(escaped);
      }
+    if (source) {
+        char *escaped = xmlescape(source->value);
+        avio_printf(out, "\t\t<Source>%s</Source>\n", escaped);
+        av_free(escaped);
+    }
+    if (copyright) {
+        char *escaped = xmlescape(copyright->value);
+        avio_printf(out, "\t\t<Copyright>%s</Copyright>\n", escaped);
+        av_free(escaped);
+    }
+    if (lang) {
+        char *escaped = xmlescape(lang->value);
+        avio_printf(out, "\t\t<lang>%s</lang>\n", escaped);
+        av_free(escaped);
+    }
+    if (moreInformationURL) {
+        char *escaped = xmlescape(moreInformationURL->value);
+        avio_printf(out, 
"\t\t<moreInformationURL>%s</moreInformationURL>\n", escaped);
+        av_free(escaped);
+    }
      avio_printf(out, "\t</ProgramInformation>\n");
       avio_printf(out, "\t<ServiceDescription id=\"0\">\n");
diff mbox series

Patch

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 295b01e225..e45eca3468 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1141,6 +1141,10 @@  static int write_manifest(AVFormatContext *s, int 
final)
      int use_rename = proto && !strcmp(proto, "file");
      static unsigned int warned_non_file = 0;
      AVDictionaryEntry *title = av_dict_get(s->metadata, "title", NULL, 0);
+    AVDictionaryEntry *source = av_dict_get(s->metadata, "source", 
NULL, 0);
+    AVDictionaryEntry *copyright = av_dict_get(s->metadata, 
"copyright", NULL, 0);
+    AVDictionaryEntry *lang = av_dict_get(s->metadata, "lang", NULL, 0);
+    AVDictionaryEntry *moreInformationURL = av_dict_get(s->metadata,