aboutsummaryrefslogtreecommitdiffhomepage
path: root/libmpdemux
diff options
context:
space:
mode:
authorGravatar arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-09-08 23:00:01 +0000
committerGravatar arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-09-08 23:00:01 +0000
commitcd8540ab8cdc8cb314c7ca3ac9107b65577e0fcf (patch)
treebea6b35ad9d4c60b6a6516e554a35baa53771bc4 /libmpdemux
parent095a1cad2d136cd5e0e7eec7c8e012e1cfdfe766 (diff)
removed messy global 'tv_handle', use stream->priv for that purpose
note: i couldn't test it (only compile test) may be broken :( we're going to an unified demuxer API - required for modularization git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7330 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/demuxer.c17
-rw-r--r--libmpdemux/open.c5
-rw-r--r--libmpdemux/stream.h2
-rw-r--r--libmpdemux/tv.c16
4 files changed, 23 insertions, 17 deletions
diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c
index 22588cb115..4aa929f948 100644
--- a/libmpdemux/demuxer.c
+++ b/libmpdemux/demuxer.c
@@ -157,13 +157,12 @@ extern void demux_close_rawdv(demuxer_t* demuxer);
#ifdef USE_TV
#include "tv.h"
-extern tvi_handle_t *tv_handler;
extern int tv_param_on;
-extern int demux_tv_fill_buffer(demuxer_t *demux, demux_stream_t *ds, tvi_handle_t *tvh);
-extern int demux_open_tv(demuxer_t *demuxer, tvi_handle_t *tvh);
+extern int demux_tv_fill_buffer(demuxer_t *demux, demux_stream_t *ds);
+extern int demux_open_tv(demuxer_t *demuxer);
#if defined(USE_TV) && defined(HAVE_TV_V4L)
-extern void demux_close_tv(demuxer_t *demuxer, tvi_handle_t *tvh);
+extern void demux_close_tv(demuxer_t *demuxer);
#endif
#endif
@@ -191,7 +190,7 @@ void free_demuxer(demuxer_t *demuxer){
demux_close_nuv(demuxer); break;
#if defined(USE_TV) && defined(HAVE_TV_V4L)
case DEMUXER_TYPE_TV:
- demux_close_tv(demuxer, tv_handler); break;
+ demux_close_tv(demuxer); break;
#endif
#ifdef HAVE_LIBDV095
case DEMUXER_TYPE_RAWDV:
@@ -312,7 +311,7 @@ int demux_fill_buffer(demuxer_t *demux,demux_stream_t *ds){
case DEMUXER_TYPE_REAL: return demux_real_fill_buffer(demux);
case DEMUXER_TYPE_NUV: return demux_nuv_fill_buffer(demux);
#ifdef USE_TV
- case DEMUXER_TYPE_TV: return demux_tv_fill_buffer(demux, ds, tv_handler);
+ case DEMUXER_TYPE_TV: return demux_tv_fill_buffer(demux, ds);
#endif
case DEMUXER_TYPE_Y4M: return demux_y4m_fill_buffer(demux);
case DEMUXER_TYPE_AUDIO: return demux_audio_fill_buffer(ds);
@@ -994,11 +993,7 @@ switch(file_format){
}
#ifdef USE_TV
case DEMUXER_TYPE_TV: {
- if (!demux_open_tv(demuxer, tv_handler))
- {
- tv_uninit(tv_handler);
- return(NULL);
- }
+ if (!demux_open_tv(demuxer)) return(NULL);
break;
}
#endif
diff --git a/libmpdemux/open.c b/libmpdemux/open.c
index 5b3bf25d14..de9a35ce71 100644
--- a/libmpdemux/open.c
+++ b/libmpdemux/open.c
@@ -68,7 +68,6 @@ extern int vcd_get_track_end(int fd,int track);
#ifdef USE_TV
#include "tv.h"
-tvi_handle_t *tv_handler;
extern int stream_open_tv(stream_t *stream, tvi_handle_t *tvh);
#endif
@@ -401,6 +400,8 @@ if(dvd_title){
//============ Check for TV-input ====
if (tv_param_on == 1)
{
+ tvi_handle_t *tv_handler;
+
/* create stream */
stream = new_stream(-1, STREAMTYPE_TV);
if (!stream)
@@ -417,6 +418,8 @@ if(dvd_title){
if (!stream_open_tv(stream, tv_handler))
goto tv_err;
+
+ stream->priv=tv_handler;
return(stream);
diff --git a/libmpdemux/stream.h b/libmpdemux/stream.h
index b1fe824c77..03ceba1112 100644
--- a/libmpdemux/stream.h
+++ b/libmpdemux/stream.h
@@ -42,7 +42,7 @@ typedef struct {
int eof;
unsigned int cache_pid;
void* cache_data;
- void* priv; // used for DVD
+ void* priv; // used for DVD, TV, RTSP etc
unsigned char buffer[STREAM_BUFFER_SIZE>VCD_SECTOR_SIZE?STREAM_BUFFER_SIZE:VCD_SECTOR_SIZE];
#ifdef STREAMING
streaming_ctrl_t *streaming_ctrl;
diff --git a/libmpdemux/tv.c b/libmpdemux/tv.c
index a3abb1cd1a..321aba8ff1 100644
--- a/libmpdemux/tv.c
+++ b/libmpdemux/tv.c
@@ -73,8 +73,9 @@ char* tv_param_adevice = NULL;
*/
/* fill demux->video and demux->audio */
-int demux_tv_fill_buffer(demuxer_t *demux, demux_stream_t *ds, tvi_handle_t *tvh)
+int demux_tv_fill_buffer(demuxer_t *demux, demux_stream_t *ds)
{
+ tvi_handle_t *tvh=(tvi_handle_t*)(demux->stream->priv);
demux_packet_t* dp;
sh_video_t *sh_video = demux->video->sh;
@@ -254,8 +255,9 @@ done:
return 1;
}
-int demux_open_tv(demuxer_t *demuxer, tvi_handle_t *tvh)
+int demux_open_tv(demuxer_t *demuxer)
{
+ tvi_handle_t *tvh=(tvi_handle_t*)(demuxer->stream->priv);
sh_video_t *sh_video = NULL;
sh_audio_t *sh_audio = NULL;
tvi_functions_t *funcs = tvh->functions;
@@ -374,12 +376,18 @@ int demux_open_tv(demuxer_t *demuxer, tvi_handle_t *tvh)
}
no_audio:
- return(funcs->start(tvh->priv));
+ if(!(funcs->start(tvh->priv))){
+ // start failed :(
+ tv_uninit(tvh);
+ return 0;
+ }
+ return 1;
}
#if defined(USE_TV) && defined(HAVE_TV_V4L)
-int demux_close_tv(demuxer_t *demuxer, tvi_handle_t *tvh)
+int demux_close_tv(demuxer_t *demuxer)
{
+ tvi_handle_t *tvh=(tvi_handle_t*)(demuxer->stream->priv);
return(tvh->functions->uninit(tvh->priv));
}
#endif