Mercurial > libavformat.hg
comparison movenc.c @ 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 | 60f897e8dd2d |
children | e996e7da971c |
comparison
equal
deleted
inserted
replaced
493:166b71445aec | 494:abc8a657a8dd |
---|---|
250 { 0, 0 }, | 250 { 0, 0 }, |
251 }; | 251 }; |
252 | 252 |
253 static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack* track) | 253 static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack* track) |
254 { | 254 { |
255 int pos = url_ftell(pb), tag; | 255 int pos = url_ftell(pb); |
256 int tag; | |
256 | 257 |
257 put_be32(pb, 0); /* size */ | 258 put_be32(pb, 0); /* size */ |
258 | 259 |
259 tag = codec_get_tag(codec_movaudio_tags, track->enc->codec_id); | 260 tag = codec_get_tag(codec_movaudio_tags, track->enc->codec_id); |
260 // if no mac fcc found, try with Microsoft tags | 261 // if no mac fcc found, try with Microsoft tags |
261 if (!tag) | 262 if (!tag) |
262 { | 263 { |
263 int tmp = codec_get_tag(codec_wav_tags, track->enc->codec_id); | 264 int tmp = codec_get_tag(codec_wav_tags, track->enc->codec_id); |
264 if (tmp) | 265 tag = MKTAG('m', 's', ((tmp >> 8) & 0xff), (tmp & 0xff)); |
265 tag = MKTAG('m', 's', ((tmp >> 8) & 0xff), (tmp & 0xff)); | 266 } |
266 } | 267 put_le32(pb, tag); // store it byteswapped |
267 if (!tag) | |
268 put_tag(pb, " "); | |
269 else | |
270 put_le32(pb, tag); // store it byteswapped | |
271 | 268 |
272 put_be32(pb, 0); /* Reserved */ | 269 put_be32(pb, 0); /* Reserved */ |
273 put_be16(pb, 0); /* Reserved */ | 270 put_be16(pb, 0); /* Reserved */ |
274 put_be16(pb, 1); /* Data-reference index, XXX == 1 */ | 271 put_be16(pb, 1); /* Data-reference index, XXX == 1 */ |
275 | 272 |
440 { 0, 0 }, | 437 { 0, 0 }, |
441 }; | 438 }; |
442 | 439 |
443 static int mov_write_video_tag(ByteIOContext *pb, MOVTrack* track) | 440 static int mov_write_video_tag(ByteIOContext *pb, MOVTrack* track) |
444 { | 441 { |
445 int pos = url_ftell(pb), tag; | 442 int pos = url_ftell(pb); |
443 int tag; | |
446 | 444 |
447 put_be32(pb, 0); /* size */ | 445 put_be32(pb, 0); /* size */ |
448 | 446 |
449 tag = codec_get_tag(codec_movvideo_tags, track->enc->codec_id); | 447 tag = codec_get_tag(codec_movvideo_tags, track->enc->codec_id); |
450 // if no mac fcc found, try with Microsoft tags | 448 // if no mac fcc found, try with Microsoft tags |
451 if (!tag) | 449 if (!tag) |
452 tag = codec_get_tag(codec_bmp_tags, track->enc->codec_id); | 450 tag = codec_get_tag(codec_bmp_tags, track->enc->codec_id); |
453 if (!tag) | 451 put_le32(pb, tag); // store it byteswapped |
454 put_tag(pb, " "); | |
455 else | |
456 put_le32(pb, tag); // store it byteswapped | |
457 | 452 |
458 put_be32(pb, 0); /* Reserved */ | 453 put_be32(pb, 0); /* Reserved */ |
459 put_be16(pb, 0); /* Reserved */ | 454 put_be16(pb, 0); /* Reserved */ |
460 put_be16(pb, 1); /* Data-reference index */ | 455 put_be16(pb, 1); /* Data-reference index */ |
461 | 456 |
928 { | 923 { |
929 ByteIOContext *pb = &s->pb; | 924 ByteIOContext *pb = &s->pb; |
930 MOVContext *mov = s->priv_data; | 925 MOVContext *mov = s->priv_data; |
931 int i; | 926 int i; |
932 | 927 |
928 for(i=0; i<s->nb_streams; i++){ | |
929 AVCodecContext *c= &s->streams[i]->codec; | |
930 | |
931 if (c->codec_type == CODEC_TYPE_VIDEO){ | |
932 if (!codec_get_tag(codec_movvideo_tags, c->codec_id)){ | |
933 if(!codec_get_tag(codec_bmp_tags, c->codec_id)) | |
934 return -1; | |
935 else | |
936 av_log(s, AV_LOG_INFO, "Warning, using MS style video codec tag, the file may be unplayable!\n"); | |
937 } | |
938 }else if(c->codec_type == CODEC_TYPE_AUDIO){ | |
939 if (!codec_get_tag(codec_movaudio_tags, c->codec_id)){ | |
940 if(!codec_get_tag(codec_wav_tags, c->codec_id)) | |
941 return -1; | |
942 else | |
943 av_log(s, AV_LOG_INFO, "Warning, using MS style audio codec tag, the file may be unplayable!\n"); | |
944 } | |
945 } | |
946 } | |
947 | |
933 /* Default mode == MP4 */ | 948 /* Default mode == MP4 */ |
934 mov->mode = MODE_MP4; | 949 mov->mode = MODE_MP4; |
935 | 950 |
936 if (s->oformat != NULL) { | 951 if (s->oformat != NULL) { |
937 if (!strcmp("3gp", s->oformat->name)) mov->mode = MODE_3GP; | 952 if (!strcmp("3gp", s->oformat->name)) mov->mode = MODE_3GP; |