1
0
mirror of https://github.com/mpv-player/mpv synced 2025-04-01 14:50:07 +00:00

stream_pvr: remove global option variables

This commit is contained in:
wm4 2014-06-10 20:12:19 +02:00
parent fcf9bb95b5
commit 73ac34b220
7 changed files with 122 additions and 250 deletions

View File

@ -1691,8 +1691,8 @@ OPTIONS
You can also try to use ``--no-correct-pts`` for files with completely You can also try to use ``--no-correct-pts`` for files with completely
broken timestamps. broken timestamps.
``--pvr=<option1:option2:...>`` ``--pvr-...``
This option tunes various encoding properties of the PVR capture module. These options tune various encoding properties of the PVR capture module.
It has to be used with any hardware MPEG encoder based card supported by It has to be used with any hardware MPEG encoder based card supported by
the V4L2 driver. The Hauppauge WinTV PVR-150/250/350/500 and all IVTV the V4L2 driver. The Hauppauge WinTV PVR-150/250/350/500 and all IVTV
based cards are known as PVR capture cards. Be aware that only Linux based cards are known as PVR capture cards. Be aware that only Linux
@ -1700,9 +1700,8 @@ OPTIONS
For hardware capture of an MPEG stream and watching it with mpv, use For hardware capture of an MPEG stream and watching it with mpv, use
``pvr://`` as a movie URL. ``pvr://`` as a movie URL.
Available options are:
``aspect=<0-3>`` ``--pvr-aspect=<0-3>``
Specify input aspect ratio: Specify input aspect ratio:
:0: 1:1 :0: 1:1
@ -1710,34 +1709,34 @@ OPTIONS
:2: 16:9 :2: 16:9
:3: 2.21:1 :3: 2.21:1
``arate=<32000-48000>`` ``--pvr-arate=<32000-48000>``
Specify encoding audio rate (default: 48000 Hz, available: 32000, Specify encoding audio rate (default: 48000 Hz, available: 32000,
44100 and 48000 Hz). 44100 and 48000 Hz).
``alayer=<1-3>`` ``--pvr-alayer=<1-3>``
Specify MPEG audio layer encoding (default: 2). Specify MPEG audio layer encoding (default: 2).
``abitrate=<32-448>`` ``--pvr-abitrate=<32-448>``
Specify audio encoding bitrate in kbps (default: 384). Specify audio encoding bitrate in kbps (default: 384).
``amode=<value>`` ``--pvr-amode=<value>``
Specify audio encoding mode. Available preset values are 'stereo', Specify audio encoding mode. Available preset values are 'stereo',
'joint_stereo', 'dual' and 'mono' (default: stereo). 'joint_stereo', 'dual' and 'mono' (default: stereo).
``vbitrate=<value>`` ``--pvr-vbitrate=<value>``
Specify average video bitrate encoding in Mbps (default: 6). Specify average video bitrate encoding in Mbps (default: 6).
``vmode=<value>`` ``--pvr-vmode=<value>``
Specify video encoding mode: Specify video encoding mode:
:vbr: Variable BitRate (default) :vbr: Variable BitRate (default)
:cbr: Constant BitRate :cbr: Constant BitRate
``vpeak=<value>`` ``--pvr-vpeak=<value>``
Specify peak video bitrate encoding in Mbps (only useful for VBR Specify peak video bitrate encoding in Mbps (only useful for VBR
encoding, default: 9.6). encoding, default: 9.6).
``fmt=<value>`` ``--pvr-fmt=<value>``
Choose an MPEG format for encoding: Choose an MPEG format for encoding:
:ps: MPEG-2 Program Stream (default) :ps: MPEG-2 Program Stream (default)

View File

@ -63,31 +63,7 @@ static void print_help(struct mp_log *log)
} }
extern const struct m_sub_options tv_params_conf; extern const struct m_sub_options tv_params_conf;
extern const struct m_sub_options stream_pvr_conf;
extern int pvr_param_aspect_ratio;
extern int pvr_param_sample_rate;
extern int pvr_param_audio_layer;
extern int pvr_param_audio_bitrate;
extern char *pvr_param_audio_mode;
extern int pvr_param_bitrate;
extern char *pvr_param_bitrate_mode;
extern int pvr_param_bitrate_peak;
extern char *pvr_param_stream_type;
#if HAVE_PVR
static const m_option_t pvropts_conf[]={
{"aspect", &pvr_param_aspect_ratio, CONF_TYPE_INT, 0, 1, 4, NULL},
{"arate", &pvr_param_sample_rate, CONF_TYPE_INT, 0, 32000, 48000, NULL},
{"alayer", &pvr_param_audio_layer, CONF_TYPE_INT, 0, 1, 2, NULL},
{"abitrate", &pvr_param_audio_bitrate, CONF_TYPE_INT, 0, 32, 448, NULL},
{"amode", &pvr_param_audio_mode, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"vbitrate", &pvr_param_bitrate, CONF_TYPE_INT, 0, 0, 0, NULL},
{"vmode", &pvr_param_bitrate_mode, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"vpeak", &pvr_param_bitrate_peak, CONF_TYPE_INT, 0, 0, 0, NULL},
{"fmt", &pvr_param_stream_type, CONF_TYPE_STRING, 0, 0, 0, NULL},
{NULL, NULL, 0, 0, 0, 0, NULL}
};
#endif /* HAVE_PVR */
extern const m_option_t dvbin_opts_conf[]; extern const m_option_t dvbin_opts_conf[];
extern const m_option_t lavfdopts_conf[]; extern const m_option_t lavfdopts_conf[];
@ -269,7 +245,7 @@ const m_option_t mp_opts[] = {
OPT_SUBSTRUCT("tv", tv_params, tv_params_conf, 0), OPT_SUBSTRUCT("tv", tv_params, tv_params_conf, 0),
#endif /* HAVE_TV */ #endif /* HAVE_TV */
#if HAVE_PVR #if HAVE_PVR
{"pvr", (void *) pvropts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL}, OPT_SUBSTRUCT("pvr", stream_pvr_opts, stream_pvr_conf, 0),
#endif /* HAVE_PVR */ #endif /* HAVE_PVR */
#if HAVE_DVBIN #if HAVE_DVBIN
{"dvbin", (void *) dvbin_opts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL}, {"dvbin", (void *) dvbin_opts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},

View File

@ -239,6 +239,7 @@ typedef struct MPOpts {
char *network_tls_ca_file; char *network_tls_ca_file;
struct tv_params *tv_params; struct tv_params *tv_params;
struct pvr_params *stream_pvr_opts;
struct lavc_param { struct lavc_param {
int fast; int fast;

View File

@ -1210,6 +1210,4 @@ const struct CHANLISTS chanlists[] = {
{ NULL, NULL, 0 } /* EOF */ { NULL, NULL, 0 } /* EOF */
}; };
int chantab = 5; const int chancount = CHAN_COUNT(europe_west);
const struct CHANLIST *chanlist = europe_west;
int chancount = CHAN_COUNT(europe_west);

View File

@ -124,10 +124,6 @@ struct CHANLISTS {
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
extern const struct CHANLISTS chanlists[]; extern const struct CHANLISTS chanlists[];
//extern struct STRTAB chanlist_names[]; extern const int chancount;
extern int chantab;
extern const struct CHANLIST *chanlist;
extern int chancount;
#endif /* MPLAYER_FREQUENCIES_H */ #endif /* MPLAYER_FREQUENCIES_H */

View File

@ -1,91 +0,0 @@
/*
* stream layer for hardware MPEG 1/2/4 encoders a.k.a PVR
* (such as WinTV PVR-150/250/350/500 (a.k.a IVTV), pvrusb2 and cx88)
* See http://ivtvdriver.org/index.php/Main_Page for more details on the
* cards supported by the ivtv driver.
*
* Copyright (C) 2006 Benjamin Zores
* Copyright (C) 2007 Sven Gothel (Channel Navigation)
*
* 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.
*/
#ifndef MPLAYER_PVR_H
#define MPLAYER_PVR_H
#include "stream.h"
#include "tv.h"
/**
* @brief Get the current station name.
* The pointer is valid, till the stream is closed.
* @return The stream's station name
*/
const char *pvr_get_current_stationname (stream_t *stream);
/**
* @brief Get the current channel name.
* The pointer is valid, till the stream is closed.
* @return The stream's channel name
*/
const char *pvr_get_current_channelname (stream_t *stream);
/**
* @brief Get the current frequency.
* @return frequency
*/
int pvr_get_current_frequency (stream_t *stream);
/**
* @brief Set the current station using the channel name.
* This function will fail,
* if the channel does not exist, or the station is not enabled
* @return 0 if the station is available, otherwise -1
*/
int pvr_set_channel (stream_t *stream, const char *channel);
/**
* @brief Set the current station using to the last set channel
* @return 0 if the station is available, otherwise -1
*/
int pvr_set_lastchannel (stream_t *stream);
/**
* @brief Set the current channel using the frequency.
* This function will fail,
* if the frequency does not exist, or the station is not enabled
* @return 0 if the station is available, otherwise -1
*/
int pvr_set_freq (stream_t *stream, int freq);
/**
* @brief Set the current station while stepping.
* This function will fail,
* if the station does not exist, or the station is not enabled
* @return 0 if the station is available, otherwise -1
*/
int pvr_set_channel_step (stream_t *stream, int step);
/**
* @brief Set the current frequency while stepping
* This function will fail,
* if the frequency is invalid, i.e. <0
* @return 0 if success, otherwise -1
*/
int pvr_force_freq_step (stream_t *stream, int step);
#endif /* MPLAYER_PVR_H */

View File

@ -48,8 +48,7 @@
#include "options/options.h" #include "options/options.h"
#include "stream.h" #include "stream.h"
#include "pvr.h" #include "tv.h"
#include "frequencies.h" #include "frequencies.h"
#define PVR_DEFAULT_DEVICE "/dev/video0" #define PVR_DEFAULT_DEVICE "/dev/video0"
@ -81,15 +80,34 @@
#define PVR_STATION_NAME_SIZE 256 #define PVR_STATION_NAME_SIZE 256
/* command line arguments */ /* command line arguments */
int pvr_param_aspect_ratio = 0; struct pvr_params {
int pvr_param_sample_rate = 0; int aspect_ratio;
int pvr_param_audio_layer = 0; int sample_rate;
int pvr_param_audio_bitrate = 0; int audio_layer;
char *pvr_param_audio_mode = NULL; int audio_bitrate;
int pvr_param_bitrate = 0; char *audio_mode;
char *pvr_param_bitrate_mode = NULL; int bitrate;
int pvr_param_bitrate_peak = 0; char *bitrate_mode;
char *pvr_param_stream_type = NULL; int bitrate_peak;
char *stream_type;
};
#define OPT_BASE_STRUCT struct pvr_params
const struct m_sub_options stream_pvr_conf = {
.opts = (const m_option_t[]) {
OPT_INT("aspect", aspect_ratio, 0),
OPT_INT("arate", sample_rate, 0),
OPT_INT("alayer", audio_layer, 0),
OPT_INT("abitrate", audio_bitrate, 0),
OPT_STRING("amode", audio_mode, 0),
OPT_INT("vbitrate", bitrate, 0),
OPT_STRING("vmode", bitrate_mode, 0),
OPT_INT("vpeak", bitrate_peak, 0),
OPT_STRING("fmt", stream_type, 0),
{0}
},
.size = sizeof(struct pvr_params),
};
#define BUFSTRCPY(d, s) av_strlcpy(d, s, sizeof(d)) #define BUFSTRCPY(d, s) av_strlcpy(d, s, sizeof(d))
#define BUFPRINTF(d, ...) snprintf(d, sizeof(d), __VA_ARGS__) #define BUFPRINTF(d, ...) snprintf(d, sizeof(d), __VA_ARGS__)
@ -112,8 +130,10 @@ typedef struct stationlist_s {
struct pvr_t { struct pvr_t {
struct mp_log *log; struct mp_log *log;
tv_param_t *tv_params; tv_param_t *tv_params;
struct pvr_params *params;
int dev_fd; int dev_fd;
char *video_dev; char *video_dev;
int chantab;
/* v4l2 params */ /* v4l2 params */
int mute; int mute;
@ -154,6 +174,7 @@ pvr_init (void)
pvr = calloc (1, sizeof (struct pvr_t)); pvr = calloc (1, sizeof (struct pvr_t));
pvr->dev_fd = -1; pvr->dev_fd = -1;
pvr->video_dev = strdup (PVR_DEFAULT_DEVICE); pvr->video_dev = strdup (PVR_DEFAULT_DEVICE);
pvr->chantab = 5;
/* v4l2 params */ /* v4l2 params */
pvr->mute = 0; pvr->mute = 0;
@ -213,10 +234,10 @@ copycreate_stationlist (struct pvr_t *pvr, stationlist_t *stationlist, int num)
{ {
int i; int i;
if (chantab < 0 || !stationlist) if (pvr->chantab < 0 || !stationlist)
return -1; return -1;
num = FFMAX (num, chanlists[chantab].count); num = FFMAX (num, chanlists[pvr->chantab].count);
free (stationlist->list); free (stationlist->list);
stationlist->list = NULL; stationlist->list = NULL;
@ -235,13 +256,13 @@ copycreate_stationlist (struct pvr_t *pvr, stationlist_t *stationlist, int num)
/* transport the channel list data to our extented struct */ /* transport the channel list data to our extented struct */
stationlist->total = num; stationlist->total = num;
BUFSTRCPY(stationlist->name, chanlists[chantab].name); BUFSTRCPY(stationlist->name, chanlists[pvr->chantab].name);
for (i = 0; i < chanlists[chantab].count; i++) for (i = 0; i < chanlists[pvr->chantab].count; i++)
{ {
stationlist->list[i].station[0]= '\0'; /* no station name yet */ stationlist->list[i].station[0]= '\0'; /* no station name yet */
BUFSTRCPY(stationlist->list[i].name, chanlists[chantab].list[i].name); BUFSTRCPY(stationlist->list[i].name, chanlists[pvr->chantab].list[i].name);
stationlist->list[i].freq = chanlists[chantab].list[i].freq; stationlist->list[i].freq = chanlists[pvr->chantab].list[i].freq;
stationlist->list[i].enabled = 1; /* default enabled */ stationlist->list[i].enabled = 1; /* default enabled */
stationlist->enabled++; stationlist->enabled++;
stationlist->used++; stationlist->used++;
@ -417,23 +438,23 @@ parse_setup_stationlist (struct pvr_t *pvr)
{ {
if (!strcasecmp (chanlists[i].name, pvr->tv_params->chanlist)) if (!strcasecmp (chanlists[i].name, pvr->tv_params->chanlist))
{ {
chantab = i; pvr->chantab = i;
break; break;
} }
} }
if (!chanlists[i].name) if (!chanlists[i].name)
{ {
MP_ERR(pvr, "%s unable to find channel list %s, using default %s\n", MP_ERR(pvr, "%s unable to find channel list %s, using default %s\n",
LOG_LEVEL_V4L2, pvr->tv_params->chanlist, chanlists[chantab].name); LOG_LEVEL_V4L2, pvr->tv_params->chanlist, chanlists[pvr->chantab].name);
} }
else else
{ {
MP_INFO(pvr, "%s select channel list %s, entries %d\n", LOG_LEVEL_V4L2, MP_INFO(pvr, "%s select channel list %s, entries %d\n", LOG_LEVEL_V4L2,
chanlists[chantab].name, chanlists[chantab].count); chanlists[pvr->chantab].name, chanlists[pvr->chantab].count);
} }
} }
if (0 > chantab) if (0 > pvr->chantab)
{ {
MP_FATAL(pvr, "%s No channel list selected, giving up\n", LOG_LEVEL_V4L2); MP_FATAL(pvr, "%s No channel list selected, giving up\n", LOG_LEVEL_V4L2);
return -1; return -1;
@ -733,29 +754,6 @@ set_station_by_channelname_or_freq (struct pvr_t *pvr, const char *channel,
return (pvr->freq > 0) ? 0 : -1; return (pvr->freq > 0) ? 0 : -1;
} }
static int
force_freq_step (struct pvr_t *pvr, int step)
{
int freq;
if (!pvr)
return -1;
freq = pvr->freq+step;
if (freq)
{
MP_INFO(pvr, "%s Force Frequency %d + %d = %d \n", LOG_LEVEL_V4L2,
pvr->freq, step, freq);
pvr->freq = freq;
return set_v4l2_freq (pvr);
}
return -1;
}
static void static void
parse_encoder_options (struct pvr_t *pvr) parse_encoder_options (struct pvr_t *pvr)
{ {
@ -763,13 +761,13 @@ parse_encoder_options (struct pvr_t *pvr)
return; return;
/* -pvr aspect=digit */ /* -pvr aspect=digit */
if (pvr_param_aspect_ratio >= 0 && pvr_param_aspect_ratio <= 3) if (pvr->params->aspect_ratio >= 0 && pvr->params->aspect_ratio <= 3)
pvr->aspect = pvr_param_aspect_ratio; pvr->aspect = pvr->params->aspect_ratio;
/* -pvr arate=x */ /* -pvr arate=x */
if (pvr_param_sample_rate != 0) if (pvr->params->sample_rate != 0)
{ {
switch (pvr_param_sample_rate) switch (pvr->params->sample_rate)
{ {
case 32000: case 32000:
pvr->samplerate = V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000; pvr->samplerate = V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000;
@ -786,19 +784,19 @@ parse_encoder_options (struct pvr_t *pvr)
} }
/* -pvr alayer=x */ /* -pvr alayer=x */
if (pvr_param_audio_layer == 1) if (pvr->params->audio_layer == 1)
pvr->layer = V4L2_MPEG_AUDIO_ENCODING_LAYER_1; pvr->layer = V4L2_MPEG_AUDIO_ENCODING_LAYER_1;
else if (pvr_param_audio_layer == 2) else if (pvr->params->audio_layer == 2)
pvr->layer = V4L2_MPEG_AUDIO_ENCODING_LAYER_2; pvr->layer = V4L2_MPEG_AUDIO_ENCODING_LAYER_2;
else if (pvr_param_audio_layer == 3) else if (pvr->params->audio_layer == 3)
pvr->layer = V4L2_MPEG_AUDIO_ENCODING_LAYER_3; pvr->layer = V4L2_MPEG_AUDIO_ENCODING_LAYER_3;
/* -pvr abitrate=x */ /* -pvr abitrate=x */
if (pvr_param_audio_bitrate != 0) if (pvr->params->audio_bitrate != 0)
{ {
if (pvr->layer == V4L2_MPEG_AUDIO_ENCODING_LAYER_1) if (pvr->layer == V4L2_MPEG_AUDIO_ENCODING_LAYER_1)
{ {
switch (pvr_param_audio_bitrate) switch (pvr->params->audio_bitrate)
{ {
case 32: case 32:
pvr->audio_rate = V4L2_MPEG_AUDIO_L1_BITRATE_32K; pvr->audio_rate = V4L2_MPEG_AUDIO_L1_BITRATE_32K;
@ -849,7 +847,7 @@ parse_encoder_options (struct pvr_t *pvr)
else if (pvr->layer == V4L2_MPEG_AUDIO_ENCODING_LAYER_2) else if (pvr->layer == V4L2_MPEG_AUDIO_ENCODING_LAYER_2)
{ {
switch (pvr_param_audio_bitrate) switch (pvr->params->audio_bitrate)
{ {
case 32: case 32:
pvr->audio_rate = V4L2_MPEG_AUDIO_L2_BITRATE_32K; pvr->audio_rate = V4L2_MPEG_AUDIO_L2_BITRATE_32K;
@ -900,7 +898,7 @@ parse_encoder_options (struct pvr_t *pvr)
else if (pvr->layer == V4L2_MPEG_AUDIO_ENCODING_LAYER_3) else if (pvr->layer == V4L2_MPEG_AUDIO_ENCODING_LAYER_3)
{ {
switch (pvr_param_audio_bitrate) switch (pvr->params->audio_bitrate)
{ {
case 32: case 32:
pvr->audio_rate = V4L2_MPEG_AUDIO_L3_BITRATE_32K; pvr->audio_rate = V4L2_MPEG_AUDIO_L3_BITRATE_32K;
@ -951,49 +949,49 @@ parse_encoder_options (struct pvr_t *pvr)
} }
/* -pvr amode=x */ /* -pvr amode=x */
if (pvr_param_audio_mode) if (pvr->params->audio_mode)
{ {
if (!strcmp (pvr_param_audio_mode, PVR_AUDIO_MODE_ARG_STEREO)) if (!strcmp (pvr->params->audio_mode, PVR_AUDIO_MODE_ARG_STEREO))
pvr->audio_mode = V4L2_MPEG_AUDIO_MODE_STEREO; pvr->audio_mode = V4L2_MPEG_AUDIO_MODE_STEREO;
else if (!strcmp (pvr_param_audio_mode, PVR_AUDIO_MODE_ARG_JOINT_STEREO)) else if (!strcmp (pvr->params->audio_mode, PVR_AUDIO_MODE_ARG_JOINT_STEREO))
pvr->audio_mode = V4L2_MPEG_AUDIO_MODE_JOINT_STEREO; pvr->audio_mode = V4L2_MPEG_AUDIO_MODE_JOINT_STEREO;
else if (!strcmp (pvr_param_audio_mode, PVR_AUDIO_MODE_ARG_DUAL)) else if (!strcmp (pvr->params->audio_mode, PVR_AUDIO_MODE_ARG_DUAL))
pvr->audio_mode = V4L2_MPEG_AUDIO_MODE_DUAL; pvr->audio_mode = V4L2_MPEG_AUDIO_MODE_DUAL;
else if (!strcmp (pvr_param_audio_mode, PVR_AUDIO_MODE_ARG_MONO)) else if (!strcmp (pvr->params->audio_mode, PVR_AUDIO_MODE_ARG_MONO))
pvr->audio_mode = V4L2_MPEG_AUDIO_MODE_MONO; pvr->audio_mode = V4L2_MPEG_AUDIO_MODE_MONO;
} }
/* -pvr vbitrate=x */ /* -pvr vbitrate=x */
if (pvr_param_bitrate) if (pvr->params->bitrate)
pvr->bitrate = pvr_param_bitrate; pvr->bitrate = pvr->params->bitrate;
/* -pvr vmode=x */ /* -pvr vmode=x */
if (pvr_param_bitrate_mode) if (pvr->params->bitrate_mode)
{ {
if (!strcmp (pvr_param_bitrate_mode, PVR_VIDEO_BITRATE_MODE_ARG_VBR)) if (!strcmp (pvr->params->bitrate_mode, PVR_VIDEO_BITRATE_MODE_ARG_VBR))
pvr->bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_VBR; pvr->bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_VBR;
else if (!strcmp (pvr_param_bitrate_mode, PVR_VIDEO_BITRATE_MODE_ARG_CBR)) else if (!strcmp (pvr->params->bitrate_mode, PVR_VIDEO_BITRATE_MODE_ARG_CBR))
pvr->bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_CBR; pvr->bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_CBR;
} }
/* -pvr vpeak=x */ /* -pvr vpeak=x */
if (pvr_param_bitrate_peak) if (pvr->params->bitrate_peak)
pvr->bitrate_peak = pvr_param_bitrate_peak; pvr->bitrate_peak = pvr->params->bitrate_peak;
/* -pvr fmt=x */ /* -pvr fmt=x */
if (pvr_param_stream_type) if (pvr->params->stream_type)
{ {
if (!strcmp (pvr_param_stream_type, PVR_VIDEO_STREAM_TYPE_PS)) if (!strcmp (pvr->params->stream_type, PVR_VIDEO_STREAM_TYPE_PS))
pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS; pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS;
else if (!strcmp (pvr_param_stream_type, PVR_VIDEO_STREAM_TYPE_TS)) else if (!strcmp (pvr->params->stream_type, PVR_VIDEO_STREAM_TYPE_TS))
pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_TS; pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_TS;
else if (!strcmp (pvr_param_stream_type, PVR_VIDEO_STREAM_TYPE_MPEG1)) else if (!strcmp (pvr->params->stream_type, PVR_VIDEO_STREAM_TYPE_MPEG1))
pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG1_SS; pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG1_SS;
else if (!strcmp (pvr_param_stream_type, PVR_VIDEO_STREAM_TYPE_DVD)) else if (!strcmp (pvr->params->stream_type, PVR_VIDEO_STREAM_TYPE_DVD))
pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_DVD; pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_DVD;
else if (!strcmp (pvr_param_stream_type, PVR_VIDEO_STREAM_TYPE_VCD)) else if (!strcmp (pvr->params->stream_type, PVR_VIDEO_STREAM_TYPE_VCD))
pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG1_VCD; pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG1_VCD;
else if (!strcmp (pvr_param_stream_type, PVR_VIDEO_STREAM_TYPE_SVCD)) else if (!strcmp (pvr->params->stream_type, PVR_VIDEO_STREAM_TYPE_SVCD))
pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD; pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD;
} }
} }
@ -1523,6 +1521,7 @@ pvr_stream_open (stream_t *stream)
pvr = pvr_init (); pvr = pvr_init ();
pvr->tv_params = stream->opts->tv_params; pvr->tv_params = stream->opts->tv_params;
pvr->log = stream->log; pvr->log = stream->log;
pvr->params = stream->opts->stream_pvr_opts;
/** /**
* if the url, i.e. 'pvr://8', contains the channel, use it, * if the url, i.e. 'pvr://8', contains the channel, use it,
@ -1620,7 +1619,8 @@ pvr_stream_open (stream_t *stream)
/* PVR Public API access */ /* PVR Public API access */
const char * #if 0
static const char *
pvr_get_current_stationname (stream_t *stream) pvr_get_current_stationname (stream_t *stream)
{ {
struct pvr_t *pvr; struct pvr_t *pvr;
@ -1638,7 +1638,7 @@ pvr_get_current_stationname (stream_t *stream)
return NULL; return NULL;
} }
const char * static const char *
pvr_get_current_channelname (stream_t *stream) pvr_get_current_channelname (stream_t *stream)
{ {
struct pvr_t *pvr = (struct pvr_t *) stream->priv; struct pvr_t *pvr = (struct pvr_t *) stream->priv;
@ -1650,8 +1650,9 @@ pvr_get_current_channelname (stream_t *stream)
return NULL; return NULL;
} }
#endif
int static int
pvr_get_current_frequency (stream_t *stream) pvr_get_current_frequency (stream_t *stream)
{ {
struct pvr_t *pvr = (struct pvr_t *) stream->priv; struct pvr_t *pvr = (struct pvr_t *) stream->priv;
@ -1659,7 +1660,7 @@ pvr_get_current_frequency (stream_t *stream)
return pvr->freq; return pvr->freq;
} }
int static int
pvr_set_channel (stream_t *stream, const char * channel) pvr_set_channel (stream_t *stream, const char * channel)
{ {
struct pvr_t *pvr = (struct pvr_t *) stream->priv; struct pvr_t *pvr = (struct pvr_t *) stream->priv;
@ -1667,7 +1668,7 @@ pvr_set_channel (stream_t *stream, const char * channel)
return set_station_by_channelname_or_freq (pvr, channel, -1, 1); return set_station_by_channelname_or_freq (pvr, channel, -1, 1);
} }
int static int
pvr_set_lastchannel (stream_t *stream) pvr_set_lastchannel (stream_t *stream)
{ {
struct pvr_t *pvr = (struct pvr_t *) stream->priv; struct pvr_t *pvr = (struct pvr_t *) stream->priv;
@ -1680,7 +1681,7 @@ pvr_set_lastchannel (stream_t *stream)
return -1; return -1;
} }
int static int
pvr_set_freq (stream_t *stream, int freq) pvr_set_freq (stream_t *stream, int freq)
{ {
struct pvr_t *pvr = (struct pvr_t *) stream->priv; struct pvr_t *pvr = (struct pvr_t *) stream->priv;
@ -1688,7 +1689,7 @@ pvr_set_freq (stream_t *stream, int freq)
return set_station_by_channelname_or_freq (pvr, NULL, freq, 1); return set_station_by_channelname_or_freq (pvr, NULL, freq, 1);
} }
int static int
pvr_set_channel_step (stream_t *stream, int step) pvr_set_channel_step (stream_t *stream, int step)
{ {
struct pvr_t *pvr = (struct pvr_t *) stream->priv; struct pvr_t *pvr = (struct pvr_t *) stream->priv;
@ -1696,14 +1697,6 @@ pvr_set_channel_step (stream_t *stream, int step)
return set_station_by_step (pvr, step, 1); return set_station_by_step (pvr, step, 1);
} }
int
pvr_force_freq_step (stream_t *stream, int step)
{
struct pvr_t *pvr = (struct pvr_t *) stream->priv;
return force_freq_step (pvr, step);
}
static int pvr_stream_control(struct stream *s, int cmd, void *arg) static int pvr_stream_control(struct stream *s, int cmd, void *arg)
{ {
switch (cmd) { switch (cmd) {