mirror of
https://github.com/owntone/owntone-server.git
synced 2025-02-24 03:49:14 -05:00
win32 fixes for new plugin model
This commit is contained in:
parent
57dded49f9
commit
f40c75773a
@ -25,7 +25,11 @@
|
||||
#include "ff-dbstruct.h"
|
||||
|
||||
#ifdef WIN32
|
||||
# ifdef _WINDLL
|
||||
# define EXPORT __declspec(dllimport)
|
||||
# else
|
||||
# define EXPORT __declspec(dllexport)
|
||||
# endif
|
||||
#else
|
||||
# define EXPORT
|
||||
#endif
|
||||
@ -129,10 +133,14 @@ typedef struct tag_db_query {
|
||||
void *priv;
|
||||
} DB_QUERY;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* webserver functions */
|
||||
extern EXPORT EXPORT char *pi_ws_uri(struct tag_ws_conninfo *);
|
||||
extern EXPORT EXPORT void pi_ws_will_close(struct tag_ws_conninfo *);
|
||||
extern EXPORT EXPORT int pi_ws_returnerror(struct tag_ws_conninfo *, int, char *);
|
||||
extern EXPORT char *pi_ws_uri(struct tag_ws_conninfo *);
|
||||
extern EXPORT void pi_ws_will_close(struct tag_ws_conninfo *);
|
||||
extern EXPORT int pi_ws_returnerror(struct tag_ws_conninfo *, int, char *);
|
||||
extern EXPORT char *pi_ws_getvar(struct tag_ws_conninfo *, char *);
|
||||
extern EXPORT int pi_ws_writefd(struct tag_ws_conninfo *, char *, ...);
|
||||
extern EXPORT int pi_ws_addresponseheader(struct tag_ws_conninfo *, char *, char *, ...);
|
||||
@ -173,5 +181,8 @@ extern EXPORT int pi_conf_get_int(char *section, char *key, int dflt);
|
||||
|
||||
extern EXPORT void pi_config_set_status(struct tag_ws_conninfo *pwsc, int session, char *fmt, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FF_PLUGINS_ */
|
||||
|
@ -110,8 +110,6 @@ int ssc_ffmpeg_close(void *pv);
|
||||
int ssc_ffmpeg_read(void *pv, char *buffer, int len);
|
||||
char *ssc_ffmpeg_error(void *pv);
|
||||
|
||||
PLUGIN_INFO *plugin_info(PLUGIN_INPUT_FN*);
|
||||
|
||||
/* Globals */
|
||||
PLUGIN_TRANSCODE_FN _ptfn = {
|
||||
ssc_ffmpeg_init,
|
||||
@ -122,8 +120,6 @@ PLUGIN_TRANSCODE_FN _ptfn = {
|
||||
ssc_ffmpeg_error
|
||||
};
|
||||
|
||||
PLUGIN_INPUT_FN *_ppi;
|
||||
|
||||
PLUGIN_INFO _pi = {
|
||||
PLUGIN_VERSION, /* version */
|
||||
PLUGIN_TRANSCODE, /* type */
|
||||
@ -141,8 +137,7 @@ char *ssc_ffmpeg_error(void *pv) {
|
||||
return ssc_ffmpeg_errors[handle->errnum];
|
||||
}
|
||||
|
||||
PLUGIN_INFO *plugin_info(PLUGIN_INPUT_FN *ppi) {
|
||||
_ppi = ppi;
|
||||
PLUGIN_INFO *plugin_info(void) {
|
||||
av_register_all();
|
||||
|
||||
return &_pi;
|
||||
|
@ -73,8 +73,6 @@ int ssc_wma_close(void *pv);
|
||||
int ssc_wma_read(void *pv, char *buffer, int len);
|
||||
char *ssc_wma_error(void *pv);
|
||||
|
||||
PLUGIN_INFO *plugin_info(PLUGIN_INPUT_FN*);
|
||||
|
||||
/* Globals */
|
||||
PLUGIN_TRANSCODE_FN _ptfn = {
|
||||
ssc_wma_init,
|
||||
@ -85,8 +83,6 @@ PLUGIN_TRANSCODE_FN _ptfn = {
|
||||
ssc_wma_error
|
||||
};
|
||||
|
||||
PLUGIN_INPUT_FN *_ppi;
|
||||
|
||||
PLUGIN_INFO _pi = {
|
||||
PLUGIN_VERSION, /* version */
|
||||
PLUGIN_TRANSCODE, /* type */
|
||||
@ -107,8 +103,7 @@ char *ssc_wma_error(void *pv) {
|
||||
return _ssc_wma_errors[handle->errnum];
|
||||
}
|
||||
|
||||
PLUGIN_INFO *plugin_info(PLUGIN_INPUT_FN *ppi) {
|
||||
_ppi = ppi;
|
||||
PLUGIN_INFO *plugin_info(void) {
|
||||
return &_pi;
|
||||
}
|
||||
|
||||
@ -118,7 +113,7 @@ void *ssc_wma_init(void) {
|
||||
|
||||
hr = CoInitializeEx(NULL,COINIT_MULTITHREADED);
|
||||
if(FAILED(hr)) {
|
||||
_ppi->log(E_INF,"Could not initialize COM, Error code: 0x%08X\n",hr);
|
||||
pi_log(E_INF,"Could not initialize COM, Error code: 0x%08X\n",hr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -164,7 +159,7 @@ int ssc_wma_open(void *vp, MP3FILE *pmp3) {
|
||||
|
||||
hr = WMCreateSyncReader(NULL,0,&handle->pReader);
|
||||
if(FAILED(hr)) {
|
||||
_ppi->log(E_INF,"Could not create WMA reader. Error code: 0x%08X\n",hr);
|
||||
pi_log(E_INF,"Could not create WMA reader. Error code: 0x%08X\n",hr);
|
||||
handle->errnum = SSC_WMA_E_NOREADER;
|
||||
return FALSE;
|
||||
}
|
||||
@ -174,20 +169,20 @@ int ssc_wma_open(void *vp, MP3FILE *pmp3) {
|
||||
|
||||
hr = handle->pReader->Open(fname);
|
||||
if(FAILED(hr)) {
|
||||
_ppi->log(E_INF,"Could not open file. Error code: 0x%08X\n",hr);
|
||||
pi_log(E_INF,"Could not open file. Error code: 0x%08X\n",hr);
|
||||
return FALSE;
|
||||
}
|
||||
handle->state=STATE_OPEN;
|
||||
|
||||
hr = handle->pReader->SetRange(0,0);
|
||||
if(FAILED(hr)) {
|
||||
_ppi->log(E_INF,"Could not set range. Error code: 0x%08X\n",hr);
|
||||
pi_log(E_INF,"Could not set range. Error code: 0x%08X\n",hr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hr = handle->pReader->SetReadStreamSamples(1,0);
|
||||
if(FAILED(hr)) {
|
||||
_ppi->log(E_INF,"Could not stream samples. Error code: 0x%08X\n",hr);
|
||||
pi_log(E_INF,"Could not stream samples. Error code: 0x%08X\n",hr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -198,19 +193,19 @@ int ssc_wma_open(void *vp, MP3FILE *pmp3) {
|
||||
IWMOutputMediaProps *pprops;
|
||||
hr = handle->pReader->GetOutputFormat(0,0,&pprops);
|
||||
if(FAILED(hr)) {
|
||||
_ppi->log(E_LOG,"Could not get output format for %s\n",file);
|
||||
pi_log(E_LOG,"Could not get output format for %s\n",file);
|
||||
return TRUE; /* we'll assume 44100/16/2 */
|
||||
}
|
||||
|
||||
hr = pprops->GetMediaType(NULL,&byte_count);
|
||||
if(FAILED(hr)) {
|
||||
_ppi->log(E_LOG,"Could not get media type for %s\n",file);
|
||||
pi_log(E_LOG,"Could not get media type for %s\n",file);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
WM_MEDIA_TYPE *ptype = (WM_MEDIA_TYPE*)calloc(byte_count,1);
|
||||
if(!ptype) {
|
||||
_ppi->log(E_FATAL,"ssc_wma_open: malloc\n");
|
||||
pi_log(E_FATAL,"ssc_wma_open: malloc\n");
|
||||
}
|
||||
|
||||
hr = pprops->GetMediaType(ptype, &byte_count);
|
||||
@ -280,9 +275,9 @@ int ssc_wma_read(void *vp, char *buffer, int len) {
|
||||
byte_rate = sample_rate * channels * bits_per_sample / 8;
|
||||
block_align = channels * bits_per_sample / 8;
|
||||
|
||||
_ppi->log(E_DBG,"Channels.......: %d\n",channels);
|
||||
_ppi->log(E_DBG,"Sample rate....: %d\n",sample_rate);
|
||||
_ppi->log(E_DBG,"Bits/Sample....: %d\n",bits_per_sample);
|
||||
pi_log(E_DBG,"Channels.......: %d\n",channels);
|
||||
pi_log(E_DBG,"Sample rate....: %d\n",sample_rate);
|
||||
pi_log(E_DBG,"Bits/Sample....: %d\n",bits_per_sample);
|
||||
|
||||
memcpy(&handle->wav_header[0],"RIFF",4);
|
||||
*((unsigned int*)(&handle->wav_header[4])) = 36 + sample_len;
|
||||
@ -332,12 +327,12 @@ int ssc_wma_read(void *vp, char *buffer, int len) {
|
||||
if(SUCCEEDED(hr)) {
|
||||
hr = handle->pBuffer->GetBufferAndLength(&handle->pdata, &handle->data_len);
|
||||
if(FAILED(hr)) {
|
||||
_ppi->log(E_LOG,"Read error while transcoding file\n");
|
||||
pi_log(E_LOG,"Read error while transcoding file\n");
|
||||
handle->errnum = SSC_WMA_E_READ;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// _ppi->log(E_SPAM,"Read %d bytes\n",handle->data_len);
|
||||
// pi_log(E_SPAM,"Read %d bytes\n",handle->data_len);
|
||||
|
||||
bytes_returned = handle->data_len;
|
||||
if(bytes_returned > len)
|
||||
|
@ -6,14 +6,12 @@
|
||||
#include "ff-plugins.h"
|
||||
|
||||
/* Forwards */
|
||||
PLUGIN_INFO *plugin_info(PLUGIN_INPUT_FN *ppi);
|
||||
void plugin_handler(int, int, void *, int);
|
||||
|
||||
#define PIPE_BUFFER_SIZE 4096
|
||||
|
||||
/* Globals */
|
||||
PLUGIN_EVENT_FN _pefn = { plugin_handler };
|
||||
PLUGIN_INPUT_FN *_ppi;
|
||||
|
||||
PLUGIN_INFO _pi = {
|
||||
PLUGIN_VERSION, /* version */
|
||||
@ -34,8 +32,7 @@ typedef struct tag_plugin_msg {
|
||||
} PLUGIN_MSG;
|
||||
|
||||
|
||||
PLUGIN_INFO *plugin_info(PLUGIN_INPUT_FN *ppi) {
|
||||
_ppi = ppi;
|
||||
PLUGIN_INFO *plugin_info(void) {
|
||||
return &_pi;
|
||||
}
|
||||
|
||||
|
@ -71,6 +71,7 @@
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)/mt-daapd.pdb"
|
||||
SubSystem="1"
|
||||
ImportLibrary="firefly.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
@ -152,6 +153,7 @@
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
ImportLibrary="firefly.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
@ -228,6 +230,10 @@
|
||||
RelativePath="..\src\err.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\ff-plugins.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\getopt.c"
|
||||
>
|
||||
|
@ -42,7 +42,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..;..\..\src"
|
||||
PreprocessorDefinitions="HAVE_CONFIG_H"
|
||||
PreprocessorDefinitions="HAVE_CONFIG_H;WIN32"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
@ -62,6 +62,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="firefly.lib"
|
||||
OutputFile="$(OutDir)/out-daap.dll"
|
||||
LinkIncremental="2"
|
||||
ModuleDefinitionFile="out-daap.def"
|
||||
@ -122,7 +123,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..;..\..\src"
|
||||
PreprocessorDefinitions="HAVE_CONFIG_H"
|
||||
PreprocessorDefinitions="HAVE_CONFIG_H;WIN32"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
@ -140,6 +141,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\firefly.lib"
|
||||
OutputFile="$(OutDir)/out-daap.dll"
|
||||
LinkIncremental="1"
|
||||
ModuleDefinitionFile="out-daap.def"
|
||||
@ -231,6 +233,10 @@
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath="..\firefly.lib"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
@ -4,6 +4,7 @@
|
||||
Version="8.00"
|
||||
Name="rsp"
|
||||
ProjectGUID="{68CCEA19-503F-4894-8AE3-B1673FDEA920}"
|
||||
RootNamespace="rsp"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
@ -41,7 +42,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\win32;.;..\src"
|
||||
PreprocessorDefinitions="_WIN32;HAVE_CONFIG_H;ZLIB_DLL"
|
||||
PreprocessorDefinitions="_WIN32;HAVE_CONFIG_H;ZLIB_DLL;WIN32;PLUGIN"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
@ -61,7 +62,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="zdll.lib"
|
||||
AdditionalDependencies="zdll.lib firefly.lib"
|
||||
OutputFile="$(OutDir)/rsp.dll"
|
||||
LinkIncremental="2"
|
||||
IgnoreAllDefaultLibraries="false"
|
||||
@ -123,7 +124,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\win32;.;..\src"
|
||||
PreprocessorDefinitions="_WIN32;HAVE_CONFIG_H;ZLIB_DLL"
|
||||
PreprocessorDefinitions="_WIN32;HAVE_CONFIG_H;ZLIB_DLL;WIN32;PLUGIN"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
@ -141,7 +142,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="zdll.lib"
|
||||
AdditionalDependencies="zdll.lib firefly.lib"
|
||||
OutputFile="$(OutDir)/rsp.dll"
|
||||
LinkIncremental="1"
|
||||
IgnoreAllDefaultLibraries="false"
|
||||
|
@ -4,6 +4,7 @@
|
||||
Version="8.00"
|
||||
Name="ssc-ffmpeg"
|
||||
ProjectGUID="{DA27D6F4-7E9F-40CA-AC5C-480DC81A1C56}"
|
||||
RootNamespace="ssc-ffmpeg"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
@ -41,7 +42,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\win32;.;..\src"
|
||||
PreprocessorDefinitions="HAVE_CONFIG_H;_WIN32"
|
||||
PreprocessorDefinitions="HAVE_CONFIG_H;_WIN32;WIN32"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
@ -61,7 +62,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="avcodec.lib avformat.lib avutil.lib"
|
||||
AdditionalDependencies="avcodec.lib avformat.lib avutil.lib firefly.lib"
|
||||
OutputFile="$(OutDir)/ssc-ffmpeg.dll"
|
||||
LinkIncremental="2"
|
||||
ModuleDefinitionFile="ssc-ffmpeg.def"
|
||||
@ -122,7 +123,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\win32;.;..\src"
|
||||
PreprocessorDefinitions="HAVE_CONFIG_H;_WIN32"
|
||||
PreprocessorDefinitions="HAVE_CONFIG_H;_WIN32;WIN32"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
@ -140,7 +141,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="avcodec.lib avformat.lib avutil.lib"
|
||||
AdditionalDependencies="avcodec.lib avformat.lib avutil.lib firefly.lib"
|
||||
OutputFile="$(OutDir)/ssc-ffmpeg.dll"
|
||||
LinkIncremental="1"
|
||||
ModuleDefinitionFile="ssc-ffmpeg.def"
|
||||
|
@ -4,6 +4,7 @@
|
||||
Version="8.00"
|
||||
Name="ssc-wma"
|
||||
ProjectGUID="{C1EF5133-DFB3-4FEC-B999-3655DBB14785}"
|
||||
RootNamespace="ssc-wma"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
@ -41,7 +42,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..;..\..\src"
|
||||
PreprocessorDefinitions="HAVE_CONFIG_H"
|
||||
PreprocessorDefinitions="HAVE_CONFIG_H;WIN32"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
@ -61,7 +62,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="wmvcore.lib"
|
||||
AdditionalDependencies="wmvcore.lib ..\firefly.lib"
|
||||
OutputFile="$(OutDir)/ssc-wma.dll"
|
||||
LinkIncremental="2"
|
||||
ModuleDefinitionFile="ssc-wma.def"
|
||||
@ -122,7 +123,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..;..\..\src"
|
||||
PreprocessorDefinitions="HAVE_CONFIG_H"
|
||||
PreprocessorDefinitions="HAVE_CONFIG_H;WIN32"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
@ -140,7 +141,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="wmvcore.lib"
|
||||
AdditionalDependencies="wmvcore.lib ..\firefly.lib"
|
||||
OutputFile="$(OutDir)/ssc-wma.dll"
|
||||
LinkIncremental="1"
|
||||
ModuleDefinitionFile="ssc-wma.def"
|
||||
|
@ -42,7 +42,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\win32;.;..\src"
|
||||
PreprocessorDefinitions="HAVE_CONFIG_H;_WIN32"
|
||||
PreprocessorDefinitions="HAVE_CONFIG_H;_WIN32;WIN32"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
@ -62,7 +62,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="wsock32.lib"
|
||||
AdditionalDependencies="wsock32.lib firefly.lib"
|
||||
OutputFile="$(OutDir)/w32-event.dll"
|
||||
LinkIncremental="2"
|
||||
ModuleDefinitionFile="w32-event.def"
|
||||
@ -123,7 +123,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\win32;.;..\src"
|
||||
PreprocessorDefinitions="HAVE_CONFIG_H;_WIN32"
|
||||
PreprocessorDefinitions="HAVE_CONFIG_H;_WIN32;WIN32"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
@ -141,7 +141,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="wsock32.lib"
|
||||
AdditionalDependencies="wsock32.lib firefly.lib"
|
||||
OutputFile="$(OutDir)/w32-event.dll"
|
||||
LinkIncremental="1"
|
||||
ModuleDefinitionFile="w32-event.def"
|
||||
|
Loading…
x
Reference in New Issue
Block a user