[MPlayer-dev-eng] [PATCH] error checking in ao_pcm
Marco Gaddoni
mgaddoni at h-europa.com
Wed Dec 31 14:40:32 CET 2003
Hello
Here is a patch to add error checking
in ao_pcm. This is mostly usefull when you
fill up the disk while dumping the audio.
Please note that mplayer should really
abort when you are out of space
(the audiodump is incomplete) but
i don't know how to abort mplayer
from inside the play method.
ciao, marco.
Index: libao2/ao_pcm.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_pcm.c,v
retrieving revision 1.19
diff -u -r1.19 ao_pcm.c
--- libao2/ao_pcm.c 26 Oct 2003 13:43:30 -0000 1.19
+++ libao2/ao_pcm.c 30 Dec 2003 16:58:06 -0000
@@ -9,6 +9,9 @@
#include "audio_out.h"
#include "audio_out_internal.h"
+#include "../mp_msg.h"
+#include "errno.h"
+
static ao_info_t info =
{
"RAW PCM/WAVE file writer audio output",
@@ -172,6 +175,7 @@
// it should round it down to outburst*n
// return: number of bytes played
static int play(void* data,int len,int flags){
+ int out;
// let libaf to do the conversion...
#if 0
@@ -186,7 +190,13 @@
#endif
//printf("PCM: Writing chunk!\n");
- fwrite(data,len,1,fp);
+ out = fwrite(data,len,1,fp);
+ if (out != 1) {
+ mp_msg(MSGT_AO,MSGL_ERR,
+ "ao_pcm: error writing (total written %d) : \"%s\"\n",
+ wavhdr.data_length, strerror(errno));
+ /* FIXME how to abort mplayer from here ? */
+ }
if(ao_pcm_waveheader)
wavhdr.data_length += len;
--
This is not a .sig. With homage to Magritte.
More information about the MPlayer-dev-eng
mailing list