Line
Link Here
|
0 |
-- easytag-2.1.7/src/mp4_header.c |
0 |
++ easytag-2.1.7/src/mp4_header.c |
Lines 204-210
Link Here
|
204 |
/* Get size of file */ |
204 |
/* Get size of file */ |
205 |
ETFileInfo->size = Get_File_Size(filename); |
205 |
ETFileInfo->size = Get_File_Size(filename); |
206 |
|
206 |
|
207 |
if ((file = MP4Read(filename, 0)) == MP4_INVALID_FILE_HANDLE ) |
207 |
if ((file = MP4Read(filename)) == MP4_INVALID_FILE_HANDLE ) |
208 |
{ |
208 |
{ |
209 |
gchar *filename_utf8 = filename_to_display(filename); |
209 |
gchar *filename_utf8 = filename_to_display(filename); |
210 |
//g_print(_("ERROR while opening file: '%s' (%s)."),filename_utf8,g_strerror(errno)); |
210 |
//g_print(_("ERROR while opening file: '%s' (%s)."),filename_utf8,g_strerror(errno)); |
Lines 218-224
Link Here
|
218 |
{ |
218 |
{ |
219 |
gchar *filename_utf8 = filename_to_display(filename); |
219 |
gchar *filename_utf8 = filename_to_display(filename); |
220 |
Log_Print(LOG_ERROR,_("ERROR while opening file: '%s' (%s)."),filename_utf8,("Contains no audio track")); |
220 |
Log_Print(LOG_ERROR,_("ERROR while opening file: '%s' (%s)."),filename_utf8,("Contains no audio track")); |
221 |
MP4Close(file); |
221 |
MP4Close(file, 0); |
222 |
g_free(filename_utf8); |
222 |
g_free(filename_utf8); |
223 |
return FALSE; |
223 |
return FALSE; |
224 |
} |
224 |
} |
Lines 243-249
Link Here
|
243 |
ETFileInfo->mode = MP4GetTrackAudioChannels(file, trackId); |
243 |
ETFileInfo->mode = MP4GetTrackAudioChannels(file, trackId); |
244 |
ETFileInfo->duration = MP4ConvertFromTrackDuration(file, trackId, MP4GetTrackDuration(file, trackId), MP4_SECS_TIME_SCALE); |
244 |
ETFileInfo->duration = MP4ConvertFromTrackDuration(file, trackId, MP4GetTrackDuration(file, trackId), MP4_SECS_TIME_SCALE); |
245 |
|
245 |
|
246 |
MP4Close(file); |
246 |
MP4Close(file, 0); |
247 |
return TRUE; |
247 |
return TRUE; |
248 |
} |
248 |
} |
249 |
|
249 |
|
250 |
-- easytag-2.1.7/src/mp4_tag.c |
250 |
++ easytag-2.1.7/src/mp4_tag.c |
Lines 80-94
Link Here
|
80 |
{ |
80 |
{ |
81 |
FILE *file; |
81 |
FILE *file; |
82 |
MP4FileHandle mp4file = NULL; |
82 |
MP4FileHandle mp4file = NULL; |
83 |
uint16_t track, track_total; |
|
|
84 |
uint16_t disk, disktotal; |
85 |
u_int8_t *coverArt; |
86 |
u_int32_t coverSize; |
87 |
Picture *prev_pic = NULL; |
83 |
Picture *prev_pic = NULL; |
88 |
#ifdef NEWMP4 |
|
|
89 |
gint pic_num; |
84 |
gint pic_num; |
90 |
#endif |
85 |
|
91 |
|
|
|
92 |
if (!filename || !FileTag) |
86 |
if (!filename || !FileTag) |
93 |
return FALSE; |
87 |
return FALSE; |
94 |
|
88 |
|
Lines 102-108
Link Here
|
102 |
fclose(file); // We close it cause mp4 opens/closes file itself |
96 |
fclose(file); // We close it cause mp4 opens/closes file itself |
103 |
|
97 |
|
104 |
/* Get data from tag */ |
98 |
/* Get data from tag */ |
105 |
mp4file = MP4Read(filename, 0); |
99 |
mp4file = MP4Read(filename); |
106 |
if (mp4file == MP4_INVALID_FILE_HANDLE) |
100 |
if (mp4file == MP4_INVALID_FILE_HANDLE) |
107 |
{ |
101 |
{ |
108 |
gchar *filename_utf8 = filename_to_display(filename); |
102 |
gchar *filename_utf8 = filename_to_display(filename); |
Lines 111-219
Link Here
|
111 |
return FALSE; |
105 |
return FALSE; |
112 |
} |
106 |
} |
113 |
|
107 |
|
|
|
108 |
const MP4Tags* tags = MP4TagsAlloc(); |
109 |
MP4TagsFetch(tags, mp4file); |
110 |
|
114 |
/* TODO Add error detection */ |
111 |
/* TODO Add error detection */ |
115 |
|
112 |
|
116 |
/********* |
113 |
/********* |
117 |
* Title * |
114 |
* Title * |
118 |
*********/ |
115 |
*********/ |
119 |
MP4GetMetadataName(mp4file, &FileTag->title); |
116 |
if (tags->name) |
|
|
117 |
{ |
118 |
FileTag->title = Try_To_Validate_Utf8_String(tags->name); |
119 |
} |
120 |
|
120 |
|
121 |
/********** |
121 |
/********** |
122 |
* Artist * |
122 |
* Artist * |
123 |
**********/ |
123 |
**********/ |
124 |
MP4GetMetadataArtist(mp4file, &FileTag->artist); |
124 |
if (tags->artist) |
|
|
125 |
{ |
126 |
FileTag->artist = Try_To_Validate_Utf8_String(tags->artist); |
127 |
} |
128 |
|
129 |
/**************** |
130 |
* Album Artist * |
131 |
****************/ |
132 |
if (tags->albumArtist) |
133 |
{ |
134 |
FileTag->album_artist = Try_To_Validate_Utf8_String(tags->albumArtist); |
135 |
} |
125 |
|
136 |
|
126 |
/********* |
137 |
/********* |
127 |
* Album * |
138 |
* Album * |
128 |
*********/ |
139 |
*********/ |
129 |
MP4GetMetadataAlbum(mp4file, &FileTag->album); |
140 |
if (tags->album) |
|
|
141 |
{ |
142 |
FileTag->album = Try_To_Validate_Utf8_String(tags->album); |
143 |
} |
130 |
|
144 |
|
131 |
/********************** |
145 |
/********************** |
132 |
* Disk / Total Disks * |
146 |
* Disk / Total Disks * |
133 |
**********************/ |
147 |
**********************/ |
134 |
if (MP4GetMetadataDisk(mp4file, &disk, &disktotal)) |
148 |
if (tags->disk) |
135 |
{ |
149 |
{ |
136 |
if (disk != 0 && disktotal != 0) |
150 |
if (tags->disk->index != 0 && tags->disk->total != 0) |
137 |
FileTag->disc_number = g_strdup_printf("%d/%d",(gint)disk,(gint)disktotal); |
151 |
FileTag->disc_number = g_strdup_printf("%d/%d",(gint)tags->disk->index,(gint)tags->disk->total); |
138 |
else if (disk != 0) |
152 |
else if (tags->disk->index != 0) |
139 |
FileTag->disc_number = g_strdup_printf("%d",(gint)disk); |
153 |
FileTag->disc_number = g_strdup_printf("%d",(gint)tags->disk->index); |
140 |
else if (disktotal != 0) |
154 |
else if (tags->disk->total != 0) |
141 |
FileTag->disc_number = g_strdup_printf("/%d",(gint)disktotal); |
155 |
FileTag->disc_number = g_strdup_printf("/%d",(gint)tags->disk->total); |
142 |
//if (disktotal != 0) |
|
|
143 |
// FileTag->disk_number_total = g_strdup_printf("%d",(gint)disktotal); |
144 |
} |
156 |
} |
145 |
|
157 |
|
146 |
/******** |
158 |
/******** |
147 |
* Year * |
159 |
* Year * |
148 |
********/ |
160 |
********/ |
149 |
MP4GetMetadataYear(mp4file, &FileTag->year); |
161 |
if (tags->releaseDate) |
|
|
162 |
{ |
163 |
FileTag->year = Try_To_Validate_Utf8_String(tags->releaseDate); |
164 |
} |
150 |
|
165 |
|
151 |
/************************* |
166 |
/************************* |
152 |
* Track and Total Track * |
167 |
* Track and Total Track * |
153 |
*************************/ |
168 |
*************************/ |
154 |
if (MP4GetMetadataTrack(mp4file, &track, &track_total)) |
169 |
if (tags->track) |
155 |
{ |
170 |
{ |
156 |
if (track != 0) |
171 |
if (tags->track->index != 0) |
157 |
FileTag->track = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,(gint)track); // Just to have numbers like this : '01', '05', '12', ... |
172 |
FileTag->track = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,(gint)tags->track->index); // Just to have numbers like this : '01', '05', '12', ... |
158 |
if (track_total != 0) |
173 |
if (tags->track->total != 0) |
159 |
FileTag->track_total = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,(gint)track_total); // Just to have numbers like this : '01', '05', '12', ... |
174 |
FileTag->track_total = g_strdup_printf("%.*d",NUMBER_TRACK_FORMATED_SPIN_BUTTON,(gint)tags->track->total); // Just to have numbers like this : '01', '05', '12', ... |
160 |
} |
175 |
} |
161 |
|
176 |
|
162 |
/********* |
177 |
/********* |
163 |
* Genre * |
178 |
* Genre * |
164 |
*********/ |
179 |
*********/ |
165 |
MP4GetMetadataGenre(mp4file, &FileTag->genre); |
180 |
if (tags->genre) |
|
|
181 |
{ |
182 |
FileTag->genre = Try_To_Validate_Utf8_String(tags->genre); |
183 |
} |
166 |
|
184 |
|
167 |
/*********** |
185 |
/*********** |
168 |
* Comment * |
186 |
* Comment * |
169 |
***********/ |
187 |
***********/ |
170 |
MP4GetMetadataComment(mp4file, &FileTag->comment); |
188 |
if (tags->comments) |
|
|
189 |
{ |
190 |
FileTag->comment = Try_To_Validate_Utf8_String(tags->comments); |
191 |
} |
171 |
|
192 |
|
172 |
/********************** |
193 |
/********************** |
173 |
* Composer or Writer * |
194 |
* Composer or Writer * |
174 |
**********************/ |
195 |
**********************/ |
175 |
MP4GetMetadataWriter(mp4file, &FileTag->composer); |
196 |
if (tags->composer) |
|
|
197 |
{ |
198 |
FileTag->composer = Try_To_Validate_Utf8_String(tags->composer); |
199 |
} |
176 |
|
200 |
|
177 |
/***************** |
201 |
/***************** |
178 |
* Encoding Tool * |
202 |
* Encoding Tool * |
179 |
*****************/ |
203 |
*****************/ |
180 |
MP4GetMetadataTool(mp4file, &FileTag->encoded_by); |
204 |
if (tags->encodedBy) |
181 |
|
205 |
{ |
182 |
/* Unimplemented |
206 |
FileTag->encoded_by = Try_To_Validate_Utf8_String(tags->encodedBy); |
183 |
Tempo / BPM |
207 |
} |
184 |
MP4GetMetadataTempo(file, &string) |
|
|
185 |
*/ |
186 |
|
208 |
|
187 |
/*********** |
209 |
/*********** |
188 |
* Picture * |
210 |
* Picture * |
189 |
***********/ |
211 |
***********/ |
190 |
#ifdef NEWMP4 |
212 |
if (tags->artworkCount) { |
191 |
// There version can handle multiple pictures! |
213 |
const MP4TagArtwork* art = tags->artwork; /* artwork != NULL when artworkCount > 0 */ |
192 |
// Version 1.6 of libmp4v2 introduces an index argument for MP4GetMetadataCoverart |
214 |
for (pic_num = 0; pic_num < tags->artworkCount; pic_num++, art++) |
193 |
for (pic_num = 0; (MP4GetMetadataCoverArt( mp4file, &coverArt, &coverSize,pic_num )); pic_num++) |
215 |
{ |
194 |
#else |
216 |
Picture *pic; |
195 |
// There version handle only one picture! |
217 |
|
196 |
if ( MP4GetMetadataCoverArt( mp4file, &coverArt, &coverSize ) ) |
218 |
pic = Picture_Allocate(); |
197 |
#endif |
219 |
if (!prev_pic) |
198 |
{ |
220 |
FileTag->picture = pic; |
199 |
Picture *pic; |
221 |
else |
200 |
|
222 |
prev_pic->next = pic; |
201 |
pic = Picture_Allocate(); |
223 |
prev_pic = pic; |
202 |
if (!prev_pic) |
224 |
|
203 |
FileTag->picture = pic; |
225 |
pic->size = art->size; |
204 |
else |
226 |
pic->data = g_memdup(art->data, pic->size); |
205 |
prev_pic->next = pic; |
227 |
pic->type = PICTURE_TYPE_FRONT_COVER; |
206 |
prev_pic = pic; |
228 |
pic->description = NULL; |
207 |
|
229 |
} |
208 |
pic->size = coverSize; |
|
|
209 |
pic->data = coverArt; |
210 |
pic->type = PICTURE_TYPE_FRONT_COVER; |
211 |
pic->description = NULL; |
212 |
} |
230 |
} |
213 |
|
231 |
|
214 |
|
232 |
|
215 |
/* Free allocated data */ |
233 |
/* Free allocated data */ |
216 |
MP4Close(mp4file); |
234 |
MP4TagsFree(tags); |
|
|
235 |
MP4Close(mp4file, 0); |
217 |
|
236 |
|
218 |
return TRUE; |
237 |
return TRUE; |
219 |
} |
238 |
} |
Lines 235-240
Link Here
|
235 |
FILE *file; |
254 |
FILE *file; |
236 |
MP4FileHandle mp4file = NULL; |
255 |
MP4FileHandle mp4file = NULL; |
237 |
gint error = 0; |
256 |
gint error = 0; |
|
|
257 |
gint pic_num; |
238 |
|
258 |
|
239 |
if (!ETFile || !ETFile->FileTag) |
259 |
if (!ETFile || !ETFile->FileTag) |
240 |
return FALSE; |
260 |
return FALSE; |
Lines 252-274
Link Here
|
252 |
fclose(file); |
272 |
fclose(file); |
253 |
|
273 |
|
254 |
/* Open file for writing */ |
274 |
/* Open file for writing */ |
255 |
mp4file = MP4Modify(filename,0,0); |
275 |
mp4file = MP4Modify(filename, 0); |
256 |
if (mp4file == MP4_INVALID_FILE_HANDLE) |
276 |
if (mp4file == MP4_INVALID_FILE_HANDLE) |
257 |
{ |
277 |
{ |
258 |
Log_Print(LOG_ERROR,_("ERROR while opening file: '%s' (%s)."),filename_utf8,_("MP4 format invalid")); |
278 |
Log_Print(LOG_ERROR,_("ERROR while opening file: '%s' (%s)."),filename_utf8,_("MP4 format invalid")); |
259 |
return FALSE; |
279 |
return FALSE; |
260 |
} |
280 |
} |
261 |
|
281 |
|
|
|
282 |
const MP4Tags* tags = MP4TagsAlloc(); |
283 |
MP4TagsFetch(tags, mp4file); |
284 |
|
262 |
/********* |
285 |
/********* |
263 |
* Title * |
286 |
* Title * |
264 |
*********/ |
287 |
*********/ |
265 |
if (FileTag->title && g_utf8_strlen(FileTag->title, -1) > 0) |
288 |
if (FileTag->title && g_utf8_strlen(FileTag->title, -1) > 0) |
266 |
{ |
289 |
{ |
267 |
MP4SetMetadataName(mp4file, FileTag->title); |
290 |
MP4TagsSetName(tags, FileTag->title); |
268 |
}else |
291 |
}else |
269 |
{ |
292 |
{ |
270 |
//MP4DeleteMetadataName(mp4file); // Not available on mpeg4ip-1.2 (only in 1.3) |
293 |
MP4TagsSetName(tags, ""); |
271 |
MP4SetMetadataName(mp4file, ""); |
|
|
272 |
} |
294 |
} |
273 |
|
295 |
|
274 |
/********** |
296 |
/********** |
Lines 276-286
Link Here
|
276 |
**********/ |
298 |
**********/ |
277 |
if (FileTag->artist && g_utf8_strlen(FileTag->artist, -1) > 0) |
299 |
if (FileTag->artist && g_utf8_strlen(FileTag->artist, -1) > 0) |
278 |
{ |
300 |
{ |
279 |
MP4SetMetadataArtist(mp4file, FileTag->artist); |
301 |
MP4TagsSetArtist(tags, FileTag->artist); |
|
|
302 |
}else |
303 |
{ |
304 |
MP4TagsSetArtist(tags, ""); |
305 |
} |
306 |
|
307 |
/**************** |
308 |
* Album Artist * |
309 |
****************/ |
310 |
if (FileTag->artist && g_utf8_strlen(FileTag->artist, -1) > 0) |
311 |
{ |
312 |
MP4TagsSetAlbumArtist(tags, FileTag->album_artist); |
280 |
}else |
313 |
}else |
281 |
{ |
314 |
{ |
282 |
//MP4DeleteMetadataArtist(mp4file); |
315 |
MP4TagsSetAlbumArtist(tags, ""); |
283 |
MP4SetMetadataArtist(mp4file, ""); |
|
|
284 |
} |
316 |
} |
285 |
|
317 |
|
286 |
/********* |
318 |
/********* |
Lines 288-309
Link Here
|
288 |
*********/ |
320 |
*********/ |
289 |
if (FileTag->album && g_utf8_strlen(FileTag->album, -1) > 0) |
321 |
if (FileTag->album && g_utf8_strlen(FileTag->album, -1) > 0) |
290 |
{ |
322 |
{ |
291 |
MP4SetMetadataAlbum(mp4file, FileTag->album); |
323 |
MP4TagsSetAlbum(tags, FileTag->album); |
292 |
}else |
324 |
}else |
293 |
{ |
325 |
{ |
294 |
//MP4DeleteMetadataAlbum(mp4file); |
326 |
MP4TagsSetAlbum(tags, ""); |
295 |
MP4SetMetadataAlbum(mp4file, ""); |
|
|
296 |
} |
327 |
} |
297 |
|
328 |
|
298 |
/********************** |
329 |
/********************** |
299 |
* Disk / Total Disks * |
330 |
* Disk / Total Disks * |
300 |
**********************/ |
331 |
**********************/ |
|
|
332 |
MP4TagDisk td; |
301 |
if (FileTag->disc_number && g_utf8_strlen(FileTag->disc_number, -1) > 0) |
333 |
if (FileTag->disc_number && g_utf8_strlen(FileTag->disc_number, -1) > 0) |
302 |
//|| FileTag->disc_number_total && g_utf8_strlen(FileTag->disc_number_total, -1) > 0) |
334 |
//|| FileTag->disc_number_total && g_utf8_strlen(FileTag->disc_number_total, -1) > 0) |
303 |
{ |
335 |
{ |
304 |
uint16_t disk = 0; |
|
|
305 |
uint16_t disktotal = 0; |
306 |
|
307 |
/* At the present time, we manage only disk number like '1' or '1/2', we |
336 |
/* At the present time, we manage only disk number like '1' or '1/2', we |
308 |
* don't use disk number total... so here we try to decompose */ |
337 |
* don't use disk number total... so here we try to decompose */ |
309 |
if (FileTag->disc_number) |
338 |
if (FileTag->disc_number) |
Lines 314-340
Link Here
|
314 |
{ |
343 |
{ |
315 |
// A disc_number_total was entered |
344 |
// A disc_number_total was entered |
316 |
if ( (tmp+1) && atoi(tmp+1) ) |
345 |
if ( (tmp+1) && atoi(tmp+1) ) |
317 |
disktotal = atoi(tmp+1); |
346 |
td.total = atoi(tmp+1); |
318 |
|
347 |
|
319 |
// Fill disc_number |
348 |
// Fill disc_number |
320 |
*tmp = '\0'; |
349 |
*tmp = '\0'; |
321 |
disk = atoi(dn_tmp); |
350 |
td.index = atoi(dn_tmp); |
322 |
}else |
351 |
}else |
323 |
{ |
352 |
{ |
324 |
disk = atoi(FileTag->disc_number); |
353 |
td.index = atoi(FileTag->disc_number); |
|
|
354 |
td.total = NULL; |
325 |
} |
355 |
} |
326 |
g_free(dn_tmp); |
356 |
g_free(dn_tmp); |
327 |
} |
357 |
} |
328 |
/*if (FileTag->disc_number) |
358 |
MP4TagsSetDisk(tags, &td); |
329 |
disk = atoi(FileTag->disc_number); |
|
|
330 |
if (FileTag->disc_number_total) |
331 |
disktotal = atoi(FileTag->disc_number_total); |
332 |
*/ |
333 |
MP4SetMetadataDisk(mp4file, disk, disktotal); |
334 |
}else |
359 |
}else |
335 |
{ |
360 |
{ |
336 |
//MP4DeleteMetadataDisk(mp4file); |
361 |
td.index = NULL; |
337 |
MP4SetMetadataDisk(mp4file, 0, 0); |
362 |
td.total = NULL; |
|
|
363 |
MP4TagsSetDisk(tags, &td); |
338 |
} |
364 |
} |
339 |
|
365 |
|
340 |
/******** |
366 |
/******** |
Lines 342-371
Link Here
|
342 |
********/ |
368 |
********/ |
343 |
if (FileTag->year && g_utf8_strlen(FileTag->year, -1) > 0) |
369 |
if (FileTag->year && g_utf8_strlen(FileTag->year, -1) > 0) |
344 |
{ |
370 |
{ |
345 |
MP4SetMetadataYear(mp4file, FileTag->year); |
371 |
MP4TagsSetReleaseDate(tags, FileTag->year); |
346 |
}else |
372 |
}else |
347 |
{ |
373 |
{ |
348 |
//MP4DeleteMetadataYear(mp4file); |
374 |
MP4TagsSetReleaseDate(tags, ""); |
349 |
MP4SetMetadataYear(mp4file, ""); |
|
|
350 |
} |
375 |
} |
351 |
|
376 |
|
352 |
/************************* |
377 |
/************************* |
353 |
* Track and Total Track * |
378 |
* Track and Total Track * |
354 |
*************************/ |
379 |
*************************/ |
|
|
380 |
MP4TagTrack tt; |
355 |
if ( (FileTag->track && g_utf8_strlen(FileTag->track, -1) > 0) |
381 |
if ( (FileTag->track && g_utf8_strlen(FileTag->track, -1) > 0) |
356 |
|| (FileTag->track_total && g_utf8_strlen(FileTag->track_total, -1) > 0) ) |
382 |
|| (FileTag->track_total && g_utf8_strlen(FileTag->track_total, -1) > 0) ) |
357 |
{ |
383 |
{ |
358 |
uint16_t track = 0; |
|
|
359 |
uint16_t track_total = 0; |
360 |
if (FileTag->track) |
384 |
if (FileTag->track) |
361 |
track = atoi(FileTag->track); |
385 |
tt.index = atoi(FileTag->track); |
362 |
if (FileTag->track_total) |
386 |
if (FileTag->track_total) |
363 |
track_total = atoi(FileTag->track_total); |
387 |
tt.total = atoi(FileTag->track_total); |
364 |
MP4SetMetadataTrack(mp4file, track, track_total); |
388 |
MP4TagsSetTrack(tags, &tt); |
365 |
}else |
389 |
}else |
366 |
{ |
390 |
{ |
367 |
//MP4DeleteMetadataTrack(mp4file); |
391 |
tt.index = NULL; |
368 |
MP4SetMetadataTrack(mp4file, 0, 0); |
392 |
tt.total = NULL; |
|
|
393 |
MP4TagsSetTrack(tags, &tt); |
369 |
} |
394 |
} |
370 |
|
395 |
|
371 |
/********* |
396 |
/********* |
Lines 373-383
Link Here
|
373 |
*********/ |
398 |
*********/ |
374 |
if (FileTag->genre && g_utf8_strlen(FileTag->genre, -1) > 0 ) |
399 |
if (FileTag->genre && g_utf8_strlen(FileTag->genre, -1) > 0 ) |
375 |
{ |
400 |
{ |
376 |
MP4SetMetadataGenre(mp4file, FileTag->genre); |
401 |
MP4TagsSetGenre(tags, FileTag->genre); |
377 |
}else |
402 |
}else |
378 |
{ |
403 |
{ |
379 |
//MP4DeleteMetadataGenre(mp4file); |
404 |
MP4TagsSetGenre(tags, ""); |
380 |
MP4SetMetadataGenre(mp4file, ""); |
|
|
381 |
} |
405 |
} |
382 |
|
406 |
|
383 |
/*********** |
407 |
/*********** |
Lines 385-395
Link Here
|
385 |
***********/ |
409 |
***********/ |
386 |
if (FileTag->comment && g_utf8_strlen(FileTag->comment, -1) > 0) |
410 |
if (FileTag->comment && g_utf8_strlen(FileTag->comment, -1) > 0) |
387 |
{ |
411 |
{ |
388 |
MP4SetMetadataComment(mp4file, FileTag->comment); |
412 |
MP4TagsSetComments(tags, FileTag->comment); |
389 |
}else |
413 |
}else |
390 |
{ |
414 |
{ |
391 |
//MP4DeleteMetadataComment(mp4file); |
415 |
MP4TagsSetComments(tags, ""); |
392 |
MP4SetMetadataComment(mp4file, ""); |
|
|
393 |
} |
416 |
} |
394 |
|
417 |
|
395 |
/********************** |
418 |
/********************** |
Lines 397-407
Link Here
|
397 |
**********************/ |
420 |
**********************/ |
398 |
if (FileTag->composer && g_utf8_strlen(FileTag->composer, -1) > 0) |
421 |
if (FileTag->composer && g_utf8_strlen(FileTag->composer, -1) > 0) |
399 |
{ |
422 |
{ |
400 |
MP4SetMetadataWriter(mp4file, FileTag->composer); |
423 |
MP4TagsSetComposer(tags, FileTag->composer); |
401 |
}else |
424 |
}else |
402 |
{ |
425 |
{ |
403 |
//MP4DeleteMetadataWriter(mp4file); |
426 |
MP4TagsSetComposer(tags, ""); |
404 |
MP4SetMetadataWriter(mp4file, ""); |
|
|
405 |
} |
427 |
} |
406 |
|
428 |
|
407 |
/***************** |
429 |
/***************** |
Lines 409-441
Link Here
|
409 |
*****************/ |
431 |
*****************/ |
410 |
if (FileTag->encoded_by && g_utf8_strlen(FileTag->encoded_by, -1) > 0) |
432 |
if (FileTag->encoded_by && g_utf8_strlen(FileTag->encoded_by, -1) > 0) |
411 |
{ |
433 |
{ |
412 |
MP4SetMetadataTool(mp4file, FileTag->encoded_by); |
434 |
MP4TagsSetEncodedBy(tags, FileTag->encoded_by); |
413 |
}else |
435 |
}else |
414 |
{ |
436 |
{ |
415 |
//MP4DeleteMetadataTool(mp4file); |
437 |
MP4TagsSetEncodedBy(tags, ""); |
416 |
MP4SetMetadataTool(mp4file, ""); |
|
|
417 |
} |
438 |
} |
418 |
|
439 |
|
419 |
/*********** |
440 |
/*********** |
420 |
* Picture * |
441 |
* Picture * |
421 |
***********/ |
442 |
***********/ |
|
|
443 |
Picture *pic = FileTag->picture; |
444 |
const gint artworkCount = tags->artworkCount; |
445 |
|
446 |
for (pic_num = 0; pic_num < artworkCount; pic_num++) |
422 |
{ |
447 |
{ |
423 |
// Can handle only one picture... |
448 |
MP4TagsRemoveArtwork(tags, 0); |
424 |
Picture *pic; |
449 |
} |
425 |
|
450 |
|
426 |
//MP4DeleteMetadataCoverArt(mp4file); |
451 |
while (pic) |
427 |
MP4SetMetadataCoverArt(mp4file, NULL, 0); |
452 |
{ |
428 |
for( pic = FileTag->picture; pic; pic = pic->next ) |
453 |
if (pic->data) |
429 |
{ |
454 |
{ |
430 |
if( pic->type == PICTURE_TYPE_FRONT_COVER ) |
455 |
MP4TagArtwork art; |
431 |
{ |
456 |
art.data = pic->data; |
432 |
MP4SetMetadataCoverArt(mp4file, pic->data, pic->size); |
457 |
art.size = pic->size; |
433 |
} |
458 |
art.type = MP4_ART_UNDEFINED; // delegate typing to libmp4v2 |
|
|
459 |
MP4TagsAddArtwork(tags, &art); |
434 |
} |
460 |
} |
|
|
461 |
pic = pic->next; |
435 |
} |
462 |
} |
436 |
|
463 |
|
437 |
|
464 |
MP4TagsStore(tags, mp4file); |
438 |
MP4Close(mp4file); |
465 |
MP4TagsFree(tags); |
|
|
466 |
MP4Close(mp4file, 0); |
439 |
|
467 |
|
440 |
if (error) return FALSE; |
468 |
if (error) return FALSE; |
441 |
else return TRUE; |
469 |
else return TRUE; |
442 |
-- easytag-2.1.7/src/picture.c |
470 |
++ easytag-2.1.7/src/picture.c |
Lines 326-349
Link Here
|
326 |
else if (MESSAGE_BOX_POSITION_MOUSE) |
326 |
else if (MESSAGE_BOX_POSITION_MOUSE) |
327 |
gtk_window_set_position(GTK_WINDOW(FileSelectionWindow),GTK_WIN_POS_MOUSE); |
327 |
gtk_window_set_position(GTK_WINDOW(FileSelectionWindow),GTK_WIN_POS_MOUSE); |
328 |
|
328 |
|
329 |
// Behaviour following the tag type... |
329 |
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(FileSelectionWindow), TRUE); |
330 |
switch (ETCore->ETFileDisplayed->ETFileDescription->TagType) |
|
|
331 |
{ |
332 |
case MP4_TAG: |
333 |
{ |
334 |
// Only one file can be selected |
335 |
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(FileSelectionWindow), FALSE); |
336 |
break; |
337 |
} |
338 |
|
339 |
// Other tag types |
340 |
default: |
341 |
{ |
342 |
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(FileSelectionWindow), TRUE); |
343 |
break; |
344 |
} |
345 |
} |
346 |
|
347 |
gtk_dialog_set_default_response(GTK_DIALOG(FileSelectionWindow), GTK_RESPONSE_OK); |
330 |
gtk_dialog_set_default_response(GTK_DIALOG(FileSelectionWindow), GTK_RESPONSE_OK); |
348 |
|
331 |
|
349 |
// Starting directory (the same of the current file) |
332 |
// Starting directory (the same of the current file) |