write id3v2 tags when ripping cds to mp3
authorJonathan Marshall <jmarshall@never.you.mind>
Thu, 3 Jan 2013 04:22:17 +0000 (17:22 +1300)
committerS. Davilla <davilla@4pi.com>
Fri, 11 Jan 2013 13:45:36 +0000 (08:45 -0500)
xbmc/cdrip/DllLameenc.h
xbmc/cdrip/EncoderLame.cpp

index 3678879..2e5fe29 100644 (file)
@@ -31,6 +31,7 @@ class DllLameEncInterface
 {
 public:
   virtual void id3tag_init(lame_global_flags* gfp)=0;
+  virtual void id3tag_add_v2(lame_global_flags* gfp)=0;
   virtual int id3tag_set_genre(lame_global_flags* gfp, const char* genre)=0;
   virtual void id3tag_set_title(lame_global_flags* gfp, const char* title)=0;
   virtual void id3tag_set_artist(lame_global_flags* gfp, const char* artist)=0;
@@ -61,6 +62,7 @@ class DllLameEnc : public DllDynamic, DllLameEncInterface
 {
   DECLARE_DLL_WRAPPER(DllLameEnc, DLL_PATH_LAME_ENC)
   DEFINE_METHOD1(void, id3tag_init, (lame_global_flags* p1));
+  DEFINE_METHOD1(void, id3tag_add_v2, (lame_global_flags* p1));
   DEFINE_METHOD2(int, id3tag_set_genre, (lame_global_flags* p1, const char* p2))
   DEFINE_METHOD2(void, id3tag_set_title, (lame_global_flags* p1, const char* p2))
   DEFINE_METHOD2(void, id3tag_set_artist, (lame_global_flags* p1, const char* p2))
@@ -85,6 +87,7 @@ class DllLameEnc : public DllDynamic, DllLameEncInterface
   DEFINE_METHOD3(int, lame_encode_flush, (lame_global_flags* p1, unsigned char* p2, int p3))
   BEGIN_METHOD_RESOLVE()
     RESOLVE_METHOD(id3tag_init)
+    RESOLVE_METHOD(id3tag_add_v2)
     RESOLVE_METHOD(id3tag_set_genre)
     RESOLVE_METHOD(id3tag_set_title)
     RESOLVE_METHOD(id3tag_set_artist)
index 1ca0049..4dce280 100644 (file)
@@ -87,16 +87,9 @@ bool CEncoderLame::Init(const char* strFile, int iInChannels, int iInRate, int i
   m_dll.lame_set_asm_optimizations(m_pGlobalFlags, SSE, 1);
   m_dll.lame_set_in_samplerate(m_pGlobalFlags, 44100);
 
-  // Now that all the options are set, lame needs to analyze them and
-  // set some more internal options and check for problems
-  if (m_dll.lame_init_params(m_pGlobalFlags) < 0)
-  {
-    CLog::Log(LOGERROR, "Error: Cannot init Lame params");
-    return false;
-  }
-
   // Setup the ID3 tagger
   m_dll.id3tag_init(m_pGlobalFlags);
+  m_dll.id3tag_add_v2(m_pGlobalFlags);
   m_dll.id3tag_set_title(m_pGlobalFlags, m_strTitle.c_str());
   m_dll.id3tag_set_artist(m_pGlobalFlags, m_strArtist.c_str());
   m_dll.id3tag_set_textinfo_latin1(m_pGlobalFlags, "TPE2", m_strAlbumArtist.c_str());
@@ -107,6 +100,14 @@ bool CEncoderLame::Init(const char* strFile, int iInChannels, int iInRate, int i
   if(test==-1)
     m_dll.id3tag_set_genre(m_pGlobalFlags,"Other");
 
+  // Now that all the options are set, lame needs to analyze them and
+  // set some more internal options and check for problems
+  if (m_dll.lame_init_params(m_pGlobalFlags) < 0)
+  {
+    CLog::Log(LOGERROR, "Error: Cannot init Lame params");
+    return false;
+  }
+
   return true;
 }