mirror of
https://github.com/mpv-player/mpv
synced 2024-12-25 16:33:02 +00:00
dvb cleanup: call dvb_(set|step)_channel() without dereferencing stream->priv (1000l to me)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25405 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
9c189c49bf
commit
c5ad15d8c0
19
command.c
19
command.c
@ -2628,10 +2628,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
|
|||||||
#endif /* HAVE_PVR */
|
#endif /* HAVE_PVR */
|
||||||
}
|
}
|
||||||
#ifdef HAS_DVBIN_SUPPORT
|
#ifdef HAS_DVBIN_SUPPORT
|
||||||
if ((mpctx->stream->type == STREAMTYPE_DVB)
|
if (mpctx->stream->type == STREAMTYPE_DVB) {
|
||||||
&& mpctx->stream->priv) {
|
|
||||||
dvb_priv_t *priv = (dvb_priv_t *) mpctx->stream->priv;
|
|
||||||
if (priv->is_on) {
|
|
||||||
int dir;
|
int dir;
|
||||||
int v = cmd->args[0].v.i;
|
int v = cmd->args[0].v.i;
|
||||||
|
|
||||||
@ -2642,9 +2639,8 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
|
|||||||
dir = DVB_CHANNEL_LOWER;
|
dir = DVB_CHANNEL_LOWER;
|
||||||
|
|
||||||
|
|
||||||
if (dvb_step_channel(priv, dir))
|
if (dvb_step_channel(mpctx->stream, dir))
|
||||||
mpctx->eof = mpctx->dvbin_reopen = 1;
|
mpctx->eof = mpctx->dvbin_reopen = 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif /* HAS_DVBIN_SUPPORT */
|
#endif /* HAS_DVBIN_SUPPORT */
|
||||||
break;
|
break;
|
||||||
@ -2671,19 +2667,12 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
|
|||||||
|
|
||||||
#ifdef HAS_DVBIN_SUPPORT
|
#ifdef HAS_DVBIN_SUPPORT
|
||||||
case MP_CMD_DVB_SET_CHANNEL:
|
case MP_CMD_DVB_SET_CHANNEL:
|
||||||
if ((mpctx->stream->type == STREAMTYPE_DVB)
|
if (mpctx->stream->type == STREAMTYPE_DVB) {
|
||||||
&& mpctx->stream->priv) {
|
|
||||||
dvb_priv_t *priv = (dvb_priv_t *) mpctx->stream->priv;
|
|
||||||
if (priv->is_on) {
|
|
||||||
if (priv->list->current <= cmd->args[0].v.i)
|
|
||||||
mpctx->last_dvb_step = 1;
|
mpctx->last_dvb_step = 1;
|
||||||
else
|
|
||||||
mpctx->last_dvb_step = -1;
|
|
||||||
|
|
||||||
if (dvb_set_channel
|
if (dvb_set_channel
|
||||||
(priv, cmd->args[1].v.i, cmd->args[0].v.i))
|
(mpctx->stream, cmd->args[1].v.i, cmd->args[0].v.i))
|
||||||
mpctx->eof = mpctx->dvbin_reopen = 1;
|
mpctx->eof = mpctx->dvbin_reopen = 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif /* HAS_DVBIN_SUPPORT */
|
#endif /* HAS_DVBIN_SUPPORT */
|
||||||
|
@ -3115,11 +3115,8 @@ if(mpctx->sh_video){
|
|||||||
if(!mpctx->sh_video && !mpctx->sh_audio){
|
if(!mpctx->sh_video && !mpctx->sh_audio){
|
||||||
mp_msg(MSGT_CPLAYER,MSGL_FATAL, MSGTR_NoStreamFound);
|
mp_msg(MSGT_CPLAYER,MSGL_FATAL, MSGTR_NoStreamFound);
|
||||||
#ifdef HAS_DVBIN_SUPPORT
|
#ifdef HAS_DVBIN_SUPPORT
|
||||||
if((mpctx->stream->type == STREAMTYPE_DVB) && mpctx->stream->priv)
|
if(mpctx->stream->type == STREAMTYPE_DVB)
|
||||||
{
|
{
|
||||||
dvb_priv_t *priv = (dvb_priv_t*) mpctx->stream->priv;
|
|
||||||
if(priv->is_on)
|
|
||||||
{
|
|
||||||
int dir;
|
int dir;
|
||||||
int v = mpctx->last_dvb_step;
|
int v = mpctx->last_dvb_step;
|
||||||
if(v > 0)
|
if(v > 0)
|
||||||
@ -3127,9 +3124,8 @@ if(!mpctx->sh_video && !mpctx->sh_audio){
|
|||||||
else
|
else
|
||||||
dir = DVB_CHANNEL_LOWER;
|
dir = DVB_CHANNEL_LOWER;
|
||||||
|
|
||||||
if(dvb_step_channel(priv, dir))
|
if(dvb_step_channel(mpctx->stream, dir))
|
||||||
mpctx->eof = mpctx->dvbin_reopen = 1;
|
mpctx->eof = mpctx->dvbin_reopen = 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
goto goto_next_file; // exit_player(MSGTR_Exit_error);
|
goto goto_next_file; // exit_player(MSGTR_Exit_error);
|
||||||
|
@ -109,8 +109,8 @@ typedef struct {
|
|||||||
#define TUNER_CBL 3
|
#define TUNER_CBL 3
|
||||||
#define TUNER_ATSC 4
|
#define TUNER_ATSC 4
|
||||||
|
|
||||||
extern int dvb_step_channel(dvb_priv_t *, int);
|
extern int dvb_step_channel(stream_t *, int);
|
||||||
extern int dvb_set_channel(dvb_priv_t *, int, int);
|
extern int dvb_set_channel(stream_t *, int, int);
|
||||||
extern dvb_config_t *dvb_get_config(void);
|
extern dvb_config_t *dvb_get_config(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -469,11 +469,11 @@ static int dvb_streaming_read(stream_t *stream, char *buffer, int size)
|
|||||||
|
|
||||||
static void dvbin_close(stream_t *stream);
|
static void dvbin_close(stream_t *stream);
|
||||||
|
|
||||||
int dvb_set_channel(dvb_priv_t *priv, int card, int n)
|
int dvb_set_channel(stream_t *stream, int card, int n)
|
||||||
{
|
{
|
||||||
dvb_channels_list *new_list;
|
dvb_channels_list *new_list;
|
||||||
dvb_channel_t *channel;
|
dvb_channel_t *channel;
|
||||||
stream_t *stream = (stream_t*) priv->stream;
|
dvb_priv_t *priv = stream->priv;
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
dvb_config_t *conf = (dvb_config_t *) priv->config;
|
dvb_config_t *conf = (dvb_config_t *) priv->config;
|
||||||
int devno;
|
int devno;
|
||||||
@ -557,10 +557,11 @@ int dvb_set_channel(dvb_priv_t *priv, int card, int n)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int dvb_step_channel(dvb_priv_t *priv, int dir)
|
int dvb_step_channel(stream_t *stream, int dir)
|
||||||
{
|
{
|
||||||
int new_current;
|
int new_current;
|
||||||
dvb_channels_list *list;
|
dvb_channels_list *list;
|
||||||
|
dvb_priv_t *priv = stream->priv;
|
||||||
|
|
||||||
mp_msg(MSGT_DEMUX, MSGL_V, "DVB_STEP_CHANNEL dir %d\n", dir);
|
mp_msg(MSGT_DEMUX, MSGL_V, "DVB_STEP_CHANNEL dir %d\n", dir);
|
||||||
|
|
||||||
@ -579,7 +580,7 @@ int dvb_step_channel(dvb_priv_t *priv, int dir)
|
|||||||
|
|
||||||
new_current = (list->NUM_CHANNELS + list->current + (dir == DVB_CHANNEL_HIGHER ? 1 : -1)) % list->NUM_CHANNELS;
|
new_current = (list->NUM_CHANNELS + list->current + (dir == DVB_CHANNEL_HIGHER ? 1 : -1)) % list->NUM_CHANNELS;
|
||||||
|
|
||||||
return dvb_set_channel(priv, priv->card, new_current);
|
return dvb_set_channel(stream, priv->card, new_current);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -640,7 +641,7 @@ static int dvb_streaming_start(dvb_priv_t *priv, struct stream_priv_s *opts, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!dvb_set_channel(priv, priv->card, priv->list->current))
|
if(!dvb_set_channel(stream, priv->card, priv->list->current))
|
||||||
{
|
{
|
||||||
mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR, COULDN'T SET CHANNEL %i: ", priv->list->current);
|
mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR, COULDN'T SET CHANNEL %i: ", priv->list->current);
|
||||||
dvbin_close(stream);
|
dvbin_close(stream);
|
||||||
|
Loading…
Reference in New Issue
Block a user