changeset 494:abc8a657a8dd libavformat

warn user if ms style codec tag is used remove " " codec tag
author michael
date Tue, 13 Jul 2004 20:59:29 +0000
parents 166b71445aec
children d33ce0cfc81c
files movenc.c
diffstat 1 files changed, 27 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/movenc.c	Wed Jul 07 20:19:29 2004 +0000
+++ b/movenc.c	Tue Jul 13 20:59:29 2004 +0000
@@ -252,7 +252,8 @@
 
 static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack* track)
 {
-    int pos = url_ftell(pb), tag;
+    int pos = url_ftell(pb);
+    int tag;
     
     put_be32(pb, 0); /* size */
 
@@ -261,13 +262,9 @@
     if (!tag)
     {
 	int tmp = codec_get_tag(codec_wav_tags, track->enc->codec_id);
-	if (tmp)
-	    tag = MKTAG('m', 's', ((tmp >> 8) & 0xff), (tmp & 0xff));
+        tag = MKTAG('m', 's', ((tmp >> 8) & 0xff), (tmp & 0xff));
     }
-    if (!tag)
-	put_tag(pb, "    ");
-    else
-	put_le32(pb, tag); // store it byteswapped
+    put_le32(pb, tag); // store it byteswapped
 
     put_be32(pb, 0); /* Reserved */
     put_be16(pb, 0); /* Reserved */
@@ -442,7 +439,8 @@
 
 static int mov_write_video_tag(ByteIOContext *pb, MOVTrack* track)
 {
-    int pos = url_ftell(pb), tag;
+    int pos = url_ftell(pb);
+    int tag;
 
     put_be32(pb, 0); /* size */
 
@@ -450,10 +448,7 @@
     // if no mac fcc found, try with Microsoft tags
     if (!tag)
 	tag = codec_get_tag(codec_bmp_tags, track->enc->codec_id);
-    if (!tag)
-	put_tag(pb, "    ");
-    else
-	put_le32(pb, tag); // store it byteswapped
+    put_le32(pb, tag); // store it byteswapped
 
     put_be32(pb, 0); /* Reserved */
     put_be16(pb, 0); /* Reserved */
@@ -930,6 +925,26 @@
     MOVContext *mov = s->priv_data;
     int i;
 
+    for(i=0; i<s->nb_streams; i++){
+        AVCodecContext *c= &s->streams[i]->codec;
+
+        if      (c->codec_type == CODEC_TYPE_VIDEO){
+            if (!codec_get_tag(codec_movvideo_tags, c->codec_id)){
+                if(!codec_get_tag(codec_bmp_tags, c->codec_id))
+                    return -1;
+                else
+                    av_log(s, AV_LOG_INFO, "Warning, using MS style video codec tag, the file may be unplayable!\n");
+            }
+        }else if(c->codec_type == CODEC_TYPE_AUDIO){
+            if (!codec_get_tag(codec_movaudio_tags, c->codec_id)){
+                if(!codec_get_tag(codec_wav_tags, c->codec_id))
+                    return -1;
+                else
+                    av_log(s, AV_LOG_INFO, "Warning, using MS style audio codec tag, the file may be unplayable!\n");
+            }
+        }
+    }
+
     /* Default mode == MP4 */
     mov->mode = MODE_MP4;