Mercurial > mplayer.hg
changeset 2931:bce9c945b29c
tv interface update
author | alex |
---|---|
date | Fri, 16 Nov 2001 21:30:10 +0000 |
parents | 511f8eba46be |
children | fa3224774679 |
files | libmpdemux/demuxer.c libmpdemux/open.c libmpdemux/tv.c libmpdemux/tv.h libmpdemux/tvi_v4l.c |
diffstat | 5 files changed, 64 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demuxer.c Fri Nov 16 21:14:38 2001 +0000 +++ b/libmpdemux/demuxer.c Fri Nov 16 21:30:10 2001 +0000 @@ -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){
--- a/libmpdemux/open.c Fri Nov 16 21:14:38 2001 +0000 +++ b/libmpdemux/open.c Fri Nov 16 21:30:10 2001 +0000 @@ -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); }
--- a/libmpdemux/tv.c Fri Nov 16 21:14:38 2001 +0000 +++ b/libmpdemux/tv.c Fri Nov 16 21:30:10 2001 +0000 @@ -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)
--- a/libmpdemux/tv.h Fri Nov 16 21:14:38 2001 +0000 +++ b/libmpdemux/tv.h Fri Nov 16 21:30:10 2001 +0000 @@ -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 */
--- a/libmpdemux/tvi_v4l.c Fri Nov 16 21:14:38 2001 +0000 +++ b/libmpdemux/tvi_v4l.c Fri Nov 16 21:30:10 2001 +0000 @@ -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 */