diff --git a/src/ff-plugins.h b/src/ff-plugins.h
index 738b81e1..7ecaafbe 100644
--- a/src/ff-plugins.h
+++ b/src/ff-plugins.h
@@ -62,12 +62,12 @@ typedef struct tag_plugin_event_fn {
} PLUGIN_EVENT_FN;
typedef struct tag_plugin_transcode_fn {
- void *(*init)(void);
- void (*deinit)(void*);
- int (*open)(void*, char *, char*, int);
- int (*close)(void*);
- int (*read)(void*, char*, int);
- char *(*error)(void*);
+ void *(*ssc_init)(void);
+ void (*ssc_deinit)(void*);
+ int (*ssc_open)(void*, char *, char*, int);
+ int (*ssc_close)(void*);
+ int (*ssc_read)(void*, char*, int);
+ char *(*ssc_error)(void*);
} PLUGIN_TRANSCODE_FN;
/* info for rendezvous advertising */
diff --git a/src/main.c b/src/main.c
index a8fd2afc..82800187 100644
--- a/src/main.c
+++ b/src/main.c
@@ -439,7 +439,7 @@ int main(int argc, char *argv[]) {
txt_add(txtrecord,"iTSh Version=131073"); /* iTunes 6.0.4 */
txt_add(txtrecord,"Version=196610"); /* iTunes 6.0.4 */
txt_add(txtrecord,"Password=%s",conf_isset("general","password") ? "true" : "false");
- srand(time(NULL));
+ srand((unsigned int)time(NULL));
txt_add(txtrecord,"ffid=%08x",rand());
DPRINTF(E_LOG,L_MAIN|L_REND,"Registering rendezvous names\n");
diff --git a/src/plugin.c b/src/plugin.c
index a553b104..58b5aa4e 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -273,7 +273,7 @@ int _plugin_error(char **pe, int error, ...) {
*/
void _plugin_recalc_codecs(void) {
PLUGIN_ENTRY *ppi;
- int size=0;
+ size_t size=0;
_plugin_writelock();
@@ -606,14 +606,14 @@ int _plugin_ssc_copy(WS_CONNINFO *pwsc, PLUGIN_TRANSCODE_FN *pfn,
if(bytes_to_read > offset)
bytes_to_read = offset;
- bytes_read = pfn->read(vp,buffer,bytes_to_read);
+ bytes_read = pfn->ssc_read(vp,buffer,bytes_to_read);
if(bytes_read <= 0)
return bytes_read;
offset -= bytes_read;
}
- while((bytes_read=pfn->read(vp,buffer,sizeof(buffer))) > 0) {
+ while((bytes_read=pfn->ssc_read(vp,buffer,sizeof(buffer))) > 0) {
total_bytes_read += bytes_read;
ws_writebinary(pwsc,buffer,bytes_read);
}
@@ -660,9 +660,9 @@ int plugin_ssc_transcode(WS_CONNINFO *pwsc, char *file, char *codec, int duratio
DPRINTF(E_DBG,L_PLUG,"Transcoding %s with %s\n",file,
ptc->pinfo->server);
- vp_ssc = pfn->init();
+ vp_ssc = pfn->ssc_init();
if(vp_ssc) {
- if(pfn->open(vp_ssc,file,codec,duration)) {
+ if(pfn->ssc_open(vp_ssc,file,codec,duration)) {
/* start reading and throwing */
ws_addresponseheader(pwsc,"Content-Type","audio/wav");
ws_addresponseheader(pwsc,"Connection","Close");
@@ -678,12 +678,12 @@ int plugin_ssc_transcode(WS_CONNINFO *pwsc, char *file, char *codec, int duratio
/* start reading/writing */
result = _plugin_ssc_copy(pwsc,pfn,vp_ssc,offset);
post_error = 0;
- pfn->close(vp_ssc);
+ pfn->ssc_close(vp_ssc);
} else {
DPRINTF(E_LOG,L_PLUG,"Error opening %s for ssc: %s\n",
- file,pfn->error(vp_ssc));
+ file,pfn->ssc_error(vp_ssc));
}
- pfn->deinit(vp_ssc);
+ pfn->ssc_deinit(vp_ssc);
} else {
DPRINTF(E_LOG,L_PLUG,"Error initializing transcoder: %s\n",
ptc->pinfo->server);
diff --git a/src/plugins/ssc-ffmpeg.c b/src/plugins/ssc-ffmpeg.c
index 055ee408..6cadf535 100644
--- a/src/plugins/ssc-ffmpeg.c
+++ b/src/plugins/ssc-ffmpeg.c
@@ -45,7 +45,7 @@ typedef struct tag_ssc_handle {
int total_decoded;
int total_written;
- int errno;
+ int errnum;
int swab;
char *error;
@@ -115,7 +115,7 @@ PLUGIN_INFO _pi = {
char *ssc_ffmpeg_error(void *pv) {
SSCHANDLE *handle = (SSCHANDLE*)pv;
- return ssc_ffmpeg_errors[handle->errno];
+ return ssc_ffmpeg_errors[handle->errnum];
}
PLUGIN_INFO *plugin_info(PLUGIN_INPUT_FN *ppi) {
@@ -169,19 +169,19 @@ int ssc_ffmpeg_open(void *vp, char *file, char *codec, int duration) {
_ppi->log(E_DBG,"opening file raw\n");
handle->pCodec = avcodec_find_decoder(id);
if(!handle->pCodec) {
- handle->errno = SSC_FFMPEG_E_BADCODEC;
+ handle->errnum = SSC_FFMPEG_E_BADCODEC;
return FALSE;
}
handle->pCodecCtx = avcodec_alloc_context();
if(avcodec_open(handle->pCodecCtx,handle->pCodec) < 0) {
- handle->errno = SSC_FFMPEG_E_CODECOPEN;
+ handle->errnum = SSC_FFMPEG_E_CODECOPEN;
return FALSE;
}
handle->fin = fopen(file,"rb");
if(!handle->fin) {
- handle->errno = SSC_FFMPEG_E_FILEOPEN;
+ handle->errnum = SSC_FFMPEG_E_FILEOPEN;
return FALSE;
}
@@ -190,13 +190,13 @@ int ssc_ffmpeg_open(void *vp, char *file, char *codec, int duration) {
_ppi->log(E_DBG,"opening file with format\n");
if(av_open_input_file(&handle->pFmtCtx,file,handle->pFormat,0,NULL) < 0) {
- handle->errno = SSC_FFMPEG_E_FILEOPEN;
+ handle->errnum = SSC_FFMPEG_E_FILEOPEN;
return FALSE;
}
/* find the streams */
if(av_find_stream_info(handle->pFmtCtx) < 0) {
- handle->errno = SSC_FFMPEG_E_NOSTREAM;
+ handle->errnum = SSC_FFMPEG_E_NOSTREAM;
return FALSE;
}
@@ -211,7 +211,7 @@ int ssc_ffmpeg_open(void *vp, char *file, char *codec, int duration) {
}
if(handle->audio_stream == -1) {
- handle->errno = SSC_FFMPEG_E_NOAUDIO;
+ handle->errnum = SSC_FFMPEG_E_NOAUDIO;
return FALSE;
}
@@ -219,7 +219,7 @@ int ssc_ffmpeg_open(void *vp, char *file, char *codec, int duration) {
handle->pCodec = avcodec_find_decoder(handle->pCodecCtx->codec_id);
if(!handle->pCodec) {
- handle->errno = SSC_FFMPEG_E_BADCODEC;
+ handle->errnum = SSC_FFMPEG_E_BADCODEC;
return FALSE;
}
@@ -227,7 +227,7 @@ int ssc_ffmpeg_open(void *vp, char *file, char *codec, int duration) {
handle->pCodecCtx->flags |= CODEC_FLAG_TRUNCATED;
if(avcodec_open(handle->pCodecCtx, handle->pCodec) < 0) {
- handle->errno = SSC_FFMPEG_E_CODECOPEN;
+ handle->errnum = SSC_FFMPEG_E_CODECOPEN;
return FALSE;
}
@@ -272,7 +272,7 @@ int _ssc_ffmpeg_read_frame(void *vp, char *buffer, int len) {
if(!handle->file_bytes_read) {
/* need to grab a new chunk */
handle->file_buffer_ptr = handle->file_buffer;
- handle->file_bytes_read = fread(handle->file_buffer,
+ handle->file_bytes_read = (int)fread(handle->file_buffer,
1, sizeof(handle->file_buffer),
handle->fin);
handle->file_buffer_ptr = handle->file_buffer;
diff --git a/src/plugins/w32-event.c b/src/plugins/w32-event.c
index dbea5108..214406df 100644
--- a/src/plugins/w32-event.c
+++ b/src/plugins/w32-event.c
@@ -6,13 +6,14 @@
#include "ff-plugins.h"
/* Forwards */
-PLUGIN_INFO *plugin_info(void);
+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 */
@@ -22,7 +23,6 @@ PLUGIN_INFO _pi = {
NULL, /* output fns */
&_pefn, /* event fns */
NULL, /* transocde fns */
- NULL, /* fns exported by ff */
NULL, /* rend info */
NULL /* codec list */
};
@@ -34,9 +34,9 @@ typedef struct tag_plugin_msg {
char vp[1];
} PLUGIN_MSG;
-#define infn ((PLUGIN_INPUT_FN *)(_pi.pi))
-PLUGIN_INFO *plugin_info(void) {
+PLUGIN_INFO *plugin_info(PLUGIN_INPUT_FN *ppi) {
+ _ppi = ppi;
return &_pi;
}
@@ -50,7 +50,7 @@ void plugin_handler(int event_id, int intval, void *vp, int len) {
pmsg = (PLUGIN_MSG*)malloc(total_len);
if(!pmsg) {
-// infn->log(E_LOG,"Malloc error in w32-event.c/plugin_handler\n");
+// _ppi->log(E_LOG,"Malloc error in w32-event.c/plugin_handler\n");
return;
}
diff --git a/src/webserver.c b/src/webserver.c
index 9ca314cf..e693e8f4 100644
--- a/src/webserver.c
+++ b/src/webserver.c
@@ -1,5 +1,5 @@
/*
- * $id: webserver.c,v 1.39 2005/11/15 06:43:31 rpedde Exp $
+ * $Id$
* Webserver library
*
* Copyright (C) 2003 Ron Pedde (ron@pedde.com)
diff --git a/win32/mt-daapd.sln b/win32/mt-daapd.sln
index 654e7cd3..237cb3b4 100644
--- a/win32/mt-daapd.sln
+++ b/win32/mt-daapd.sln
@@ -15,6 +15,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "w32-event", "w32-event.vcpr
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ssc-ffmpeg", "ssc-ffmpeg.vcproj", "{DA27D6F4-7E9F-40CA-AC5C-480DC81A1C56}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
@@ -37,6 +41,10 @@ Global
{E60F90F1-A1E5-49D8-A565-B990CA4BA860}.Debug.Build.0 = Debug|Win32
{E60F90F1-A1E5-49D8-A565-B990CA4BA860}.Release.ActiveCfg = Release|Win32
{E60F90F1-A1E5-49D8-A565-B990CA4BA860}.Release.Build.0 = Release|Win32
+ {DA27D6F4-7E9F-40CA-AC5C-480DC81A1C56}.Debug.ActiveCfg = Debug|Win32
+ {DA27D6F4-7E9F-40CA-AC5C-480DC81A1C56}.Debug.Build.0 = Debug|Win32
+ {DA27D6F4-7E9F-40CA-AC5C-480DC81A1C56}.Release.ActiveCfg = Release|Win32
+ {DA27D6F4-7E9F-40CA-AC5C-480DC81A1C56}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
diff --git a/win32/mt-daapd.vcproj b/win32/mt-daapd.vcproj
index e935ab2f..24e641c1 100644
--- a/win32/mt-daapd.vcproj
+++ b/win32/mt-daapd.vcproj
@@ -209,9 +209,6 @@
-
-
@@ -247,6 +244,9 @@
+
+
diff --git a/win32/nsi/mt-daapd.nsi.templ b/win32/nsi/mt-daapd.nsi.templ
index 1de6fa80..3469a945 100644
--- a/win32/nsi/mt-daapd.nsi.templ
+++ b/win32/nsi/mt-daapd.nsi.templ
@@ -117,10 +117,14 @@ Section "MainSection" SEC01
File "${DLL_SOURCE}\sqlite.dll"
File "${DLL_SOURCE}\sqlite3.dll"
File "${DLL_SOURCE}\zlib1.dll"
+ File "${DLL_SOURCE}\avutil.dll"
+ File "${DLL_SOURCE}\avcodec.dll"
+ File "${DLL_SOURCE}\avformat.dll"
SetOutPath "$2\plugins"
File "${MTD_SOURCE}\rsp.dll"
File "${MTD_SOURCE}\w32-event.dll"
+ File "${MTD_SOURCE}\ssc-ffmpeg.dll"
SetOutPath "$2\admin-root"
File "${ADMIN_ROOT}\thanks.html"
@@ -174,7 +178,7 @@ Section "MainSection" SEC01
WriteINIStr "$2\mt-daapd.conf" "general" "mp3_dir" $3
HasConf:
WriteINIStr "$2\mt-daapd.conf" "plugins" "plugin_dir" "plugins"
- WriteINIStr "$2\mt-daapd.conf" "plugins" "plugins" "rsp.dll,w32-event.dll"
+ WriteINIStr "$2\mt-daapd.conf" "plugins" "plugins" "rsp.dll,w32-event.dll,ssc-ffmpeg.dll"
ReadINIStr $0 "$2\mt-daapd.conf" "general" "rescan_interval"
StrCmp $0 "" rescan_set rescan_skip
rescan_set:
@@ -402,8 +406,12 @@ Section Uninstall
Delete "$INSTDIR\sqlite3.dll"
Delete "$INSTDIR\mt-daapd.conf"
Delete "$INSTDIR\zlib1.dll"
+ Delete "$INSTDIR\avutil.dll"
+ Delete "$INSTDIR\avcodec.dll"
+ Delete "$INSTDIR\avformat.dll"
Delete "$INSTDIR\plugins\rsp.dll"
Delete "$INSTDIR\plugins\w32-event.dll"
+ Delete "$INSTDIR\plugins\ssc-ffmpeg.dll"
Delete "$INSTDIR\songs.db"
Delete "$INSTDIR\songs3.db"
Delete "$INSTDIR\mt-daapd-example.conf"
diff --git a/win32/ssc-ffmpeg-res.h b/win32/ssc-ffmpeg-res.h
new file mode 100644
index 00000000..63c78f09
--- /dev/null
+++ b/win32/ssc-ffmpeg-res.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by ssc-ffmpeg.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/win32/ssc-ffmpeg.def b/win32/ssc-ffmpeg.def
new file mode 100644
index 00000000..48977aa4
--- /dev/null
+++ b/win32/ssc-ffmpeg.def
@@ -0,0 +1,4 @@
+LIBRARY ssc-ffmpeg
+EXPORTS
+ plugin_info
+
diff --git a/win32/ssc-ffmpeg.rc.templ b/win32/ssc-ffmpeg.rc.templ
new file mode 100644
index 00000000..8e60adf5
--- /dev/null
+++ b/win32/ssc-ffmpeg.rc.templ
@@ -0,0 +1,102 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "ssc-ffmpeg-res.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "ssc-ffmpeg-res.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,$WCREV$
+ PRODUCTVERSION 1,0,0,$WCREV$
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Firefly Media Server"
+ VALUE "FileDescription", "ffmpeg transcoder"
+ VALUE "FileVersion", "1.0 svn-$WCREV$"
+ VALUE "InternalName", "ssc-ffmpeg"
+ VALUE "LegalCopyright", "Copyright (C) 2006 Ron Pedde"
+ VALUE "OriginalFilename", "ssc-ffmpeg.dll"
+ VALUE "ProductName", "Firefly Media Server"
+ VALUE "ProductVersion", "1.0 svn-$WCREV$"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/win32/ssc-ffmpeg.vcproj b/win32/ssc-ffmpeg.vcproj
new file mode 100644
index 00000000..d0fb8b4b
--- /dev/null
+++ b/win32/ssc-ffmpeg.vcproj
@@ -0,0 +1,149 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/win32/versionize.bat b/win32/versionize.bat
index 595bb0c5..e7fa3112 100644
--- a/win32/versionize.bat
+++ b/win32/versionize.bat
@@ -7,10 +7,12 @@ echo Fixing version info...
%SUBWC% %0\..\.. %0\..\config.h.templ %0\..\config.h
%SUBWC% %0\..\.. %0\..\FireflyConfig\AssemblyInfo.cs.templ %0\..\FireflyConfig\AssemblyInfo.cs
%SUBWC% %0\..\.. %0\..\nsi\mt-daapd.nsi.templ %0\..\nsi\mt-daapd.nsi
+%SUBWC% %0\..\.. %0\..\ssc-ffmpeg.rc.templ %0\..\ssc-ffmpeg.rc
goto END
:NOSUBWC
copy %0\..\config.h.templ %0\..\config.h
copy %0\..\FireflyConfig\AssemblyInfo.cs.templ %0\..\FireflyConfig\AssemblyInfo.cs
copy %0\..\nsi\mt-daapd.nsi.templ %0\..\nsi\mt-daapd.nsi
+copy %0\..\.. %0\..\ssc-ffmpeg.rc.templ %0\..\ssc-ffmpeg.rc
:END