aboutsummaryrefslogtreecommitdiffhomepage
path: root/stream
diff options
context:
space:
mode:
authorGravatar Uoti Urpala <uau@glyph.nonexistent.invalid>2008-10-25 05:12:34 +0300
committerGravatar Uoti Urpala <uau@glyph.nonexistent.invalid>2008-10-25 05:12:34 +0300
commit030130942562bb7b84eeba53e0226abed5a63a4c (patch)
tree9b49208facf2801369c9d2d7b3e7af11fab36829 /stream
parent562d86d95cbba67cb58358f6fc334553a467dee7 (diff)
parent15a80092161a1cd305f8005c780c744416a5252b (diff)
Merge svn changes up to 27824
Conflicts: cfg-common-opts.h libmpcodecs/dec_video.c libmpcodecs/vd.c libvo/x11_common.h mplayer.c stream/cache2.c
Diffstat (limited to 'stream')
-rw-r--r--stream/cache2.c59
-rw-r--r--stream/dvb_tune.c5
-rw-r--r--stream/librtsp/rtsp_rtp.c1
-rw-r--r--stream/network.h3
-rw-r--r--stream/stream.h1
-rw-r--r--stream/stream_cddb.c8
-rw-r--r--stream/stream_dvd.c2
-rw-r--r--stream/stream_file.c2
-rw-r--r--stream/stream_netstream.c2
-rw-r--r--stream/stream_netstream.h (renamed from stream/netstream.h)0
-rw-r--r--stream/stream_vcd.c12
-rw-r--r--stream/tvi_dshow.c46
12 files changed, 50 insertions, 91 deletions
diff --git a/stream/cache2.c b/stream/cache2.c
index 59d6e0aacb..209b2bdfd5 100644
--- a/stream/cache2.c
+++ b/stream/cache2.c
@@ -17,17 +17,17 @@
#include <unistd.h>
#include "cache2.h"
+#include "osdep/shmem.h"
#include "osdep/timer.h"
-#ifdef WIN32
+#if defined(__MINGW32__) || defined(__CYGWIN__)
#include <windows.h>
-static DWORD WINAPI ThreadProc(void* s);
+static void ThreadProc( void *s );
#elif defined(__OS2__)
#define INCL_DOS
#include <os2.h>
static void ThreadProc( void *s );
#else
#include <sys/wait.h>
-#include "osdep/shmem.h"
#endif
#include "mp_msg.h"
@@ -196,14 +196,15 @@ static 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;
@@ -213,7 +214,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:
@@ -228,17 +229,20 @@ 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;
}
static 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));
@@ -252,14 +256,14 @@ static 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);
@@ -275,17 +279,14 @@ static 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
- 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);
#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);
@@ -326,19 +327,16 @@ 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
- DWORD threadId;
-#endif
stream_t* stream2=malloc(sizeof(stream_t));
memcpy(stream2,s->stream,sizeof(stream_t));
s->stream=stream2;
-#ifdef WIN32
- stream->cache_pid = CreateThread(NULL,0,ThreadProc,s,0,&threadId);
-#else // OS2
+#if defined(__MINGW32__) || defined(__CYGWIN__)
+ stream->cache_pid = _beginthread( ThreadProc, 0, s );
+#else
stream->cache_pid = _beginthread( ThreadProc, NULL, 256 * 1024, s );
#endif
#endif
@@ -358,27 +356,25 @@ 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__)
}
-#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
#endif
// cache thread mainloop:
signal(SIGTERM,exit_sighandler); // kill
- while(1){
- if(!cache_fill((cache_vars_t*)s)){
+ do {
+ if(!cache_fill(s)){
usec_sleep(FILL_USLEEP_TIME); // idle
}
- cache_execute_control((cache_vars_t*)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){
@@ -453,6 +449,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:
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);
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 1f06a5ca14..2f8d4123ab 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
diff --git a/stream/stream.h b/stream/stream.h
index 9b598418ef..87cda3637a 100644
--- a/stream/stream.h
+++ b/stream/stream.h
@@ -65,6 +65,7 @@
#define STREAM_CTRL_GET_ANGLE 10
#define STREAM_CTRL_SET_ANGLE 11
+
#ifdef CONFIG_NETWORK
#include "network.h"
#endif
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 <unistd.h>
#include <string.h>
#include <limits.h>
-#ifdef WIN32
+#if defined(__MINGW32__) || defined(__CYGWIN__)
#ifdef __MINGW32__
#define mkdir(a,b) mkdir(a)
#endif
@@ -44,7 +44,7 @@
#include <linux/cdrom.h>
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
#include <sys/cdio.h>
-#elif defined(WIN32)
+#elif defined(__MINGW32__) || defined(__CYGWIN__)
#include <ddk/ntddcdrm.h>
#elif (__bsdi__)
#include <dvd.h>
@@ -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_dvd.c b/stream/stream_dvd.c
index 7df1040d7e..20cc8431f0 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;
}
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_netstream.c b/stream/stream_netstream.c
index f9c70e72ba..5c68defe73 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/netstream.h b/stream/stream_netstream.h
index 533e6a3b93..533e6a3b93 100644
--- a/stream/netstream.h
+++ b/stream/stream_netstream.h
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 <windows.h>
#endif
@@ -14,7 +14,7 @@
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
-#ifndef WIN32
+#if !defined(__MINGW32__) && !defined(__CYGWIN__)
#include <sys/ioctl.h>
#endif
#include <errno.h>
@@ -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/stream/tvi_dshow.c b/stream/tvi_dshow.c
index 726f469098..e06f4dc346 100644
--- a/stream/tvi_dshow.c
+++ b/stream/tvi_dshow.c
@@ -1299,52 +1299,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
*
* \param priv driver's private data