[FFmpeg-devel] [PATCH] simplify mov mode

Michael Niedermayer michaelni
Thu Jun 12 00:04:26 CEST 2008


Hi

$subj

This patch also moves us closer to being able to have "multi role" mp4s.

Index: libavformat/movenc.c
===================================================================
--- libavformat/movenc.c	(revision 13749)
+++ libavformat/movenc.c	(working copy)
@@ -31,13 +31,13 @@
 #define MOV_INDEX_CLUSTER_SIZE 16384
 #define globalTimescale 1000
 
-#define MODE_MP4 0
-#define MODE_MOV 1
-#define MODE_3GP 2
-#define MODE_PSP 3 // example working PSP command line:
+#define MODE_MP4  0x01
+#define MODE_MOV  0x02
+#define MODE_3GP  0x04
+#define MODE_PSP  0x08 // example working PSP command line:
 // ffmpeg -i testinput.avi  -f psp -r 14.985 -s 320x240 -b 768 -ar 24000 -ab 32 M4V00001.MP4
-#define MODE_3G2 4
-#define MODE_IPOD 5
+#define MODE_3G2  0x10
+#define MODE_IPOD 0x20
 
 typedef struct MOVIentry {
     unsigned int flags, size;
@@ -526,7 +526,7 @@
         if (!match_ext(s->filename, "m4a") && !match_ext(s->filename, "m4v"))
             av_log(s, AV_LOG_WARNING, "Warning, extension is not .m4a nor .m4v "
                    "Quicktime/Ipod might not play the file\n");
-    } else if (track->mode == MODE_3GP || track->mode == MODE_3G2) {
+    } else if (track->mode & MODE_3GP) {
         tag = codec_get_tag(codec_3gp_tags, track->enc->codec_id);
     } else if (!tag || (track->enc->strict_std_compliance >= FF_COMPLIANCE_NORMAL &&
                         (tag == MKTAG('d','v','c','p') ||
@@ -1255,7 +1255,7 @@
         put_be32(pb, 0); /* size */
         put_tag(pb, "udta");
 
-        if (mov->mode == MODE_3GP || mov->mode == MODE_3G2) {
+        if (mov->mode & MODE_3GP) {
             mov_write_3gp_udta_tag(pb, s, "titl", s->title);
             mov_write_3gp_udta_tag(pb, s, "auth", s->author);
             mov_write_3gp_udta_tag(pb, s, "gnre", s->genre);
@@ -1386,7 +1386,7 @@
 
     if (mov->mode == MODE_3GP)
         put_tag(pb, "3gp4");
-    else if (mov->mode == MODE_3G2)
+    else if (mov->mode & MODE_3G2)
         put_tag(pb, "3g2a");
     else if (mov->mode == MODE_PSP)
         put_tag(pb, "MSNV");
@@ -1407,7 +1407,7 @@
 
     if (mov->mode == MODE_3GP)
         put_tag(pb, "3gp4");
-    else if (mov->mode == MODE_3G2)
+    else if (mov->mode & MODE_3G2)
         put_tag(pb, "3g2a");
     else if (mov->mode == MODE_PSP)
         put_tag(pb, "MSNV");
@@ -1496,7 +1496,7 @@
 
     if (s->oformat != NULL) {
         if (!strcmp("3gp", s->oformat->name)) mov->mode = MODE_3GP;
-        else if (!strcmp("3g2", s->oformat->name)) mov->mode = MODE_3G2;
+        else if (!strcmp("3g2", s->oformat->name)) mov->mode = MODE_3GP|MODE_3G2;
         else if (!strcmp("mov", s->oformat->name)) mov->mode = MODE_MOV;
         else if (!strcmp("psp", s->oformat->name)) mov->mode = MODE_PSP;
         else if (!strcmp("ipod",s->oformat->name)) mov->mode = MODE_IPOD;

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080612/4aafc39e/attachment.pgp>



More information about the ffmpeg-devel mailing list