[Mplayer-cvslog] CVS: main/libmpdemux demuxer.c,1.109,1.110 open.c,1.53,1.54 stream.h,1.46,1.47 tv.c,1.31,1.32

Arpi of Ize arpi at mplayerhq.hu
Mon Sep 9 01:00:04 CEST 2002


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv21302/libmpdemux

Modified Files:
	demuxer.c open.c stream.h tv.c 
Log Message:
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


Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -r1.109 -r1.110
--- demuxer.c	21 Aug 2002 21:31:20 -0000	1.109
+++ demuxer.c	8 Sep 2002 23:00:01 -0000	1.110
@@ -157,13 +157,12 @@
 
 #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 @@
       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 @@
     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 @@
  }
 #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

Index: open.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/open.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- open.c	6 Sep 2002 13:31:33 -0000	1.53
+++ open.c	8 Sep 2002 23:00:01 -0000	1.54
@@ -68,7 +68,6 @@
 
 #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 @@
 //============ 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 (!stream_open_tv(stream, tv_handler))
 	goto tv_err;
+
+    stream->priv=tv_handler;
     
     return(stream);
 

Index: stream.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/stream.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- stream.h	2 Sep 2002 19:19:56 -0000	1.46
+++ stream.h	8 Sep 2002 23:00:01 -0000	1.47
@@ -42,7 +42,7 @@
   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;

Index: tv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tv.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- tv.c	8 Sep 2002 16:04:21 -0000	1.31
+++ tv.c	8 Sep 2002 23:00:01 -0000	1.32
@@ -73,8 +73,9 @@
 */
 /* 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 @@
 	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 @@
     }
 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




More information about the MPlayer-cvslog mailing list