[MPlayer-cvslog] r20812 - trunk/stream/stream_radio.c

voroshil subversion at mplayerhq.hu
Thu Nov 9 14:09:48 CET 2006


Author: voroshil
Date: Thu Nov  9 14:09:48 2006
New Revision: 20812

Modified:
   trunk/stream/stream_radio.c

Log:
Move non driver-specific block to non-driver specific procedure, to avoid
unnecceduplicating code.
Avoid calling set_volume on no-initialized radio device in close_s.



Modified: trunk/stream/stream_radio.c
==============================================================================
--- trunk/stream/stream_radio.c	(original)
+++ trunk/stream/stream_radio.c	Thu Nov  9 14:09:48 2006
@@ -298,12 +298,6 @@
         frequency,strerror(errno));
         return  STREAM_ERROR;
     }
-#ifdef USE_RADIO_CAPTURE
-    if(clear_buffer(priv)!=STREAM_OK){
-        mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_ClearBufferFailed,strerror(errno));
-        return  STREAM_ERROR;
-    }
-#endif
     return STREAM_OK;
 }
 
@@ -441,12 +435,6 @@
         mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_SetFreqFailed,freq,frequency,strerror(errno));
         return  STREAM_ERROR;
     }
-#ifdef USE_RADIO_CAPTURE
-    if(clear_buffer(priv)!=STREAM_OK){
-        mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_ClearBufferFailed,strerror(errno));
-        return  STREAM_ERROR;
-    }
-#endif
     return STREAM_OK;
 }
 /*****************************************************************
@@ -542,15 +530,25 @@
     switch(priv->driver){
 #ifdef HAVE_RADIO_V4L
         case RADIO_DRIVER_V4L:
-            return set_frequency_v4l(priv,frequency);
+            if(set_frequency_v4l(priv,frequency)!=STREAM_OK)
+                return STREAM_ERROR;
 #endif
 #ifdef HAVE_RADIO_V4L2
         case RADIO_DRIVER_V4L2:
-            return set_frequency_v4l2(priv,frequency);
+            if(set_frequency_v4l2(priv,frequency)!=STREAM_OK)
+                return STREAM_ERROR;
 #endif
+        default:
+            mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_DriverUnknownId,priv->driver);
+            return STREAM_ERROR;
     }
-    mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_DriverUnknownId,priv->driver);
-    return STREAM_ERROR;
+#ifdef USE_RADIO_CAPTURE
+    if(clear_buffer(priv)!=STREAM_OK){
+        mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_ClearBufferFailed,strerror(errno));
+        return  STREAM_ERROR;
+    }
+#endif
+   return STREAM_OK;
 }
 static inline int get_frequency(radio_priv_t* priv,float* frequency){ 
     switch(priv->driver){
@@ -1110,8 +1108,8 @@
     priv->radio_channel_current=NULL;
     priv->radio_channel_list=NULL;
 
-    set_volume(priv, priv->old_snd_volume);
     if (priv->radio_fd>0){
+        set_volume(priv, priv->old_snd_volume);
         close(priv->radio_fd);
     }
 



More information about the MPlayer-cvslog mailing list