Lines 41-46
Link Here
|
41 |
#include "metadata.h" |
41 |
#include "metadata.h" |
42 |
#include "macros.h" |
42 |
#include "macros.h" |
43 |
|
43 |
|
|
|
44 |
/* FLAC 1.1.3 has FLAC_API_VERSION_CURRENT == 8 */ |
45 |
#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT < 8 |
46 |
#define LEGACY_FLAC |
47 |
#else |
48 |
#undef LEGACY_FLAC |
49 |
#endif |
50 |
|
44 |
struct _Metadata { |
51 |
struct _Metadata { |
45 |
char *title; |
52 |
char *title; |
46 |
|
53 |
|
Lines 829-850
Link Here
|
829 |
|
836 |
|
830 |
flac_decoder = FLAC__stream_decoder_new (); |
837 |
flac_decoder = FLAC__stream_decoder_new (); |
831 |
|
838 |
|
|
|
839 |
#ifdef LEGACY_FLAC |
832 |
FLAC__stream_decoder_set_read_callback (flac_decoder, FLAC_read_callback); |
840 |
FLAC__stream_decoder_set_read_callback (flac_decoder, FLAC_read_callback); |
833 |
FLAC__stream_decoder_set_write_callback (flac_decoder, FLAC_write_callback); |
841 |
FLAC__stream_decoder_set_write_callback (flac_decoder, FLAC_write_callback); |
834 |
FLAC__stream_decoder_set_metadata_callback (flac_decoder, FLAC_metadata_callback); |
842 |
FLAC__stream_decoder_set_metadata_callback (flac_decoder, FLAC_metadata_callback); |
835 |
FLAC__stream_decoder_set_error_callback (flac_decoder, FLAC_error_callback); |
843 |
FLAC__stream_decoder_set_error_callback (flac_decoder, FLAC_error_callback); |
|
|
844 |
#endif |
836 |
|
845 |
|
837 |
callback_data = g_new0 (CallbackData, 1); |
846 |
callback_data = g_new0 (CallbackData, 1); |
838 |
callback_data->handle = handle; |
847 |
callback_data->handle = handle; |
839 |
callback_data->comment = comment; |
848 |
callback_data->comment = comment; |
|
|
849 |
#ifdef LEGACY_FLAC |
840 |
FLAC__stream_decoder_set_client_data (flac_decoder, callback_data); |
850 |
FLAC__stream_decoder_set_client_data (flac_decoder, callback_data); |
|
|
851 |
#endif |
841 |
|
852 |
|
842 |
/* by default, only the STREAMINFO block is parsed and passed to |
853 |
/* by default, only the STREAMINFO block is parsed and passed to |
843 |
* the metadata callback. Here we instruct the decoder to also |
854 |
* the metadata callback. Here we instruct the decoder to also |
844 |
* pass us the VORBISCOMMENT block if there is one. */ |
855 |
* pass us the VORBISCOMMENT block if there is one. */ |
845 |
FLAC__stream_decoder_set_metadata_respond (flac_decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT); |
856 |
FLAC__stream_decoder_set_metadata_respond (flac_decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT); |
846 |
|
857 |
|
|
|
858 |
#ifdef LEGACY_FLAC |
847 |
FLAC__stream_decoder_init (flac_decoder); |
859 |
FLAC__stream_decoder_init (flac_decoder); |
|
|
860 |
#else |
861 |
FLAC__stream_decoder_init_stream (flac_decoder, FLAC_read_callback, NULL, NULL, NULL, NULL, FLAC_write_callback, FLAC_metadata_callback, FLAC_error_callback, callback_data); |
862 |
#endif |
848 |
|
863 |
|
849 |
/* this runs the decoding process, calling the callbacks as appropriate */ |
864 |
/* this runs the decoding process, calling the callbacks as appropriate */ |
850 |
if (FLAC__stream_decoder_process_until_end_of_metadata (flac_decoder) == 0) { |
865 |
if (FLAC__stream_decoder_process_until_end_of_metadata (flac_decoder) == 0) { |