Clean use of FFmpeg internal

This commit is contained in:
bnnm 2019-10-13 19:54:52 +02:00
parent 98ed9b6a02
commit a05f8cbbec
3 changed files with 14 additions and 14 deletions

View File

@ -305,6 +305,7 @@ void free_ffmpeg(ffmpeg_codec_data *data);
void ffmpeg_set_skip_samples(ffmpeg_codec_data * data, int skip_samples);
uint32_t ffmpeg_get_channel_layout(ffmpeg_codec_data * data);
void ffmpeg_set_channel_remapping(ffmpeg_codec_data * data, int *channels_remap);
const char* ffmpeg_get_codec_name(ffmpeg_codec_data * data);
/* ffmpeg_decoder_utils.c (helper-things) */

View File

@ -903,4 +903,14 @@ void ffmpeg_set_channel_remapping(ffmpeg_codec_data * data, int *channel_remap)
data->channel_remap_set = 1;
}
const char* ffmpeg_get_codec_name(ffmpeg_codec_data * data) {
if (!data || !data->codec)
return NULL;
if (data->codec->long_name)
return data->codec->long_name;
if (data->codec->name)
return data->codec->name;
return NULL;
}
#endif

View File

@ -1,4 +1,5 @@
#include "vgmstream.h"
#include "coding/coding.h"
/* Defines the list of accepted extensions. vgmstream doesn't use it internally so it's here
@ -1262,22 +1263,10 @@ void get_vgmstream_coding_description(VGMSTREAM *vgmstream, char *out, size_t ou
switch (vgmstream->coding_type) {
#ifdef VGM_USE_FFMPEG
case coding_FFmpeg:
{
ffmpeg_codec_data *data = vgmstream->codec_data;
if (data) {
if (data->codec && data->codec->long_name) {
description = data->codec->long_name;
} else if (data->codec && data->codec->name) {
description = data->codec->name;
} else {
description = "FFmpeg (unknown codec)";
}
} else {
description = ffmpeg_get_codec_name(vgmstream->codec_data);
if (description == NULL)
description = "FFmpeg";
}
break;
}
#endif
default:
list_length = sizeof(coding_info_list) / sizeof(coding_info);