]> git.sesse.net Git - ffmpeg/commitdiff
avformat/movenc: allow hdlr name field to be empty
authorGyan Doshi <ffmpeg@gyani.pro>
Thu, 21 Jun 2018 06:03:00 +0000 (11:33 +0530)
committerGyan Doshi <ffmpeg@gyani.pro>
Thu, 21 Jun 2018 06:03:00 +0000 (11:33 +0530)
Both QTFF and the ISOBMFF standards allow it.

Fixes #7262

libavformat/movenc.c
libavformat/movenc.h
libavformat/version.h

index 3661d24f4f2739e0ed3382599ad35da480b3e928..e2c5613f98dfa09f1ea77a6482f8bfdd6cd12b25 100644 (file)
@@ -101,6 +101,7 @@ static const AVOption options[] = {
     { "write_prft", "Write producer reference time box with specified time source", offsetof(MOVMuxContext, write_prft), AV_OPT_TYPE_INT, {.i64 = MOV_PRFT_NONE}, 0, MOV_PRFT_NB-1, AV_OPT_FLAG_ENCODING_PARAM, "prft"},
     { "wallclock", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = MOV_PRFT_SRC_WALLCLOCK}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM, "prft"},
     { "pts", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = MOV_PRFT_SRC_PTS}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM, "prft"},
+    { "empty_hdlr_name", "write zero-length name string in hdlr atoms within mdia and minf atoms", offsetof(MOVMuxContext, empty_hdlr_name), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
     { NULL },
 };
 
@@ -2551,6 +2552,7 @@ static int is_clcp_track(MOVTrack *track)
 
 static int mov_write_hdlr_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track)
 {
+    MOVMuxContext *mov = s->priv_data;
     const char *hdlr, *descr = NULL, *hdlr_type = NULL;
     int64_t pos = avio_tell(pb);
 
@@ -2605,6 +2607,9 @@ static int mov_write_hdlr_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra
         }
     }
 
+    if (mov->empty_hdlr_name) /* expressly allowed by QTFF and not prohibited in ISO 14496-12 8.4.3.3 */
+        descr = "";
+
     avio_wb32(pb, 0); /* size */
     ffio_wfourcc(pb, "hdlr");
     avio_wb32(pb, 0); /* Version & flags */
index f2967bfacec934ed58e85f3faa97b4d27b2d8145..fe605d1ad2facec454589da1c71e9b506311c53b 100644 (file)
@@ -233,6 +233,7 @@ typedef struct MOVMuxContext {
     int track_ids_ok;
     int write_tmcd;
     MOVPrftBox write_prft;
+    int empty_hdlr_name;
 } MOVMuxContext;
 
 #define FF_MOV_FLAG_RTP_HINT              (1 <<  0)
index 3c54efbb37e9b4ddce4ec771a8619e9a66548de3..57b6599e71b832b54805cceebd68bbb7ebd7b8e5 100644 (file)
@@ -33,7 +33,7 @@
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  58
 #define LIBAVFORMAT_VERSION_MINOR  17
-#define LIBAVFORMAT_VERSION_MICRO 100
+#define LIBAVFORMAT_VERSION_MICRO 101
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \