On Mon, 17 Mar 2014, John Stebbins wrote:

---
libavformat/movenc.c | 5 ++++-
libavformat/movenc.h | 2 ++
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 2ae3475..fedfc3c 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -64,6 +64,7 @@ static const AVOption options[] = {
    { "min_frag_duration", "Minimum fragment duration", offsetof(MOVMuxContext, 
min_fragment_duration), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
    { "frag_size", "Maximum fragment size", offsetof(MOVMuxContext, 
max_fragment_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
    { "ism_lookahead", "Number of lookahead entries for ISM files", 
offsetof(MOVMuxContext, ism_lookahead), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, 
AV_OPT_FLAG_ENCODING_PARAM},
+    { "brand",    "Override major brand", offsetof(MOVMuxContext, 
major_brand),   AV_OPT_TYPE_STRING, {.str = NULL}, .flags = AV_OPT_FLAG_ENCODING_PARAM },
    { NULL },
};

@@ -2564,7 +2565,9 @@ static int mov_write_ftyp_tag(AVIOContext *pb, 
AVFormatContext *s)
    avio_wb32(pb, 0); /* size */
    ffio_wfourcc(pb, "ftyp");

-    if (mov->mode == MODE_3GP) {
+    if (mov->major_brand)
+        ffio_wfourcc(pb, mov->major_brand);

Would it be worthwhile to have some check for the string length to make sure it's >= 4? Even though the user is at fault for setting a faulty option, it's still not nice to have the library crash on the user in those cases. (Although in most cases it probably wouldn't crash since the string is dynamically allocated and the real allocation probably is bigger than 1-3 bytes, but you see my point.)

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to