VCR2 fails for mpeg12, decodes incorrectly (and cannot be fixed) for
[mplayer/glamo.git] / stream / stream_tv.c
blob3db6195dcfad6d1b2f052ab32a0dc00b4c6b285e
1 /*
2 * stream layer for TV Input, based on previous work from Albeu
4 * Copyright (C) 2006 Benjamin Zores
6 * This file is part of MPlayer.
8 * MPlayer is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * MPlayer is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include "config.h"
25 #include <stdlib.h>
26 #include <string.h>
28 #include "stream.h"
29 #include "libmpdemux/demuxer.h"
30 #include "m_option.h"
31 #include "m_struct.h"
32 #include "tv.h"
34 #include <stdio.h>
36 tv_param_t stream_tv_defaults = {
37 NULL, //freq
38 NULL, //channel
39 "europe-east", //chanlist
40 "pal", //norm
41 0, //automute
42 -1, //normid
43 NULL, //device
44 NULL, //driver
45 -1, //width
46 -1, //height
47 0, //input, used in v4l and bttv
48 -1, //outfmt
49 -1.0, //fps
50 NULL, //channels
51 0, //noaudio;
52 0, //immediate;
53 44100, //audiorate;
54 0, //audio_id
55 -1, //amode
56 -1, //volume
57 -1, //bass
58 -1, //treble
59 -1, //balance
60 -1, //forcechan
61 0, //force_audio
62 -1, //buffer_size
63 0, //mjpeg
64 2, //decimation
65 90, //quality
66 0, //alsa
67 NULL, //adevice
68 0, //brightness
69 0, //contrast
70 0, //hue
71 0, //saturation
72 -1, //gain
73 NULL, //tdevice
74 0, //tformat
75 100, //tpage
76 0, //tlang
77 0, //scan_autostart
78 50, //scan_threshold
79 0.5, //scan_period
80 0, //hidden_video_renderer;
81 0, //hidden_vp_renderer;
82 0, //system_clock;
83 0 //normalize_audio_chunks;
86 #define ST_OFF(f) M_ST_OFF(tv_param_t,f)
87 static const m_option_t stream_opts_fields[] = {
88 {"hostname", ST_OFF(channel), CONF_TYPE_STRING, 0, 0 ,0, NULL},
89 {"filename", ST_OFF(input), CONF_TYPE_INT, 0, 0 ,0, NULL},
90 { NULL, NULL, 0, 0, 0, 0, NULL }
93 static const struct m_struct_st stream_opts = {
94 "tv",
95 sizeof(tv_param_t),
96 &stream_tv_defaults,
97 stream_opts_fields
100 static void
101 tv_stream_close (stream_t *stream)
103 if(stream->priv)
104 m_struct_free(&stream_opts,stream->priv);
105 stream->priv=NULL;
107 static int
108 tv_stream_open (stream_t *stream, int mode, void *opts, int *file_format)
111 stream->type = STREAMTYPE_TV;
112 stream->priv = opts;
113 stream->close=tv_stream_close;
114 *file_format = DEMUXER_TYPE_TV;
116 return STREAM_OK;
119 const stream_info_t stream_info_tv = {
120 "TV Input",
121 "tv",
122 "Benjamin Zores, Albeu",
124 tv_stream_open,
125 { "tv", NULL },
126 &stream_opts,