[Mplayer-cvslog] CVS: main/libmpdemux demuxer.c,1.44,1.45 open.c,1.20,1.21 tv.c,1.10,1.11 tv.h,1.7,1.8 tvi_v4l.c,1.9,1.10

Alex Beregszaszi alex at mplayer.dev.hu
Fri Nov 16 22:30:13 CET 2001


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

Modified Files:
	demuxer.c open.c tv.c tv.h tvi_v4l.c 
Log Message:
tv interface update

Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- demuxer.c	13 Nov 2001 21:38:29 -0000	1.44
+++ demuxer.c	16 Nov 2001 21:30:10 -0000	1.45
@@ -160,7 +160,10 @@
 #ifdef USE_TV
 #include "tv.h"
 extern tvi_handle_t *tv_handler;
-int demux_tv_fill_buffer(demuxer_t *demux, tvi_handle_t *tvh);
+extern int tv_param_on;
+
+extern int demux_tv_fill_buffer(demuxer_t *demux, tvi_handle_t *tvh);
+extern int demux_open_tv(demuxer_t *demuxer, tvi_handle_t *tvh);
 #endif
 
 int demux_fill_buffer(demuxer_t *demux,demux_stream_t *ds){
@@ -352,10 +355,8 @@
 int mov_check_file(demuxer_t* demuxer);
 int mov_read_header(demuxer_t* demuxer);
 
-#ifdef USE_TV
-/* tv ! */
-extern int tv_param_on;
-#endif
+extern int vivo_check_file(demuxer_t *demuxer);
+extern void demux_open_vivo(demuxer_t *demuxer);
 
 demuxer_t* demux_open(stream_t *stream,int file_format,int audio_id,int video_id,int dvdsub_id){
 

Index: open.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/open.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- open.c	11 Nov 2001 15:45:23 -0000	1.20
+++ open.c	16 Nov 2001 21:30:10 -0000	1.21
@@ -73,6 +73,8 @@
 #ifdef USE_TV
 #include "tv.h"
 tvi_handle_t *tv_handler;
+
+extern int stream_open_tv(stream_t *stream, tvi_handle_t *tvh);
 #endif
 
 // Open a new stream  (stdin/file/vcd/url)
@@ -249,14 +251,29 @@
 
 #ifdef USE_TV
 //============ Check for TV-input ====
-  if (tv_param_on==1)
+  if (tv_param_on == 1)
   {
-    stream = new_stream(-1,STREAMTYPE_TV);
+    /* create stream */
+    stream = new_stream(-1, STREAMTYPE_TV);
+    if (!stream)
+	return(NULL);
+
+    /* create tvi handler */
     tv_handler = tv_begin();
     if (!tv_handler)
 	return(NULL);
-    if (tv_init(tv_handler) == 1)
-	return(stream);
+
+    /* preinit */
+    if (!tv_init(tv_handler))
+	goto tv_err;
+
+    if (!stream_open_tv(stream, tv_handler))
+	goto tv_err;
+    
+    return(stream);
+
+    /* something went wrong - uninit */
+tv_err:
     tv_uninit(tv_handler);
     return(NULL);
   }

Index: tv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tv.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- tv.c	11 Nov 2001 16:29:26 -0000	1.10
+++ tv.c	16 Nov 2001 21:30:10 -0000	1.11
@@ -3,7 +3,7 @@
  
  API idea based on libvo2's
 
- UNDER HEAVY DEVELOPEMENT, DO NOT USE! :)
+ UNDER HEAVY DEVELOPEMENT, NO FEATURE REQUESTS PLEASE! :)
 */
 
 #include <stdio.h>
@@ -53,7 +53,7 @@
     demux_packet_t* dp;
     int len;
 
-    mp_msg(MSGT_DEMUX, MSGL_DBG2, "demux_tv_fill_buffer(sequence:%d) called!\n", seq);
+    mp_dbg(MSGT_DEMUX, MSGL_DBG2, "demux_tv_fill_buffer(sequence:%d) called!\n", seq);
 
 //    demux->filepos = -1;
 
@@ -88,6 +88,10 @@
     return 1;
 }
 
+int stream_open_tv(stream_t *stream, tvi_handle_t *tvh)
+{
+}
+
 int demux_open_tv(demuxer_t *demuxer, tvi_handle_t *tvh)
 {
     sh_video_t *sh_video = NULL;
@@ -176,6 +180,7 @@
     demuxer->video->sh = sh_video;
     sh_video->ds = demuxer->video;
     demuxer->video->id = 0;
+    demuxer->seekable = 0;
 
     /* here comes audio init */
     if (funcs->control(tvh->priv, TVI_CONTROL_IS_AUDIO, 0) == TVI_CONTROL_TRUE)

Index: tv.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tv.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- tv.h	11 Nov 2001 15:45:23 -0000	1.7
+++ tv.h	16 Nov 2001 21:30:10 -0000	1.8
@@ -97,9 +97,8 @@
 #define TVI_CONTROL_SPC_GET_INPUT	0x401	/* set input channel (tv,s-video,composite..) */
 #define TVI_CONTROL_SPC_SET_INPUT	0x402	/* set input channel (tv,s-video,composite..) */
 
-//extern int demux_tv_fill_buffer(demuxer_t *demux, tvi_handle_t *tvh);
-//extern int demux_open_tv(demuxer_t *demux, tvi_handle_t *tvh);
 extern tvi_handle_t *tv_begin(void);
 extern int tv_init(tvi_handle_t *tvh);
+extern int tv_uninit(tvi_handle_t *tvh);
 
 #endif /* USE_TV */

Index: tvi_v4l.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tvi_v4l.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- tvi_v4l.c	11 Nov 2001 16:28:12 -0000	1.9
+++ tvi_v4l.c	16 Nov 2001 21:30:10 -0000	1.10
@@ -22,6 +22,8 @@
 #include <linux/videodev.h>
 #include <unistd.h>
 #include <sys/mman.h>
+#include <stdlib.h>
+#include <string.h>
 
 #include "mp_msg.h"
 #include "../libao2/afmt.h"
@@ -349,7 +351,6 @@
     /* video buffers */
     priv->buf = (struct video_mmap *)malloc(priv->nbuf * sizeof(struct video_mmap));
     memset(priv->buf, 0, priv->nbuf * sizeof(struct video_mmap));
-
     
     return(1);
 
@@ -363,6 +364,8 @@
 {
     close(priv->fd);
 #warning "Implement uninit!"
+
+    return(1);
 }
 
 static int start(priv_t *priv)
@@ -404,6 +407,20 @@
 	mp_msg(MSGT_TV, MSGL_DBG2, "buffer: %d => %p\n", i, &priv->buf[i]);
     } 
 
+#if 0
+    {
+	struct video_play_mode pmode;
+	
+	pmode.mode = VID_PLAY_NORMAL;
+	pmode.p1 = 1;
+	pmode.p2 = 0;
+	if (ioctl(priv->fd, VIDIOCSPLAYMODE, &pmode) == -1)
+	{
+	    mp_msg(MSGT_TV, MSGL_ERR, "ioctl set play mode failed: %s\n", strerror(errno));
+//	    return(0);
+	}
+    }
+#endif
 
 #if 0
     {
@@ -709,10 +726,10 @@
     int frame = priv->queue % priv->nbuf;
     int nextframe = (priv->queue+1) % priv->nbuf;
 
-    mp_msg(MSGT_TV, MSGL_DBG2, "grab_video_frame(priv=%p, buffer=%p, len=%d\n",
+    mp_dbg(MSGT_TV, MSGL_DBG2, "grab_video_frame(priv=%p, buffer=%p, len=%d\n",
 	priv, buffer, len);
 
-    mp_msg(MSGT_TV, MSGL_DBG3, "buf: %p + frame: %d => %p\n",
+    mp_dbg(MSGT_TV, MSGL_DBG3, "buf: %p + frame: %d => %p\n",
 	priv->buf, nextframe, &priv->buf[nextframe]);
     if (ioctl(priv->fd, VIDIOCMCAPTURE, &priv->buf[nextframe]) == -1)
     {
@@ -724,9 +741,14 @@
 	mp_msg(MSGT_TV, MSGL_ERR, "ioctl sync failed: %s\n", strerror(errno));
     priv->queue++;
     
-    mp_msg(MSGT_TV, MSGL_DBG3, "mmap: %p + offset: %d => %p\n",
+    mp_dbg(MSGT_TV, MSGL_DBG3, "mmap: %p + offset: %d => %p\n",
 	priv->mmap, priv->mbuf.offsets[frame],
 	priv->mmap+priv->mbuf.offsets[frame]);
+
+    /* XXX also directrendering would be nicer! */
+    /* 3 times copying the same picture to other buffer :( */
+
+    /* copy the actual frame */
     memcpy(buffer, priv->mmap+priv->mbuf.offsets[frame], len);
 
     return(len);
@@ -734,16 +756,17 @@
 
 static int get_video_framesize(priv_t *priv)
 {
-    return priv->bytesperline * priv->height;
+    return(priv->bytesperline * priv->height);
 }
 
 static int grab_audio_frame(priv_t *priv, char *buffer, int len)
 {
+    return(65536);
 }
 
 static int get_audio_framesize(priv_t *priv)
 {
-    return 65536;
+    return(65536);
 }
 
 #endif /* USE_TV */




More information about the MPlayer-cvslog mailing list