Mercurial > mplayer.hg
annotate stream/stream_tv.c @ 24539:aeb04553212e
rename windows ddk makefile to nmakefile so that a makefile for mingw can be added
author | faust3 |
---|---|
date | Mon, 17 Sep 2007 19:33:33 +0000 |
parents | d31512f03462 |
children | d6bba2781d01 |
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 | 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 | 33 tv_param_t stream_tv_defaults = { |
34 NULL, //freq | |
35 NULL, //channel | |
36 "europe-east", //chanlist | |
37 "pal", //norm | |
38 0, //automute | |
39 #ifdef HAVE_TV_V4L2 | |
40 -1, //normid | |
41 #endif | |
42 NULL, //device | |
24403 | 43 NULL, //driver |
23882 | 44 -1, //width |
45 -1, //height | |
46 0, //input, used in v4l and bttv | |
47 -1, //outfmt | |
48 -1.0, //fps | |
49 NULL, //channels | |
50 0, //noaudio; | |
51 0, //immediate; | |
52 44100, //audiorate; | |
53 0, //audio_id | |
54 #if defined(HAVE_TV_V4L) | |
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 #if defined(HAVE_ALSA9) || defined(HAVE_ALSA1X) | |
67 0, //alsa | |
68 #endif | |
24191
e6221b1a7322
10l: Move #endif upper to reflect changes in r24054.
voroshil
parents:
24105
diff
changeset
|
69 #endif |
23882 | 70 NULL, //adevice |
71 0, //brightness | |
72 0, //contrast | |
73 0, //hue | |
74 0, //saturation | |
23900 | 75 NULL, //tdevice |
76 0, //tformat | |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
77 100, //tpage |
24290 | 78 0, //tlang |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
79 |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
80 0, //scan_autostart |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
81 50, //scan_threshold |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
82 0.5 //scan_period |
23667
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
83 }; |
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
84 |
23882 | 85 #define ST_OFF(f) M_ST_OFF(tv_param_t,f) |
23667
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
86 static m_option_t stream_opts_fields[] = { |
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
87 {"hostname", ST_OFF(channel), CONF_TYPE_STRING, 0, 0 ,0, NULL}, |
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
88 {"filename", ST_OFF(input), CONF_TYPE_INT, 0, 0 ,0, NULL}, |
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
89 { NULL, NULL, 0, 0, 0, 0, NULL } |
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
90 }; |
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
91 |
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
92 static struct m_struct_st stream_opts = { |
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
93 "tv", |
23882 | 94 sizeof(tv_param_t), |
95 &stream_tv_defaults, | |
23667
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
96 stream_opts_fields |
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
97 }; |
19273
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
98 |
23882 | 99 static void |
100 tv_stream_close (stream_t *stream) | |
101 { | |
102 if(stream->priv) | |
103 m_struct_free(&stream_opts,stream->priv); | |
104 stream->priv=NULL; | |
105 } | |
19273
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
106 static int |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
107 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
|
108 { |
23678 | 109 |
19295
f6316aa3a7f2
conversion from stream_null to stream_tv was missing stream type
ben
parents:
19273
diff
changeset
|
110 stream->type = STREAMTYPE_TV; |
23882 | 111 stream->priv = opts; |
112 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
|
113 *file_format = DEMUXER_TYPE_TV; |
23678 | 114 |
19273
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
115 return STREAM_OK; |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
116 } |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
117 |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
118 stream_info_t stream_info_tv = { |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
119 "TV Input", |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
120 "tv", |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
121 "Benjamin Zores, Albeu", |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
122 "", |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
123 tv_stream_open, |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
124 { "tv", NULL }, |
23667
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
125 &stream_opts, |
19273
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
126 1 |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
127 }; |