1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-25 00:02:13 +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:
nicodvb 2007-12-15 13:05:06 +00:00
parent 9c189c49bf
commit c5ad15d8c0
4 changed files with 14 additions and 28 deletions

View File

@ -2628,10 +2628,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
#endif /* HAVE_PVR */
}
#ifdef HAS_DVBIN_SUPPORT
if ((mpctx->stream->type == STREAMTYPE_DVB)
&& mpctx->stream->priv) {
dvb_priv_t *priv = (dvb_priv_t *) mpctx->stream->priv;
if (priv->is_on) {
if (mpctx->stream->type == STREAMTYPE_DVB) {
int dir;
int v = cmd->args[0].v.i;
@ -2642,9 +2639,8 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
dir = DVB_CHANNEL_LOWER;
if (dvb_step_channel(priv, dir))
if (dvb_step_channel(mpctx->stream, dir))
mpctx->eof = mpctx->dvbin_reopen = 1;
}
}
#endif /* HAS_DVBIN_SUPPORT */
break;
@ -2671,19 +2667,12 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
#ifdef HAS_DVBIN_SUPPORT
case MP_CMD_DVB_SET_CHANNEL:
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)
if (mpctx->stream->type == STREAMTYPE_DVB) {
mpctx->last_dvb_step = 1;
else
mpctx->last_dvb_step = -1;
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;
}
}
break;
#endif /* HAS_DVBIN_SUPPORT */

View File

@ -3115,11 +3115,8 @@ if(mpctx->sh_video){
if(!mpctx->sh_video && !mpctx->sh_audio){
mp_msg(MSGT_CPLAYER,MSGL_FATAL, MSGTR_NoStreamFound);
#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 v = mpctx->last_dvb_step;
if(v > 0)
@ -3127,9 +3124,8 @@ if(!mpctx->sh_video && !mpctx->sh_audio){
else
dir = DVB_CHANNEL_LOWER;
if(dvb_step_channel(priv, dir))
if(dvb_step_channel(mpctx->stream, dir))
mpctx->eof = mpctx->dvbin_reopen = 1;
}
}
#endif
goto goto_next_file; // exit_player(MSGTR_Exit_error);

View File

@ -109,8 +109,8 @@ typedef struct {
#define TUNER_CBL 3
#define TUNER_ATSC 4
extern int dvb_step_channel(dvb_priv_t *, int);
extern int dvb_set_channel(dvb_priv_t *, int, int);
extern int dvb_step_channel(stream_t *, int);
extern int dvb_set_channel(stream_t *, int, int);
extern dvb_config_t *dvb_get_config(void);
#endif

View File

@ -469,11 +469,11 @@ static int dvb_streaming_read(stream_t *stream, char *buffer, int size)
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_channel_t *channel;
stream_t *stream = (stream_t*) priv->stream;
dvb_priv_t *priv = stream->priv;
char buf[4096];
dvb_config_t *conf = (dvb_config_t *) priv->config;
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;
dvb_channels_list *list;
dvb_priv_t *priv = stream->priv;
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;
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);
dvbin_close(stream);