changeset 32070:acb0f1b02040

Rename vo_mpegpes_fd2 variable to ao_mpegpes_fd.
author diego
date Sat, 11 Sep 2010 14:13:21 +0000
parents ca56fb28bfa2
children 54b48f83d02b
files libao2/ao_mpegpes.c libvo/vo_mpegpes.c
diffstat 2 files changed, 26 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_mpegpes.c	Sat Sep 11 12:32:38 2010 +0000
+++ b/libao2/ao_mpegpes.c	Sat Sep 11 14:13:21 2010 +0000
@@ -52,7 +52,7 @@
 #define false 0
 
 extern int vo_mpegpes_fd;
-int vo_mpegpes_fd2 = -1;
+int ao_mpegpes_fd = -1;
 
 #include <errno.h>
 
@@ -76,20 +76,20 @@
 #ifdef CONFIG_DVB
     switch(cmd){
 	case AOCONTROL_GET_VOLUME:
-	  if(vo_mpegpes_fd2>=0){
+	  if(ao_mpegpes_fd >= 0){
 	    ((ao_control_vol_t*)(arg))->left=dvb_mixer.volume_left/2.56;
 	    ((ao_control_vol_t*)(arg))->right=dvb_mixer.volume_right/2.56;
 	    return CONTROL_OK;
 	  }
 	  return CONTROL_ERROR;
 	case AOCONTROL_SET_VOLUME:
-	  if(vo_mpegpes_fd2>=0){
+	  if(ao_mpegpes_fd >= 0){
 	    dvb_mixer.volume_left=((ao_control_vol_t*)(arg))->left*2.56;
 	    dvb_mixer.volume_right=((ao_control_vol_t*)(arg))->right*2.56;
 	    if(dvb_mixer.volume_left>255) dvb_mixer.volume_left=255;
 	    if(dvb_mixer.volume_right>255) dvb_mixer.volume_right=255;
 	    //	 printf("Setting DVB volume: %d ; %d  \n",dvb_mixer.volume_left,dvb_mixer.volume_right);
-	    if ( (ioctl(vo_mpegpes_fd2,AUDIO_SET_MIXER, &dvb_mixer) < 0)){
+	    if ( (ioctl(ao_mpegpes_fd, AUDIO_SET_MIXER, &dvb_mixer) < 0)){
 		mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_MPEGPES_CantSetMixer,
 		    strerror(errno));
 	      return CONTROL_ERROR;
@@ -111,36 +111,36 @@
 	char ao_file[30];
 	sprintf(ao_file, "/dev/dvb/adapter%d/audio0", card);
 	mp_msg(MSGT_VO,MSGL_INFO, "Opening %s\n", ao_file);
-	if((vo_mpegpes_fd2 = open(ao_file,O_RDWR|O_NONBLOCK)) < 0)
+	if((ao_mpegpes_fd = open(ao_file,O_RDWR|O_NONBLOCK)) < 0)
 	{
         	mp_msg(MSGT_VO, MSGL_ERR, "DVB AUDIO DEVICE: %s\n", strerror(errno));
         	return -1;
 	}
-	if( (ioctl(vo_mpegpes_fd2,AUDIO_SELECT_SOURCE, AUDIO_SOURCE_MEMORY) < 0))
+	if( (ioctl(ao_mpegpes_fd, AUDIO_SELECT_SOURCE, AUDIO_SOURCE_MEMORY) < 0))
 	{
 		mp_msg(MSGT_VO, MSGL_ERR, "DVB AUDIO SELECT SOURCE: %s\n", strerror(errno));
 		goto fail;
 	}
-	if((ioctl(vo_mpegpes_fd2,AUDIO_PLAY) < 0))
+	if((ioctl(ao_mpegpes_fd, AUDIO_PLAY) < 0))
 	{
 		mp_msg(MSGT_VO, MSGL_ERR, "DVB AUDIO PLAY: %s\n", strerror(errno));
 		goto fail;
 	}
-	if((ioctl(vo_mpegpes_fd2,AUDIO_SET_AV_SYNC, true) < 0))
+	if((ioctl(ao_mpegpes_fd, AUDIO_SET_AV_SYNC, true) < 0))
 	{
 		mp_msg(MSGT_VO, MSGL_ERR, "DVB AUDIO SET AV SYNC: %s\n", strerror(errno));
 		goto fail;
 	}
 	//FIXME: in vo_mpegpes audio was initialized as MUTEd
-	if((ioctl(vo_mpegpes_fd2,AUDIO_SET_MUTE, false) < 0))
+	if((ioctl(ao_mpegpes_fd, AUDIO_SET_MUTE, false) < 0))
 	{
 		mp_msg(MSGT_VO, MSGL_ERR, "DVB AUDIO SET MUTE: %s\n", strerror(errno));
 		goto fail;
 	}
-	return vo_mpegpes_fd2;
+	return ao_mpegpes_fd;
 fail:
-	close(vo_mpegpes_fd2);
-	vo_mpegpes_fd2 = -1;
+	close(ao_mpegpes_fd);
+	ao_mpegpes_fd = -1;
 	return -1;
 }
 #endif
@@ -191,13 +191,13 @@
 		return vo_mpegpes_fd;	//video fd
 #endif
 
-	vo_mpegpes_fd2=open(ao_file,O_WRONLY|O_CREAT,0666);
-	if(vo_mpegpes_fd2<0)
+	ao_mpegpes_fd = open(ao_file, O_WRONLY | O_CREAT, 0666);
+	if(ao_mpegpes_fd < 0)
 	{
 		mp_msg(MSGT_VO, MSGL_ERR, "ao_mpegpes: %s\n", strerror(errno));
 		return -1;
 	}
-	return vo_mpegpes_fd2;
+	return ao_mpegpes_fd;
 }
 
 static int my_ao_write(const unsigned char* data,int len){
@@ -206,13 +206,13 @@
 #define NFD   1
     struct pollfd pfd[NFD];
 
-    pfd[0].fd = vo_mpegpes_fd2;
+    pfd[0].fd     = ao_mpegpes_fd;
     pfd[0].events = POLLOUT;
 
     while(len>0){
         if(poll(pfd,NFD,1)){
             if(pfd[0].revents & POLLOUT){
-                int ret=write(vo_mpegpes_fd2,data,len);
+                int ret = write(ao_mpegpes_fd, data, len);
                 if(ret<=0){
                     mp_msg(MSGT_VO, MSGL_ERR, "ao_mpegpes write: %s\n", strerror(errno));
                     usleep(0);
@@ -225,8 +225,8 @@
     }
 
 #else
-    if(vo_mpegpes_fd2<0) return 0; // no file
-    write(vo_mpegpes_fd2,data,len); // write to file
+    if(ao_mpegpes_fd < 0) return 0; // no file
+    write(ao_mpegpes_fd, data, len); // write to file
 #endif
     return orig_len;
 }
@@ -278,9 +278,9 @@
 
 // close audio device
 static void uninit(int immed){
-	if (vo_mpegpes_fd2 >= 0)
-		close(vo_mpegpes_fd2);
-	vo_mpegpes_fd2 = -1;
+	if (ao_mpegpes_fd >= 0)
+		close(ao_mpegpes_fd);
+	ao_mpegpes_fd = -1;
 }
 
 // stop playing and empty buffers (for seeking/pause)
--- a/libvo/vo_mpegpes.c	Sat Sep 11 12:32:38 2010 +0000
+++ b/libvo/vo_mpegpes.c	Sat Sep 11 14:13:21 2010 +0000
@@ -58,7 +58,7 @@
 #include "libmpdemux/mpeg_packetizer.h"
 
 int vo_mpegpes_fd=-1;
-extern int vo_mpegpes_fd2;
+extern int ao_mpegpes_fd;
 
 static const vo_info_t info =
 {
@@ -175,7 +175,7 @@
 	pfd[0].fd = vo_mpegpes_fd;
 	pfd[0].events = POLLOUT;
 
-	pfd[1].fd = vo_mpegpes_fd2;
+	pfd[1].fd = ao_mpegpes_fd;
 	pfd[1].events = POLLOUT;
 
     while(len>0){
@@ -231,8 +231,8 @@
 static void
 uninit(void)
 {
-    if(vo_mpegpes_fd2>=0 && vo_mpegpes_fd2!=vo_mpegpes_fd) close(vo_mpegpes_fd2);
-    vo_mpegpes_fd2=-1;
+    if(ao_mpegpes_fd >= 0 && ao_mpegpes_fd != vo_mpegpes_fd) close(ao_mpegpes_fd);
+    ao_mpegpes_fd =- 1;
     if(vo_mpegpes_fd>=0){ close(vo_mpegpes_fd);vo_mpegpes_fd=-1;}
 }