[MPlayer-cvslog] r25405 - in trunk: command.c mplayer.c stream/dvbin.h stream/stream_dvb.c

nicodvb subversion at mplayerhq.hu
Sat Dec 15 14:05:06 CET 2007


Author: nicodvb
Date: Sat Dec 15 14:05:06 2007
New Revision: 25405

Log:
dvb cleanup: call dvb_(set|step)_channel() without dereferencing stream->priv (1000l to me)

Modified:
   trunk/command.c
   trunk/mplayer.c
   trunk/stream/dvbin.h
   trunk/stream/stream_dvb.c

Modified: trunk/command.c
==============================================================================
--- trunk/command.c	(original)
+++ trunk/command.c	Sat Dec 15 14:05:06 2007
@@ -2628,10 +2628,7 @@ int run_command(MPContext * mpctx, mp_cm
 #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_cm
 			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_cm
 
 #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     */

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	(original)
+++ trunk/mplayer.c	Sat Dec 15 14:05:06 2007
@@ -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);

Modified: trunk/stream/dvbin.h
==============================================================================
--- trunk/stream/dvbin.h	(original)
+++ trunk/stream/dvbin.h	Sat Dec 15 14:05:06 2007
@@ -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

Modified: trunk/stream/stream_dvb.c
==============================================================================
--- trunk/stream/stream_dvb.c	(original)
+++ trunk/stream/stream_dvb.c	Sat Dec 15 14:05:06 2007
@@ -469,11 +469,11 @@ static int dvb_streaming_read(stream_t *
 
 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, in
 
 
 
-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, i
 
 	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_
 	}
 
 
-	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);



More information about the MPlayer-cvslog mailing list