Mercurial > mplayer.hg
annotate stream/stream_tv.c @ 30811:50e0f6942e43
Implement Win32 mutexes.
Implement Win32 mutexes; they used to just be mapped on top of events, which
is not the same thing at all.
The implementation is pretty much the obvious one, similar to the
current critical section implementation and the semaphore implementation;
a single lock count protected by a pthread mutex, and an event lockers can
sleep on to know when the mutex is available.
Also make CreateMutexA and ReleaseMutex available even if QuickTime codecs
support is not configured.
author | sesse |
---|---|
date | Sat, 06 Mar 2010 10:13:37 +0000 |
parents | 5a62af75e64c |
children | 7766530caa76 |
rev | line source |
---|---|
19273
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
1 /* |
26737
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25691
diff
changeset
|
2 * stream layer for TV Input, based on previous work from Albeu |
19273
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
3 * |
26737
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25691
diff
changeset
|
4 * Copyright (C) 2006 Benjamin Zores |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25691
diff
changeset
|
5 * |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25691
diff
changeset
|
6 * This file is part of MPlayer. |
19273
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
7 * |
26737
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25691
diff
changeset
|
8 * MPlayer is free software; you can redistribute it and/or modify |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25691
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25691
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25691
diff
changeset
|
11 * (at your option) any later version. |
19273
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
12 * |
26737
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25691
diff
changeset
|
13 * MPlayer is distributed in the hope that it will be useful, |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25691
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25691
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25691
diff
changeset
|
16 * GNU General Public License for more details. |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25691
diff
changeset
|
17 * |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25691
diff
changeset
|
18 * You should have received a copy of the GNU General Public License along |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25691
diff
changeset
|
19 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25691
diff
changeset
|
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
19273
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 |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
23 #include "config.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 <stdlib.h> |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
26 #include <string.h> |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
27 |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
28 #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
|
29 #include "libmpdemux/demuxer.h" |
23667
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
30 #include "m_option.h" |
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
31 #include "m_struct.h" |
23882 | 32 #include "tv.h" |
23667
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
33 |
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
34 #include <stdio.h> |
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
35 |
23882 | 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 | |
24403 | 44 NULL, //driver |
23882 | 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 | |
24553
d6bba2781d01
Implement setting gain control for video devices (usually webcams)
voroshil
parents:
24403
diff
changeset
|
72 -1, //gain |
30740 | 73 { |
23900 | 74 NULL, //tdevice |
75 0, //tformat | |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
76 100, //tpage |
24290 | 77 0, //tlang |
30740 | 78 }, |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
79 0, //scan_autostart |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
80 50, //scan_threshold |
24744 | 81 0.5, //scan_period |
82 0, //hidden_video_renderer; | |
83 0, //hidden_vp_renderer; | |
84 0, //system_clock; | |
85 0 //normalize_audio_chunks; | |
23667
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
86 }; |
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
87 |
23882 | 88 #define ST_OFF(f) M_ST_OFF(tv_param_t,f) |
25242 | 89 static const m_option_t stream_opts_fields[] = { |
23667
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
90 {"hostname", ST_OFF(channel), CONF_TYPE_STRING, 0, 0 ,0, NULL}, |
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
91 {"filename", ST_OFF(input), CONF_TYPE_INT, 0, 0 ,0, NULL}, |
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
92 { NULL, NULL, 0, 0, 0, 0, NULL } |
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
93 }; |
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
94 |
25691 | 95 static const struct m_struct_st stream_opts = { |
23667
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
96 "tv", |
23882 | 97 sizeof(tv_param_t), |
98 &stream_tv_defaults, | |
23667
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
99 stream_opts_fields |
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
100 }; |
19273
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
101 |
23882 | 102 static void |
103 tv_stream_close (stream_t *stream) | |
104 { | |
105 if(stream->priv) | |
106 m_struct_free(&stream_opts,stream->priv); | |
107 stream->priv=NULL; | |
108 } | |
19273
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
109 static int |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
110 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
|
111 { |
23678 | 112 |
19295
f6316aa3a7f2
conversion from stream_null to stream_tv was missing stream type
ben
parents:
19273
diff
changeset
|
113 stream->type = STREAMTYPE_TV; |
23882 | 114 stream->priv = opts; |
115 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
|
116 *file_format = DEMUXER_TYPE_TV; |
23678 | 117 |
19273
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
118 return STREAM_OK; |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
119 } |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
120 |
25211 | 121 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
|
122 "TV Input", |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
123 "tv", |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
124 "Benjamin Zores, Albeu", |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
125 "", |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26737
diff
changeset
|
126 tv_stream_open, |
19273
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
127 { "tv", NULL }, |
23667
568e9190f631
Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents:
19312
diff
changeset
|
128 &stream_opts, |
19273
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
129 1 |
11ec1cb3a7ea
add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff
changeset
|
130 }; |