[easytag] require FLAC >= 1.1.4 and followup cleanups



commit 5f763220f87a746c4c94b0eb827bb4c3cb67362c
Author: Adrian Bunk <bunk stusta de>
Date:   Mon Jan 21 20:04:15 2013 +0200

    require FLAC >= 1.1.4 and followup cleanups
    
    The pkgconfig that is used was added in 1.1.4, so older versions are
    anyway no longer supported.
    
    Additional cleanups this allowed:
    - FLAC 1.1.4 also contains the fix for flac not being linked with libogg
    - FLAC < 1.1.3 compat code is no longer required

 configure.ac      |    8 ++----
 src/easytag.c     |   31 ---------------------------
 src/flac_header.c |   60 +----------------------------------------------------
 src/flac_tag.c    |   18 ---------------
 4 files changed, 4 insertions(+), 113 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 3b5bceb..3b7632f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,11 +103,11 @@ AC_CHECK_LIB([socket], [recv])
 
 
 dnl ################################################
-dnl # Ogg Vorbis libraries (rq : needed also for libFLAC)
+dnl # Ogg Vorbis libraries
 dnl ################################################
 
 OGG_DEPS="ogg >= 1.0 vorbis >= 1.0.1 vorbisfile"
-AS_IF([test "x$enable_ogg" != "xno" -o "x$enable_flac" != "xno"],
+AS_IF([test "x$enable_ogg" != "xno"],
       [PKG_CHECK_EXISTS([$OGG_DEPS], [have_ogg=yes], [have_ogg=no])],
       [have_ogg=no])
 
@@ -121,7 +121,6 @@ dnl ################################################
 dnl # libSpeex library
 dnl ################################################
 dnl check for system libspeex
-dnl Note that libvorbis is required for speex support, even if the user chooses --disable-ogg
 
 SPEEX_DEPS="speex"
 AS_IF([test "x$enable_speex" != "xno"],
@@ -138,9 +137,8 @@ dnl ################################################
 dnl # libFLAC library
 dnl ################################################
 dnl check for system libflac
-dnl Note that libvorbis is required for flac support, even if the user chooses --disable-ogg
 
-FLAC_DEPS="flac >= 1.1.0"
+FLAC_DEPS="flac >= 1.1.4"
 AS_IF([test "x$enable_flac" != "xno"],
       [PKG_CHECK_EXISTS([$FLAC_DEPS], [have_flac=yes], [have_flac=no])],
       [have_flac=no])
diff --git a/src/easytag.c b/src/easytag.c
index 3e671f1..9f0602c 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -85,15 +85,6 @@ static gint SF_ButtonPressed_Delete_File;
 
 #ifdef ENABLE_FLAC
     #include <FLAC/metadata.h>
-
-    /* Patch from Josh Coalson
-     * FLAC 1.1.3 has FLAC_API_VERSION_CURRENT == 8 *
-     * by LEGACY_FLAC we mean pre-FLAC 1.1.3; in FLAC 1.1.3 the FLAC__FileDecoder was merged into the FLAC__StreamDecoder */
-    #if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT < 8
-    #define LEGACY_FLAC // For FLAC version < 1.1.3
-    #else
-    #undef LEGACY_FLAC
-    #endif
 #endif
 
 
@@ -4268,7 +4259,6 @@ void Tag_Area_Display_Controls (ET_File *ETFile)
             gtk_widget_show(GTK_WIDGET(EncodedByLabel));
             gtk_widget_show(GTK_WIDGET(EncodedByEntry));
             gtk_widget_show(GTK_WIDGET(EncodedByMButton));
-            #ifndef LEGACY_FLAC // Picture supported for FLAC >= 1.1.3...
             gtk_widget_show(GTK_WIDGET(PictureLabel));
             gtk_widget_show(GTK_WIDGET(PictureScrollWindow));
             gtk_widget_show(GTK_WIDGET(PictureMButton));
@@ -4276,27 +4266,6 @@ void Tag_Area_Display_Controls (ET_File *ETFile)
             gtk_widget_show(GTK_WIDGET(PictureAddButton));
             gtk_widget_show(GTK_WIDGET(PictureSaveButton));
             gtk_widget_show(GTK_WIDGET(PicturePropertiesButton));
-            #else
-            if (WRITE_ID3_TAGS_IN_FLAC_FILE)
-            {
-                gtk_widget_show(GTK_WIDGET(PictureLabel));
-                gtk_widget_show(GTK_WIDGET(PictureScrollWindow));
-                gtk_widget_show(GTK_WIDGET(PictureMButton));
-                gtk_widget_show(GTK_WIDGET(PictureClearButton));
-                gtk_widget_show(GTK_WIDGET(PictureAddButton));
-                gtk_widget_show(GTK_WIDGET(PictureSaveButton));
-                gtk_widget_show(GTK_WIDGET(PicturePropertiesButton));
-            }else
-            {
-                gtk_widget_hide(GTK_WIDGET(PictureLabel));
-                gtk_widget_hide(GTK_WIDGET(PictureScrollWindow));
-                gtk_widget_hide(GTK_WIDGET(PictureMButton));
-                gtk_widget_hide(GTK_WIDGET(PictureClearButton));
-                gtk_widget_hide(GTK_WIDGET(PictureAddButton));
-                gtk_widget_hide(GTK_WIDGET(PictureSaveButton));
-                gtk_widget_hide(GTK_WIDGET(PicturePropertiesButton));
-            }
-            #endif
             break;
 #endif
 
diff --git a/src/flac_header.c b/src/flac_header.c
index 6e9d778..a08c8cb 100644
--- a/src/flac_header.c
+++ b/src/flac_header.c
@@ -43,15 +43,6 @@
 #include "misc.h"
 #include "charset.h"
 
-/* Patch from Josh Coalson
- * FLAC 1.1.3 has FLAC_API_VERSION_CURRENT == 8 *
- * by LEGACY_FLAC we mean pre-FLAC 1.1.3; in FLAC 1.1.3 the FLAC__FileDecoder was merged into the FLAC__StreamDecoder */
-#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT < 8
-#define LEGACY_FLAC // For FLAC version < 1.1.3
-#else
-#undef LEGACY_FLAC
-#endif
-
 
 /****************
  * Declarations *
@@ -85,15 +76,9 @@ static unsigned reservoir_samples_ = 0;
 /**************
  * Prototypes *
  **************/
-#ifdef LEGACY_FLAC
-static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
-static void metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
-static void error_callback_   (const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
-#else
 static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
 static void metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
 static void error_callback_   (const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
-#endif
 
 
 
@@ -110,12 +95,8 @@ gboolean Flac_Header_Read_File_Info (gchar *filename, ET_File_Info *ETFileInfo)
     FILE *file;
     gdouble duration = 0;
     gulong filesize;
-
-#ifdef LEGACY_FLAC
-    FLAC__FileDecoder *tmp_decoder;
-#else
     FLAC__StreamDecoder *tmp_decoder;
-#endif
+
     file_info_struct tmp_file_info;
 
     if (!filename || !ETFileInfo)
@@ -131,52 +112,25 @@ gboolean Flac_Header_Read_File_Info (gchar *filename, ET_File_Info *ETFileInfo)
     fclose(file);
 
     /* Decoding FLAC file */
-#ifdef LEGACY_FLAC
-    tmp_decoder = FLAC__file_decoder_new();
-#else
     tmp_decoder = FLAC__stream_decoder_new();
-#endif
     if (tmp_decoder == 0)
     {
         return FALSE;
     }
 
     tmp_file_info.abort_flag = false;
-#ifdef LEGACY_FLAC
-    FLAC__file_decoder_set_md5_checking     (tmp_decoder, false);
-    FLAC__file_decoder_set_filename         (tmp_decoder, filename);
-    FLAC__file_decoder_set_write_callback   (tmp_decoder, write_callback_);
-    FLAC__file_decoder_set_metadata_callback(tmp_decoder, metadata_callback_);
-    FLAC__file_decoder_set_error_callback   (tmp_decoder, error_callback_);
-    FLAC__file_decoder_set_client_data      (tmp_decoder, &tmp_file_info);
-    if (FLAC__file_decoder_init(tmp_decoder) != FLAC__FILE_DECODER_OK)
-    {
-        return FALSE;
-    }
 
-#else
     FLAC__stream_decoder_set_md5_checking     (tmp_decoder, false);
     if(FLAC__stream_decoder_init_file(tmp_decoder, filename, write_callback_, metadata_callback_, error_callback_, &tmp_file_info) != FLAC__STREAM_DECODER_INIT_STATUS_OK)
         return FALSE;
-#endif
 
-#ifdef LEGACY_FLAC
-    // In FLAC 1.0.4, is used : FLAC__file_decoder_process_until_end_of_metadata
-    if (!FLAC__file_decoder_process_until_end_of_metadata(tmp_decoder)) // FLAC 1.0.4 (Bastian Kleineidam)
-#else
     if(!FLAC__stream_decoder_process_until_end_of_metadata(tmp_decoder))
-#endif
     {
         return FALSE;
     }
 
-#ifdef LEGACY_FLAC
-    FLAC__file_decoder_finish(tmp_decoder);
-    FLAC__file_decoder_delete(tmp_decoder);
-#else
     FLAC__stream_decoder_finish(tmp_decoder);
     FLAC__stream_decoder_delete(tmp_decoder);
-#endif
     /* End of decoding FLAC file */
 
 
@@ -196,11 +150,7 @@ gboolean Flac_Header_Read_File_Info (gchar *filename, ET_File_Info *ETFileInfo)
 
 
 
-#ifdef LEGACY_FLAC
-FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
-#else
 FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
-#endif
 {
     file_info_struct *file_info = (file_info_struct *)client_data;
     const unsigned bps = file_info->bits_per_sample, channels = file_info->channels, wide_samples = frame->header.blocksize;
@@ -233,11 +183,7 @@ FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *decode
     return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
 }
 
-#ifdef LEGACY_FLAC
-void metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
-#else
 void metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
-#endif
 {
     file_info_struct *file_info = (file_info_struct *)client_data;
     (void)decoder;
@@ -265,11 +211,7 @@ void metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMe
     }
 }
 
-#ifdef LEGACY_FLAC
-void error_callback_(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
-#else
 void error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
-#endif
 {
     file_info_struct *file_info = (file_info_struct *)client_data;
     (void)decoder;
diff --git a/src/flac_tag.c b/src/flac_tag.c
index 5502780..4b533b3 100644
--- a/src/flac_tag.c
+++ b/src/flac_tag.c
@@ -50,15 +50,6 @@
 
 #define MULTIFIELD_SEPARATOR " - "
 
-/* Patch from Josh Coalson
- * FLAC 1.1.3 has FLAC_API_VERSION_CURRENT == 8 *
- * by LEGACY_FLAC we mean pre-FLAC 1.1.3; in FLAC 1.1.3 the FLAC__FileDecoder was merged into the FLAC__StreamDecoder */
-#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT < 8
-#define LEGACY_FLAC // For FLAC version < 1.1.3
-#else
-#undef LEGACY_FLAC
-#endif
-
 
 /* FLAC uses Ogg Vorbis comments
  * Ogg Vorbis fields names :
@@ -110,9 +101,7 @@ gboolean Flac_Tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
     gchar *string = NULL;
     gchar *filename_utf8 = filename_to_display(filename);
     guint i;
-#ifndef LEGACY_FLAC // For FLAC >= 1.1.3
     Picture *prev_pic = NULL;
-#endif
     //gint j = 1;
 
     
@@ -651,7 +640,6 @@ gboolean Flac_Tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
             //
             // Read the PICTURE block (severals can exist)
             //
-#ifndef LEGACY_FLAC // For FLAC >= 1.1.3
             case FLAC__METADATA_TYPE_PICTURE: 
             {
                 
@@ -684,7 +672,6 @@ gboolean Flac_Tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
 
                 break;
             }
-#endif
                 
             default:
                 break;
@@ -908,13 +895,11 @@ gboolean Flac_Tag_Write_File_Tag (ET_File *ETFile)
             //
             // Delete all the PICTURE blocks, and convert to padding
             //
-#ifndef LEGACY_FLAC // For FLAC >= 1.1.3
             case FLAC__METADATA_TYPE_PICTURE: 
             {
                 FLAC__metadata_iterator_delete_block(iter,true);
                 break;
             }
-#endif
             
             default:
                 break;
@@ -1039,8 +1024,6 @@ gboolean Flac_Tag_Write_File_Tag (ET_File *ETFile)
     /***********
      * Picture *
      ***********/
-    // For FLAC >= 1.1.3
-    #ifndef LEGACY_FLAC
     {
         Picture *pic = FileTag->picture;
         while (pic)
@@ -1089,7 +1072,6 @@ gboolean Flac_Tag_Write_File_Tag (ET_File *ETFile)
             pic = pic->next;
         }
     }
-    #endif
     
     // Free iter
     FLAC__metadata_iterator_delete(iter);



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