annotate stream/stream_tv.c @ 23734:acfe034e5386

ISO8859-1 --> UTF-8
author diego
date Mon, 09 Jul 2007 19:50:36 +0000
parents 59d684441bd6
children d5be90343fac
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"
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
29
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
30 #include <stdio.h>
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
31
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
32 static struct stream_priv_s {
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
33 /* if channels parameter exist here will be channel number otherwise - frequency */
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
34 int input;
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
35 char* channel;
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
36 } stream_priv_dflts = {
23677
ede2719f604f Don't override input= option value is no input id is passed in tv:// url.
voroshil
parents: 23667
diff changeset
37 -1,
23667
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
38 NULL
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
39 };
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
40
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
41 #define ST_OFF(f) M_ST_OFF(struct stream_priv_s,f)
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
42 static m_option_t stream_opts_fields[] = {
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
43 {"hostname", ST_OFF(channel), CONF_TYPE_STRING, 0, 0 ,0, NULL},
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
44 {"filename", ST_OFF(input), CONF_TYPE_INT, 0, 0 ,0, NULL},
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
45 { NULL, NULL, 0, 0, 0, 0, NULL }
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
46 };
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
47
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
48 static struct m_struct_st stream_opts = {
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
49 "tv",
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
50 sizeof(struct stream_priv_s),
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
51 &stream_priv_dflts,
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
52 stream_opts_fields
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
53 };
19273
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
54
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
55 static int
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
56 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
57 {
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
58 extern char* tv_param_channel;
23667
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
59 extern int tv_param_input;
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
60 struct stream_priv_s* p=(struct stream_priv_s*)opts;
23678
59d684441bd6 Cosmetics.
voroshil
parents: 23677
diff changeset
61
19295
f6316aa3a7f2 conversion from stream_null to stream_tv was missing stream type
ben
parents: 19273
diff changeset
62 stream->type = STREAMTYPE_TV;
19273
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
63 *file_format = DEMUXER_TYPE_TV;
23678
59d684441bd6 Cosmetics.
voroshil
parents: 23677
diff changeset
64
23677
ede2719f604f Don't override input= option value is no input id is passed in tv:// url.
voroshil
parents: 23667
diff changeset
65 /* don't override input= option value if no input id is
ede2719f604f Don't override input= option value is no input id is passed in tv:// url.
voroshil
parents: 23667
diff changeset
66 passed in tv:// url */
ede2719f604f Don't override input= option value is no input id is passed in tv:// url.
voroshil
parents: 23667
diff changeset
67 if(p->input!=-1)
23678
59d684441bd6 Cosmetics.
voroshil
parents: 23677
diff changeset
68 tv_param_input=p->input;
23667
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
69 if (p->channel)
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
70 tv_param_channel=strdup (p->channel);
19273
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
71 return STREAM_OK;
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
72 }
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
73
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
74 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
75 "TV Input",
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
76 "tv",
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
77 "Benjamin Zores, Albeu",
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
78 "",
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
79 tv_stream_open,
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
80 { "tv", NULL },
23667
568e9190f631 Implemented tv://[<channel>][/<input_id>] url syntax
voroshil
parents: 19312
diff changeset
81 &stream_opts,
19273
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
82 1
11ec1cb3a7ea add an explicit tv stream input instead of the previous hack in stream_null
ben
parents:
diff changeset
83 };