[easytag/wip/taglib-mp4-cxx: 14/20] Use GIO wrappers in mp4_tag.cc



commit c490b3ad3eb202eff91447cce974963bdc18708c
Author: Santtu Lakkala <inz inz fi>
Date:   Thu Apr 10 11:01:53 2014 +0300

    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 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/mp4_tag.cc b/src/mp4_tag.cc
index 65aabdc..c21f999 100644
--- a/src/mp4_tag.cc
+++ b/src/mp4_tag.cc
@@ -37,6 +37,7 @@
 #include "misc.h"
 #include "et_core.h"
 #include "charset.h"
+#include "gio_wrapper.h"
 
 #include <mp4file.h>
 #include <mp4tag.h>
@@ -58,7 +59,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 ())
     {
@@ -226,7 +231,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 ())
     {


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