mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-11 14:30:20 -05:00
Fixes to build, install, and run ffmpeg ssc on win32
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user