mirror of
https://github.com/owntone/owntone-server.git
synced 2025-02-05 02:38:09 -05:00
[scan] extract 'channels' from (files) audio and type/bitrate/samplerate/channels from streams
This commit is contained in:
parent
b126a2fbc0
commit
e2d62a62a4
@ -1677,6 +1677,10 @@ map_media_file_to_queue_item(struct db_queue_item *queue_item, struct media_file
|
|||||||
queue_item->track = mfi->track;
|
queue_item->track = mfi->track;
|
||||||
queue_item->disc = mfi->disc;
|
queue_item->disc = mfi->disc;
|
||||||
//queue_item->artwork_url
|
//queue_item->artwork_url
|
||||||
|
queue_item->type = safe_strdup(mfi->type);
|
||||||
|
queue_item->channels = mfi->channels;
|
||||||
|
queue_item->samplerate = mfi->samplerate;
|
||||||
|
queue_item->bitrate = mfi->bitrate;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -373,6 +373,7 @@ scan_metadata_ffmpeg(const char *file, struct media_file_info *mfi)
|
|||||||
char *path;
|
char *path;
|
||||||
int mdcount;
|
int mdcount;
|
||||||
int sample_rate;
|
int sample_rate;
|
||||||
|
int channels;
|
||||||
int i;
|
int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -442,6 +443,7 @@ scan_metadata_ffmpeg(const char *file, struct media_file_info *mfi)
|
|||||||
codec_id = ctx->streams[i]->codecpar->codec_id;
|
codec_id = ctx->streams[i]->codecpar->codec_id;
|
||||||
sample_rate = ctx->streams[i]->codecpar->sample_rate;
|
sample_rate = ctx->streams[i]->codecpar->sample_rate;
|
||||||
sample_fmt = ctx->streams[i]->codecpar->format;
|
sample_fmt = ctx->streams[i]->codecpar->format;
|
||||||
|
channels = ctx->streams[i]->codecpar->channels;
|
||||||
switch (codec_type)
|
switch (codec_type)
|
||||||
{
|
{
|
||||||
case AVMEDIA_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
@ -478,6 +480,7 @@ scan_metadata_ffmpeg(const char *file, struct media_file_info *mfi)
|
|||||||
mfi->bits_per_sample = 8 * av_get_bytes_per_sample(sample_fmt);
|
mfi->bits_per_sample = 8 * av_get_bytes_per_sample(sample_fmt);
|
||||||
if (mfi->bits_per_sample == 0)
|
if (mfi->bits_per_sample == 0)
|
||||||
mfi->bits_per_sample = av_get_bits_per_sample(codec_id);
|
mfi->bits_per_sample = av_get_bits_per_sample(codec_id);
|
||||||
|
mfi->channels = channels;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -503,7 +506,7 @@ scan_metadata_ffmpeg(const char *file, struct media_file_info *mfi)
|
|||||||
else if (ctx->duration > AV_TIME_BASE) /* guesstimate */
|
else if (ctx->duration > AV_TIME_BASE) /* guesstimate */
|
||||||
mfi->bitrate = ((mfi->file_size * 8) / (ctx->duration / AV_TIME_BASE)) / 1000;
|
mfi->bitrate = ((mfi->file_size * 8) / (ctx->duration / AV_TIME_BASE)) / 1000;
|
||||||
|
|
||||||
DPRINTF(E_DBG, L_SCAN, "Duration %d ms, bitrate %d kbps\n", mfi->song_length, mfi->bitrate);
|
DPRINTF(E_DBG, L_SCAN, "Duration %d ms, bitrate %d kbps, samplerate %d channels %d\n", mfi->song_length, mfi->bitrate, mfi->samplerate, mfi->channels);
|
||||||
|
|
||||||
/* Try to extract ICY metadata if http stream */
|
/* Try to extract ICY metadata if http stream */
|
||||||
if (mfi->data_kind == DATA_KIND_HTTP)
|
if (mfi->data_kind == DATA_KIND_HTTP)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user