annotate libmpdemux/tv.c @ 6161:c50ea0721e78

applied 64bit patch from Ulrich Hecht <uli at suse dot de>
author alex
date Thu, 23 May 2002 14:53:11 +0000
parents 4241047fb315
children 2e5c07262861
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
1 /*
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
2 TV Interface for MPlayer
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
3
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
4 (C) Alex Beregszaszi <alex@naxine.org>
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
5
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
6 API idea based on libvo2
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
7
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
8 Feb 19, 2002: Significant rewrites by Charles R. Henrich (henrich@msu.edu)
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
9 to add support for audio, and bktr *BSD support.
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
10
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
11 */
98769cea155c added tv subsystem
alex
parents:
diff changeset
12
98769cea155c added tv subsystem
alex
parents:
diff changeset
13 #include <stdio.h>
98769cea155c added tv subsystem
alex
parents:
diff changeset
14 #include <stdlib.h>
98769cea155c added tv subsystem
alex
parents:
diff changeset
15 #include <unistd.h>
2932
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
16 #include <string.h>
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
17 #include <sys/time.h>
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
18
98769cea155c added tv subsystem
alex
parents:
diff changeset
19 #include "config.h"
98769cea155c added tv subsystem
alex
parents:
diff changeset
20
2819
2e58962dc9fe cleaned up some warnings, and tv_param_on moved out from #ifdef USE_TV
alex
parents: 2818
diff changeset
21 int tv_param_on = 0;
2e58962dc9fe cleaned up some warnings, and tv_param_on moved out from #ifdef USE_TV
alex
parents: 2818
diff changeset
22
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
23 #ifdef USE_TV
98769cea155c added tv subsystem
alex
parents:
diff changeset
24 #include "mp_msg.h"
98769cea155c added tv subsystem
alex
parents:
diff changeset
25 #include "help_mp.h"
98769cea155c added tv subsystem
alex
parents:
diff changeset
26
98769cea155c added tv subsystem
alex
parents:
diff changeset
27 #include "stream.h"
98769cea155c added tv subsystem
alex
parents:
diff changeset
28 #include "demuxer.h"
98769cea155c added tv subsystem
alex
parents:
diff changeset
29 #include "stheader.h"
2830
596a6ba3520f never include files from public headers...
arpi
parents: 2819
diff changeset
30
596a6ba3520f never include files from public headers...
arpi
parents: 2819
diff changeset
31 #include "../libao2/afmt.h"
596a6ba3520f never include files from public headers...
arpi
parents: 2819
diff changeset
32 #include "../libvo/img_format.h"
596a6ba3520f never include files from public headers...
arpi
parents: 2819
diff changeset
33 #include "../libvo/fastmemcpy.h"
596a6ba3520f never include files from public headers...
arpi
parents: 2819
diff changeset
34
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
35 #include "tv.h"
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
36
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
37 #include "frequencies.h"
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
38
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
39 /* some default values */
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
40 int tv_param_audiorate = 44100;
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
41 int tv_param_noaudio = 0;
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
42 #ifdef HAVE_TV_BSDBT848
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
43 int tv_param_immediate = 0;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
44 #endif
2837
c63562f5f56f tuning worx (can set frequency)
alex
parents: 2830
diff changeset
45 char *tv_param_freq = NULL;
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
46 char *tv_param_channel = NULL;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
47 char *tv_param_norm = "pal";
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
48 char *tv_param_chanlist = "europe-east";
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
49 char *tv_param_device = NULL;
98769cea155c added tv subsystem
alex
parents:
diff changeset
50 char *tv_param_driver = "dummy";
98769cea155c added tv subsystem
alex
parents:
diff changeset
51 int tv_param_width = -1;
98769cea155c added tv subsystem
alex
parents:
diff changeset
52 int tv_param_height = -1;
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
53 int tv_param_input = 0; /* used in v4l and bttv */
2817
cc93d9786954 added support for -tv outfmt
alex
parents: 2813
diff changeset
54 char *tv_param_outfmt = "yv12";
3285
bd7bff4cb453 add tv fps support
alex
parents: 3284
diff changeset
55 float tv_param_fps = -1.0;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
56
98769cea155c added tv subsystem
alex
parents:
diff changeset
57 /* ================== DEMUX_TV ===================== */
98769cea155c added tv subsystem
alex
parents:
diff changeset
58 /*
98769cea155c added tv subsystem
alex
parents:
diff changeset
59 Return value:
98769cea155c added tv subsystem
alex
parents:
diff changeset
60 0 = EOF(?) or no stream
98769cea155c added tv subsystem
alex
parents:
diff changeset
61 1 = successfully read a packet
98769cea155c added tv subsystem
alex
parents:
diff changeset
62 */
98769cea155c added tv subsystem
alex
parents:
diff changeset
63 /* fill demux->video and demux->audio */
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
64
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
65 int demux_tv_fill_buffer(demuxer_t *demux, demux_stream_t *ds, tvi_handle_t *tvh)
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
66 {
2813
d6d88771f5ef demuxer fixed
arpi
parents: 2810
diff changeset
67 demux_packet_t* dp;
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
68
2932
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
69 sh_video_t *sh_video = demux->video->sh;
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
70 u_int len;
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
71 int aframeswaiting;
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
72
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
73 len = 0;
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
74
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
75 /* ================== ADD AUDIO PACKET =================== */
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
76
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
77 if (ds==demux->audio && tv_param_noaudio == 0 &&
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
78 tvh->functions->control(tvh->priv,
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
79 TVI_CONTROL_IS_AUDIO, 0) == TVI_CONTROL_TRUE)
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
80 {
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
81 len = tvh->functions->get_audio_framesize(tvh->priv);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
82
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
83 dp=new_demux_packet(len);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
84 dp->pts=tvh->functions->grab_audio_frame(tvh->priv, dp->buffer,len);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
85 ds_add_packet(demux->audio,dp);
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
86 }
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
87
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
88 /* ================== ADD VIDEO PACKET =================== */
98769cea155c added tv subsystem
alex
parents:
diff changeset
89
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
90 if (ds==demux->video && tvh->functions->control(tvh->priv,
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
91 TVI_CONTROL_IS_VIDEO, 0) == TVI_CONTROL_TRUE)
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
92 {
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
93 len = tvh->functions->get_video_framesize(tvh->priv);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
94 dp=new_demux_packet(len);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
95 dp->pts=tvh->functions->grab_video_frame(tvh->priv, dp->buffer, len);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
96 ds_add_packet(demux->video,dp);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
97 }
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
98
98769cea155c added tv subsystem
alex
parents:
diff changeset
99 return 1;
98769cea155c added tv subsystem
alex
parents:
diff changeset
100 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
101
2931
bce9c945b29c tv interface update
alex
parents: 2842
diff changeset
102 int stream_open_tv(stream_t *stream, tvi_handle_t *tvh)
bce9c945b29c tv interface update
alex
parents: 2842
diff changeset
103 {
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
104 int i;
2932
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
105 tvi_functions_t *funcs = tvh->functions;
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
106 int picture_format = 0;
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
107
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
108 if (funcs->control(tvh->priv, TVI_CONTROL_IS_VIDEO, 0) != TVI_CONTROL_TRUE)
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
109 {
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
110 mp_msg(MSGT_TV, MSGL_ERR, "Error: no video input present!\n");
3728
499ce786c30d As nobody fixed this yet:
pl
parents: 3703
diff changeset
111 return 0;
2932
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
112 }
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
113
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
114 if (!strcasecmp(tv_param_outfmt, "yv12"))
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
115 picture_format = IMGFMT_YV12;
3703
3717145636b5 i420 support
alex
parents: 3612
diff changeset
116 else if (!strcasecmp(tv_param_outfmt, "i420"))
3717145636b5 i420 support
alex
parents: 3612
diff changeset
117 picture_format = IMGFMT_I420;
2932
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
118 else if (!strcasecmp(tv_param_outfmt, "uyvy"))
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
119 picture_format = IMGFMT_UYVY;
4350
70ac7ab2a982 yuy2 reported as working
alex
parents: 4242
diff changeset
120 else if (!strcasecmp(tv_param_outfmt, "yuy2"))
70ac7ab2a982 yuy2 reported as working
alex
parents: 4242
diff changeset
121 picture_format = IMGFMT_YUY2;
2932
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
122 else if (!strcasecmp(tv_param_outfmt, "rgb32"))
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
123 picture_format = IMGFMT_RGB32;
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
124 else if (!strcasecmp(tv_param_outfmt, "rgb24"))
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
125 picture_format = IMGFMT_RGB24;
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
126 else if (!strcasecmp(tv_param_outfmt, "rgb16"))
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
127 picture_format = IMGFMT_RGB16;
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
128 else if (!strcasecmp(tv_param_outfmt, "rgb15"))
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
129 picture_format = IMGFMT_RGB15;
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
130 else
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
131 {
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
132 mp_msg(MSGT_TV, MSGL_ERR, "Unknown format given: %s\n", tv_param_outfmt);
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
133 mp_msg(MSGT_TV, MSGL_INFO, "Using default: Planar YV12\n");
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
134 picture_format = IMGFMT_YV12;
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
135 }
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
136 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_FORMAT, &picture_format);
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
137
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
138 /* set width */
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
139 if (tv_param_width != -1)
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
140 {
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
141 if (funcs->control(tvh->priv, TVI_CONTROL_VID_CHK_WIDTH, &tv_param_width) == TVI_CONTROL_TRUE)
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
142 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_WIDTH, &tv_param_width);
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
143 else
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
144 {
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
145 mp_msg(MSGT_TV, MSGL_ERR, "Unable set requested width: %d\n", tv_param_width);
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
146 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_WIDTH, &tv_param_width);
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
147 }
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
148 }
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
149
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
150 /* set height */
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
151 if (tv_param_height != -1)
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
152 {
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
153 if (funcs->control(tvh->priv, TVI_CONTROL_VID_CHK_HEIGHT, &tv_param_height) == TVI_CONTROL_TRUE)
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
154 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_HEIGHT, &tv_param_height);
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
155 else
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
156 {
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
157 mp_msg(MSGT_TV, MSGL_ERR, "Unable set requested height: %d\n", tv_param_height);
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
158 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HEIGHT, &tv_param_height);
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
159 }
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
160 }
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
161
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
162 /* set some params got from cmdline */
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
163 funcs->control(tvh->priv, TVI_CONTROL_SPC_SET_INPUT, &tv_param_input);
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
164
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
165 /* select video norm */
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
166 if (!strcasecmp(tv_param_norm, "pal"))
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
167 tvh->norm = TV_NORM_PAL;
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
168 else if (!strcasecmp(tv_param_norm, "ntsc"))
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
169 tvh->norm = TV_NORM_NTSC;
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
170 else if (!strcasecmp(tv_param_norm, "secam"))
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
171 tvh->norm = TV_NORM_SECAM;
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
172
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
173 mp_msg(MSGT_TV, MSGL_INFO, "Selected norm: %s\n", tv_param_norm);
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
174 funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm);
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
175
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
176 if (funcs->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) != TVI_CONTROL_TRUE)
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
177 {
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
178 mp_msg(MSGT_TV, MSGL_WARN, "Selected input hasn't got a tuner!\n");
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
179 goto done;
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
180 }
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
181
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
182 /* select channel list */
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
183 for (i = 0; chanlists[i].name != NULL; i++)
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
184 {
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
185 if (!strcasecmp(chanlists[i].name, tv_param_chanlist))
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
186 {
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
187 tvh->chanlist = i;
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
188 tvh->chanlist_s = chanlists[i].list;
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
189 break;
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
190 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
191 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
192
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
193 if (tvh->chanlist == -1)
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
194 mp_msg(MSGT_TV, MSGL_WARN, "Unable to find selected channel list! (%s)\n",
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
195 tv_param_chanlist);
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
196 else
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
197 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel list: %s (including %d channels)\n",
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
198 chanlists[tvh->chanlist].name, chanlists[tvh->chanlist].count);
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
199
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
200 if (tv_param_freq && tv_param_channel)
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
201 {
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
202 mp_msg(MSGT_TV, MSGL_WARN, "You can't set frequency and channel simultanly!\n");
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
203 goto done;
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
204 }
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
205
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
206 /* we need to set frequency */
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
207 if (tv_param_freq)
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
208 {
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
209 unsigned long freq = atof(tv_param_freq)*16;
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
210
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
211 /* set freq in MHz */
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
212 funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_FREQ, &freq);
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
213
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
214 funcs->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &freq);
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
215 mp_msg(MSGT_TV, MSGL_INFO, "Selected frequency: %lu (%.3f)\n",
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
216 freq, (float)freq/16);
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
217 }
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
218
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
219 if (tv_param_channel)
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
220 {
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
221 struct CHANLIST cl;
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
222
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
223 mp_msg(MSGT_TV, MSGL_V, "Requested channel: %s\n", tv_param_channel);
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
224 for (i = 0; i < chanlists[tvh->chanlist].count; i++)
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
225 {
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
226 cl = tvh->chanlist_s[i];
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
227 // printf("count%d: name: %s, freq: %d\n",
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
228 // i, cl.name, cl.freq);
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
229 if (!strcasecmp(cl.name, tv_param_channel))
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
230 {
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
231 tvh->channel = i;
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
232 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n",
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
233 cl.name, (float)cl.freq/1000);
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
234 tv_set_freq(tvh, (unsigned long)(((float)cl.freq/1000)*16));
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
235 break;
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
236 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
237 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
238 }
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
239
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
240 done:
2932
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
241 /* also start device! */
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
242 return 1;
2931
bce9c945b29c tv interface update
alex
parents: 2842
diff changeset
243 }
bce9c945b29c tv interface update
alex
parents: 2842
diff changeset
244
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
245 int demux_open_tv(demuxer_t *demuxer, tvi_handle_t *tvh)
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
246 {
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
247 sh_video_t *sh_video = NULL;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
248 sh_audio_t *sh_audio = NULL;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
249 tvi_functions_t *funcs = tvh->functions;
98769cea155c added tv subsystem
alex
parents:
diff changeset
250
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
251 sh_video = new_sh_video(demuxer, 0);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
252
2932
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
253 /* get IMAGE FORMAT */
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
254 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_FORMAT, &sh_video->format);
2810
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
255 // if (IMGFMT_IS_RGB(sh_video->format) || IMGFMT_IS_BGR(sh_video->format))
3398
a73b02e35e70 give the IMGFMT_ for sh_video->format not 0x0
alex
parents: 3285
diff changeset
256 // sh_video->format = 0x0;
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
257
09d5c9834580 tv update
alex
parents: 2790
diff changeset
258 /* set FPS and FRAMETIME */
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
259
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
260 if(!sh_video->fps)
98769cea155c added tv subsystem
alex
parents:
diff changeset
261 {
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
262 int tmp;
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
263 if (funcs->control(tvh->priv, TVI_CONTROL_VID_GET_FPS, &tmp) != TVI_CONTROL_TRUE)
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
264 sh_video->fps = 25.0f; /* on PAL */
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
265 else sh_video->fps = tmp;
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
266 }
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
267
3285
bd7bff4cb453 add tv fps support
alex
parents: 3284
diff changeset
268 if (tv_param_fps != -1.0f)
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
269 sh_video->fps = tv_param_fps;
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
270
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
271 sh_video->frametime = 1.0f/sh_video->fps;
98769cea155c added tv subsystem
alex
parents:
diff changeset
272
3815
622a9ade4517 updated
alex
parents: 3728
diff changeset
273 printf("fps: %f, frametime: %f\n", sh_video->fps, sh_video->frametime);
622a9ade4517 updated
alex
parents: 3728
diff changeset
274
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
275 #ifdef HAVE_TV_BSDBT848
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
276 /* If playback only mode, go to immediate mode, fail silently */
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
277 if(tv_param_immediate == 1)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
278 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
279 funcs->control(tvh->priv, TVI_CONTROL_IMMEDIATE, 0);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
280 tv_param_noaudio = 1;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
281 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
282 #endif
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
283
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
284 /* set width */
2932
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
285 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_WIDTH, &sh_video->disp_w);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
286
98769cea155c added tv subsystem
alex
parents:
diff changeset
287 /* set height */
2932
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
288 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HEIGHT, &sh_video->disp_h);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
289
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2817
diff changeset
290 mp_msg(MSGT_TV, MSGL_INFO, "Output size: %dx%d\n", sh_video->disp_w, sh_video->disp_h);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
291
98769cea155c added tv subsystem
alex
parents:
diff changeset
292 demuxer->video->sh = sh_video;
98769cea155c added tv subsystem
alex
parents:
diff changeset
293 sh_video->ds = demuxer->video;
98769cea155c added tv subsystem
alex
parents:
diff changeset
294 demuxer->video->id = 0;
2932
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
295
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
296 // demuxer->seekable = 0;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
297
98769cea155c added tv subsystem
alex
parents:
diff changeset
298 /* here comes audio init */
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
299
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
300 if (tv_param_noaudio == 0 && funcs->control(tvh->priv, TVI_CONTROL_IS_AUDIO, 0) == TVI_CONTROL_TRUE)
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
301 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
302 int audio_format;
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
303 int sh_audio_format;
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
304
09d5c9834580 tv update
alex
parents: 2790
diff changeset
305 /* yeah, audio is present */
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
306
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
307 funcs->control(tvh->priv, TVI_CONTROL_AUD_SET_SAMPLERATE,
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
308 &tv_param_audiorate);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
309
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
310 if (funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_FORMAT, &audio_format) != TVI_CONTROL_TRUE)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
311 goto no_audio;
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
312
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
313 switch(audio_format)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
314 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
315 case AFMT_U8:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
316 case AFMT_S8:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
317 case AFMT_U16_LE:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
318 case AFMT_U16_BE:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
319 case AFMT_S16_LE:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
320 case AFMT_S16_BE:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
321 case AFMT_S32_LE:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
322 case AFMT_S32_BE:
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
323 sh_audio_format = 0x1; /* PCM */
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
324 break;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
325 case AFMT_IMA_ADPCM:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
326 case AFMT_MU_LAW:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
327 case AFMT_A_LAW:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
328 case AFMT_MPEG:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
329 case AFMT_AC3:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
330 default:
6161
c50ea0721e78 applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents: 5923
diff changeset
331 mp_msg(MSGT_TV, MSGL_ERR, "Audio type '%s (%x)' unsupported!\n",
c50ea0721e78 applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents: 5923
diff changeset
332 audio_out_format_name(audio_format), audio_format);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
333 goto no_audio;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
334 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
335
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
336 sh_audio = new_sh_audio(demuxer, 0);
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
337
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
338 funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_SAMPLERATE,
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
339 &sh_audio->samplerate);
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
340 funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_SAMPLESIZE,
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
341 &sh_audio->samplesize);
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
342 funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_CHANNELS,
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
343 &sh_audio->channels);
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
344
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
345 sh_audio->format = sh_audio_format;
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
346 sh_audio->sample_format = audio_format;
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
347
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
348 sh_audio->i_bps = sh_audio->o_bps =
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
349 sh_audio->samplerate * sh_audio->samplesize *
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
350 sh_audio->channels;
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
351
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
352 // emulate WF for win32 codecs:
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
353 sh_audio->wf = (WAVEFORMATEX *)malloc(sizeof(WAVEFORMATEX));
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
354 sh_audio->wf->wFormatTag = sh_audio->format;
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
355 sh_audio->wf->nChannels = sh_audio->channels;
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
356 sh_audio->wf->wBitsPerSample = sh_audio->samplesize * 8;
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
357 sh_audio->wf->nSamplesPerSec = sh_audio->samplerate;
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
358 sh_audio->wf->nBlockAlign = sh_audio->samplesize * sh_audio->channels;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
359 sh_audio->wf->nAvgBytesPerSec = sh_audio->i_bps;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
360
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
361 mp_msg(MSGT_DECVIDEO, MSGL_V, " TV audio: %d channels, %d bits, %d Hz\n",
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
362 sh_audio->wf->nChannels, sh_audio->wf->wBitsPerSample,
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
363 sh_audio->wf->nSamplesPerSec);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
364
09d5c9834580 tv update
alex
parents: 2790
diff changeset
365 demuxer->audio->sh = sh_audio;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
366 sh_audio->ds = demuxer->audio;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
367 demuxer->audio->id = 0;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
368 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
369 no_audio:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
370
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
371 return(funcs->start(tvh->priv));
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
372 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
373
98769cea155c added tv subsystem
alex
parents:
diff changeset
374 /* ================== STREAM_TV ===================== */
6161
c50ea0721e78 applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents: 5923
diff changeset
375 tvi_handle_t *tvi_init_dummy(char *device);
c50ea0721e78 applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents: 5923
diff changeset
376 tvi_handle_t *tvi_init_v4l(char *device);
c50ea0721e78 applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents: 5923
diff changeset
377 tvi_handle_t *tvi_init_bsdbt848(char *device);
c50ea0721e78 applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents: 5923
diff changeset
378
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
379 tvi_handle_t *tv_begin(void)
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
380 {
98769cea155c added tv subsystem
alex
parents:
diff changeset
381 if (!strcmp(tv_param_driver, "dummy"))
6161
c50ea0721e78 applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents: 5923
diff changeset
382 return tvi_init_dummy(tv_param_device);
3249
49a0d462dffe init_v4l only present if HAVE_TV_V4L
alex
parents: 2941
diff changeset
383 #ifdef HAVE_TV_V4L
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
384 if (!strcmp(tv_param_driver, "v4l"))
6161
c50ea0721e78 applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents: 5923
diff changeset
385 return tvi_init_v4l(tv_param_device);
3249
49a0d462dffe init_v4l only present if HAVE_TV_V4L
alex
parents: 2941
diff changeset
386 #endif
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
387 #ifdef HAVE_TV_BSDBT848
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
388 if (!strcmp(tv_param_driver, "bsdbt848"))
6161
c50ea0721e78 applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents: 5923
diff changeset
389 return tvi_init_bsdbt848(tv_param_device);
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
390 #endif
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
391
98769cea155c added tv subsystem
alex
parents:
diff changeset
392 mp_msg(MSGT_TV, MSGL_ERR, "No such driver: %s\n", tv_param_driver);
98769cea155c added tv subsystem
alex
parents:
diff changeset
393 return(NULL);
98769cea155c added tv subsystem
alex
parents:
diff changeset
394 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
395
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
396 int tv_init(tvi_handle_t *tvh)
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
397 {
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2817
diff changeset
398 mp_msg(MSGT_TV, MSGL_INFO, "Selected driver: %s\n", tvh->info->short_name);
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2817
diff changeset
399 mp_msg(MSGT_TV, MSGL_INFO, " name: %s\n", tvh->info->name);
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2817
diff changeset
400 mp_msg(MSGT_TV, MSGL_INFO, " author: %s\n", tvh->info->author);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
401 if (tvh->info->comment)
2818
9f68d309f8cb printf's changed into mp_msg
alex
parents: 2817
diff changeset
402 mp_msg(MSGT_TV, MSGL_INFO, " comment: %s\n", tvh->info->comment);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
403
3815
622a9ade4517 updated
alex
parents: 3728
diff changeset
404 return(tvh->functions->init(tvh->priv));
2837
c63562f5f56f tuning worx (can set frequency)
alex
parents: 2830
diff changeset
405 }
c63562f5f56f tuning worx (can set frequency)
alex
parents: 2830
diff changeset
406
c63562f5f56f tuning worx (can set frequency)
alex
parents: 2830
diff changeset
407 int tv_uninit(tvi_handle_t *tvh)
c63562f5f56f tuning worx (can set frequency)
alex
parents: 2830
diff changeset
408 {
c63562f5f56f tuning worx (can set frequency)
alex
parents: 2830
diff changeset
409 return(tvh->functions->uninit(tvh->priv));
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
410 }
2937
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
411
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
412 /* utilities for mplayer (not mencoder!!) */
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
413 int tv_set_color_options(tvi_handle_t *tvh, int opt, int value)
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
414 {
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
415 tvi_functions_t *funcs = tvh->functions;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
416
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
417 switch(opt)
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
418 {
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
419 case TV_COLOR_BRIGHTNESS:
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
420 if (value == 50)
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
421 value = 32768;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
422 if (value > 50)
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
423 {
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
424 value *= 100;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
425 value += 32768;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
426 }
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
427 if (value < 50)
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
428 {
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
429 int i;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
430 value *= 100;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
431 i = value;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
432 value = 32768 - i;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
433 }
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
434 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_BRIGHTNESS, &value);
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
435 break;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
436 case TV_COLOR_HUE:
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
437 if (value == 50)
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
438 value = 32768;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
439 if (value > 50)
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
440 {
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
441 value *= 100;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
442 value += 32768;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
443 }
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
444 if (value < 50)
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
445 {
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
446 int i;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
447 value *= 100;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
448 i = value;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
449 value = 32768 - i;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
450 }
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
451 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_HUE, &value);
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
452 break;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
453 case TV_COLOR_SATURATION:
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
454 if (value == 50)
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
455 value = 32512;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
456 if (value > 50)
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
457 {
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
458 value *= 100;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
459 value += 32512;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
460 }
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
461 if (value < 50)
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
462 {
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
463 int i;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
464 value *= 100;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
465 i = value;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
466 value = 32512 - i;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
467 }
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
468 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_SATURATION, &value);
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
469 break;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
470 case TV_COLOR_CONTRAST:
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
471 if (value == 50)
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
472 value = 27648;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
473 if (value > 50)
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
474 {
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
475 value *= 100;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
476 value += 27648;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
477 }
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
478 if (value < 50)
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
479 {
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
480 int i;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
481 value *= 100;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
482 i = value;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
483 value = 27648 - i;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
484 }
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
485 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_CONTRAST, &value);
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
486 break;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
487 default:
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
488 mp_msg(MSGT_TV, MSGL_WARN, "Unknown color option (%d) specified!\n", opt);
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
489 }
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
490
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
491 return(1);
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
492 }
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
493
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
494 int tv_set_freq(tvi_handle_t *tvh, unsigned long freq)
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
495 {
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
496 if (tvh->functions->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) == TVI_CONTROL_TRUE)
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
497 {
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
498 // unsigned long freq = atof(tv_param_freq)*16;
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
499
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
500 /* set freq in MHz */
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
501 tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_FREQ, &freq);
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
502
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
503 tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &freq);
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
504 mp_msg(MSGT_TV, MSGL_INFO, "Current frequency: %lu (%.3f)\n",
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
505 freq, (float)freq/16);
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
506 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
507 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
508
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
509 int tv_step_channel(tvi_handle_t *tvh, int direction)
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
510 {
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
511 struct CHANLIST cl;
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
512
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
513 if (direction == TV_CHANNEL_LOWER)
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
514 {
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
515 if (tvh->channel-1 >= 0)
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
516 {
5923
4241047fb315 patch by J¸«ärgen Appel <jappel@linux01.gwdg.de>:
pl
parents: 5572
diff changeset
517 cl = tvh->chanlist_s[--tvh->channel];
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
518 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n",
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
519 cl.name, (float)cl.freq/1000);
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
520 tv_set_freq(tvh, (unsigned long)(((float)cl.freq/1000)*16));
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
521 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
522 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
523
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
524 if (direction == TV_CHANNEL_HIGHER)
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
525 {
4242
bbfbe9bbb956 fixed channel changing with frequencies.c
alex
parents: 3815
diff changeset
526 if (tvh->channel+1 < chanlists[tvh->chanlist].count)
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
527 {
5923
4241047fb315 patch by J¸«ärgen Appel <jappel@linux01.gwdg.de>:
pl
parents: 5572
diff changeset
528 cl = tvh->chanlist_s[++tvh->channel];
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
529 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n",
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
530 cl.name, (float)cl.freq/1000);
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
531 tv_set_freq(tvh, (unsigned long)(((float)cl.freq/1000)*16));
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
532 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
533 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
534 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
535
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
536 int tv_step_norm(tvi_handle_t *tvh)
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
537 {
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
538 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
539
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
540 int tv_step_chanlist(tvi_handle_t *tvh)
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
541 {
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
542 }
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
543 #endif /* USE_TV */