[PATCH 2/2] Use GIO wrappers in mp4_tag.cc



Make mp4_tag.cc use GIO wrapper for reading and writing MP4 tags with
TagLib.
---
 src/mp4_tag.cc | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/mp4_tag.cc b/src/mp4_tag.cc
index ebcd2c5..ad0371a 100644
--- a/src/mp4_tag.cc
+++ b/src/mp4_tag.cc
@@ -36,6 +36,7 @@
 #include "misc.h"
 #include "et_core.h"
 #include "charset.h"
+#include "gio_wrapper.h"
 
 #include <mp4file.h>
 #include <mp4tag.h>
@@ -61,7 +62,11 @@ gboolean Mp4tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
     g_return_val_if_fail (filename != NULL && FileTag != NULL, FALSE);
 
     /* Get data from tag. */
-    TagLib::MP4::File mp4file (filename);
+    GFile *file = g_file_new_for_path (filename);
+    GIO_InputStream stream (file);
+    TagLib::MP4::File mp4file (&stream);
+
+    g_object_unref (file);
 
     if (!mp4file.isOpen ())
     {
@@ -211,7 +216,11 @@ gboolean Mp4tag_Write_File_Tag (ET_File *ETFile)
     filename_utf8 = ((File_Name *)ETFile->FileNameCur->data)->value_utf8;
 
     /* Open file for writing */
-    TagLib::MP4::File mp4file (filename);
+    GFile *file = g_file_new_for_path (filename);
+    GIO_IOStream stream (file);
+    TagLib::MP4::File mp4file (&stream);
+
+    g_object_unref (file);
 
     if (!mp4file.isOpen ())
     {
-- 
1.8.3.2



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]