annotate stream/stream_tv.c @ 26063:caf94e545753

Disable internal VIDIX on OS/2, patch by Dave Yeo, dave.r.yeo gmail com.
author diego
date Sun, 24 Feb 2008 22:41:39 +0000
parents 68015115f63a
children a26e50cae389
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19273
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
1 /*
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
2 * Copyright (C) 2006 Benjamin Zores
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
3 * Stream layer for TV Input, based on previous work from Albeu
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
4 *
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
7 * the Free Software Foundation; either version 2 of the License, or
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
8 * (at your option) any later version.
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
9 *
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
13 * GNU General Public License for more details.
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
14 *
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
16 * along with this program; if not, write to the Free Software Foundation,
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
18 */
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
19
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
20 #include "config.h"
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
21
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
22 #include <stdlib.h>
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
23 #include <string.h>
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
24
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
25 #include "stream.h"
19312
ab8d6b6deb63 proper inclusion of demuxer.h (including libmpdemux in Makefile only was to make previous split easier)
ben
parents: 19295
diff changeset
26 #include "libmpdemux/demuxer.h"
23667
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
27 #include "m_option.h"
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
28 #include "m_struct.h"
23882
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
29 #include "tv.h"
23667
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
30
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
31 #include <stdio.h>
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
32
23882
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
33 tv_param_t stream_tv_defaults = {
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
34 NULL, //freq
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
35 NULL, //channel
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
36 "europe-east", //chanlist
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
37 "pal", //norm
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
38 0, //automute
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
39 -1, //normid
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
40 NULL, //device
24403
d31512f03462 Implementation of tv:// driver autodetection.
voroshil
parents: 24290
diff changeset
41 NULL, //driver
23882
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
42 -1, //width
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
43 -1, //height
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
44 0, //input, used in v4l and bttv
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
45 -1, //outfmt
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
46 -1.0, //fps
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
47 NULL, //channels
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
48 0, //noaudio;
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
49 0, //immediate;
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
50 44100, //audiorate;
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
51 0, //audio_id
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
52 -1, //amode
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
53 -1, //volume
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
54 -1, //bass
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
55 -1, //treble
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
56 -1, //balance
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
57 -1, //forcechan
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
58 0, //force_audio
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
59 -1, //buffer_size
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
60 0, //mjpeg
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
61 2, //decimation
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
62 90, //quality
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
63 0, //alsa
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
64 NULL, //adevice
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
65 0, //brightness
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
66 0, //contrast
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
67 0, //hue
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
68 0, //saturation
24553
d6bba2781d01 Implement setting gain control for video devices (usually webcams)
voroshil
parents: 24403
diff changeset
69 -1, //gain
23900
b5cc28c45d73 Teletext support.
voroshil
parents: 23882
diff changeset
70 NULL, //tdevice
b5cc28c45d73 Teletext support.
voroshil
parents: 23882
diff changeset
71 0, //tformat
24105
9e71e0345c35 Automatic TV channels scanning ability for MPlayer.
voroshil
parents: 23900
diff changeset
72 100, //tpage
24290
ca7ee5c1b88d Support for selecting language via packet 28.
voroshil
parents: 24191
diff changeset
73 0, //tlang
24105
9e71e0345c35 Automatic TV channels scanning ability for MPlayer.
voroshil
parents: 23900
diff changeset
74 0, //scan_autostart
9e71e0345c35 Automatic TV channels scanning ability for MPlayer.
voroshil
parents: 23900
diff changeset
75 50, //scan_threshold
24744
d81eef9beb1b DirectShow based tv:// driver for win32
voroshil
parents: 24553
diff changeset
76 0.5, //scan_period
d81eef9beb1b DirectShow based tv:// driver for win32
voroshil
parents: 24553
diff changeset
77 0, //hidden_video_renderer;
d81eef9beb1b DirectShow based tv:// driver for win32
voroshil
parents: 24553
diff changeset
78 0, //hidden_vp_renderer;
d81eef9beb1b DirectShow based tv:// driver for win32
voroshil
parents: 24553
diff changeset
79 0, //system_clock;
d81eef9beb1b DirectShow based tv:// driver for win32
voroshil
parents: 24553
diff changeset
80 0 //normalize_audio_chunks;
23667
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
81 };
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
82
23882
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
83 #define ST_OFF(f) M_ST_OFF(tv_param_t,f)
25242
371a40dcc1cc stream_opts arrays should be const
reimar
parents: 25211
diff changeset
84 static const m_option_t stream_opts_fields[] = {
23667
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
85 {"hostname", ST_OFF(channel), CONF_TYPE_STRING, 0, 0 ,0, NULL},
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
86 {"filename", ST_OFF(input), CONF_TYPE_INT, 0, 0 ,0, NULL},
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
87 { NULL, NULL, 0, 0, 0, 0, NULL }
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
88 };
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
89
25691
68015115f63a stream_opts should be const
reimar
parents: 25242
diff changeset
90 static const struct m_struct_st stream_opts = {
23667
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
91 "tv",
23882
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
92 sizeof(tv_param_t),
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
93 &stream_tv_defaults,
23667
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
94 stream_opts_fields
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
95 };
19273
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
96
23882
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
97 static void
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
98 tv_stream_close (stream_t *stream)
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
99 {
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
100 if(stream->priv)
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
101 m_struct_free(&stream_opts,stream->priv);
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
102 stream->priv=NULL;
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
103 }
19273
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
104 static int
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
105 tv_stream_open (stream_t *stream, int mode, void *opts, int *file_format)
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
106 {
23678
59d684441bd6 Cosmetics.
voroshil
parents: 23677
diff changeset
107
19295
f6316aa3a7f2 conversion from stream_null to stream_tv was missing stream type
ben
parents: 19273
diff changeset
108 stream->type = STREAMTYPE_TV;
23882
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
109 stream->priv = opts;
d5be90343fac Removing global variables from tv://
voroshil
parents: 23678
diff changeset
110 stream->close=tv_stream_close;
19273
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
111 *file_format = DEMUXER_TYPE_TV;
23678
59d684441bd6 Cosmetics.
voroshil
parents: 23677
diff changeset
112
19273
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
113 return STREAM_OK;
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
114 }
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
115
25211
c1d17bd6683c Mark all stream_info_t as const
reimar
parents: 24758
diff changeset
116 const stream_info_t stream_info_tv = {
19273
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
117 "TV Input",
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
118 "tv",
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
119 "Benjamin Zores, Albeu",
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
120 "",
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
121 tv_stream_open,
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
122 { "tv", NULL },
23667
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
123 &stream_opts,
19273
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
124 1
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
125 };