merge down from merged-API-layer branch: cvs -q up -dP -j API_LAYER_MERGING_BASELINE...
[platform/upstream/flac.git] / src / test_libs_common / file_utils_oggflac.c
similarity index 88%
rename from src/test_libOggFLAC++/file_utils.c
rename to src/test_libs_common/file_utils_oggflac.c
index d397b5b..09cb34c 100644 (file)
@@ -20,9 +20,9 @@
 #  include <config.h>
 #endif
 
-#include "file_utils.h"
 #include "FLAC/assert.h"
 #include "OggFLAC/stream_encoder.h"
+#include "test_libs_common/file_utils_oggflac.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/stat.h> /* for stat() */
@@ -50,7 +50,7 @@ typedef struct {
        FILE *file;
 } encoder_client_struct;
 
-static FLAC__StreamEncoderWriteStatus encoder_write_callback_(const OggFLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data)
+static FLAC__StreamEncoderWriteStatus encoder_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data)
 {
        encoder_client_struct *ecd = (encoder_client_struct*)client_data;
 
@@ -62,7 +62,7 @@ static FLAC__StreamEncoderWriteStatus encoder_write_callback_(const OggFLAC__Str
                return FLAC__STREAM_ENCODER_WRITE_STATUS_OK;
 }
 
-static void encoder_metadata_callback_(const OggFLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data)
+static void encoder_metadata_callback_(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data)
 {
        (void)encoder, (void)metadata, (void)client_data;
 }
@@ -107,11 +107,8 @@ FLAC__bool file_utils__generate_oggflacfile(const char *output_filename, off_t *
        OggFLAC__stream_encoder_set_rice_parameter_search_dist(encoder, 0);
        OggFLAC__stream_encoder_set_total_samples_estimate(encoder, streaminfo->data.stream_info.total_samples);
        OggFLAC__stream_encoder_set_metadata(encoder, metadata, num_metadata);
-       OggFLAC__stream_encoder_set_write_callback(encoder, encoder_write_callback_);
-       OggFLAC__stream_encoder_set_metadata_callback(encoder, encoder_metadata_callback_);
-       OggFLAC__stream_encoder_set_client_data(encoder, &encoder_client_data);
 
-       if(OggFLAC__stream_encoder_init(encoder) != OggFLAC__STREAM_ENCODER_OK) {
+       if(OggFLAC__stream_encoder_init_stream(encoder, /*read_callback=*/0, encoder_write_callback_, /*seek_callback=*/0, /*tell_callback=*/0, encoder_metadata_callback_, &encoder_client_data) != FLAC__STREAM_ENCODER_INIT_STATUS_OK) {
                fclose(encoder_client_data.file);
                return false;
        }