From ac3b6d090c0b5c6ee4efecf0b80a6c01bfd4572f Mon Sep 17 00:00:00 2001 From: diego Date: Sun, 12 Oct 2008 12:12:41 +0000 Subject: Move socklen_t typedef from config.h to stream/network.h. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27744 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/librtsp/rtsp_rtp.c | 1 + stream/network.h | 3 +++ 2 files changed, 4 insertions(+) (limited to 'stream') diff --git a/stream/librtsp/rtsp_rtp.c b/stream/librtsp/rtsp_rtp.c index fd01524d89..b782b59cd5 100644 --- a/stream/librtsp/rtsp_rtp.c +++ b/stream/librtsp/rtsp_rtp.c @@ -42,6 +42,7 @@ #include "rtsp.h" #include "rtsp_rtp.h" #include "rtsp_session.h" +#include "stream/network.h" #include "stream/freesdp/common.h" #include "stream/freesdp/parser.h" diff --git a/stream/network.h b/stream/network.h index 76e2e6d520..36b470dfe4 100644 --- a/stream/network.h +++ b/stream/network.h @@ -25,6 +25,9 @@ #ifndef HAVE_CLOSESOCKET #define closesocket close #endif +#ifndef HAVE_SOCKLEN_T +typedef int socklen_t; +#endif #define BUFFER_SIZE 2048 -- cgit v1.2.3 From c8808af5a0e19e550a1779cb3725a0dcffe0d65b Mon Sep 17 00:00:00 2001 From: diego Date: Mon, 13 Oct 2008 15:13:40 +0000 Subject: Unconditionally #include osdep/shem.h, fixes the warnings on Cygwin: stream/cache2.c:244: warning: implicit declaration of function `shmem_alloc' stream/cache2.c:265: warning: implicit declaration of function `shmem_free' git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27757 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/cache2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'stream') diff --git a/stream/cache2.c b/stream/cache2.c index 53749afb5d..aff5a93a6f 100644 --- a/stream/cache2.c +++ b/stream/cache2.c @@ -16,6 +16,7 @@ #include #include +#include "osdep/shmem.h" #include "osdep/timer.h" #ifdef WIN32 #include @@ -26,7 +27,6 @@ static DWORD WINAPI ThreadProc(void* s); static void ThreadProc( void *s ); #else #include -#include "osdep/shmem.h" #endif #include "mp_msg.h" -- cgit v1.2.3 From bc7cf2efd85d4f1a88892cff71294adb4bc44a86 Mon Sep 17 00:00:00 2001 From: diego Date: Mon, 13 Oct 2008 15:25:34 +0000 Subject: Remove unused function, fixes the warning: stream/tvi_dshow.c:1311: warning: 'reconnect_pins' defined but not used git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27758 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/tvi_dshow.c | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) (limited to 'stream') diff --git a/stream/tvi_dshow.c b/stream/tvi_dshow.c index 726f469098..e06f4dc346 100644 --- a/stream/tvi_dshow.c +++ b/stream/tvi_dshow.c @@ -1298,52 +1298,6 @@ static void get_capabilities(priv_t * priv) * *--------------------------------------------------------------------------------------- */ -/** - * \brief routine for reconnecting two pins with new media type - * \param pGraph IGraphBuilder interface - * \param chan chain data - * \param pmt [in/out] new mediatype for pin connection - * - * \return S_OK if operation successfult, error code otherwise - * will also return media type of new connection into pmt variable - */ -static HRESULT reconnect_pins(IGraphBuilder *pGraph, chain_t *chain, AM_MEDIA_TYPE *pmt) -{ - AM_MEDIA_TYPE old_mt; - HRESULT hr; - - do { - /* save old media type for reconnection in case of error */ - hr = OLE_CALL_ARGS(chain->pCapturePin, ConnectionMediaType, &old_mt); - if(FAILED(hr)) - return hr; - - hr = OLE_CALL(chain->pCapturePin, Disconnect); - if(FAILED(hr)) - return hr; - - hr = OLE_CALL_ARGS(chain->pSG, SetMediaType, pmt); - if(FAILED(hr)) - return hr; - - hr = OLE_CALL_ARGS(pGraph, Connect, chain->pCapturePin, chain->pSGIn); - if(FAILED(hr)) - { - OLE_CALL_ARGS(chain->pSG, SetMediaType, &old_mt); - OLE_CALL_ARGS(pGraph, Connect, chain->pCapturePin, chain->pSGIn); - break; - } - hr = OLE_CALL_ARGS(chain->pCapturePin, ConnectionMediaType, &old_mt); - - hr = S_OK; - } while(0); - - FreeMediaType(pmt); - CopyMediaType(pmt, &old_mt); - FreeMediaType(&old_mt); - return hr; -} - /** * \brief building in graph audio/video capture chain * -- cgit v1.2.3 From 9214b77133591ef363bd13eda0da68782244dd5d Mon Sep 17 00:00:00 2001 From: diego Date: Mon, 13 Oct 2008 15:51:29 +0000 Subject: Declare ThreadProc as void, it does not return anything, fixes the warning: stream/cache2.c:364: warning: control reaches end of non-void function git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27759 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/cache2.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'stream') diff --git a/stream/cache2.c b/stream/cache2.c index aff5a93a6f..37889acaa0 100644 --- a/stream/cache2.c +++ b/stream/cache2.c @@ -20,11 +20,9 @@ #include "osdep/timer.h" #ifdef WIN32 #include -static DWORD WINAPI ThreadProc(void* s); #elif defined(__OS2__) #define INCL_DOS #include -static void ThreadProc( void *s ); #else #include #endif @@ -37,6 +35,7 @@ extern int use_gui; int stream_fill_buffer(stream_t *s); int stream_seek_long(stream_t *s,off_t pos); +static void ThreadProc(void *s); typedef struct { // constats: @@ -362,12 +361,9 @@ int stream_enable_cache(stream_t *stream,int size,int min,int seek_limit){ #if defined(WIN32) || defined(__OS2__) } -#ifdef WIN32 -static DWORD WINAPI ThreadProc(void*s){ -#else // OS2 + static void ThreadProc( void *s ){ #endif -#endif #ifdef CONFIG_GUI use_gui = 0; // mp_msg may not use gui stuff in forked code -- cgit v1.2.3 From 4d644f513c841eaf4617edffb348338a798d37be Mon Sep 17 00:00:00 2001 From: diego Date: Mon, 13 Oct 2008 16:23:55 +0000 Subject: Replace preprocessor check for WIN32 with checks for __MINGW32__ and __CYGWIN__. This avoids a pointless indirection that only obscures what is really done. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27761 b3059339-0415-0410-9bf9-f77b7e298cf2 --- cfg-common-opts.h | 2 +- cfg-common.h | 4 ++-- configure | 2 +- cpudetect.c | 8 ++++---- get_path.c | 4 ++-- libaf/af_ladspa.c | 11 +++++------ libao2/ao_sdl.c | 2 +- libdvdread/dvd_reader.c | 5 +++-- libdvdread/libdvdread_changes.diff | 25 ++++++++++++++++++++++++- libvo/video_out.c | 2 +- mencoder.c | 10 +++++----- mplayer.c | 22 +++++++++++----------- stream/cache2.c | 20 ++++++++++---------- stream/stream_cddb.c | 8 ++++---- stream/stream_file.c | 2 +- stream/stream_vcd.c | 12 ++++++------ subreader.c | 2 +- vidix/dha.c | 2 +- vidix/nvidia_vid.c | 7 ++++--- 19 files changed, 87 insertions(+), 63 deletions(-) (limited to 'stream') diff --git a/cfg-common-opts.h b/cfg-common-opts.h index 6d6374de08..c067b5b4fb 100644 --- a/cfg-common-opts.h +++ b/cfg-common-opts.h @@ -15,7 +15,7 @@ {"msgcharset", &mp_msg_charset, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL}, #endif {"include", cfg_include, CONF_TYPE_FUNC_PARAM, CONF_NOSAVE, 0, 0, NULL}, -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) {"priority", &proc_priority, CONF_TYPE_STRING, 0, 0, 0, NULL}, #endif {"noconfig", noconfig_opts, CONF_TYPE_SUBCONFIG, CONF_GLOBAL|CONF_NOCFG|CONF_PRE_PARSE, 0, 0, NULL}, diff --git a/cfg-common.h b/cfg-common.h index 8257b47859..c69deb2cbf 100644 --- a/cfg-common.h +++ b/cfg-common.h @@ -349,7 +349,7 @@ const m_option_t msgl_config[]={ }; -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) struct { char* name; int prio; @@ -366,7 +366,7 @@ struct { { "idle", IDLE_PRIORITY_CLASS}, { NULL, NORMAL_PRIORITY_CLASS} /* default */ }; -#endif /* WIN32 */ +#endif /* defined(__MINGW32__) || defined(__CYGWIN__) */ extern const m_option_t noconfig_opts[]; diff --git a/configure b/configure index 5f65481827..be4c133c43 100755 --- a/configure +++ b/configure @@ -8227,7 +8227,7 @@ $_def_vcd #ifdef sun #define DEFAULT_CDROM_DEVICE "/vol/dev/aliases/cdrom0" #define DEFAULT_DVD_DEVICE DEFAULT_CDROM_DEVICE -#elif defined(WIN32) || defined(__OS2__) +#elif defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__) #define DEFAULT_CDROM_DEVICE "D:" #define DEFAULT_DVD_DEVICE DEFAULT_CDROM_DEVICE #elif defined(__APPLE__) || defined(__DARWIN__) diff --git a/cpudetect.c b/cpudetect.c index 8ec1adefaa..6d18212662 100644 --- a/cpudetect.c +++ b/cpudetect.c @@ -29,7 +29,7 @@ CpuCaps gCpuCaps; #include #endif -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) #include #endif @@ -314,7 +314,7 @@ static void sigill_handler_sse( int signal, struct sigcontext sc ) } #endif /* __linux__ && _POSIX_SOURCE */ -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) LONG CALLBACK win32_sig_handler_sse(EXCEPTION_POINTERS* ep) { if(ep->ExceptionRecord->ExceptionCode==EXCEPTION_ILLEGAL_INSTRUCTION){ @@ -325,7 +325,7 @@ LONG CALLBACK win32_sig_handler_sse(EXCEPTION_POINTERS* ep) } return EXCEPTION_CONTINUE_SEARCH; } -#endif /* WIN32 */ +#endif /* defined(__MINGW32__) || defined(__CYGWIN__) */ #ifdef __OS2__ ULONG _System os2_sig_handler_sse( PEXCEPTIONREPORTRECORD p1, @@ -395,7 +395,7 @@ static void check_os_katmai_support( void ) gCpuCaps.hasSSE = 0; mp_msg(MSGT_CPUDETECT,MSGL_WARN, "No OS support for SSE, disabling to be safe.\n" ); #endif -#elif defined(WIN32) +#elif defined(__MINGW32__) || defined(__CYGWIN__) LPTOP_LEVEL_EXCEPTION_FILTER exc_fil; if ( gCpuCaps.hasSSE ) { mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE... " ); diff --git a/get_path.c b/get_path.c index 16c93551c8..17520f2a2c 100644 --- a/get_path.c +++ b/get_path.c @@ -145,7 +145,7 @@ char *get_path(const char *filename){ return buff; } -#if defined(WIN32) && defined(CONFIG_WIN32DLL) +#if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_WIN32DLL) void set_path_env() { /*make our codec dirs available for LoadLibraryA()*/ @@ -181,4 +181,4 @@ void set_path_env() if (!SetEnvironmentVariableA("PATH", tmppath)) mp_msg(MSGT_WIN32, MSGL_WARN, "Cannot set PATH!"); } -#endif /*WIN32 && CONFIG_WIN32DLL*/ +#endif /* (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_WIN32DLL) */ diff --git a/libaf/af_ladspa.c b/libaf/af_ladspa.c index dadbc45548..97b8982503 100644 --- a/libaf/af_ladspa.c +++ b/libaf/af_ladspa.c @@ -296,16 +296,15 @@ static void* mydlopen(const char *filename, int flag) { size_t filenamelen; void *result = NULL; -# ifdef WIN32 /* for windows there's only absolute path support. - * if you have a windows machine, feel free to fix - * this. (path separator, shared objects extension, - * et cetera). - */ +#if defined(__MINGW32__) || defined(__CYGWIN__) + /* For Windows there's only absolute path support. + * If you have a Windows machine, feel free to fix this. + * (path separator, shared objects extension, et cetera). */ af_msg(AF_MSG_VERBOSE, "\ton windows, only absolute pathnames " "are supported\n"); af_msg(AF_MSG_VERBOSE, "\ttrying %s\n", filename); return dlopen(filename, flag); -# endif +#endif filenamelen = strlen(filename); diff --git a/libao2/ao_sdl.c b/libao2/ao_sdl.c index 292972514c..97a70d4adf 100644 --- a/libao2/ao_sdl.c +++ b/libao2/ao_sdl.c @@ -52,7 +52,7 @@ LIBAO_EXTERN(sdl) #undef USE_SDL_INTERNAL_MIXER // Samplesize used by the SDLlib AudioSpec struct -#if defined(WIN32) || defined(__AMIGAOS4__) +#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__AMIGAOS4__) #define SAMPLESIZE 2048 #else #define SAMPLESIZE 1024 diff --git a/libdvdread/dvd_reader.c b/libdvdread/dvd_reader.c index 49140544e4..6e75b27693 100644 --- a/libdvdread/dvd_reader.c +++ b/libdvdread/dvd_reader.c @@ -438,7 +438,7 @@ dvd_reader_t *DVDOpen( const char *path ) verbose = get_verbose(); -#ifdef WIN32 +#if defined(__CYGWIN__) || defined(__MINGW32__) /* Stat doesn't work on devices under mingwin/cygwin. */ if( path[0] && path[1] == ':' && path[2] == '\0' ) { @@ -495,7 +495,8 @@ dvd_reader_t *DVDOpen( const char *path ) /* XXX: We should scream real loud here. */ if( !(path_copy = strdup( path ) ) ) return 0; -#ifndef WIN32 /* don't have fchdir, and getcwd( NULL, ... ) is strange */ +/* don't have fchdir, and getcwd( NULL, ... ) is strange */ +#if !(defined(__CYGWIN__) || defined(__MINGW32__)) /* Resolve any symlinks and get the absolut dir name. */ { char *new_path; diff --git a/libdvdread/libdvdread_changes.diff b/libdvdread/libdvdread_changes.diff index f0177aa5e5..767e5a6bcb 100644 --- a/libdvdread/libdvdread_changes.diff +++ b/libdvdread/libdvdread_changes.diff @@ -42,6 +42,15 @@ /* Loop over all titles and call dvdcss_title to crack the keys. */ static int initAllCSSKeys( dvd_reader_t *dvd ) { +@@ -438,7 +438,7 @@ + + verbose = get_verbose(); + +-#ifdef WIN32 ++#if defined(__CYGWIN__) || defined(__MINGW32__) + /* Stat doesn't work on devices under mingwin/cygwin. */ + if( path[0] && path[1] == ':' && path[2] == '\0' ) + { @@ -494,7 +488,7 @@ char *path_copy; #if defined(SYS_BSD) @@ -51,7 +60,17 @@ FILE *mntfile; #endif -@@ -598,7 +592,7 @@ +@@ -495,7 +495,8 @@ + /* XXX: We should scream real loud here. */ + if( !(path_copy = strdup( path ) ) ) return 0; + +-#ifndef WIN32 /* don't have fchdir, and getcwd( NULL, ... ) is strange */ ++/* don't have fchdir, and getcwd( NULL, ... ) is strange */ ++#if !(defined(__CYGWIN__) || defined(__MINGW32__)) + /* Resolve any symlinks and get the absolut dir name. */ + { + char *new_path; +@@ -597,7 +592,7 @@ } fclose( mntfile ); } @@ -512,3 +531,7 @@ uint16_t next_pgc_nr; uint16_t prev_pgc_nr; uint16_t goup_pgc_nr; +Index: libdvdread/dvd_reader.c +=================================================================== +--- libdvdread/dvd_reader.c (revision 27759) ++++ libdvdread/dvd_reader.c (working copy) diff --git a/libvo/video_out.c b/libvo/video_out.c index 836f7adc1a..5e675042ae 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -214,7 +214,7 @@ const vo_functions_t* const video_out_drivers[] = #ifdef CONFIG_X11 &video_out_xvidix, #endif -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) &video_out_winvidix, #endif &video_out_cvidix, diff --git a/mencoder.c b/mencoder.c index 6ddf5e07e1..bc378673f2 100644 --- a/mencoder.c +++ b/mencoder.c @@ -30,7 +30,7 @@ #define SIGQUIT 3 #define SIGPIPE 13 #endif -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) #include #endif @@ -143,7 +143,7 @@ double cur_video_time_usage=0; double cur_vout_time_usage=0; int benchmark=0; -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) char * proc_priority=NULL; #endif @@ -456,9 +456,9 @@ user_correct_pts = 0; #endif #endif -#if defined(WIN32) && defined(CONFIG_WIN32DLL) +#if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_WIN32DLL) set_path_env(); -#endif /*WIN32 && CONFIG_WIN32DLL*/ +#endif InitTimer(); @@ -516,7 +516,7 @@ if (frameno_filename) { } } -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) if(proc_priority){ int i; for(i=0; priority_presets_defs[i].name; i++){ diff --git a/mplayer.c b/mplayer.c index 88ea3930f0..92f07fa0a7 100644 --- a/mplayer.c +++ b/mplayer.c @@ -6,7 +6,7 @@ #include #include "config.h" -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) #define _UWIN 1 /*disable Non-underscored versions of non-ANSI functions as otherwise int eof would conflict with eof()*/ #include #endif @@ -87,7 +87,7 @@ int player_idle_mode=0; int quiet=0; int enable_mouse_movements=0; -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) char * proc_priority=NULL; #endif @@ -688,7 +688,7 @@ void exit_player_with_rc(const char* how, int rc){ if (mpctx->user_muted && !mpctx->edl_muted) mixer_mute(&mpctx->mixer); uninit_player(INITIALIZED_ALL); -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) timeEndPeriod(1); #endif #ifdef CONFIG_X11 @@ -1207,7 +1207,7 @@ static void print_status(float a_pos, float a_v, float corr) width = screen_width; else width = 80; -#if defined(WIN32) || defined(__OS2__) +#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__) /* Windows command line is broken (MinGW's rxvt works, but we * should not depend on that). */ width--; @@ -2571,9 +2571,9 @@ int gui_no_filename=0; m_config_preparse_command_line(mconfig,argc,argv); print_version(); -#if defined(WIN32) && defined(CONFIG_WIN32DLL) +#if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_WIN32DLL) set_path_env(); -#endif /*WIN32 && CONFIG_WIN32DLL*/ +#endif #ifdef CONFIG_TV stream_tv_defaults.immediate = 1; @@ -2617,7 +2617,7 @@ int gui_no_filename=0; } } -#if defined(WIN32) && defined(CONFIG_GUI) +#if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_GUI) void *runningmplayer = FindWindow("MPlayer GUI for Windows", "MPlayer for Windows"); if(runningmplayer && filename && use_gui){ COPYDATASTRUCT csData; @@ -2632,7 +2632,7 @@ int gui_no_filename=0; } #endif -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) // request 1ms timer resolution timeBeginPeriod(1); if(proc_priority){ @@ -2652,7 +2652,7 @@ int gui_no_filename=0; use_gui=0; } #else -#ifndef WIN32 +#if !defined(__MINGW32__) && !defined(__CYGWIN__) if(use_gui && !vo_init()){ mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_GuiNeedsX); use_gui=0; @@ -3085,7 +3085,7 @@ if (edl_output_filename) { char *buf = strdup(filename), *psub; char *pdot = strrchr(buf, '.'); char *pslash = strrchr(buf, '/'); -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) if (!pslash) pslash = strrchr(buf, '\\'); #endif if (pdot && (!pslash || pdot > pslash)) @@ -3096,7 +3096,7 @@ if (edl_output_filename) { char *bname; int l; bname = strrchr(buf,'/'); -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) if(!bname) bname = strrchr(buf,'\\'); #endif if(bname) bname++; diff --git a/stream/cache2.c b/stream/cache2.c index 37889acaa0..dd2423d765 100644 --- a/stream/cache2.c +++ b/stream/cache2.c @@ -18,7 +18,7 @@ #include "osdep/shmem.h" #include "osdep/timer.h" -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) #include #elif defined(__OS2__) #define INCL_DOS @@ -239,7 +239,7 @@ static void cache_execute_control(cache_vars_t *s) { cache_vars_t* cache_init(int size,int sector){ int num; -#if !defined(WIN32) && !defined(__OS2__) +#if !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__OS2__) cache_vars_t* s=shmem_alloc(sizeof(cache_vars_t)); #else cache_vars_t* s=malloc(sizeof(cache_vars_t)); @@ -253,14 +253,14 @@ cache_vars_t* cache_init(int size,int sector){ }//32kb min_size s->buffer_size=num*sector; s->sector_size=sector; -#if !defined(WIN32) && !defined(__OS2__) +#if !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__OS2__) s->buffer=shmem_alloc(s->buffer_size); #else s->buffer=malloc(s->buffer_size); #endif if(s->buffer == NULL){ -#if !defined(WIN32) && !defined(__OS2__) +#if !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__OS2__) shmem_free(s,sizeof(cache_vars_t)); #else free(s); @@ -276,7 +276,7 @@ cache_vars_t* cache_init(int size,int sector){ void cache_uninit(stream_t *s) { cache_vars_t* c = s->cache_data; if(!s->cache_pid) return; -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) TerminateThread((HANDLE)s->cache_pid,0); #elif defined(__OS2__) DosKillThread( s->cache_pid ); @@ -286,7 +286,7 @@ void cache_uninit(stream_t *s) { waitpid(s->cache_pid,NULL,0); #endif if(!c) return; -#if defined(WIN32) || defined(__OS2__) +#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__) free(c->stream); free(c->buffer); free(s->cache_data); @@ -327,17 +327,17 @@ int stream_enable_cache(stream_t *stream,int size,int min,int seek_limit){ min = s->buffer_size - s->fill_limit; } -#if !defined(WIN32) && !defined(__OS2__) +#if !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__OS2__) if((stream->cache_pid=fork())){ #else { -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) DWORD threadId; #endif stream_t* stream2=malloc(sizeof(stream_t)); memcpy(stream2,s->stream,sizeof(stream_t)); s->stream=stream2; -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) stream->cache_pid = CreateThread(NULL,0,ThreadProc,s,0,&threadId); #else // OS2 stream->cache_pid = _beginthread( ThreadProc, NULL, 256 * 1024, s ); @@ -359,7 +359,7 @@ int stream_enable_cache(stream_t *stream,int size,int min,int seek_limit){ return 1; // parent exits } -#if defined(WIN32) || defined(__OS2__) +#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__) } static void ThreadProc( void *s ){ diff --git a/stream/stream_cddb.c b/stream/stream_cddb.c index 5236a4ca9c..4702f86d8c 100644 --- a/stream/stream_cddb.c +++ b/stream/stream_cddb.c @@ -22,7 +22,7 @@ #include #include #include -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) #ifdef __MINGW32__ #define mkdir(a,b) mkdir(a) #endif @@ -44,7 +44,7 @@ #include #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) #include -#elif defined(WIN32) +#elif defined(__MINGW32__) || defined(__CYGWIN__) #include #elif (__bsdi__) #include @@ -72,7 +72,7 @@ int read_toc(const char *dev) { int first = 0, last = -1; int i; -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) HANDLE drive; DWORD r; CDROM_TOC toc; @@ -326,7 +326,7 @@ cddb_read_cache(cddb_data_t *cddb_data) { sprintf( file_name, "%s%08lx", cddb_data->cache_dir, cddb_data->disc_id); file_fd = open(file_name, O_RDONLY -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) | O_BINARY #endif ); diff --git a/stream/stream_file.c b/stream/stream_file.c index 9b21d80d04..1abc2e1c9e 100644 --- a/stream/stream_file.c +++ b/stream/stream_file.c @@ -113,7 +113,7 @@ static int open_f(stream_t *stream,int mode, void* opts, int* file_format) { return STREAM_ERROR; } -#if defined(WIN32) || defined(__OS2__) +#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__) // extract '/' from '/x:/path' if( filename[ 0 ] == '/' && filename[ 1 ] && filename[ 2 ] == ':' ) filename++; diff --git a/stream/stream_vcd.c b/stream/stream_vcd.c index 4202a9786d..34844bcea9 100644 --- a/stream/stream_vcd.c +++ b/stream/stream_vcd.c @@ -1,7 +1,7 @@ #include "config.h" -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) #include #endif @@ -14,7 +14,7 @@ #include #include #include -#ifndef WIN32 +#if !defined(__MINGW32__) && !defined(__CYGWIN__) #include #endif #include @@ -23,7 +23,7 @@ #include "vcd_read_fbsd.h" #elif defined(__APPLE__) #include "vcd_read_darwin.h" -#elif defined(WIN32) +#elif defined(__MINGW32__) || defined(__CYGWIN__) #include "vcd_read_win32.h" #else #include "vcd_read.h" @@ -81,13 +81,13 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) int bsize = VCD_SECTOR_SIZE; #endif -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) HANDLE hd; char device[] = "\\\\.\\?:"; #endif if(mode != STREAM_READ -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) || GetVersion() > 0x80000000 // Win9x #endif ) { @@ -102,7 +102,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { p->device = strdup(DEFAULT_CDROM_DEVICE); } -#ifdef WIN32 +#if defined(__MINGW32__) || defined(__CYGWIN__) device[4] = p->device[0]; /* open() can't be used for devices so do it the complicated way */ hd = CreateFile(device, GENERIC_READ, FILE_SHARE_READ, NULL, diff --git a/subreader.c b/subreader.c index c64ff460cc..72e050380f 100644 --- a/subreader.c +++ b/subreader.c @@ -1836,7 +1836,7 @@ char** sub_filenames(const char* path, char *fname) subcnt = 0; tmp = strrchr(fname,'/'); -#if defined(WIN32) || defined(__OS2__) +#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__) if(!tmp)tmp = strrchr(fname,'\\'); if(!tmp)tmp = strrchr(fname,':'); #endif diff --git a/vidix/dha.c b/vidix/dha.c index 28dc8c8c09..638be29328 100644 --- a/vidix/dha.c +++ b/vidix/dha.c @@ -48,7 +48,7 @@ #endif #include -#if defined(WIN32) +#if defined(__MINGW32__) || defined(__CYGWIN__) #include "sysdep/libdha_win32.c" #elif defined (__EMX__) #include "sysdep/libdha_os2.c" diff --git a/vidix/nvidia_vid.c b/vidix/nvidia_vid.c index c53fa93d64..a045b397fe 100644 --- a/vidix/nvidia_vid.c +++ b/vidix/nvidia_vid.c @@ -614,13 +614,14 @@ static void rivatv_overlay_colorkey (rivatv_info* info, unsigned int chromakey){ switch (info->depth) { case 15: key = ((r >> 3) << 10) | ((g >> 3) << 5) | ((b >> 3)); -#ifndef WIN32 + +#if !defined(__MINGW32__) && !defined(__CYGWIN__) key = key | 0x00008000; #endif break; case 16: // XXX unchecked key = ((r >> 3) << 11) | ((g >> 2) << 5) | ((b >> 3)); -#ifndef WIN32 +#if !defined(__MINGW32__) && !defined(__CYGWIN__) key = key | 0x00008000; #endif break; @@ -629,7 +630,7 @@ static void rivatv_overlay_colorkey (rivatv_info* info, unsigned int chromakey){ break; case 32: key = chromakey; -#ifndef WIN32 +#if !defined(__MINGW32__) && !defined(__CYGWIN__) key = key | 0x80000000; #endif break; -- cgit v1.2.3 From 17f509905c0d005ca3283eafab850b78cc19968c Mon Sep 17 00:00:00 2001 From: diego Date: Thu, 16 Oct 2008 17:01:40 +0000 Subject: Rename stream/netstream.h to stream/stream_netstream.h; netstream.h to make it clearer that netstream.h belongs to stream_netstream.c. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27779 b3059339-0415-0410-9bf9-f77b7e298cf2 --- TOOLS/netstream.c | 2 +- stream/netstream.h | 151 ---------------------------------------------- stream/stream_netstream.c | 2 +- stream/stream_netstream.h | 151 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 153 insertions(+), 153 deletions(-) delete mode 100644 stream/netstream.h create mode 100644 stream/stream_netstream.h (limited to 'stream') diff --git a/TOOLS/netstream.c b/TOOLS/netstream.c index 4a44e9581a..8bc09b9a9d 100644 --- a/TOOLS/netstream.c +++ b/TOOLS/netstream.c @@ -44,7 +44,7 @@ #include "mpbswap.h" /// Netstream packets def and some helpers -#include "stream/netstream.h" +#include "stream/stream_netstream.h" // linking hacks char *info_name; diff --git a/stream/netstream.h b/stream/netstream.h deleted file mode 100644 index 533e6a3b93..0000000000 --- a/stream/netstream.h +++ /dev/null @@ -1,151 +0,0 @@ - -/* - * Common stuff for netstream - * Packets and so on are defined here along with a few helpers - * wich are used by both the client and the server - * - * Data is always low endian - */ - -#ifndef MPLAYER_NETSTREAM_H -#define MPLAYER_NETSTREAM_H - -#include -#include -#include -#include -#ifndef HAVE_WINSOCK2_H -#include -#endif -#include "mp_msg.h" -#include "mpbswap.h" - -typedef struct mp_net_stream_packet_st { - uint16_t len; - uint8_t cmd; - char data[0]; -} __attribute__ ((packed)) mp_net_stream_packet_t; - -#define PACKET_MAX_SIZE 4096 - -// Commands sent by the client -#define NET_STREAM_OPEN 0 -// data is the url -#define NET_STREAM_FILL_BUFFER 1 -// data is an uint16 wich is the max len of the data to return -#define NET_STREAM_SEEK 3 -// data is an uint64 wich the pos where to seek -#define NET_STREAM_CLOSE 4 -// no data -#define NET_STREAM_RESET 5 -// no data - -// Server response -#define NET_STREAM_OK 128 -// Data returned if open is successful -typedef struct mp_net_stream_opened_st { - uint32_t file_format; - uint32_t flags; - uint32_t sector_size; - uint64_t start_pos; - uint64_t end_pos; -} __attribute__ ((packed)) mp_net_stream_opened_t; -// FILL_BUFFER return the data -// CLOSE return nothing -#define NET_STREAM_ERROR 129 -// Data is the error message (if any ;) - -static int net_read(int fd, char* buf, int len) { - int r = 0; - while(len) { - r = recv(fd,buf,len,0); - if(r <= 0) { - if(errno == EINTR) continue; - if(r < 0) - mp_msg(MSGT_NETST,MSGL_ERR,"Read failed: %s\n",strerror(errno)); - return 0; - } - len -= r; - buf += r; - } - return 1; -} - -static mp_net_stream_packet_t* read_packet(int fd) { - uint16_t len; - mp_net_stream_packet_t* pack = - (mp_net_stream_packet_t*)malloc(sizeof(mp_net_stream_packet_t)); - - if(!net_read(fd,(char*)pack,sizeof(mp_net_stream_packet_t))) { - free(pack); - return NULL; - } - pack->len = le2me_16(pack->len); - - if(pack->len < sizeof(mp_net_stream_packet_t)) { - mp_msg(MSGT_NETST,MSGL_WARN,"Got invalid packet (too small: %d)\n",pack->len); - free(pack); - return NULL; - } - if(pack->len > PACKET_MAX_SIZE) { - mp_msg(MSGT_NETST,MSGL_WARN,"Got invalid packet (too big: %d)\n",pack->len); - free(pack); - return NULL; - } - len = pack->len; - if(len > sizeof(mp_net_stream_packet_t)) { - pack = realloc(pack,len); - if(!pack) { - mp_msg(MSGT_NETST,MSGL_ERR,"Failed to get memory for the packet (%d bytes)\n",len); - return NULL; - } - if(!net_read(fd,pack->data,len - sizeof(mp_net_stream_packet_t))) - return NULL; - } - // printf ("Read packet %d %d %d\n",fd,pack->cmd,pack->len); - return pack; -} - -static int net_write(int fd, char* buf, int len) { - int w; - while(len) { - w = send(fd,buf,len,0); - if(w <= 0) { - if(errno == EINTR) continue; - if(w < 0) - mp_msg(MSGT_NETST,MSGL_ERR,"Write failed: %s\n",strerror(errno)); - return 0; - } - len -= w; - buf += w; - } - return 1; -} - -static int write_packet(int fd, uint8_t cmd,char* data,int len) { - mp_net_stream_packet_t* pack = malloc(len + sizeof(mp_net_stream_packet_t)); - - if(len > 0 && data) - memcpy(pack->data,data,len); - pack->len = len + sizeof(mp_net_stream_packet_t); - pack->cmd = cmd; - - // printf("Write packet %d %d (%p) %d\n",fd,cmd,data,len); - pack->len = le2me_16(pack->len); - if(net_write(fd,(char*)pack,pack->len)) { - free(pack); - return 1; - } - free(pack); - return 0; -} - -static void net_stream_opened_2_me(mp_net_stream_opened_t* o) { - o->file_format = le2me_32(o->file_format); - o->flags = le2me_32(o->flags); - o->sector_size = le2me_32(o->sector_size); - o->start_pos = le2me_64(o->start_pos); - o->end_pos = le2me_64(o->end_pos); -} - -#endif /* MPLAYER_NETSTREAM_H */ diff --git a/stream/stream_netstream.c b/stream/stream_netstream.c index 5a3de1ce58..84e10a2c81 100644 --- a/stream/stream_netstream.c +++ b/stream/stream_netstream.c @@ -59,7 +59,7 @@ #include "mpbswap.h" #include "network.h" -#include "netstream.h" +#include "stream_netstream.h" #include "tcp.h" static struct stream_priv_s { diff --git a/stream/stream_netstream.h b/stream/stream_netstream.h new file mode 100644 index 0000000000..533e6a3b93 --- /dev/null +++ b/stream/stream_netstream.h @@ -0,0 +1,151 @@ + +/* + * Common stuff for netstream + * Packets and so on are defined here along with a few helpers + * wich are used by both the client and the server + * + * Data is always low endian + */ + +#ifndef MPLAYER_NETSTREAM_H +#define MPLAYER_NETSTREAM_H + +#include +#include +#include +#include +#ifndef HAVE_WINSOCK2_H +#include +#endif +#include "mp_msg.h" +#include "mpbswap.h" + +typedef struct mp_net_stream_packet_st { + uint16_t len; + uint8_t cmd; + char data[0]; +} __attribute__ ((packed)) mp_net_stream_packet_t; + +#define PACKET_MAX_SIZE 4096 + +// Commands sent by the client +#define NET_STREAM_OPEN 0 +// data is the url +#define NET_STREAM_FILL_BUFFER 1 +// data is an uint16 wich is the max len of the data to return +#define NET_STREAM_SEEK 3 +// data is an uint64 wich the pos where to seek +#define NET_STREAM_CLOSE 4 +// no data +#define NET_STREAM_RESET 5 +// no data + +// Server response +#define NET_STREAM_OK 128 +// Data returned if open is successful +typedef struct mp_net_stream_opened_st { + uint32_t file_format; + uint32_t flags; + uint32_t sector_size; + uint64_t start_pos; + uint64_t end_pos; +} __attribute__ ((packed)) mp_net_stream_opened_t; +// FILL_BUFFER return the data +// CLOSE return nothing +#define NET_STREAM_ERROR 129 +// Data is the error message (if any ;) + +static int net_read(int fd, char* buf, int len) { + int r = 0; + while(len) { + r = recv(fd,buf,len,0); + if(r <= 0) { + if(errno == EINTR) continue; + if(r < 0) + mp_msg(MSGT_NETST,MSGL_ERR,"Read failed: %s\n",strerror(errno)); + return 0; + } + len -= r; + buf += r; + } + return 1; +} + +static mp_net_stream_packet_t* read_packet(int fd) { + uint16_t len; + mp_net_stream_packet_t* pack = + (mp_net_stream_packet_t*)malloc(sizeof(mp_net_stream_packet_t)); + + if(!net_read(fd,(char*)pack,sizeof(mp_net_stream_packet_t))) { + free(pack); + return NULL; + } + pack->len = le2me_16(pack->len); + + if(pack->len < sizeof(mp_net_stream_packet_t)) { + mp_msg(MSGT_NETST,MSGL_WARN,"Got invalid packet (too small: %d)\n",pack->len); + free(pack); + return NULL; + } + if(pack->len > PACKET_MAX_SIZE) { + mp_msg(MSGT_NETST,MSGL_WARN,"Got invalid packet (too big: %d)\n",pack->len); + free(pack); + return NULL; + } + len = pack->len; + if(len > sizeof(mp_net_stream_packet_t)) { + pack = realloc(pack,len); + if(!pack) { + mp_msg(MSGT_NETST,MSGL_ERR,"Failed to get memory for the packet (%d bytes)\n",len); + return NULL; + } + if(!net_read(fd,pack->data,len - sizeof(mp_net_stream_packet_t))) + return NULL; + } + // printf ("Read packet %d %d %d\n",fd,pack->cmd,pack->len); + return pack; +} + +static int net_write(int fd, char* buf, int len) { + int w; + while(len) { + w = send(fd,buf,len,0); + if(w <= 0) { + if(errno == EINTR) continue; + if(w < 0) + mp_msg(MSGT_NETST,MSGL_ERR,"Write failed: %s\n",strerror(errno)); + return 0; + } + len -= w; + buf += w; + } + return 1; +} + +static int write_packet(int fd, uint8_t cmd,char* data,int len) { + mp_net_stream_packet_t* pack = malloc(len + sizeof(mp_net_stream_packet_t)); + + if(len > 0 && data) + memcpy(pack->data,data,len); + pack->len = len + sizeof(mp_net_stream_packet_t); + pack->cmd = cmd; + + // printf("Write packet %d %d (%p) %d\n",fd,cmd,data,len); + pack->len = le2me_16(pack->len); + if(net_write(fd,(char*)pack,pack->len)) { + free(pack); + return 1; + } + free(pack); + return 0; +} + +static void net_stream_opened_2_me(mp_net_stream_opened_t* o) { + o->file_format = le2me_32(o->file_format); + o->flags = le2me_32(o->flags); + o->sector_size = le2me_32(o->sector_size); + o->start_pos = le2me_64(o->start_pos); + o->end_pos = le2me_64(o->end_pos); +} + +#endif /* MPLAYER_NETSTREAM_H */ -- cgit v1.2.3 From 629db77d89d6bdead91fd18faa6445632a750e94 Mon Sep 17 00:00:00 2001 From: diego Date: Thu, 16 Oct 2008 18:28:38 +0000 Subject: Move DEFAULT_CDROM_DEVICE/DEFAULT_DVD_DEVICE to stream.h where it belongs. config.h should only contain option definitions, no logic. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27787 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 27 --------------------------- stream/stream.h | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 27 deletions(-) (limited to 'stream') diff --git a/configure b/configure index 1448ae024a..20d0e74657 100755 --- a/configure +++ b/configure @@ -8204,33 +8204,6 @@ $_def_dvdnav $_def_vcd -#ifdef __sun -#define DEFAULT_CDROM_DEVICE "/vol/dev/aliases/cdrom0" -#define DEFAULT_DVD_DEVICE DEFAULT_CDROM_DEVICE -#elif defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__) -#define DEFAULT_CDROM_DEVICE "D:" -#define DEFAULT_DVD_DEVICE DEFAULT_CDROM_DEVICE -#elif defined(__APPLE__) || defined(__DARWIN__) -#define DEFAULT_CDROM_DEVICE "/dev/disk1" -#define DEFAULT_DVD_DEVICE "/dev/rdiskN" -#elif defined(__OpenBSD__) -#define DEFAULT_CDROM_DEVICE "/dev/rcd0a" -#define DEFAULT_DVD_DEVICE DEFAULT_CDROM_DEVICE -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -#define DEFAULT_CDROM_DEVICE "/dev/acd0" -#define DEFAULT_DVD_DEVICE DEFAULT_CDROM_DEVICE -#elif defined(__DragonFly__) -#define DEFAULT_CDROM_DEVICE "/dev/cd0" -#define DEFAULT_DVD_DEVICE DEFAULT_CDROM_DEVICE -#elif defined(__AMIGAOS4__) -#define DEFAULT_CDROM_DEVICE "a1ide.device:2" -#define DEFAULT_DVD_DEVICE DEFAULT_CDROM_DEVICE -#else -#define DEFAULT_CDROM_DEVICE "/dev/cdrom" -#define DEFAULT_DVD_DEVICE "/dev/dvd" -#endif - - /* define this to use iconv(3) function to codepage conversions */ $_def_iconv diff --git a/stream/stream.h b/stream/stream.h index 4e872195a5..4eab9b5d85 100644 --- a/stream/stream.h +++ b/stream/stream.h @@ -65,6 +65,33 @@ #define STREAM_CTRL_GET_ANGLE 10 #define STREAM_CTRL_SET_ANGLE 11 +#ifdef __sun +#define DEFAULT_CDROM_DEVICE "/vol/dev/aliases/cdrom0" +#define DEFAULT_DVD_DEVICE DEFAULT_CDROM_DEVICE +#elif defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__) +#define DEFAULT_CDROM_DEVICE "D:" +#define DEFAULT_DVD_DEVICE DEFAULT_CDROM_DEVICE +#elif defined(__APPLE__) || defined(__DARWIN__) +#define DEFAULT_CDROM_DEVICE "/dev/disk1" +#define DEFAULT_DVD_DEVICE "/dev/rdiskN" +#elif defined(__OpenBSD__) +#define DEFAULT_CDROM_DEVICE "/dev/rcd0a" +#define DEFAULT_DVD_DEVICE DEFAULT_CDROM_DEVICE +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#define DEFAULT_CDROM_DEVICE "/dev/acd0" +#define DEFAULT_DVD_DEVICE DEFAULT_CDROM_DEVICE +#elif defined(__DragonFly__) +#define DEFAULT_CDROM_DEVICE "/dev/cd0" +#define DEFAULT_DVD_DEVICE DEFAULT_CDROM_DEVICE +#elif defined(__AMIGAOS4__) +#define DEFAULT_CDROM_DEVICE "a1ide.device:2" +#define DEFAULT_DVD_DEVICE DEFAULT_CDROM_DEVICE +#else +#define DEFAULT_CDROM_DEVICE "/dev/cdrom" +#define DEFAULT_DVD_DEVICE "/dev/dvd" +#endif + + #ifdef CONFIG_NETWORK #include "network.h" #endif -- cgit v1.2.3 From 2195547220674940ef20e9ea38bb3610541d04b3 Mon Sep 17 00:00:00 2001 From: diego Date: Thu, 16 Oct 2008 19:24:21 +0000 Subject: Revert declaring ThreadProc as void, it breaks the WINAPI. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27790 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/cache2.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'stream') diff --git a/stream/cache2.c b/stream/cache2.c index dd2423d765..7decd32d01 100644 --- a/stream/cache2.c +++ b/stream/cache2.c @@ -20,9 +20,11 @@ #include "osdep/timer.h" #if defined(__MINGW32__) || defined(__CYGWIN__) #include +static DWORD WINAPI ThreadProc(void* s); #elif defined(__OS2__) #define INCL_DOS #include +static void ThreadProc( void *s ); #else #include #endif @@ -35,7 +37,6 @@ extern int use_gui; int stream_fill_buffer(stream_t *s); int stream_seek_long(stream_t *s,off_t pos); -static void ThreadProc(void *s); typedef struct { // constats: @@ -361,9 +362,12 @@ int stream_enable_cache(stream_t *stream,int size,int min,int seek_limit){ #if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__) } - +#if defined(__MINGW32__) || defined(__CYGWIN__) +static DWORD WINAPI ThreadProc(void*s){ +#else // OS2 static void ThreadProc( void *s ){ #endif +#endif #ifdef CONFIG_GUI use_gui = 0; // mp_msg may not use gui stuff in forked code -- cgit v1.2.3 From 834d4c5b7b9a2c0344445cfb1719e37838ea5844 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 19 Oct 2008 17:28:23 +0000 Subject: Remove useless casts. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27803 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/cache2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'stream') diff --git a/stream/cache2.c b/stream/cache2.c index 7decd32d01..b7326b4832 100644 --- a/stream/cache2.c +++ b/stream/cache2.c @@ -375,10 +375,10 @@ static void ThreadProc( void *s ){ // cache thread mainloop: signal(SIGTERM,exit_sighandler); // kill while(1){ - if(!cache_fill((cache_vars_t*)s)){ + if(!cache_fill(s)){ usec_sleep(FILL_USLEEP_TIME); // idle } - cache_execute_control((cache_vars_t*)s); + cache_execute_control(s); // cache_stats(s->cache_data); } } -- cgit v1.2.3 From 3d1f36e3e704a830d6a4048a46367f5ee72f8747 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 19 Oct 2008 18:05:45 +0000 Subject: Avoid CreateThread and especially TerminateThread since they cause a memleak. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27804 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/cache2.c | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) (limited to 'stream') diff --git a/stream/cache2.c b/stream/cache2.c index b7326b4832..aa06bc1b51 100644 --- a/stream/cache2.c +++ b/stream/cache2.c @@ -20,7 +20,7 @@ #include "osdep/timer.h" #if defined(__MINGW32__) || defined(__CYGWIN__) #include -static DWORD WINAPI ThreadProc(void* s); +static void ThreadProc( void *s ); #elif defined(__OS2__) #define INCL_DOS #include @@ -198,14 +198,15 @@ int cache_fill(cache_vars_t* s){ } -static void cache_execute_control(cache_vars_t *s) { +static int cache_execute_control(cache_vars_t *s) { + int res = 1; static unsigned last; if (!s->stream->control) { s->stream_time_length = 0; s->control_new_pos = 0; s->control_res = STREAM_UNSUPPORTED; s->control = -1; - return; + return res; } if (GetTimerMS() - last > 99) { double len; @@ -215,7 +216,7 @@ static void cache_execute_control(cache_vars_t *s) { s->stream_time_length = 0; last = GetTimerMS(); } - if (s->control == -1) return; + if (s->control == -1) return res; switch (s->control) { case STREAM_CTRL_GET_CURRENT_TIME: case STREAM_CTRL_SEEK_TO_TIME: @@ -230,12 +231,15 @@ static void cache_execute_control(cache_vars_t *s) { case STREAM_CTRL_SET_ANGLE: s->control_res = s->stream->control(s->stream, s->control, &s->control_uint_arg); break; + case -2: + res = 0; default: s->control_res = STREAM_UNSUPPORTED; break; } s->control_new_pos = s->stream->pos; s->control = -1; + return res; } cache_vars_t* cache_init(int size,int sector){ @@ -277,11 +281,8 @@ cache_vars_t* cache_init(int size,int sector){ void cache_uninit(stream_t *s) { cache_vars_t* c = s->cache_data; if(!s->cache_pid) return; -#if defined(__MINGW32__) || defined(__CYGWIN__) - TerminateThread((HANDLE)s->cache_pid,0); -#elif defined(__OS2__) - DosKillThread( s->cache_pid ); - DosWaitThread( &s->cache_pid, DCWW_WAIT ); +#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__) + cache_do_control(s, -2, NULL); #else kill(s->cache_pid,SIGKILL); waitpid(s->cache_pid,NULL,0); @@ -332,15 +333,12 @@ int stream_enable_cache(stream_t *stream,int size,int min,int seek_limit){ if((stream->cache_pid=fork())){ #else { -#if defined(__MINGW32__) || defined(__CYGWIN__) - DWORD threadId; -#endif stream_t* stream2=malloc(sizeof(stream_t)); memcpy(stream2,s->stream,sizeof(stream_t)); s->stream=stream2; #if defined(__MINGW32__) || defined(__CYGWIN__) - stream->cache_pid = CreateThread(NULL,0,ThreadProc,s,0,&threadId); -#else // OS2 + stream->cache_pid = _beginthread( ThreadProc, 0, s ); +#else stream->cache_pid = _beginthread( ThreadProc, NULL, 256 * 1024, s ); #endif #endif @@ -362,25 +360,23 @@ int stream_enable_cache(stream_t *stream,int size,int min,int seek_limit){ #if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__) } -#if defined(__MINGW32__) || defined(__CYGWIN__) -static DWORD WINAPI ThreadProc(void*s){ -#else // OS2 static void ThreadProc( void *s ){ #endif -#endif #ifdef CONFIG_GUI use_gui = 0; // mp_msg may not use gui stuff in forked code #endif // cache thread mainloop: signal(SIGTERM,exit_sighandler); // kill - while(1){ + do { if(!cache_fill(s)){ usec_sleep(FILL_USLEEP_TIME); // idle } - cache_execute_control(s); // cache_stats(s->cache_data); - } + } while (cache_execute_control(s)); +#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__) + _endthread(); +#endif } int cache_stream_fill_buffer(stream_t *s){ @@ -455,6 +451,7 @@ int cache_do_control(stream_t *stream, int cmd, void *arg) { case STREAM_CTRL_GET_ASPECT_RATIO: case STREAM_CTRL_GET_NUM_ANGLES: case STREAM_CTRL_GET_ANGLE: + case -2: s->control = cmd; break; default: -- cgit v1.2.3 From 6f6bf7f765c8eb182da524983790e5ae0b60643b Mon Sep 17 00:00:00 2001 From: diego Date: Mon, 20 Oct 2008 09:55:38 +0000 Subject: Replace typeof by __typeof__, the former is a non-portable GNU extension. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27807 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/stream_dvd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'stream') diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c index b28cb874b7..ec0b7983c8 100644 --- a/stream/stream_dvd.c +++ b/stream/stream_dvd.c @@ -398,7 +398,7 @@ read_next: // See also gcc problem report PR c/7847: // http://gcc.gnu.org/cgi-bin/gnatsweb.pl?database=gcc&cmd=view+audit-trail&pr=7847 for(i=0;i<9;i++) { // check if all values zero: - typeof(d->dsi_pack.sml_agli.data[i].address) tmp_addr; + __typeof__(d->dsi_pack.sml_agli.data[i].address) tmp_addr; memcpy(&tmp_addr,&d->dsi_pack.sml_agli.data[i].address,sizeof(tmp_addr)); if((skip=tmp_addr)!=0) break; } -- cgit v1.2.3 From ed0af8844ae1a89b758ff30f588cfef20c598efc Mon Sep 17 00:00:00 2001 From: diego Date: Tue, 21 Oct 2008 07:02:25 +0000 Subject: Determine default CD/DVD device in configure instead of using an #ifdef jungle. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27809 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 30 ++++++++++++++++++++++++++++++ stream/stream.h | 26 -------------------------- 2 files changed, 30 insertions(+), 26 deletions(-) (limited to 'stream') diff --git a/configure b/configure index bbd26dc69d..1674447fb5 100755 --- a/configure +++ b/configure @@ -5372,6 +5372,34 @@ echores "$_sgiaudio" fi #if irix +# set default CD/DVD devices +if win32 || os2 ; then + default_cdrom_device="D:" +elif darwin ; then + default_cdrom_device="/dev/disk1" +elif dragonfly ; then + default_cdrom_device="/dev/cd0" +elif freebsd ; then + default_cdrom_device="/dev/acd0" +elif openbsd ; then + default_cdrom_device="/dev/rcd0a" +elif sunos ; then + default_cdrom_device="/vol/dev/aliases/cdrom0" +elif amigaos ; then + default_cdrom_device="a1ide.device:2" +else + default_cdrom_device="/dev/cdrom" +fi + +if win32 || os2 || dragonfly || freebsd || openbsd || sunos || amigaos ; then + default_dvd_device=$default_cdrom_device +elif darwin ; then + default_dvd_device="/dev/rdiskN" +else + default_dvd_device="/dev/dvd" +fi + + echocheck "VCD support" if linux || freebsd || netbsd || dragonfly || bsdos || darwin || sunos || mingw32; then _inputmodules="vcd $_inputmodules" @@ -8127,6 +8155,8 @@ $_def_words_endian /* DVD/VCD/CD */ +#define DEFAULT_CDROM_DEVICE "$default_cdrom_device" +#define DEFAULT_DVD_DEVICE "$default_dvd_device" $_def_bsdi_dvd $_def_cddb $_def_cdio diff --git a/stream/stream.h b/stream/stream.h index 4eab9b5d85..686288071f 100644 --- a/stream/stream.h +++ b/stream/stream.h @@ -65,32 +65,6 @@ #define STREAM_CTRL_GET_ANGLE 10 #define STREAM_CTRL_SET_ANGLE 11 -#ifdef __sun -#define DEFAULT_CDROM_DEVICE "/vol/dev/aliases/cdrom0" -#define DEFAULT_DVD_DEVICE DEFAULT_CDROM_DEVICE -#elif defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__) -#define DEFAULT_CDROM_DEVICE "D:" -#define DEFAULT_DVD_DEVICE DEFAULT_CDROM_DEVICE -#elif defined(__APPLE__) || defined(__DARWIN__) -#define DEFAULT_CDROM_DEVICE "/dev/disk1" -#define DEFAULT_DVD_DEVICE "/dev/rdiskN" -#elif defined(__OpenBSD__) -#define DEFAULT_CDROM_DEVICE "/dev/rcd0a" -#define DEFAULT_DVD_DEVICE DEFAULT_CDROM_DEVICE -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -#define DEFAULT_CDROM_DEVICE "/dev/acd0" -#define DEFAULT_DVD_DEVICE DEFAULT_CDROM_DEVICE -#elif defined(__DragonFly__) -#define DEFAULT_CDROM_DEVICE "/dev/cd0" -#define DEFAULT_DVD_DEVICE DEFAULT_CDROM_DEVICE -#elif defined(__AMIGAOS4__) -#define DEFAULT_CDROM_DEVICE "a1ide.device:2" -#define DEFAULT_DVD_DEVICE DEFAULT_CDROM_DEVICE -#else -#define DEFAULT_CDROM_DEVICE "/dev/cdrom" -#define DEFAULT_DVD_DEVICE "/dev/dvd" -#endif - #ifdef CONFIG_NETWORK #include "network.h" -- cgit v1.2.3 From c0f231ac477aa6ee55526e6401ed114026473980 Mon Sep 17 00:00:00 2001 From: diego Date: Fri, 24 Oct 2008 09:13:04 +0000 Subject: Conditionally declare a conditionally used variable, fixes the warning: stream/dvb_tune.c:99: warning: unused variable 'sec_dev' git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27820 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/dvb_tune.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'stream') diff --git a/stream/dvb_tune.c b/stream/dvb_tune.c index 64a2b0fb0a..b42d69d17e 100644 --- a/stream/dvb_tune.c +++ b/stream/dvb_tune.c @@ -96,7 +96,10 @@ int dvb_set_ts_filt(int fd, uint16_t pid, dmx_pes_type_t pestype); int dvb_open_devices(dvb_priv_t *priv, int n, int demux_cnt) { int i; - char frontend_dev[32], dvr_dev[32], demux_dev[32], sec_dev[32]; + char frontend_dev[32], dvr_dev[32], demux_dev[32]; +#ifndef CONFIG_DVB_HEAD + char sec_dev[32]; +#endif #ifdef CONFIG_DVB_HEAD sprintf(frontend_dev, "/dev/dvb/adapter%d/frontend0", n); -- cgit v1.2.3