diff src/libid3tag/file.c @ 2563:bdd0ee5888e0 trunk

[svn] - add support for opening id3 tags from a live vfs handle. Patch by Christian Birchinger (joker).
author nenolod
date Sat, 24 Feb 2007 07:41:14 -0800
parents d4ecf0a91222
children 13bd2580ec18
line wrap: on
line diff
--- a/src/libid3tag/file.c	Sat Feb 24 06:01:39 2007 -0800
+++ b/src/libid3tag/file.c	Sat Feb 24 07:41:14 2007 -0800
@@ -473,6 +473,35 @@
 }
 
 /*
+ * NAME:	file->vfsopen()
+ * DESCRIPTION:	open a file given its vfs
+ */
+struct id3_file *id3_file_vfsopen(VFSFile *iofile, enum id3_file_mode mode)
+{
+  struct id3_file *file;
+  glong curpos;
+  gchar *path;
+
+  assert(iofile);
+  
+  path = iofile->uri;
+
+  vfs_dup(iofile);
+
+  curpos = vfs_ftell(iofile);
+  vfs_fseek(iofile, 0, SEEK_SET);
+
+  file = new_file(iofile, mode, path);
+  if (file == 0){
+    printf("id3_vfs_open: file failed\n");
+  }
+
+  vfs_fseek(iofile, curpos, SEEK_SET);
+
+  return file;
+}
+
+/*
  * NAME:	file->fdopen()
  * DESCRIPTION:	open a file using an existing file descriptor
  */