2009-08-02 14:50:24 +00:00
|
|
|
/*
|
2009-08-15 23:41:35 +00:00
|
|
|
* TV interface
|
2009-08-02 14:50:24 +00:00
|
|
|
*
|
2009-08-15 23:33:56 +00:00
|
|
|
* Copyright (C) 2001 Alex Beregszászi
|
|
|
|
* Copyright (C) 2007 Attila Ötvös
|
2009-08-02 14:50:24 +00:00
|
|
|
* Copyright (C) 2007 Vladimir Voroshilov <voroshil@gmail.com>
|
|
|
|
*
|
|
|
|
* This file is part of MPlayer.
|
|
|
|
*
|
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MPlayer is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#ifndef MPLAYER_TV_H
|
|
|
|
#define MPLAYER_TV_H
|
2001-11-09 23:46:06 +00:00
|
|
|
|
2013-12-21 19:24:20 +00:00
|
|
|
struct mp_log;
|
|
|
|
|
2014-06-09 21:54:45 +00:00
|
|
|
typedef struct tv_params {
|
2007-07-29 10:11:24 +00:00
|
|
|
char *freq;
|
|
|
|
char *channel;
|
|
|
|
char *chanlist;
|
|
|
|
char *norm;
|
|
|
|
int automute;
|
|
|
|
int normid;
|
|
|
|
char *device;
|
|
|
|
char *driver;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
int input;
|
|
|
|
int outfmt;
|
|
|
|
float fps;
|
|
|
|
char **channels;
|
2014-06-09 21:54:45 +00:00
|
|
|
int audio;
|
2007-07-29 10:11:24 +00:00
|
|
|
int immediate;
|
|
|
|
int audiorate;
|
|
|
|
int audio_id;
|
|
|
|
int amode;
|
|
|
|
int volume;
|
|
|
|
int bass;
|
|
|
|
int treble;
|
|
|
|
int balance;
|
|
|
|
int forcechan;
|
|
|
|
int force_audio;
|
|
|
|
int buffer_size;
|
|
|
|
int mjpeg;
|
|
|
|
int decimation;
|
|
|
|
int quality;
|
|
|
|
int alsa;
|
2007-08-13 17:41:56 +00:00
|
|
|
char* adevice;
|
2007-07-29 10:11:24 +00:00
|
|
|
int brightness;
|
|
|
|
int contrast;
|
|
|
|
int hue;
|
|
|
|
int saturation;
|
2007-09-18 16:28:39 +00:00
|
|
|
int gain;
|
2007-08-23 16:09:30 +00:00
|
|
|
|
|
|
|
int scan;
|
|
|
|
int scan_threshold;
|
|
|
|
float scan_period;
|
2007-07-29 10:11:24 +00:00
|
|
|
} tv_param_t;
|
2009-05-13 02:58:57 +00:00
|
|
|
|
2014-06-09 21:54:45 +00:00
|
|
|
struct tv_stream_params {
|
|
|
|
char *channel;
|
|
|
|
int input;
|
|
|
|
};
|
2009-05-13 02:58:57 +00:00
|
|
|
|
2001-11-09 23:46:06 +00:00
|
|
|
typedef struct tvi_info_s
|
|
|
|
{
|
2013-12-21 19:24:20 +00:00
|
|
|
struct tvi_handle_s * (*tvi_init)(struct mp_log *log, tv_param_t* tv_param);
|
2001-11-09 23:46:06 +00:00
|
|
|
const char *name;
|
|
|
|
const char *short_name;
|
|
|
|
} tvi_info_t;
|
|
|
|
|
2010-06-13 17:20:29 +00:00
|
|
|
|
|
|
|
struct priv;
|
|
|
|
|
2001-11-09 23:46:06 +00:00
|
|
|
typedef struct tvi_functions_s
|
|
|
|
{
|
2010-06-13 17:20:29 +00:00
|
|
|
int (*init)(struct priv *priv);
|
|
|
|
int (*uninit)(struct priv *priv);
|
|
|
|
int (*control)(struct priv *priv, int cmd, void *arg);
|
|
|
|
int (*start)(struct priv *priv);
|
|
|
|
double (*grab_video_frame)(struct priv *priv, char *buffer, int len);
|
|
|
|
int (*get_video_framesize)(struct priv *priv);
|
|
|
|
double (*grab_audio_frame)(struct priv *priv, char *buffer, int len);
|
|
|
|
int (*get_audio_framesize)(struct priv *priv);
|
2001-11-09 23:46:06 +00:00
|
|
|
} tvi_functions_t;
|
|
|
|
|
|
|
|
typedef struct tvi_handle_s {
|
2013-12-21 19:24:20 +00:00
|
|
|
struct mp_log *log;
|
2014-04-13 16:00:51 +00:00
|
|
|
const tvi_functions_t *functions;
|
|
|
|
void *priv;
|
|
|
|
int seq;
|
|
|
|
struct demuxer *demuxer;
|
2001-11-17 00:23:48 +00:00
|
|
|
|
|
|
|
/* specific */
|
2014-04-13 16:00:51 +00:00
|
|
|
int norm;
|
|
|
|
int chanlist;
|
2006-04-03 06:38:55 +00:00
|
|
|
const struct CHANLIST *chanlist_s;
|
2014-04-13 16:00:51 +00:00
|
|
|
int channel;
|
2007-07-29 10:11:24 +00:00
|
|
|
tv_param_t * tv_param;
|
2007-08-23 16:09:30 +00:00
|
|
|
void * scan;
|
2014-06-09 21:54:45 +00:00
|
|
|
|
|
|
|
struct tv_channels_s *tv_channel_list;
|
|
|
|
struct tv_channels_s *tv_channel_current, *tv_channel_last;
|
|
|
|
char *tv_channel_last_real;
|
2001-11-09 23:46:06 +00:00
|
|
|
} tvi_handle_t;
|
|
|
|
|
2002-12-28 22:57:39 +00:00
|
|
|
typedef struct tv_channels_s {
|
|
|
|
int index;
|
|
|
|
char number[5];
|
|
|
|
char name[20];
|
2008-06-14 09:14:16 +00:00
|
|
|
int norm;
|
2002-12-28 22:57:39 +00:00
|
|
|
int freq;
|
|
|
|
struct tv_channels_s *next;
|
|
|
|
struct tv_channels_s *prev;
|
|
|
|
} tv_channels_t;
|
|
|
|
|
2007-08-23 16:09:30 +00:00
|
|
|
typedef struct {
|
|
|
|
unsigned int scan_timer;
|
|
|
|
int channel_num;
|
|
|
|
int new_channels;
|
|
|
|
} tv_scan_t;
|
|
|
|
|
2014-04-13 16:00:51 +00:00
|
|
|
#define TVI_CONTROL_FALSE 0
|
|
|
|
#define TVI_CONTROL_TRUE 1
|
|
|
|
#define TVI_CONTROL_NA -1
|
|
|
|
#define TVI_CONTROL_UNKNOWN -2
|
2001-11-09 23:46:06 +00:00
|
|
|
|
2001-11-10 23:32:10 +00:00
|
|
|
/* ======================== CONTROLS =========================== */
|
|
|
|
|
|
|
|
/* GENERIC controls */
|
2014-04-13 16:00:51 +00:00
|
|
|
#define TVI_CONTROL_IS_AUDIO 0x1
|
|
|
|
#define TVI_CONTROL_IS_VIDEO 0x2
|
|
|
|
#define TVI_CONTROL_IS_TUNER 0x3
|
2002-08-21 21:31:20 +00:00
|
|
|
#define TVI_CONTROL_IMMEDIATE 0x4
|
2001-11-10 23:32:10 +00:00
|
|
|
|
|
|
|
/* VIDEO controls */
|
2014-04-13 16:00:51 +00:00
|
|
|
#define TVI_CONTROL_VID_GET_FPS 0x101
|
|
|
|
#define TVI_CONTROL_VID_GET_PLANES 0x102
|
|
|
|
#define TVI_CONTROL_VID_GET_BITS 0x103
|
|
|
|
#define TVI_CONTROL_VID_CHK_BITS 0x104
|
|
|
|
#define TVI_CONTROL_VID_SET_BITS 0x105
|
|
|
|
#define TVI_CONTROL_VID_GET_FORMAT 0x106
|
|
|
|
#define TVI_CONTROL_VID_CHK_FORMAT 0x107
|
|
|
|
#define TVI_CONTROL_VID_SET_FORMAT 0x108
|
|
|
|
#define TVI_CONTROL_VID_GET_WIDTH 0x109
|
|
|
|
#define TVI_CONTROL_VID_CHK_WIDTH 0x110
|
|
|
|
#define TVI_CONTROL_VID_SET_WIDTH 0x111
|
|
|
|
#define TVI_CONTROL_VID_GET_HEIGHT 0x112
|
|
|
|
#define TVI_CONTROL_VID_CHK_HEIGHT 0x113
|
|
|
|
#define TVI_CONTROL_VID_SET_HEIGHT 0x114
|
|
|
|
#define TVI_CONTROL_VID_GET_BRIGHTNESS 0x115
|
|
|
|
#define TVI_CONTROL_VID_SET_BRIGHTNESS 0x116
|
|
|
|
#define TVI_CONTROL_VID_GET_HUE 0x117
|
|
|
|
#define TVI_CONTROL_VID_SET_HUE 0x118
|
|
|
|
#define TVI_CONTROL_VID_GET_SATURATION 0x119
|
|
|
|
#define TVI_CONTROL_VID_SET_SATURATION 0x11a
|
|
|
|
#define TVI_CONTROL_VID_GET_CONTRAST 0x11b
|
|
|
|
#define TVI_CONTROL_VID_SET_CONTRAST 0x11c
|
|
|
|
#define TVI_CONTROL_VID_GET_PICTURE 0x11d
|
|
|
|
#define TVI_CONTROL_VID_SET_PICTURE 0x11e
|
|
|
|
#define TVI_CONTROL_VID_SET_GAIN 0x11f
|
|
|
|
#define TVI_CONTROL_VID_GET_GAIN 0x120
|
|
|
|
#define TVI_CONTROL_VID_SET_WIDTH_HEIGHT 0x121
|
2001-11-10 23:32:10 +00:00
|
|
|
|
|
|
|
/* TUNER controls */
|
2014-04-13 16:00:51 +00:00
|
|
|
#define TVI_CONTROL_TUN_GET_FREQ 0x201
|
|
|
|
#define TVI_CONTROL_TUN_SET_FREQ 0x202
|
|
|
|
#define TVI_CONTROL_TUN_GET_TUNER 0x203 /* update priv->tuner struct for used input */
|
|
|
|
#define TVI_CONTROL_TUN_SET_TUNER 0x204 /* update priv->tuner struct for used input */
|
|
|
|
#define TVI_CONTROL_TUN_GET_NORM 0x205
|
|
|
|
#define TVI_CONTROL_TUN_SET_NORM 0x206
|
|
|
|
#define TVI_CONTROL_TUN_GET_SIGNAL 0x207
|
2001-11-10 23:32:10 +00:00
|
|
|
|
|
|
|
/* AUDIO controls */
|
2014-04-13 16:00:51 +00:00
|
|
|
#define TVI_CONTROL_AUD_GET_FORMAT 0x301
|
|
|
|
#define TVI_CONTROL_AUD_GET_SAMPLERATE 0x302
|
|
|
|
#define TVI_CONTROL_AUD_GET_CHANNELS 0x304
|
|
|
|
#define TVI_CONTROL_AUD_SET_SAMPLERATE 0x305
|
2001-11-10 23:32:10 +00:00
|
|
|
|
|
|
|
/* SPECIFIC controls */
|
2014-04-13 16:00:51 +00:00
|
|
|
#define TVI_CONTROL_SPC_GET_INPUT 0x401 /* set input channel (tv,s-video,composite..) */
|
|
|
|
#define TVI_CONTROL_SPC_SET_INPUT 0x402 /* set input channel (tv,s-video,composite..) */
|
|
|
|
#define TVI_CONTROL_SPC_GET_NORMID 0x403 /* get normid from norm name */
|
2001-11-09 23:46:06 +00:00
|
|
|
|
2001-11-17 00:23:48 +00:00
|
|
|
int tv_set_color_options(tvi_handle_t *tvh, int opt, int val);
|
2006-04-21 12:45:18 +00:00
|
|
|
int tv_get_color_options(tvi_handle_t *tvh, int opt, int* val);
|
2001-11-16 22:59:07 +00:00
|
|
|
|
2002-12-28 22:57:39 +00:00
|
|
|
int tv_step_channel_real(tvi_handle_t *tvh, int direction);
|
2001-11-17 00:23:48 +00:00
|
|
|
int tv_step_channel(tvi_handle_t *tvh, int direction);
|
2014-04-13 16:00:51 +00:00
|
|
|
#define TV_CHANNEL_LOWER 1
|
|
|
|
#define TV_CHANNEL_HIGHER 2
|
2001-11-17 00:23:48 +00:00
|
|
|
|
2002-12-28 22:57:39 +00:00
|
|
|
int tv_last_channel(tvi_handle_t *tvh);
|
|
|
|
|
|
|
|
int tv_set_channel_real(tvi_handle_t *tvh, char *channel);
|
2002-12-19 10:09:43 +00:00
|
|
|
int tv_set_channel(tvi_handle_t *tvh, char *channel);
|
|
|
|
|
2001-11-17 00:23:48 +00:00
|
|
|
int tv_step_norm(tvi_handle_t *tvh);
|
|
|
|
int tv_step_chanlist(tvi_handle_t *tvh);
|
|
|
|
|
2003-08-04 09:13:10 +00:00
|
|
|
int tv_set_freq(tvi_handle_t *tvh, unsigned long freq);
|
|
|
|
int tv_get_freq(tvi_handle_t *tvh, unsigned long *freq);
|
2007-08-23 16:09:30 +00:00
|
|
|
int tv_get_signal(tvi_handle_t *tvh);
|
2007-03-17 11:51:17 +00:00
|
|
|
int tv_step_freq(tvi_handle_t *tvh, float step_interval);
|
2003-08-04 09:13:10 +00:00
|
|
|
|
|
|
|
int tv_set_norm(tvi_handle_t *tvh, char* norm);
|
|
|
|
|
2007-08-23 16:09:30 +00:00
|
|
|
void tv_start_scan(tvi_handle_t *tvh, int start);
|
|
|
|
|
2013-12-21 19:24:20 +00:00
|
|
|
tvi_handle_t *tv_new_handle(int size, struct mp_log *log, const tvi_functions_t *functions);
|
2010-09-11 23:53:15 +00:00
|
|
|
void tv_free_handle(tvi_handle_t *h);
|
|
|
|
|
2014-04-13 16:00:51 +00:00
|
|
|
#define TV_NORM_PAL 1
|
|
|
|
#define TV_NORM_NTSC 2
|
|
|
|
#define TV_NORM_SECAM 3
|
|
|
|
#define TV_NORM_PALNC 4
|
|
|
|
#define TV_NORM_PALM 5
|
|
|
|
#define TV_NORM_PALN 6
|
|
|
|
#define TV_NORM_NTSCJP 7
|
2001-11-17 00:23:48 +00:00
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#endif /* MPLAYER_TV_H */
|