Track names can be in multiple metadata entries, one per language that the track name is translated to. HandBrake only supports one track name which we write with the lang "und" Search for best candidate track name from the available options.
| 5371 | // |
| 5372 | // Search for best candidate track name from the available options. |
| 5373 | static const char * ffmpeg_track_name(AVStream * st, const char * lang) |
| 5374 | { |
| 5375 | AVDictionaryEntry * t; |
| 5376 | char * key; |
| 5377 | |
| 5378 | // Use key with no language extension |
| 5379 | // ffmpeg sets this for "und" entries or when source format |
| 5380 | // doesn't have a language field |
| 5381 | t = av_dict_get(st->metadata, "title", NULL, 0); |
| 5382 | if (t != NULL && t->value[0] != 0) |
| 5383 | { |
| 5384 | return t->value; |
| 5385 | } |
| 5386 | // Try explicit "und" extension |
| 5387 | t = av_dict_get(st->metadata, "title-und", NULL, 0); |
| 5388 | if (t != NULL && t->value[0] != 0) |
| 5389 | { |
| 5390 | return t->value; |
| 5391 | } |
| 5392 | // Try source track language |
| 5393 | key = hb_strdup_printf("title-%s", lang); |
| 5394 | t = av_dict_get(st->metadata, key, NULL, 0); |
| 5395 | free(key); |
| 5396 | if (t != NULL && t->value[0] != 0) |
| 5397 | { |
| 5398 | return t->value; |
| 5399 | } |
| 5400 | while ((t = av_dict_get(st->metadata, "title-", t, AV_DICT_IGNORE_SUFFIX))) |
| 5401 | { |
| 5402 | // Use first available |
| 5403 | if (t != NULL && t->value[0] != 0) |
| 5404 | { |
| 5405 | return t->value; |
| 5406 | } |
| 5407 | } |
| 5408 | return NULL; |
| 5409 | } |
| 5410 | |
| 5411 | static void add_ffmpeg_linked_audio(hb_audio_t * audio, int audio_index, hb_list_t * list_linked_index) |
| 5412 | { |
no test coverage detected