aboutsummaryrefslogtreecommitdiffhomepage
path: root/stream
diff options
context:
space:
mode:
authorGravatar voroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-09 13:09:48 +0000
committerGravatar voroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-09 13:09:48 +0000
commitcb6497bd3ceefe91fae35becaf25ce470457f98f (patch)
tree0ae954819199fd237042c5e36b99b25db76922cc /stream
parentd1639ced67d9ccff7d785d1e1542b808c689bdf2 (diff)
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. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20812 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream')
-rw-r--r--stream/stream_radio.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/stream/stream_radio.c b/stream/stream_radio.c
index a4c4cd46b8..4f11a22876 100644
--- a/stream/stream_radio.c
+++ b/stream/stream_radio.c
@@ -298,12 +298,6 @@ static int set_frequency_v4l2(radio_priv_t* priv,float frequency){
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 @@ static int set_frequency_v4l(radio_priv_t* priv,float frequency){
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 @@ static inline int set_frequency(radio_priv_t* priv,float frequency){
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 @@ static void close_s(struct stream_st * stream){
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);
}