# HG changeset patch # User voroshil # Date 1183055765 0 # Node ID 568e9190f631c7c6e1b3989b520d3028bcab67be # Parent 5c3c7efd9b75a20427288037a0a7647d708a1ed1 Implemented tv://[][/] url syntax to allow users start watching from S-Video or Composite input without touching '-tv input=' option. diff -r 5c3c7efd9b75 -r 568e9190f631 DOCS/man/en/mplayer.1 --- a/DOCS/man/en/mplayer.1 Thu Jun 28 11:24:12 2007 +0000 +++ b/DOCS/man/en/mplayer.1 Thu Jun 28 18:36:05 2007 +0000 @@ -70,7 +70,7 @@ . .br .B mplayer -tv://[channel] +tv://[channel][/input_id] [options] . .br @@ -1728,7 +1728,8 @@ This option tunes various properties of the TV capture module. For watching TV with MPlayer, use 'tv://' or 'tv://' or even 'tv:// (see option channels for channel_name below) -as a movie URL. +as a movie URL. You can also use 'tv:///' to start watching +movie from Composite or S-Video input (see option input for details). .sp 1 Available options are: .RSs diff -r 5c3c7efd9b75 -r 568e9190f631 stream/stream_tv.c --- a/stream/stream_tv.c Thu Jun 28 11:24:12 2007 +0000 +++ b/stream/stream_tv.c Thu Jun 28 18:36:05 2007 +0000 @@ -24,17 +24,48 @@ #include "stream.h" #include "libmpdemux/demuxer.h" +#include "m_option.h" +#include "m_struct.h" + +#include + +static struct stream_priv_s { + /* if channels parameter exist here will be channel number otherwise - frequency */ + int input; + char* channel; +} stream_priv_dflts = { + 0, + NULL +}; + +#define ST_OFF(f) M_ST_OFF(struct stream_priv_s,f) +static m_option_t stream_opts_fields[] = { + {"hostname", ST_OFF(channel), CONF_TYPE_STRING, 0, 0 ,0, NULL}, + {"filename", ST_OFF(input), CONF_TYPE_INT, 0, 0 ,0, NULL}, + { NULL, NULL, 0, 0, 0, 0, NULL } +}; + +static struct m_struct_st stream_opts = { + "tv", + sizeof(struct stream_priv_s), + &stream_priv_dflts, + stream_opts_fields +}; static int tv_stream_open (stream_t *stream, int mode, void *opts, int *file_format) { extern char* tv_param_channel; + extern int tv_param_input; + struct stream_priv_s* p=(struct stream_priv_s*)opts; stream->type = STREAMTYPE_TV; *file_format = DEMUXER_TYPE_TV; - if (strlen (stream->url) > 5 && stream->url[5] != '\0') - tv_param_channel = strdup (stream->url + 5); + tv_param_input=p->input; + if (p->channel) + tv_param_channel=strdup (p->channel); +fprintf(stderr,"%p\n",p->channel) ; return STREAM_OK; } @@ -45,6 +76,6 @@ "", tv_stream_open, { "tv", NULL }, - NULL, + &stream_opts, 1 }; diff -r 5c3c7efd9b75 -r 568e9190f631 stream/tvi_vbi.c