Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 103345 Details for
Bug 157125
media-sound/easytag-1.99.12 patch for new FLAC API
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
easytag_flac8.diff
easytag_flac8.diff (text/plain), 9.30 KB, created by
Maarten Maathuis
on 2006-12-04 11:41:34 UTC
(
hide
)
Description:
easytag_flac8.diff
Filename:
MIME Type:
Creator:
Maarten Maathuis
Created:
2006-12-04 11:41:34 UTC
Size:
9.30 KB
patch
obsolete
>diff -ur easytag-1.99.12/configure.in easytag-1.99.12-new/configure.in >--- easytag-1.99.12/configure.in 2005-12-15 20:50:49.000000000 +0100 >+++ easytag-1.99.12-new/configure.in 2006-12-04 19:50:33.000000000 +0100 >@@ -109,13 +109,26 @@ > if test "x$enable_flac" = "xyes"; then > dnl Library required for flac files, if not found 'enable_flac' is disabled > AC_CHECK_LIB(m, cos) dnl Patch from Christian Weisgerber >- AC_CHECK_LIB(FLAC, FLAC__metadata_simple_iterator_new, , flac_available=no) >+ AC_CHECK_LIB(FLAC, FLAC__stream_decoder_init_file, flac_8_available=yes, flac_8_available=no) >+ AC_CHECK_LIB(FLAC, FLAC__file_decoder_new, flac_7_available=yes, flac_7_available=no) > > AC_MSG_CHECKING(for FLAC file support) >+ if test "x$flac_8_available" = "xyes"; then >+ enable_flac="yes" >+ flac_available="yes" >+ AC_DEFINE(ENABLE_FLAC_8,1,[Define for FLAC support]) >+ elif test "x$flac_7_available" = "xyes"; then >+ enable_flac="yes" >+ flac_available="yes" >+ AC_DEFINE(ENABLE_FLAC_7,1,[Define for FLAC support]) >+ else >+ flac_available="no" >+ fi >+ > if test "x$flac_available" = "xno"; then >- AC_MSG_RESULT(no) >- enable_flac="no" >- echo "***" >+ AC_MSG_RESULT(no) >+ enable_flac="no" >+ echo "***" > echo "*** Warning: FLAC file support disabled, libflac missing" > echo "*** (Install libflac, libogg and libvorbis libraries to enable it)" > echo "***" >@@ -144,7 +157,7 @@ > if test "x$enable_flac" = "xyes"; then > LIBS_SAVE="$LIBS" > CFLAGS_SAVE="$CFLAGS" >- LIBS="$LIBS $LIBFLAC_LIBS" >+ LIBS="$LIBS -lFLAC" > CFLAGS="$CFLAGS $LIBFLAC_CFLAGS" > AC_MSG_CHECKING(for libFLAC version) > AC_TRY_RUN([ >@@ -168,8 +181,8 @@ > fclose(output); > exit(0); > } >-], . ./conftest.flac; echo "${LIBFLAC_MAJOR}.${LIBFLAC_MINOR}.${LIBFLAC_PATCH}", AC_MSG_WARN(could not determine libFLAC version),[echo $ac_n "cross compiling; assuming ${LIBFLAC_MAJOR}.${LIBFLAC_MINOR}.${LIBFLAC_PATCH} $ac_c"]) >- LIBS="$LIBS_SAVE" >+], source ./conftest.flac; echo "${LIBFLAC_MAJOR}.${LIBFLAC_MINOR}.${LIBFLAC_PATCH}", AC_MSG_WARN(could not determine libFLAC version),echo $ac_n "cross compiling; assuming ${LIBFLAC_MAJOR}.${LIBFLAC_MINOR}.${LIBFLAC_PATCH} $ac_c") >+ LIBS="$LIBS_SAVE -lFLAC" > CFLAGS="$CFLAGS_SAVE" > LIBFLAC_VERSION="(flac-$LIBFLAC_MAJOR.$LIBFLAC_MINOR.$LIBFLAC_PATCH)" > fi >diff -ur easytag-1.99.12/src/flac_header.c easytag-1.99.12-new/src/flac_header.c >--- easytag-1.99.12/src/flac_header.c 2005-10-22 21:34:56.000000000 +0200 >+++ easytag-1.99.12-new/src/flac_header.c 2006-12-04 19:52:54.000000000 +0100 >@@ -75,11 +75,17 @@ > /************** > * Prototypes * > **************/ >+#endif /* ENABLE_FLAC */ >+ >+#ifdef ENABLE_FLAC_8 >+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); >+#elif ENABLE_FLAC_7 > 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 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); >- >- >+#endif /* ENABLE_FLAC_8 */ > > /************* > * Functions * >@@ -88,16 +94,93 @@ > /**************************** > * Header info of FLAC file * > ****************************/ >+#ifdef ENABLE_FLAC_8 > > gboolean Flac_Header_Read_File_Info (gchar *filename, ET_File_Info *ETFileInfo) > { > FILE *file; > gdouble duration = 0; > gulong filesize; >+ >+ >+ >+ FLAC__StreamDecoder *tmp_decoder; >+ >+ file_info_struct tmp_file_info; >+ >+ >+ if (!filename || !ETFileInfo) >+ return FALSE; >+ >+ if ( (file=fopen(filename,"r"))==NULL ) >+ { >+ gchar *filename_utf8 = filename_to_display(filename); >+ g_print(_("ERROR while opening file: '%s' (%s)\n\a"),filename_utf8,g_strerror(errno)); >+ g_free(filename_utf8); >+ return FALSE; >+ } >+ fclose(file); >+ >+ /* Decoding FLAC file */ >+ tmp_decoder = FLAC__stream_decoder_new(); >+ if (tmp_decoder == 0) >+ { >+ return FALSE; >+ } >+ >+ tmp_file_info.abort_flag = false; >+ >+ 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; >+ } >+ >+ if (!FLAC__stream_decoder_process_until_end_of_metadata(tmp_decoder)) { >+ return FALSE; >+ } > >+ FLAC__stream_decoder_finish(tmp_decoder); >+ FLAC__stream_decoder_delete(tmp_decoder); >+ /* End of decoding FLAC file */ >+ >+ >+ filesize = Get_File_Size(filename); >+ duration = (gint)tmp_file_info.length_in_msec/1000; >+ >+ ETFileInfo->version = 0; // Not defined in FLAC file >+ if (duration > 0) >+ ETFileInfo->bitrate = filesize*8/duration/1000; // FIXME : Approximation!! Needs to remove tag size! >+ ETFileInfo->samplerate = tmp_file_info.sample_rate; >+ ETFileInfo->mode = tmp_file_info.channels; >+ ETFileInfo->size = filesize; >+ ETFileInfo->duration = duration; >+ >+ return TRUE; >+} >+ >+#elif ENABLE_FLAC_7 >+ >+gboolean Flac_Header_Read_File_Info (gchar *filename, ET_File_Info *ETFileInfo) >+{ >+ FILE *file; >+ gdouble duration = 0; >+ gulong filesize; >+ >+ >+ > FLAC__FileDecoder *tmp_decoder; >+ > file_info_struct tmp_file_info; > >+ > if (!filename || !ETFileInfo) > return FALSE; > >@@ -159,7 +242,77 @@ > return TRUE; > } > >+#endif /* ENABLE_FLAC_8 */ > >+#ifdef ENABLE_FLAC_8 >+ >+FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) >+{ >+ 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; >+ unsigned wide_sample, sample, channel; >+ FLAC__int8 *scbuffer = (FLAC__int8*)reservoir_; >+ FLAC__int16 *ssbuffer = (FLAC__int16*)reservoir_; >+ >+ (void)decoder; >+ >+ if (file_info->abort_flag) >+ return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; >+ >+ if (bps == 8) { >+ for(sample = reservoir_samples_*channels, wide_sample = 0; wide_sample < wide_samples; wide_sample++) >+ for(channel = 0; channel < channels; channel++, sample++) >+ scbuffer[sample] = (FLAC__int8)buffer[channel][wide_sample]; >+ } >+ else if (bps == 16) { >+ for(sample = reservoir_samples_*channels, wide_sample = 0; wide_sample < wide_samples; wide_sample++) >+ for(channel = 0; channel < channels; channel++, sample++) >+ ssbuffer[sample] = (FLAC__int16)buffer[channel][wide_sample]; >+ } >+ else { >+ file_info->abort_flag = true; >+ return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; >+ } >+ >+ reservoir_samples_ += wide_samples; >+ >+ return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; >+} >+ >+void metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) >+{ >+ file_info_struct *file_info = (file_info_struct *)client_data; >+ (void)decoder; >+ if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO) { >+ FLAC__ASSERT(metadata->data.stream_info.total_samples < 0x100000000); /* this plugin can only handle < 4 gigasamples */ >+ file_info->total_samples = (unsigned)(metadata->data.stream_info.total_samples&0xffffffff); >+ file_info->bits_per_sample = metadata->data.stream_info.bits_per_sample; >+ file_info->channels = metadata->data.stream_info.channels; >+ file_info->sample_rate = metadata->data.stream_info.sample_rate; >+ >+ if (file_info->bits_per_sample == 8) { >+ file_info->sample_format = FMT_S8; >+ } >+ else if (file_info->bits_per_sample == 16) { >+ file_info->sample_format = FMT_S16_NE; >+ } >+ else { >+ file_info->abort_flag = true; >+ return; >+ } >+ file_info->length_in_msec = file_info->total_samples * 10 / (file_info->sample_rate / 100); >+ } >+} >+ >+void error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) >+{ >+ file_info_struct *file_info = (file_info_struct *)client_data; >+ (void)decoder; >+ if (status != FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC) >+ file_info->abort_flag = true; >+} >+ >+#elif ENABLE_FLAC_7 > > FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) > { >@@ -227,8 +380,9 @@ > file_info->abort_flag = true; > } > >+#endif /* FLAC_ENABLE_8 */ > >- >+#ifdef ENABLE_FLAC > > gboolean Flac_Header_Display_File_Info_To_UI (gchar *filename_utf8, ET_File_Info *ETFileInfo) > {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 157125
:
103345
|
103809