Mercurial > libavformat.hg
comparison movenc.c @ 2668:8d400e382d6e libavformat
Prevent mov muxer from writing empty udta atoms.
author | benoit |
---|---|
date | Wed, 24 Oct 2007 14:20:15 +0000 |
parents | 0b993d441969 |
children | 09eb62fa2a0e |
comparison
equal
deleted
inserted
replaced
2667:e896ac505ec6 | 2668:8d400e382d6e |
---|---|
1218 } | 1218 } |
1219 | 1219 |
1220 static int mov_write_udta_tag(ByteIOContext *pb, MOVContext* mov, | 1220 static int mov_write_udta_tag(ByteIOContext *pb, MOVContext* mov, |
1221 AVFormatContext *s) | 1221 AVFormatContext *s) |
1222 { | 1222 { |
1223 offset_t pos = url_ftell(pb); | 1223 int i, req = 0; |
1224 int i; | 1224 |
1225 /* Requirements */ | |
1226 for (i=0; i<mov->nb_streams; i++) { | |
1227 if(mov->tracks[i].entry <= 0) continue; | |
1228 if (mov->tracks[i].enc->codec_id == CODEC_ID_AAC || | |
1229 mov->tracks[i].enc->codec_id == CODEC_ID_MPEG4) { | |
1230 req = 1; | |
1231 break; | |
1232 } | |
1233 } | |
1234 | |
1235 if (s->title[0] || s->author[0] || s->album[0] || s->year || | |
1236 s->comment[0] || s->genre[0] || s->track || | |
1237 (mov->mode == MODE_MOV && | |
1238 ((mov->tracks[0].enc && !mov->tracks[0].enc->flags & CODEC_FLAG_BITEXACT) || req))) { | |
1239 offset_t pos = url_ftell(pb); | |
1225 | 1240 |
1226 put_be32(pb, 0); /* size */ | 1241 put_be32(pb, 0); /* size */ |
1227 put_tag(pb, "udta"); | 1242 put_tag(pb, "udta"); |
1228 | 1243 |
1229 /* iTunes meta data */ | 1244 /* iTunes meta data */ |
1230 mov_write_meta_tag(pb, mov, s); | 1245 mov_write_meta_tag(pb, mov, s); |
1231 | 1246 |
1232 if(mov->mode == MODE_MOV){ // the title field breaks gtkpod with mp4 and my suspicion is that stuff is not valid in mp4 | 1247 if(mov->mode == MODE_MOV){ // the title field breaks gtkpod with mp4 and my suspicion is that stuff is not valid in mp4 |
1233 /* Requirements */ | 1248 /* Requirements */ |
1234 for (i=0; i<mov->nb_streams; i++) { | 1249 if (req) |
1235 if(mov->tracks[i].entry <= 0) continue; | |
1236 if (mov->tracks[i].enc->codec_id == CODEC_ID_AAC || | |
1237 mov->tracks[i].enc->codec_id == CODEC_ID_MPEG4) { | |
1238 mov_write_string_tag(pb, "\251req", "QuickTime 6.0 or greater", 0); | 1250 mov_write_string_tag(pb, "\251req", "QuickTime 6.0 or greater", 0); |
1239 break; | |
1240 } | |
1241 } | |
1242 | 1251 |
1243 mov_write_string_tag(pb, "\251nam", s->title , 0); | 1252 mov_write_string_tag(pb, "\251nam", s->title , 0); |
1244 mov_write_string_tag(pb, "\251aut", s->author , 0); | 1253 mov_write_string_tag(pb, "\251aut", s->author , 0); |
1245 mov_write_string_tag(pb, "\251alb", s->album , 0); | 1254 mov_write_string_tag(pb, "\251alb", s->album , 0); |
1246 mov_write_day_tag(pb, s->year, 0); | 1255 mov_write_day_tag(pb, s->year, 0); |
1249 mov_write_string_tag(pb, "\251des", s->comment , 0); | 1258 mov_write_string_tag(pb, "\251des", s->comment , 0); |
1250 mov_write_string_tag(pb, "\251gen", s->genre , 0); | 1259 mov_write_string_tag(pb, "\251gen", s->genre , 0); |
1251 } | 1260 } |
1252 | 1261 |
1253 return updateSize(pb, pos); | 1262 return updateSize(pb, pos); |
1263 } | |
1264 | |
1265 return 0; | |
1254 } | 1266 } |
1255 | 1267 |
1256 static int utf8len(uint8_t *b){ | 1268 static int utf8len(uint8_t *b){ |
1257 int len=0; | 1269 int len=0; |
1258 int val; | 1270 int val; |