[gst-devel] Re: virtual file support in audiofile

Daniel Kobras kobras at linux.de
Sun Apr 21 05:50:03 CEST 2002


On Sun, Apr 21, 2002 at 02:19:33PM +0200, Baker, Steve wrote:
> Index: openclose.c
> ===================================================================
> RCS file: /cvs/audiofile/libaudiofile/openclose.c,v
> retrieving revision 1.8
> diff -u -r1.8 openclose.c
> --- openclose.c	2001/08/28 20:34:46	1.8
> +++ openclose.c	2002/04/21 12:06:22
[...]
> +	if (_afOpenFile(access, vf, NULL, &filehandle, setup) !=
> AF_SUCCEED){
                                ^^ make that 'vfile'.
				
> +		printf("_afOpenFile failed");
> +		af_fclose(vf);
                          ^^ dito.

Below's the tested patch from the Debian diff.

Regards,

Daniel.

---------------------
PatchSet 70
Date: 2002/03/01 21:05:11
Author: kobras
Log:
Implement afOpenVirtualFile(). [dk]

Members: 
	libaudiofile/openclose.c:1.3->1.4 

Index: libaudiofile/openclose.c
===================================================================
RCS file: /home/kobras/cvsroot/debian/audiofile/libaudiofile/openclose.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -u -r1.3 -r1.4
--- libaudiofile/openclose.c	2001/10/26 09:31:02	1.3
+++ libaudiofile/openclose.c	2002/03/01 21:05:11	1.4
@@ -265,6 +265,40 @@
 	return filehandle;
 }
 
+AFfilehandle afOpenVirtualFile (AFvirtualfile *vfile, const char *mode, AFfilesetup setup)
+{
+	AFfilehandle	filehandle;
+	int		access;
+
+	if (vfile == NULL)
+	{
+		_af_error(AF_BAD_FILEHANDLE, "null virtual filehandle");
+		return AF_NULL_FILEHANDLE;
+	}
+
+	if (mode == NULL)
+	{
+		_af_error(AF_BAD_ACCMODE, "null access mode");
+		return AF_NULL_FILEHANDLE;
+	}
+
+	if (mode[0] == 'r')
+		access = _AF_READ_ACCESS;
+	else if (mode[0] == 'w')
+		access = _AF_WRITE_ACCESS;
+	else
+	{
+		_af_error(AF_BAD_ACCMODE, "unrecognized access mode '%s'", mode);
+		return AF_NULL_FILEHANDLE;
+	}
+
+	if (_afOpenFile(access, vfile, NULL, &filehandle, setup) != AF_SUCCEED)
+		af_fclose(vfile);
+
+	return filehandle;
+}
+
+
 static status _afOpenFile (int access, AFvirtualfile *vf, const char *filename,
 	AFfilehandle *file, AFfilesetup filesetup)
 {




More information about the gstreamer-devel mailing list