Coverage Report

Created: 2023-06-07 07:26

/src/vlc/modules/demux/mp4/meta.c
Line
Count
Source (jump to first uncovered line)
1
/*****************************************************************************
2
 * meta.c: mp4 meta handling
3
 *****************************************************************************
4
 * Copyright (C) 2001-2004, 2010, 2014 VLC authors and VideoLAN
5
 *
6
 * This program is free software; you can redistribute it and/or modify it
7
 * under the terms of the GNU Lesser General Public License as published by
8
 * the Free Software Foundation; either version 2.1 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 * GNU Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public License
17
 * along with this program; if not, write to the Free Software Foundation,
18
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19
 *****************************************************************************/
20
#ifdef HAVE_CONFIG_H
21
# include "config.h"
22
#endif
23
24
#include "libmp4.h"
25
#include "../../meta_engine/ID3Genres.h"  /* for ATOM_gnre */
26
#include "languages.h"
27
28
#include <vlc_meta.h>
29
#include <vlc_charset.h>
30
31
#include "meta.h"
32
33
#include "../../meta_engine/ID3Tag.h"
34
#include "../../meta_engine/ID3Meta.h"
35
36
#include <assert.h>
37
38
static const struct
39
{
40
    const uint32_t xa9_type;
41
    const vlc_meta_type_t meta_type;
42
} xa9typetometa[] = {
43
    { ATOM_0x40PRM, vlc_meta_EncodedBy }, /* Adobe Premiere */
44
    { ATOM_0x40PRQ, vlc_meta_EncodedBy }, /* Adobe Qt */
45
    { ATOM_0xa9nam, vlc_meta_Title }, /* Full name */
46
    { ATOM_0xa9aut, vlc_meta_Artist },
47
    { ATOM_0xa9ART, vlc_meta_Artist },
48
    { ATOM_0xa9cpy, vlc_meta_Copyright },
49
    { ATOM_0xa9day, vlc_meta_Date }, /* Creation Date */
50
    { ATOM_0xa9des, vlc_meta_Description }, /* Description */
51
    { ATOM_0xa9gen, vlc_meta_Genre }, /* Genre */
52
    { ATOM_0xa9alb, vlc_meta_Album }, /* Album */
53
    { ATOM_0xa9trk, vlc_meta_TrackNumber }, /* Track */
54
    { ATOM_0xa9cmt, vlc_meta_Description }, /* Comment */
55
    { ATOM_0xa9url, vlc_meta_URL }, /* URL */
56
    { ATOM_0xa9too, vlc_meta_EncodedBy }, /* Encoder Tool */
57
    { ATOM_0xa9enc, vlc_meta_EncodedBy }, /* Encoded By */
58
    { ATOM_0xa9pub, vlc_meta_Publisher },
59
    { ATOM_0xa9dir, vlc_meta_Director },
60
    { ATOM_desc,    vlc_meta_Description },
61
    { ATOM_MCPS,    vlc_meta_EncodedBy }, /* Cleaner Pro */
62
    { ATOM_aART,    vlc_meta_AlbumArtist },
63
};
64
65
static const struct
66
{
67
    const uint32_t xa9_type;
68
    const char metadata[26];
69
} xa9typetoextrameta[] = {
70
    { ATOM_0xa9wrt, N_("Writer") },
71
    { ATOM_0xa9com, N_("Composer") },
72
    { ATOM_0xa9prd, N_("Producer") },
73
    { ATOM_0xa9inf, N_("Information") },
74
    { ATOM_0xa9dis, N_("Disclaimer") },
75
    { ATOM_0xa9req, N_("Requirements") },
76
    { ATOM_0xa9fmt, N_("Original Format") },
77
    { ATOM_0xa9dsa, N_("Display Source As") },
78
    { ATOM_0xa9hst, N_("Host Computer") },
79
    { ATOM_0xa9prf, N_("Performers") },
80
    { ATOM_0xa9ope, N_("Original Performer") },
81
    { ATOM_0xa9src, N_("Providers Source Content") },
82
    { ATOM_0xa9wrn, N_("Warning") },
83
    { ATOM_0xa9swr, N_("Software") },
84
    { ATOM_0xa9lyr, N_("Lyrics") },
85
    { ATOM_0xa9mak, N_("Record Company") },
86
    { ATOM_0xa9mod, N_("Model") },
87
    { ATOM_0xa9PRD, N_("Product") },
88
    { ATOM_0xa9grp, N_("Grouping") },
89
    { ATOM_0xa9gen, N_("Genre") },
90
    { ATOM_0xa9st3, N_("Sub-Title") },
91
    { ATOM_0xa9arg, N_("Arranger") },
92
    { ATOM_0xa9ard, N_("Art Director") },
93
    { ATOM_0xa9cak, N_("Copyright Acknowledgement") },
94
    { ATOM_0xa9con, N_("Conductor") },
95
    { ATOM_0xa9des, N_("Song Description") },
96
    { ATOM_0xa9lnt, N_("Liner Notes") },
97
    { ATOM_0xa9phg, N_("Phonogram Rights") },
98
    { ATOM_0xa9pub, N_("Publisher") },
99
    { ATOM_0xa9sne, N_("Sound Engineer") },
100
    { ATOM_0xa9sol, N_("Soloist") },
101
    { ATOM_0xa9thx, N_("Thanks") },
102
    { ATOM_0xa9xpd, N_("Executive Producer") },
103
    { ATOM_aART,    N_("Album Artist") },
104
    { ATOM_flvr,    N_("Encoding Params") },
105
    { ATOM_vndr,    N_("Vendor") },
106
    { ATOM_xid_,    N_("Catalog Number") },
107
    { ATOM_gshh,    "YouTube Host" },
108
    { ATOM_gspm,    "YouTube Ping Message" },
109
    { ATOM_gspu,    "YouTube Ping Url" },
110
    { ATOM_gssd,    "YouTube Source Data" },
111
    { ATOM_gsst,    "YouTube Start Time" },
112
    { ATOM_gstd,    "YouTube Track Duration" },
113
    { ATOM_purl,    "Podcast URL" },
114
};
115
116
static const struct
117
{
118
    const char *psz_naming;
119
    const vlc_meta_type_t meta_type;
120
} com_apple_quicktime_tometa[] = {
121
    { "displayname",     vlc_meta_NowPlaying },
122
    { "software",        vlc_meta_EncodedBy },
123
    { "Encoded_With",    vlc_meta_EncodedBy },
124
    { "album",           vlc_meta_Album },
125
    { "artist",          vlc_meta_Artist },
126
    { "comment",         vlc_meta_Description },
127
    { "description",     vlc_meta_Description },
128
    { "copyright",       vlc_meta_Copyright },
129
    { "creationdate",    vlc_meta_Date },
130
    { "director",        vlc_meta_Director },
131
    { "genre",           vlc_meta_Genre },
132
    { "publisher",       vlc_meta_Publisher },
133
};
134
135
static const struct
136
{
137
    const char *psz_naming;
138
    const char *psz_metadata;
139
} com_apple_quicktime_toextrameta[] = {
140
    { "information",     N_("Information") },
141
    { "keywords",        N_("Keywords") },
142
    { "make",            N_("Vendor") },
143
};
144
145
inline static char * StringConvert( const MP4_Box_data_data_t *p_data )
146
0
{
147
0
    if ( !p_data || !p_data->i_blob )
148
0
        return NULL;
149
150
0
    switch( p_data->e_wellknowntype )
151
0
    {
152
0
    case DATA_WKT_UTF8:
153
0
    case DATA_WKT_UTF8_SORT:
154
0
        return FromCharset( "UTF-8", p_data->p_blob, p_data->i_blob );
155
0
    case DATA_WKT_UTF16:
156
0
    case DATA_WKT_UTF16_SORT:
157
0
        return FromCharset( "UTF-16BE", p_data->p_blob, p_data->i_blob );
158
0
    case DATA_WKT_SJIS:
159
0
        return FromCharset( "SHIFT-JIS", p_data->p_blob, p_data->i_blob );
160
0
    default:
161
0
        return NULL;
162
0
    }
163
0
}
164
165
static char * ExtractString( const MP4_Box_t *p_box )
166
0
{
167
0
    if ( p_box->i_type == ATOM_data )
168
0
        return StringConvert( p_box->data.p_data );
169
170
0
    const MP4_Box_t *p_data = MP4_BoxGet( p_box, "data" );
171
0
    if ( p_data )
172
0
        return StringConvert( BOXDATA(p_data) );
173
0
    else if ( p_box->data.p_binary && p_box->data.p_binary->p_blob )
174
0
    {
175
0
        char *psz_utf = strndup( p_box->data.p_binary->p_blob,
176
0
                                 p_box->data.p_binary->i_blob );
177
0
        if (likely( psz_utf ))
178
0
            EnsureUTF8( psz_utf );
179
0
        return psz_utf;
180
0
    }
181
0
    else
182
0
        return NULL;
183
0
}
184
185
static bool AppleNameToMeta( char const* name,
186
    vlc_meta_type_t const** meta_type, char const** meta_key )
187
0
{
188
0
    *meta_type = NULL;
189
0
    *meta_key = NULL;
190
191
0
    for( size_t i = 0; *meta_type == NULL &&
192
0
                       i < ARRAY_SIZE( com_apple_quicktime_tometa ); ++i )
193
0
    {
194
0
        if( !strcmp( name, com_apple_quicktime_tometa[i].psz_naming ) )
195
0
            *meta_type = &com_apple_quicktime_tometa[i].meta_type;
196
0
    }
197
198
0
    for( size_t i = 0; *meta_key == NULL &&
199
0
                       i < ARRAY_SIZE( com_apple_quicktime_toextrameta ); ++i )
200
0
    {
201
0
        if( !strcmp( name, com_apple_quicktime_toextrameta[i].psz_naming ) )
202
0
            *meta_key = com_apple_quicktime_toextrameta[i].psz_metadata;
203
0
    }
204
205
0
    return *meta_type || *meta_key;
206
0
}
207
208
static bool AtomXA9ToMeta( uint32_t i_type,
209
    vlc_meta_type_t const** meta_type, char const** meta_key )
210
3
{
211
3
    *meta_type = NULL;
212
3
    *meta_key = NULL;
213
214
63
    for( size_t i = 0; !*meta_type && i < ARRAY_SIZE( xa9typetometa ); ++i )
215
60
        if( xa9typetometa[i].xa9_type == i_type )
216
0
            *meta_type = &xa9typetometa[i].meta_type;
217
218
105
    for( size_t i = 0; !*meta_key && i < ARRAY_SIZE( xa9typetoextrameta ); ++i )
219
102
        if( xa9typetoextrameta[i].xa9_type == i_type )
220
1
            *meta_key = xa9typetoextrameta[i].metadata;
221
222
3
    return *meta_type || *meta_key;
223
3
}
224
225
static bool SetMeta( vlc_meta_t* p_meta, int i_type, char const* name, const MP4_Box_t* p_box )
226
1
{
227
1
    vlc_meta_type_t const* type;
228
1
    char const* key;
229
230
1
    if( name != NULL)
231
0
    {
232
0
        if ( !AppleNameToMeta( name, &type, &key ) )
233
0
            return false;
234
0
    }
235
1
    else
236
1
    {
237
1
        if ( !AtomXA9ToMeta( i_type, &type, &key ) )
238
1
            return false;
239
1
    }
240
241
0
    char* psz_utf = ExtractString( p_box );
242
243
0
    if( psz_utf )
244
0
    {
245
0
        if( type ) vlc_meta_Set( p_meta, *type, psz_utf );
246
0
        else       vlc_meta_AddExtra( p_meta, key, psz_utf );
247
248
0
        free( psz_utf );
249
0
    }
250
251
0
    return true;
252
1
}
253
254
static int ExtractIntlStrings( vlc_meta_t *p_meta, const MP4_Box_t *p_box )
255
2
{
256
2
    if( MP4_BoxGet( p_box, "data" ) )
257
0
        return false;
258
259
2
    vlc_meta_type_t const* meta_type;
260
2
    char const* meta_key;
261
262
2
    if( AtomXA9ToMeta( p_box->i_type, &meta_type, &meta_key ) == false )
263
1
        return false;
264
265
1
    if( p_box->p_father == NULL              ||
266
1
        p_box->p_father->i_type != ATOM_udta ||
267
1
        p_box->data.p_binary == NULL         ||
268
1
        p_box->data.p_binary->p_blob == NULL )
269
0
    {
270
0
        return false;
271
0
    }
272
273
1
    vlc_meta_t* p_meta_intl = vlc_meta_New();
274
275
1
    if( unlikely( !p_meta_intl ) )
276
0
        return false;
277
278
1
    char const* p_peek = p_box->data.p_binary->p_blob;
279
1
    uint64_t i_read = p_box->data.p_binary->i_blob;
280
281
2
    while( i_read >= 4 )
282
1
    {
283
1
        uint16_t i_len = GetWBE( p_peek );
284
1
        uint16_t i_lang = GetWBE( p_peek + 2 );
285
1
        p_peek += 4;
286
1
        i_read -= 4;
287
288
1
        if( i_len > i_read )
289
0
            break;
290
291
1
        char charset[15] = "MACINTOSH//";
292
293
1
        decodeQtLanguageCode( i_lang, charset+11, &(bool){0} );
294
295
1
        if( i_lang >= 0x400 && i_lang != 0x7fff )
296
1
        {
297
1
            strcpy( charset, i_len < 2 || memcmp( p_peek, "\xFE\xFF", 2 )
298
1
                ? "UTF-8" : "UTF-16BE" );
299
1
        }
300
301
1
        char* data = FromCharset( charset, p_peek, i_len );
302
1
        if( data )
303
1
        {
304
1
            if( meta_type )
305
0
            {
306
0
                vlc_meta_Set( p_meta_intl, *meta_type, data );
307
308
0
                meta_key = vlc_meta_TypeToLocalizedString( *meta_type );
309
0
                meta_type = NULL;
310
0
            }
311
1
            else
312
1
            {
313
1
                char* key;
314
1
                if( asprintf( &key, "%s (%s)", meta_key, charset+11 ) != -1 )
315
1
                {
316
1
                    vlc_meta_AddExtra( p_meta_intl, key, data );
317
1
                    free( key );
318
1
                }
319
1
            }
320
1
            free( data );
321
1
        }
322
323
1
        p_peek += i_len;
324
1
        i_read -= i_len;
325
1
    }
326
327
1
    if( i_read == 0 )
328
1
        vlc_meta_Merge( p_meta, p_meta_intl );
329
330
1
    vlc_meta_Delete( p_meta_intl );
331
1
    return i_read == 0;
332
1
}
333
334
static void ExtractItunesInfoTriplets( vlc_meta_t *p_meta, const MP4_Box_t *p_box )
335
0
{
336
0
    if( p_box->i_type != ATOM_ITUN )
337
0
        return;
338
0
    const MP4_Box_t *p_mean = MP4_BoxGet( p_box, "mean" );
339
0
    const MP4_Box_t *p_name = MP4_BoxGet( p_box, "name" );
340
0
    const MP4_Box_t *p_data = MP4_BoxGet( p_box, "data" );
341
0
    if( !p_mean || p_mean->data.p_binary->i_blob < 4 + 16 ||
342
0
        !p_name || p_name->data.p_binary->i_blob < 5 ||
343
0
        !p_data || !BOXDATA(p_data) )
344
0
        return;
345
346
0
    if( !strncmp( &((char*)p_mean->data.p_binary->p_blob)[4], "com.apple.iTunes",
347
0
                  p_mean->data.p_binary->i_blob - 4 ) )
348
0
    {
349
0
        char *psz_name = strndup( &((char*)p_name->data.p_binary->p_blob)[4],
350
0
                                 p_name->data.p_binary->i_blob - 4 );
351
0
        char *psz_value = ExtractString( p_data );
352
0
        if( psz_name && psz_value )
353
0
            vlc_meta_AddExtra( p_meta, psz_name, psz_value );
354
0
        free( psz_name );
355
0
        free( psz_value );
356
0
    }
357
0
}
358
359
static void SetupmdirMeta( vlc_meta_t *p_meta, const MP4_Box_t *p_box )
360
2
{
361
2
    const MP4_Box_t *p_data = MP4_BoxGet( p_box, "data" );
362
363
2
    if( p_data == NULL || !BOXDATA(p_data) )
364
2
    {
365
2
        if( ExtractIntlStrings( p_meta, p_box ) )
366
1
            return;
367
368
1
        SetMeta( p_meta, p_box->i_type, NULL, p_box );
369
1
        return;
370
2
    }
371
372
    /* XXX Becarefull p_udta can have box that are not 0xa9xx */
373
0
    switch( p_box->i_type )
374
0
    {
375
0
    case ATOM_atID:
376
0
    {
377
0
        if ( BOXDATA(p_data)->i_blob >= 4 &&
378
0
             BOXDATA(p_data)->e_wellknowntype == DATA_WKT_BE_SIGNED )
379
0
        {
380
0
            char psz_utf[11];
381
0
            snprintf( psz_utf, sizeof( psz_utf ), "%"PRId32,
382
0
                      GetDWBE(BOXDATA(p_data)->p_blob) );
383
0
            vlc_meta_AddExtra( p_meta, "iTunes Account ID", psz_utf );
384
0
        }
385
0
        break;
386
0
    }
387
0
    case ATOM_cnID:
388
0
    {
389
0
        if ( BOXDATA(p_data)->i_blob >= 4 &&
390
0
             BOXDATA(p_data)->e_wellknowntype == DATA_WKT_BE_SIGNED )
391
0
        {
392
0
            char psz_utf[11];
393
0
            snprintf( psz_utf, sizeof( psz_utf ), "%"PRId32,
394
0
                      GetDWBE(BOXDATA(p_data)->p_blob) );
395
0
            vlc_meta_AddExtra( p_meta, "iTunes Catalog ID", psz_utf );
396
0
        }
397
0
        break;
398
0
    }
399
0
    case ATOM_disk:
400
0
    {
401
0
        if ( BOXDATA(p_data)->i_blob >= 6 &&
402
0
             BOXDATA(p_data)->e_wellknowntype == DATA_WKT_RESERVED )
403
0
        {
404
0
            char psz_number[6];
405
0
            snprintf( psz_number, sizeof( psz_number ), "%"PRIu16, GetWBE(&BOXDATA(p_data)->p_blob[2]) );
406
0
            vlc_meta_Set( p_meta, vlc_meta_DiscNumber, psz_number );
407
0
            snprintf( psz_number, sizeof( psz_number ), "%"PRIu16, GetWBE(&BOXDATA(p_data)->p_blob[4]) );
408
0
            vlc_meta_Set( p_meta, vlc_meta_DiscTotal, psz_number );
409
0
        }
410
0
        break;
411
0
    }
412
0
    case ATOM_gnre:
413
0
    {
414
0
        if ( BOXDATA(p_data)->i_blob >= 2 &&
415
0
             BOXDATA(p_data)->e_wellknowntype == DATA_WKT_RESERVED )
416
0
        {
417
0
            const uint16_t i_genre = GetWBE(BOXDATA(p_data)->p_blob);
418
0
            if( i_genre && i_genre <= ID3_GENRES_COUNT )
419
0
                vlc_meta_SetGenre( p_meta, ID3_ppsz_genres[i_genre - 1] );
420
0
        }
421
0
        break;
422
0
    }
423
0
    case ATOM_rtng:
424
0
    {
425
0
        if ( BOXDATA(p_data)->i_blob >= 1 )
426
0
        {
427
0
            const char *psz_rating;
428
0
            switch( *BOXDATA(p_data)->p_blob )
429
0
            {
430
0
            case 0x4:
431
0
                psz_rating = N_("Explicit");
432
0
                break;
433
0
            case 0x2:
434
0
                psz_rating = N_("Clean");
435
0
                break;
436
0
            default:
437
0
            case 0x0:
438
0
                psz_rating = N_("None");
439
0
                break;
440
0
            }
441
0
            vlc_meta_AddExtra( p_meta, N_("Rating"), psz_rating );
442
0
        }
443
0
        break;
444
0
    }
445
0
    case ATOM_trkn:
446
0
    {
447
0
        if ( BOXDATA(p_data)->i_blob >= 4 &&
448
0
             BOXDATA(p_data)->e_wellknowntype == DATA_WKT_RESERVED )
449
0
        {
450
0
            char psz_trck[6];
451
0
            snprintf( psz_trck, sizeof( psz_trck ), "%"PRIu16, GetWBE(&BOXDATA(p_data)->p_blob[2]) );
452
0
            vlc_meta_SetTrackNum( p_meta, psz_trck );
453
0
            if( BOXDATA(p_data)->i_blob >= 8 && GetWBE(&BOXDATA(p_data)->p_blob[4]) )
454
0
            {
455
0
                snprintf( psz_trck, sizeof( psz_trck ), "%"PRIu16, GetWBE(&BOXDATA(p_data)->p_blob[4]) );
456
0
                vlc_meta_Set( p_meta, vlc_meta_TrackTotal, psz_trck );
457
0
            }
458
0
        }
459
0
        break;
460
0
    }
461
0
    case ATOM_ITUN:
462
0
        ExtractItunesInfoTriplets( p_meta, p_box );
463
0
        break;
464
0
    default:
465
0
        SetMeta( p_meta, p_box->i_type, NULL, p_box );
466
0
        break;
467
0
    }
468
0
}
469
470
static void SetupmdtaMeta( vlc_meta_t *p_meta, const MP4_Box_t *p_box, const MP4_Box_t *p_keys )
471
0
{
472
0
    if ( !p_keys || !BOXDATA(p_keys) || BOXDATA(p_keys)->i_entry_count == 0 )
473
0
        return;
474
0
    if ( !p_box->i_index || p_box->i_index > BOXDATA(p_keys)->i_entry_count )
475
0
        return;
476
477
0
    const char *psz_naming = BOXDATA(p_keys)->p_entries[p_box->i_index - 1].psz_value;
478
0
    const uint32_t i_namespace = BOXDATA(p_keys)->p_entries[p_box->i_index - 1].i_namespace;
479
480
0
    if( i_namespace == HANDLER_mdta )
481
0
    {
482
0
        if ( !strncmp( "com.apple.quicktime.", psz_naming, 20 ) )
483
0
            SetMeta( p_meta, 0, psz_naming + 20, p_box );
484
0
    }
485
0
    else if ( i_namespace == ATOM_udta )
486
0
    {
487
        /* Regular atom inside... could that be even more complex ??? */
488
0
        char *psz_utf = ExtractString( p_box );
489
0
        if ( psz_utf )
490
0
        {
491
0
            if ( strlen(psz_utf) == 4 )
492
0
            {
493
0
                SetMeta( p_meta,
494
0
                         VLC_FOURCC(psz_utf[0],psz_utf[1],psz_utf[2],psz_utf[3]),
495
0
                         NULL, p_box );
496
0
            }
497
0
            free( psz_utf );
498
0
        }
499
0
    }
500
0
}
501
502
static int ID3TAG_Parse_Handler( uint32_t i_tag, const uint8_t *p_payload,
503
                                 size_t i_payload, void *p_priv )
504
0
{
505
0
    vlc_meta_t *p_meta = (vlc_meta_t *) p_priv;
506
507
0
    (void) ID3HandleTag( p_payload, i_payload, i_tag, p_meta, NULL );
508
509
0
    return VLC_SUCCESS;
510
0
}
511
512
static void SetupID3v2Meta( vlc_meta_t *p_meta, const MP4_Box_t *p_box )
513
0
{
514
0
    const MP4_Box_t *p_binary = MP4_BoxGet( p_box, "ID32" );
515
0
    if( p_binary == NULL || !BOXDATA(p_binary) || BOXDATA(p_binary)->i_blob < 6 + 20 + 1 )
516
0
        return;
517
518
    /* ID3v2 in 3GPP / ETSI TS 126 244 8.3, Header size 4 + 2 */
519
0
    ID3TAG_Parse( &((uint8_t *)BOXDATA(p_binary)->p_blob)[6], BOXDATA(p_binary)->i_blob - 6,
520
0
                  ID3TAG_Parse_Handler, p_meta );
521
0
}
522
523
void SetupMeta( vlc_meta_t *p_meta, const MP4_Box_t *p_udta )
524
3
{
525
3
    uint32_t i_handler = 0;
526
3
    if ( p_udta->p_father )
527
3
        i_handler = p_udta->i_handler;
528
529
5
    for( const MP4_Box_t *p_box = p_udta->p_first; p_box; p_box = p_box->p_next )
530
2
    {
531
2
        switch( i_handler )
532
2
        {
533
0
            case HANDLER_mdta:
534
0
            {
535
0
                const MP4_Box_t *p_keys = MP4_BoxGet( p_udta->p_father, "keys" );
536
0
                SetupmdtaMeta( p_meta, p_box, p_keys );
537
0
                break;
538
0
            }
539
540
0
            case HANDLER_ID32:
541
0
                SetupID3v2Meta( p_meta, p_box );
542
0
                break;
543
544
0
            case HANDLER_mdir:
545
2
            default:
546
2
                SetupmdirMeta( p_meta, p_box );
547
2
                break;
548
2
        }
549
2
    }
550
3
}
551