mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-10 05:59:45 -05:00
Fixes to build, install, and run ffmpeg ssc on win32
This commit is contained in:
@@ -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 */
|
||||
|
||||
@@ -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");
|
||||
|
||||
16
src/plugin.c
16
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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user