add FLAC::Encoder::*::set_metadata(FLAC::Metadata::Prototype **metadata, unsigned...
authorJosh Coalson <jcoalson@users.sourceforce.net>
Thu, 22 Jul 2004 01:04:22 +0000 (01:04 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Thu, 22 Jul 2004 01:04:22 +0000 (01:04 +0000)
include/FLAC++/encoder.h
src/libFLAC++/file_encoder.cpp
src/libFLAC++/seekable_stream_encoder.cpp
src/libFLAC++/stream_encoder.cpp

index e7476d0..bcecd39 100644 (file)
@@ -38,6 +38,7 @@
 #include "FLAC/seekable_stream_encoder.h"
 #include "FLAC/stream_encoder.h"
 #include "decoder.h"
+#include "metadata.h"
 
 
 /** \file include/FLAC++/encoder.h
@@ -125,6 +126,7 @@ namespace FLAC {
                        bool set_rice_parameter_search_dist(unsigned value);
                        bool set_total_samples_estimate(FLAC__uint64 value);
                        bool set_metadata(::FLAC__StreamMetadata **metadata, unsigned num_blocks);
+                       bool set_metadata(FLAC::Metadata::Prototype **metadata, unsigned num_blocks);
 
                        State    get_state() const;
                        Decoder::Stream::State get_verify_decoder_state() const;
@@ -222,6 +224,7 @@ namespace FLAC {
                        bool set_rice_parameter_search_dist(unsigned value);
                        bool set_total_samples_estimate(FLAC__uint64 value);
                        bool set_metadata(::FLAC__StreamMetadata **metadata, unsigned num_blocks);
+                       bool set_metadata(FLAC::Metadata::Prototype **metadata, unsigned num_blocks);
 
                        State    get_state() const;
                        Stream::State get_stream_encoder_state() const;
@@ -322,6 +325,7 @@ namespace FLAC {
                        bool set_rice_parameter_search_dist(unsigned value);
                        bool set_total_samples_estimate(FLAC__uint64 value);
                        bool set_metadata(::FLAC__StreamMetadata **metadata, unsigned num_blocks);
+                       bool set_metadata(FLAC::Metadata::Prototype **metadata, unsigned num_blocks);
                        bool set_filename(const char *value);
 
                        State    get_state() const;
index c810172..875fc6c 100644 (file)
@@ -165,6 +165,17 @@ namespace FLAC {
                        return (bool)::FLAC__file_encoder_set_metadata(encoder_, metadata, num_blocks);
                }
 
+               bool File::set_metadata(FLAC::Metadata::Prototype **metadata, unsigned num_blocks)
+               {
+                       FLAC__ASSERT(is_valid());
+                       ::FLAC__StreamMetadata *m[num_blocks];
+                       for(unsigned i = 0; i < num_blocks; i++) {
+                               // we can get away with this since we know the encoder will only correct the is_last flags
+                               m[i] = const_cast< ::FLAC__StreamMetadata*>((::FLAC__StreamMetadata*)metadata[i]);
+                       }
+                       return (bool)::FLAC__file_encoder_set_metadata(encoder_, m, num_blocks);
+               }
+
                bool File::set_filename(const char *value)
                {
                        FLAC__ASSERT(is_valid());
index 1d1e42b..9e8f58e 100644 (file)
@@ -165,6 +165,17 @@ namespace FLAC {
                        return (bool)::FLAC__seekable_stream_encoder_set_metadata(encoder_, metadata, num_blocks);
                }
 
+               bool SeekableStream::set_metadata(FLAC::Metadata::Prototype **metadata, unsigned num_blocks)
+               {
+                       FLAC__ASSERT(is_valid());
+                       ::FLAC__StreamMetadata *m[num_blocks];
+                       for(unsigned i = 0; i < num_blocks; i++) {
+                               // we can get away with this since we know the encoder will only correct the is_last flags
+                               m[i] = const_cast< ::FLAC__StreamMetadata*>((::FLAC__StreamMetadata*)metadata[i]);
+                       }
+                       return (bool)::FLAC__seekable_stream_encoder_set_metadata(encoder_, m, num_blocks);
+               }
+
                SeekableStream::State SeekableStream::get_state() const
                {
                        FLAC__ASSERT(is_valid());
index 6e6ca64..5aaa43e 100644 (file)
@@ -30,6 +30,7 @@
  */
 
 #include "FLAC++/encoder.h"
+#include "FLAC++/metadata.h"
 #include "FLAC/assert.h"
 
 #ifdef _MSC_VER
@@ -165,6 +166,17 @@ namespace FLAC {
                        return (bool)::FLAC__stream_encoder_set_metadata(encoder_, metadata, num_blocks);
                }
 
+               bool Stream::set_metadata(FLAC::Metadata::Prototype **metadata, unsigned num_blocks)
+               {
+                       FLAC__ASSERT(is_valid());
+                       ::FLAC__StreamMetadata *m[num_blocks];
+                       for(unsigned i = 0; i < num_blocks; i++) {
+                               // we can get away with this since we know the encoder will only correct the is_last flags
+                               m[i] = const_cast< ::FLAC__StreamMetadata*>((::FLAC__StreamMetadata*)metadata[i]);
+                       }
+                       return (bool)::FLAC__stream_encoder_set_metadata(encoder_, m, num_blocks);
+               }
+
                Stream::State Stream::get_state() const
                {
                        FLAC__ASSERT(is_valid());