changeset 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 07b990906823
children 5b9f0dc2c034
files ChangeLog src/audacious/build_stamp.c src/libid3tag/file.c src/libid3tag/id3tag.h
diffstat 4 files changed, 45 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Feb 24 06:01:39 2007 -0800
+++ b/ChangeLog	Sat Feb 24 07:41:14 2007 -0800
@@ -1,3 +1,15 @@
+2007-02-24 14:01:39 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
+  revision [4134]
+  - add reference-counting to VFS and add new function, vfs_dup() to 
+    mark a VFS handle as duplicated.
+  
+  trunk/src/audacious/vfs.c               |   24 ++++++++++++++++++++++++
+  trunk/src/audacious/vfs.h               |    4 ++++
+  trunk/src/audacious/vfs_buffer.c        |    1 +
+  trunk/src/audacious/vfs_buffered_file.c |    1 +
+  4 files changed, 30 insertions(+)
+
+
 2007-02-24 04:10:54 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [4132]
   - provide fd->uri for buffered files
--- a/src/audacious/build_stamp.c	Sat Feb 24 06:01:39 2007 -0800
+++ b/src/audacious/build_stamp.c	Sat Feb 24 07:41:14 2007 -0800
@@ -1,2 +1,2 @@
 #include <glib.h>
-const gchar *svn_stamp = "20070224-4132";
+const gchar *svn_stamp = "20070224-4134";
--- 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
  */
--- a/src/libid3tag/id3tag.h	Sat Feb 24 06:01:39 2007 -0800
+++ b/src/libid3tag/id3tag.h	Sat Feb 24 07:41:14 2007 -0800
@@ -29,6 +29,8 @@
 extern "C" {
 # endif
 
+#include <audacious/vfs.h>
+
 # define ID3_TAG_VERSION		0x0400
 # define ID3_TAG_VERSION_MAJOR(x)	(((x) >> 8) & 0xff)
 # define ID3_TAG_VERSION_MINOR(x)	(((x) >> 0) & 0xff)
@@ -245,6 +247,7 @@
 };
 
 struct id3_file *id3_file_open(char const *, enum id3_file_mode);
+struct id3_file *id3_file_vfsopen(VFSFile *, enum id3_file_mode);
 struct id3_file *id3_file_fdopen(int, enum id3_file_mode);
 int id3_file_close(struct id3_file *);