If you have an issue with any of our projects. feel free to register.

Commit c34e7e63 authored by Christopher Snowhill's avatar Christopher Snowhill

Fix seeking with raw DTS files

Fix encoding of version about string, and add FFmpeg build version
parent 0e087503
......@@ -7,6 +7,7 @@
// (C) 2006-2018 Christopher Snowhill
//
// Changes:
// 0.6.8 (2019-02-20): Fixed plain DTS file seeking
// 0.6.7 (2019-01-11): Fixed decode postprocessor handling multiple packets in a single decode call
// 0.6.6 (2019-01-10): Fixed decode postprocessor handling pre-stream silence
// 0.6.5 (2019-01-10): Hopefully fixed Windows XP support
......@@ -64,7 +65,7 @@
// 0.0.4 (2004-10-15): Simplified packet decoder, added codec reporting, fixed typo in version number
// 0.0.3 (2004-10-15): Added Matroska packet decoder support
#define FD_VERSION "0.6.7"
#define FD_VERSION "0.6.8"
//#define DTS_DEBUG // print status info to console
......@@ -322,26 +323,44 @@ public:
{
if (data->endOfAudio || data->endOfStream) return false;
bool ret = decode_ffmpeg(data, chunk, p_abort);
if (ret) {
dynamic_last_decoded = chunk.get_sample_count();
dynamic_decoded_this_interval += dynamic_last_decoded;
if (!dynamic_blocks_per_interval) {
dynamic_blocks_per_interval = (dynamic_interval + (dynamic_last_decoded - 1)) / dynamic_last_decoded;
dynamic_bitrates.set_count(dynamic_blocks_per_interval);
dynamic_bitrates.fill_null();
dynamic_current_bitrate = 0;
dynamic_bitrate_total = 0;
dynamic_bitrate_count = 0;
bool ret;
do
{
ret = decode_ffmpeg(data, chunk, p_abort);
if (ret) {
dynamic_last_decoded = chunk.get_sample_count();
dynamic_decoded_this_interval += dynamic_last_decoded;
if (!dynamic_blocks_per_interval) {
dynamic_blocks_per_interval = (dynamic_interval + (dynamic_last_decoded - 1)) / dynamic_last_decoded;
dynamic_bitrates.set_count(dynamic_blocks_per_interval);
dynamic_bitrates.fill_null();
dynamic_current_bitrate = 0;
dynamic_bitrate_total = 0;
dynamic_bitrate_count = 0;
}
dynamic_bitrate_total -= dynamic_bitrates[dynamic_current_bitrate];
dynamic_bitrates[dynamic_current_bitrate] = data->bitrate;
dynamic_bitrate_total += data->bitrate;
dynamic_current_bitrate = (dynamic_current_bitrate + 1) % dynamic_blocks_per_interval;
if (dynamic_bitrate_count < dynamic_blocks_per_interval)
++dynamic_bitrate_count;
if (data->samplesToDiscard > 0) {
int last_decoded = chunk.get_sample_count();
if (data->samplesToDiscard >= last_decoded) {
data->samplesToDiscard -= last_decoded;
continue;
}
else {
last_decoded -= data->samplesToDiscard;
memmove(chunk.get_data(), chunk.get_data() + data->samplesToDiscard * data->channels, last_decoded * data->channels * sizeof(audio_sample));
chunk.set_sample_count(last_decoded);
data->samplesToDiscard = 0;
}
}
}
dynamic_bitrate_total -= dynamic_bitrates[dynamic_current_bitrate];
dynamic_bitrates[dynamic_current_bitrate] = data->bitrate;
dynamic_bitrate_total += data->bitrate;
dynamic_current_bitrate = (dynamic_current_bitrate + 1) % dynamic_blocks_per_interval;
if (dynamic_bitrate_count < dynamic_blocks_per_interval)
++dynamic_bitrate_count;
}
} while (ret && data->samplesToDiscard > 0);
return ret;
}
......@@ -427,14 +446,28 @@ static input_cuesheet_factory_t<input_dts> g_input_dts_factory;
#include "../patrons.h"
DECLARE_COMPONENT_VERSION("DTS decoder", FD_VERSION,
"DTS decoding powered by FFmpeg.\n"
"\n"
"foobar2000 component by Janne Hyvärinen and Christopher Snowhill.\n"
"Licensed under GNU GPL.\n\n"
"https://www.patreon.com/kode54\n\n"
MY_PATRONS
);
class version_dts : public componentversion
{
public:
virtual void get_file_name(pfc::string_base & out) { out = core_api::get_my_file_name(); }
virtual void get_component_name(pfc::string_base & out) { out = "DTS decoder"; }
virtual void get_component_version(pfc::string_base & out) { out = FD_VERSION; }
virtual void get_about_message(pfc::string_base & out)
{
out = "DTS decoding powered by FFmpeg.\n";
out += "\n";
out += "Using FFmpeg version: ";
out += av_version_info();
out += "\n";
out += "\n";
out += u8"foobar2000 component by Janne Hyvärinen and Christopher Snowhill.\n";
out += "Licensed under GNU GPL.\n\n";
out += "https://www.patreon.com/kode54\n\n";
out += MY_PATRONS;
}
};
static service_factory_single_t<version_dts> g_componentversion_dts_factory;
DECLARE_FILE_TYPE("DTS files", "*.DTS;*.DTSWAV;*.DTSHD;*.DTSMA");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment