2008-05-26 15:29:21 +02:00
|
|
|
#ifndef _FOO_VGMSTREAM_
|
|
|
|
#define _FOO_VGMSTREAM_
|
|
|
|
|
2024-08-10 23:26:53 +02:00
|
|
|
#define SAMPLE_BUFFER_SIZE 1024
|
|
|
|
#define FOO_PATH_LIMIT 4096 /* see vgmstream_limits.h*/
|
2018-09-08 01:22:49 +02:00
|
|
|
|
2021-09-05 17:53:47 +02:00
|
|
|
extern "C" {
|
|
|
|
#include "../src/vgmstream.h"
|
|
|
|
}
|
|
|
|
|
2024-08-10 23:26:53 +02:00
|
|
|
typedef struct {
|
|
|
|
pfc::string8_fast title;
|
|
|
|
pfc::string8_fast stream_name;
|
|
|
|
pfc::string8_fast layout_name;
|
|
|
|
pfc::string8_fast codec_name;
|
|
|
|
pfc::string8_fast meta_name;
|
|
|
|
pfc::string8_fast channel_mask;
|
|
|
|
|
|
|
|
int channels;
|
|
|
|
int sample_rate;
|
|
|
|
|
|
|
|
int input_channels;
|
|
|
|
int subsong_count;
|
|
|
|
int subsong_index;
|
|
|
|
|
|
|
|
int bits_per_sample;
|
|
|
|
|
|
|
|
int64_t stream_samples;
|
|
|
|
int64_t loop_start;
|
|
|
|
int64_t loop_end;
|
|
|
|
bool loop_flag;
|
|
|
|
|
|
|
|
int bitrate;
|
|
|
|
uint32_t channel_layout;
|
|
|
|
|
|
|
|
double play_length_s;
|
|
|
|
|
|
|
|
} vgmstream_info_t;
|
2010-02-27 22:05:57 +01:00
|
|
|
|
2017-12-31 04:15:34 +01:00
|
|
|
class input_vgmstream : public input_stubs {
|
2017-08-12 21:17:44 +02:00
|
|
|
public:
|
|
|
|
input_vgmstream();
|
|
|
|
~input_vgmstream();
|
|
|
|
|
2020-07-29 19:41:17 +02:00
|
|
|
void open(service_ptr_t<file> p_filehint, const char * p_path, t_input_open_reason p_reason, abort_callback & p_abort);
|
2017-08-12 21:17:44 +02:00
|
|
|
|
|
|
|
unsigned get_subsong_count();
|
|
|
|
t_uint32 get_subsong(unsigned p_index);
|
2020-07-29 19:41:17 +02:00
|
|
|
void get_info(t_uint32 p_subsong, file_info & p_info, abort_callback & p_abort);
|
2017-08-12 21:17:44 +02:00
|
|
|
t_filestats get_file_stats(abort_callback & p_abort);
|
2023-02-12 00:10:49 +01:00
|
|
|
t_filestats2 get_stats2(uint32_t f, abort_callback & p_abort);
|
2017-08-12 21:17:44 +02:00
|
|
|
|
2020-07-29 19:41:17 +02:00
|
|
|
void decode_initialize(t_uint32 p_subsong, unsigned p_flags, abort_callback & p_abort);
|
|
|
|
bool decode_run(audio_chunk & p_chunk, abort_callback & p_abort);
|
|
|
|
void decode_seek(double p_seconds, abort_callback & p_abort);
|
2017-08-12 21:17:44 +02:00
|
|
|
bool decode_can_seek();
|
|
|
|
bool decode_get_dynamic_info(file_info & p_out, double & p_timestamp_delta);
|
|
|
|
bool decode_get_dynamic_info_track(file_info & p_out, double & p_timestamp_delta);
|
|
|
|
void decode_on_idle(abort_callback & p_abort);
|
|
|
|
|
2020-07-29 19:41:17 +02:00
|
|
|
void retag_set_info(t_uint32 p_subsong, const file_info & p_info, abort_callback & p_abort);
|
2017-08-12 21:17:44 +02:00
|
|
|
void retag_commit(abort_callback & p_abort);
|
2022-05-01 18:07:53 +02:00
|
|
|
void remove_tags(abort_callback & p_abort);
|
2017-08-12 21:17:44 +02:00
|
|
|
|
|
|
|
static bool g_is_our_content_type(const char * p_content_type);
|
2020-07-29 19:41:17 +02:00
|
|
|
static bool g_is_our_path(const char * p_path, const char * p_extension);
|
2017-08-12 21:17:44 +02:00
|
|
|
|
2017-12-31 04:15:34 +01:00
|
|
|
static GUID g_get_guid();
|
|
|
|
static const char * g_get_name();
|
|
|
|
static GUID g_get_preferences_guid();
|
|
|
|
static bool g_is_low_merit();
|
|
|
|
|
2017-08-12 21:17:44 +02:00
|
|
|
private:
|
2017-08-13 22:26:40 +02:00
|
|
|
//service_ptr_t<file> m_file;
|
2017-08-12 21:17:44 +02:00
|
|
|
pfc::string8 filename;
|
|
|
|
t_filestats stats;
|
2023-02-12 00:10:49 +01:00
|
|
|
t_filestats2 stats2;
|
2017-08-12 21:17:44 +02:00
|
|
|
|
|
|
|
/* state */
|
2020-07-29 19:41:17 +02:00
|
|
|
VGMSTREAM* vgmstream;
|
2017-08-13 22:26:40 +02:00
|
|
|
t_uint32 subsong;
|
2018-04-15 00:54:46 +02:00
|
|
|
bool direct_subsong;
|
2019-03-23 22:50:15 +01:00
|
|
|
int output_channels;
|
2017-08-12 21:17:44 +02:00
|
|
|
|
|
|
|
bool decoding;
|
|
|
|
int paused;
|
|
|
|
int decode_pos_ms;
|
|
|
|
int decode_pos_samples;
|
2020-07-29 19:41:17 +02:00
|
|
|
int length_samples;
|
2019-03-23 22:50:15 +01:00
|
|
|
short sample_buffer[SAMPLE_BUFFER_SIZE * VGMSTREAM_MAX_CHANNELS];
|
2017-08-12 21:17:44 +02:00
|
|
|
|
2018-11-03 22:58:59 +01:00
|
|
|
/* settings */
|
2017-08-12 21:17:44 +02:00
|
|
|
double fade_seconds;
|
|
|
|
double fade_delay_seconds;
|
|
|
|
double loop_count;
|
|
|
|
bool loop_forever;
|
2024-08-10 23:26:53 +02:00
|
|
|
bool ignore_loop;
|
2017-08-13 22:26:40 +02:00
|
|
|
bool disable_subsongs;
|
2020-07-29 19:41:17 +02:00
|
|
|
|
2018-04-29 23:31:52 +02:00
|
|
|
int downmix_channels;
|
2018-11-03 22:58:59 +01:00
|
|
|
bool tagfile_disable;
|
|
|
|
pfc::string8 tagfile_name;
|
2018-11-04 00:36:28 +01:00
|
|
|
bool override_title;
|
2019-09-30 00:56:29 +02:00
|
|
|
//bool exts_common_on;
|
|
|
|
//bool exts_unknown_on;
|
2017-08-12 21:17:44 +02:00
|
|
|
|
|
|
|
/* helpers */
|
2024-08-10 23:26:53 +02:00
|
|
|
void load_settings();
|
|
|
|
|
|
|
|
void put_info_tags(file_info& p_info, vgmstream_info_t& v_info);
|
|
|
|
void put_into_tagfile(file_info& p_info, abort_callback& p_abort);
|
|
|
|
void put_info_details(file_info& p_info, vgmstream_info_t& v_info);
|
|
|
|
|
2021-09-05 17:53:47 +02:00
|
|
|
VGMSTREAM* init_vgmstream_foo(t_uint32 p_subsong, const char* const filename, abort_callback& p_abort);
|
|
|
|
void setup_vgmstream(abort_callback& p_abort);
|
|
|
|
void apply_config(VGMSTREAM* vgmstream);
|
2019-09-30 00:56:29 +02:00
|
|
|
|
2024-08-10 23:26:53 +02:00
|
|
|
void query_subsong_info(t_uint32 p_subsong, vgmstream_info_t& v_info, abort_callback& p_abort);
|
|
|
|
bool query_description_tag(pfc::string_base& temp, pfc::string_base const& description, const char* tag, char delimiter = '\n');
|
|
|
|
|
2021-09-05 17:53:47 +02:00
|
|
|
static void g_load_cfg(int* accept_unknown, int* accept_common);
|
2010-02-26 08:45:06 +01:00
|
|
|
};
|
|
|
|
|
2017-08-13 22:26:40 +02:00
|
|
|
/* foo_streamfile.cpp */
|
2021-09-05 17:53:47 +02:00
|
|
|
STREAMFILE* open_foo_streamfile(const char* const filename, abort_callback* p_abort, t_filestats* stats);
|
2010-02-27 22:05:57 +01:00
|
|
|
|
2017-08-13 22:26:40 +02:00
|
|
|
|
2017-05-18 23:03:55 +02:00
|
|
|
#endif /*_FOO_VGMSTREAM_*/
|