2006-07-31 18:36:29 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2006 Benjamin Zores
|
|
|
|
* Stream layer for TV Input, based on previous work from Albeu
|
|
|
|
*
|
|
|
|
* This program 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.
|
|
|
|
*
|
|
|
|
* This program 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 this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "stream.h"
|
2006-08-04 17:01:29 +00:00
|
|
|
#include "libmpdemux/demuxer.h"
|
2007-06-28 18:36:05 +00:00
|
|
|
#include "m_option.h"
|
|
|
|
#include "m_struct.h"
|
2007-07-29 10:11:24 +00:00
|
|
|
#include "tv.h"
|
2007-06-28 18:36:05 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2007-07-29 10:11:24 +00:00
|
|
|
tv_param_t stream_tv_defaults = {
|
|
|
|
NULL, //freq
|
|
|
|
NULL, //channel
|
|
|
|
"europe-east", //chanlist
|
|
|
|
"pal", //norm
|
|
|
|
0, //automute
|
|
|
|
-1, //normid
|
|
|
|
NULL, //device
|
2007-09-10 17:09:35 +00:00
|
|
|
NULL, //driver
|
2007-07-29 10:11:24 +00:00
|
|
|
-1, //width
|
|
|
|
-1, //height
|
|
|
|
0, //input, used in v4l and bttv
|
|
|
|
-1, //outfmt
|
|
|
|
-1.0, //fps
|
|
|
|
NULL, //channels
|
|
|
|
0, //noaudio;
|
|
|
|
0, //immediate;
|
|
|
|
44100, //audiorate;
|
|
|
|
0, //audio_id
|
|
|
|
-1, //amode
|
|
|
|
-1, //volume
|
|
|
|
-1, //bass
|
|
|
|
-1, //treble
|
|
|
|
-1, //balance
|
|
|
|
-1, //forcechan
|
|
|
|
0, //force_audio
|
|
|
|
-1, //buffer_size
|
|
|
|
0, //mjpeg
|
|
|
|
2, //decimation
|
|
|
|
90, //quality
|
|
|
|
0, //alsa
|
2007-08-26 15:03:43 +00:00
|
|
|
NULL, //adevice
|
2007-07-29 10:11:24 +00:00
|
|
|
0, //brightness
|
|
|
|
0, //contrast
|
|
|
|
0, //hue
|
|
|
|
0, //saturation
|
2007-09-18 16:28:39 +00:00
|
|
|
-1, //gain
|
2007-07-29 17:55:28 +00:00
|
|
|
NULL, //tdevice
|
|
|
|
0, //tformat
|
2007-08-23 16:09:30 +00:00
|
|
|
100, //tpage
|
2007-08-31 16:53:27 +00:00
|
|
|
0, //tlang
|
2007-08-23 16:09:30 +00:00
|
|
|
0, //scan_autostart
|
|
|
|
50, //scan_threshold
|
2007-10-13 17:14:39 +00:00
|
|
|
0.5, //scan_period
|
|
|
|
0, //hidden_video_renderer;
|
|
|
|
0, //hidden_vp_renderer;
|
|
|
|
0, //system_clock;
|
|
|
|
0 //normalize_audio_chunks;
|
2007-06-28 18:36:05 +00:00
|
|
|
};
|
|
|
|
|
2007-07-29 10:11:24 +00:00
|
|
|
#define ST_OFF(f) M_ST_OFF(tv_param_t,f)
|
2007-12-02 21:37:08 +00:00
|
|
|
static const m_option_t stream_opts_fields[] = {
|
2007-06-28 18:36:05 +00:00
|
|
|
{"hostname", ST_OFF(channel), CONF_TYPE_STRING, 0, 0 ,0, NULL},
|
|
|
|
{"filename", ST_OFF(input), CONF_TYPE_INT, 0, 0 ,0, NULL},
|
|
|
|
{ NULL, NULL, 0, 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
2008-01-13 12:34:42 +00:00
|
|
|
static const struct m_struct_st stream_opts = {
|
2007-06-28 18:36:05 +00:00
|
|
|
"tv",
|
2007-07-29 10:11:24 +00:00
|
|
|
sizeof(tv_param_t),
|
|
|
|
&stream_tv_defaults,
|
2007-06-28 18:36:05 +00:00
|
|
|
stream_opts_fields
|
|
|
|
};
|
2006-07-31 18:36:29 +00:00
|
|
|
|
2007-07-29 10:11:24 +00:00
|
|
|
static void
|
|
|
|
tv_stream_close (stream_t *stream)
|
|
|
|
{
|
|
|
|
if(stream->priv)
|
|
|
|
m_struct_free(&stream_opts,stream->priv);
|
|
|
|
stream->priv=NULL;
|
|
|
|
}
|
2006-07-31 18:36:29 +00:00
|
|
|
static int
|
|
|
|
tv_stream_open (stream_t *stream, int mode, void *opts, int *file_format)
|
|
|
|
{
|
2007-06-30 10:59:55 +00:00
|
|
|
|
2006-08-03 19:12:31 +00:00
|
|
|
stream->type = STREAMTYPE_TV;
|
2007-07-29 10:11:24 +00:00
|
|
|
stream->priv = opts;
|
|
|
|
stream->close=tv_stream_close;
|
2006-07-31 18:36:29 +00:00
|
|
|
*file_format = DEMUXER_TYPE_TV;
|
2007-06-30 10:59:55 +00:00
|
|
|
|
2006-07-31 18:36:29 +00:00
|
|
|
return STREAM_OK;
|
|
|
|
}
|
|
|
|
|
2007-12-02 13:22:53 +00:00
|
|
|
const stream_info_t stream_info_tv = {
|
2006-07-31 18:36:29 +00:00
|
|
|
"TV Input",
|
|
|
|
"tv",
|
|
|
|
"Benjamin Zores, Albeu",
|
|
|
|
"",
|
|
|
|
tv_stream_open,
|
|
|
|
{ "tv", NULL },
|
2007-06-28 18:36:05 +00:00
|
|
|
&stream_opts,
|
2006-07-31 18:36:29 +00:00
|
|
|
1
|
|
|
|
};
|