comparison movenc.c @ 3450:0e53bfbd3a1c libavformat

rework udta handling, if any track set bitexact, don't write any metadata
author bcoudurier
date Mon, 09 Jun 2008 20:13:44 +0000
parents 8c8959bade51
children 548c70a18d9f
comparison
equal deleted inserted replaced
3449:8c8959bade51 3450:0e53bfbd3a1c
1146 mov_write_string_tag(pb, "\251nam", s->title , 1); 1146 mov_write_string_tag(pb, "\251nam", s->title , 1);
1147 mov_write_string_tag(pb, "\251ART", s->author , 1); 1147 mov_write_string_tag(pb, "\251ART", s->author , 1);
1148 mov_write_string_tag(pb, "\251wrt", s->author , 1); 1148 mov_write_string_tag(pb, "\251wrt", s->author , 1);
1149 mov_write_string_tag(pb, "\251alb", s->album , 1); 1149 mov_write_string_tag(pb, "\251alb", s->album , 1);
1150 mov_write_day_tag(pb, s->year ,1); 1150 mov_write_day_tag(pb, s->year ,1);
1151 if(mov->tracks[0].enc && !(mov->tracks[0].enc->flags & CODEC_FLAG_BITEXACT)) 1151 mov_write_string_tag(pb, "\251too", LIBAVFORMAT_IDENT, 1);
1152 mov_write_string_tag(pb, "\251too", LIBAVFORMAT_IDENT, 1);
1153 mov_write_string_tag(pb, "\251cmt", s->comment , 1); 1152 mov_write_string_tag(pb, "\251cmt", s->comment , 1);
1154 mov_write_string_tag(pb, "\251gen", s->genre , 1); 1153 mov_write_string_tag(pb, "\251gen", s->genre , 1);
1155 mov_write_trkn_tag(pb, mov, s); 1154 mov_write_trkn_tag(pb, mov, s);
1156 return updateSize(pb, pos); 1155 return updateSize(pb, pos);
1157 } 1156 }
1178 1177
1179 static int mov_write_udta_tag(ByteIOContext *pb, MOVContext *mov, 1178 static int mov_write_udta_tag(ByteIOContext *pb, MOVContext *mov,
1180 AVFormatContext *s) 1179 AVFormatContext *s)
1181 { 1180 {
1182 int i; 1181 int i;
1183 1182 int bitexact = 0;
1184 if (s->title[0] || s->author[0] || s->album[0] || s->year || 1183
1185 s->comment[0] || s->genre[0] || s->track || 1184 for (i = 0; i < s->nb_streams; i++)
1186 (mov->mode == MODE_MOV && 1185 if (mov->tracks[i].enc->flags & CODEC_FLAG_BITEXACT) {
1187 (mov->tracks[0].enc && !(mov->tracks[0].enc->flags & CODEC_FLAG_BITEXACT)))) { 1186 bitexact = 1;
1187 break;
1188 }
1189
1190 if (!bitexact && (s->title[0] || s->author[0] || s->album[0] || s->year ||
1191 s->comment[0] || s->genre[0] || s->track)) {
1188 offset_t pos = url_ftell(pb); 1192 offset_t pos = url_ftell(pb);
1189 1193
1190 put_be32(pb, 0); /* size */ 1194 put_be32(pb, 0); /* size */
1191 put_tag(pb, "udta"); 1195 put_tag(pb, "udta");
1192 1196
1196 if(mov->mode == MODE_MOV){ // the title field breaks gtkpod with mp4 and my suspicion is that stuff is not valid in mp4 1200 if(mov->mode == MODE_MOV){ // the title field breaks gtkpod with mp4 and my suspicion is that stuff is not valid in mp4
1197 mov_write_string_tag(pb, "\251nam", s->title , 0); 1201 mov_write_string_tag(pb, "\251nam", s->title , 0);
1198 mov_write_string_tag(pb, "\251aut", s->author , 0); 1202 mov_write_string_tag(pb, "\251aut", s->author , 0);
1199 mov_write_string_tag(pb, "\251alb", s->album , 0); 1203 mov_write_string_tag(pb, "\251alb", s->album , 0);
1200 mov_write_day_tag(pb, s->year, 0); 1204 mov_write_day_tag(pb, s->year, 0);
1201 if(mov->tracks[0].enc && !(mov->tracks[0].enc->flags & CODEC_FLAG_BITEXACT)) 1205 mov_write_string_tag(pb, "\251enc", LIBAVFORMAT_IDENT, 0);
1202 mov_write_string_tag(pb, "\251enc", LIBAVFORMAT_IDENT, 0);
1203 mov_write_string_tag(pb, "\251des", s->comment , 0); 1206 mov_write_string_tag(pb, "\251des", s->comment , 0);
1204 mov_write_string_tag(pb, "\251gen", s->genre , 0); 1207 mov_write_string_tag(pb, "\251gen", s->genre , 0);
1205 } 1208 }
1206 1209
1207 return updateSize(pb, pos); 1210 return updateSize(pb, pos);