~ubuntu-branches/ubuntu/utopic/flac/utopic-security

« back to all changes in this revision

Viewing changes to include/FLAC++/metadata.h

  • Committer: Bazaar Package Importer
  • Author(s): Marc 'HE' Brockschmidt
  • Date: 2008-03-16 18:02:56 UTC
  • mfrom: (1.1.5 upstream) (8.1.2 gutsy)
  • Revision ID: james.westby@ubuntu.com-20080316180256-qhf3wk704rp165pm
Tags: 1.2.1-1.2
* Non-maintainer upload.
* Fix gcc-4.3 FTBFS, patch by KiBi (Closes: #455304)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* libFLAC++ - Free Lossless Audio Codec library
2
 
 * Copyright (C) 2002,2003,2004,2005  Josh Coalson
 
2
 * Copyright (C) 2002,2003,2004,2005,2006,2007  Josh Coalson
3
3
 *
4
4
 * Redistribution and use in source and binary forms, with or without
5
5
 * modification, are permitted provided that the following conditions
64
64
 *
65
65
 *  The behavior closely mimics the C layer interface; be sure to read
66
66
 *  the detailed description of the
67
 
 *  \link flac_metadata C metadata module \endlink.
 
67
 *  \link flac_metadata C metadata module \endlink.  Note that like the
 
68
 *  C layer, currently only the Chain interface (level 2) supports Ogg
 
69
 *  FLAC files, and it is read-only i.e. no writing back changed
 
70
 *  metadata to file.
68
71
 */
69
72
 
70
73
 
100
103
                 */
101
104
 
102
105
                /** Base class for all metadata block types.
 
106
                 *  See the \link flacpp_metadata_object overview \endlink for more.
103
107
                 */
104
108
                class FLACPP_API Prototype {
105
109
                protected:
147
151
                        virtual ~Prototype();
148
152
 
149
153
                        //@{
150
 
                        /** Check for equality, performing a deep compare by following pointers. */
 
154
                        /** Check for equality, performing a deep compare by following pointers.
 
155
                         */
151
156
                        inline bool operator==(const Prototype &) const;
152
157
                        inline bool operator==(const ::FLAC__StreamMetadata &) const;
153
158
                        inline bool operator==(const ::FLAC__StreamMetadata *) const;
259
264
 
260
265
 
261
266
                /** STREAMINFO metadata block.
262
 
                 *  See <A HREF="../format.html#metadata_block_streaminfo">format specification</A>.
 
267
                 *  See the \link flacpp_metadata_object overview \endlink for more,
 
268
                 *  and the <A HREF="../format.html#metadata_block_streaminfo">format specification</A>.
263
269
                 */
264
270
                class FLACPP_API StreamInfo : public Prototype {
265
271
                public:
332
338
                };
333
339
 
334
340
                /** PADDING metadata block.
335
 
                 *  See <A HREF="../format.html#metadata_block_padding">format specification</A>.
 
341
                 *  See the \link flacpp_metadata_object overview \endlink for more,
 
342
                 *  and the <A HREF="../format.html#metadata_block_padding">format specification</A>.
336
343
                 */
337
344
                class FLACPP_API Padding : public Prototype {
338
345
                public:
384
391
                };
385
392
 
386
393
                /** APPLICATION metadata block.
387
 
                 *  See <A HREF="../format.html#metadata_block_application">format specification</A>.
 
394
                 *  See the \link flacpp_metadata_object overview \endlink for more,
 
395
                 *  and the <A HREF="../format.html#metadata_block_application">format specification</A>.
388
396
                 */
389
397
                class FLACPP_API Application : public Prototype {
390
398
                public:
442
450
                };
443
451
 
444
452
                /** SEEKTABLE metadata block.
445
 
                 *  See <A HREF="../format.html#metadata_block_seektable">format specification</A>.
 
453
                 *  See the \link flacpp_metadata_object overview \endlink for more,
 
454
                 *  and the <A HREF="../format.html#metadata_block_seektable">format specification</A>.
446
455
                 */
447
456
                class FLACPP_API SeekTable : public Prototype {
448
457
                public:
507
516
                };
508
517
 
509
518
                /** VORBIS_COMMENT metadata block.
510
 
                 *  See <A HREF="../format.html#metadata_block_vorbis_comment">format specification</A>.
 
519
                 *  See the \link flacpp_metadata_object overview \endlink for more,
 
520
                 *  and the <A HREF="../format.html#metadata_block_vorbis_comment">format specification</A>.
511
521
                 */
512
522
                class FLACPP_API VorbisComment : public Prototype {
513
523
                public:
556
566
 
557
567
                                virtual ~Entry();
558
568
 
559
 
                                virtual bool is_valid() const;
 
569
                                virtual bool is_valid() const; ///< Returns \c true iff object was properly constructed.
560
570
 
561
571
                                unsigned get_field_length() const;
562
572
                                unsigned get_field_name_length() const;
658
668
                };
659
669
 
660
670
                /** CUESHEET metadata block.
661
 
                 *  See <A HREF="../format.html#metadata_block_cuesheet">format specification</A>.
 
671
                 *  See the \link flacpp_metadata_object overview \endlink for more,
 
672
                 *  and the <A HREF="../format.html#metadata_block_cuesheet">format specification</A>.
662
673
                 */
663
674
                class FLACPP_API CueSheet : public Prototype {
664
675
                public:
679
690
 
680
691
                                virtual ~Track();
681
692
 
682
 
                                virtual bool is_valid() const;
 
693
                                virtual bool is_valid() const; ///< Returns \c true iff object was properly constructed.
 
694
 
683
695
 
684
696
                                inline FLAC__uint64 get_offset() const { return object_->offset; }
685
697
                                inline FLAC__byte get_number() const { return object_->number; }
777
789
 
778
790
                        //! See FLAC__metadata_object_cuesheet_is_legal()
779
791
                        bool is_legal(bool check_cd_da_subset = false, const char **violation = 0) const;
 
792
 
 
793
                        //! See FLAC__metadata_object_cuesheet_calculate_cddb_id()
 
794
                        FLAC__uint32 calculate_cddb_id() const;
 
795
                };
 
796
 
 
797
                /** PICTURE metadata block.
 
798
                 *  See the \link flacpp_metadata_object overview \endlink for more,
 
799
                 *  and the <A HREF="../format.html#metadata_block_picture">format specification</A>.
 
800
                 */
 
801
                class FLACPP_API Picture : public Prototype {
 
802
                public:
 
803
                        Picture();
 
804
 
 
805
                        //@{
 
806
                        /** Constructs a copy of the given object.  This form
 
807
                         *  always performs a deep copy.
 
808
                         */
 
809
                        inline Picture(const Picture &object): Prototype(object) { }
 
810
                        inline Picture(const ::FLAC__StreamMetadata &object): Prototype(object) { }
 
811
                        inline Picture(const ::FLAC__StreamMetadata *object): Prototype(object) { }
 
812
                        //@}
 
813
 
 
814
                        /** Constructs an object with copy control.  See
 
815
                         *  Prototype(::FLAC__StreamMetadata *object, bool copy).
 
816
                         */
 
817
                        inline Picture(::FLAC__StreamMetadata *object, bool copy): Prototype(object, copy) { }
 
818
 
 
819
                        ~Picture();
 
820
 
 
821
                        //@{
 
822
                        /** Assign from another object.  Always performs a deep copy. */
 
823
                        inline Picture &operator=(const Picture &object) { Prototype::operator=(object); return *this; }
 
824
                        inline Picture &operator=(const ::FLAC__StreamMetadata &object) { Prototype::operator=(object); return *this; }
 
825
                        inline Picture &operator=(const ::FLAC__StreamMetadata *object) { Prototype::operator=(object); return *this; }
 
826
                        //@}
 
827
 
 
828
                        /** Assigns an object with copy control.  See
 
829
                         *  Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy).
 
830
                         */
 
831
                        inline Picture &assign(::FLAC__StreamMetadata *object, bool copy) { Prototype::assign_object(object, copy); return *this; }
 
832
 
 
833
                        //@{
 
834
                        /** Check for equality, performing a deep compare by following pointers. */
 
835
                        inline bool operator==(const Picture &object) const { return Prototype::operator==(object); }
 
836
                        inline bool operator==(const ::FLAC__StreamMetadata &object) const { return Prototype::operator==(object); }
 
837
                        inline bool operator==(const ::FLAC__StreamMetadata *object) const { return Prototype::operator==(object); }
 
838
                        //@}
 
839
 
 
840
                        //@{
 
841
                        /** Check for inequality, performing a deep compare by following pointers. */
 
842
                        inline bool operator!=(const Picture &object) const { return Prototype::operator!=(object); }
 
843
                        inline bool operator!=(const ::FLAC__StreamMetadata &object) const { return Prototype::operator!=(object); }
 
844
                        inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
 
845
                        //@}
 
846
 
 
847
                        ::FLAC__StreamMetadata_Picture_Type get_type() const;
 
848
                        const char *get_mime_type() const; // NUL-terminated printable ASCII string
 
849
                        const FLAC__byte *get_description() const; // NUL-terminated UTF-8 string
 
850
                        FLAC__uint32 get_width() const;
 
851
                        FLAC__uint32 get_height() const;
 
852
                        FLAC__uint32 get_depth() const;
 
853
                        FLAC__uint32 get_colors() const; ///< a return value of \c 0 means true-color, i.e. 2^depth colors
 
854
                        FLAC__uint32 get_data_length() const;
 
855
                        const FLAC__byte *get_data() const;
 
856
 
 
857
                        void set_type(::FLAC__StreamMetadata_Picture_Type type);
 
858
 
 
859
                        //! See FLAC__metadata_object_picture_set_mime_type()
 
860
                        bool set_mime_type(const char *string); // NUL-terminated printable ASCII string
 
861
 
 
862
                        //! See FLAC__metadata_object_picture_set_description()
 
863
                        bool set_description(const FLAC__byte *string); // NUL-terminated UTF-8 string
 
864
 
 
865
                        void set_width(FLAC__uint32 value) const;
 
866
                        void set_height(FLAC__uint32 value) const;
 
867
                        void set_depth(FLAC__uint32 value) const;
 
868
                        void set_colors(FLAC__uint32 value) const; ///< a value of \c 0 means true-color, i.e. 2^depth colors
 
869
 
 
870
                        //! See FLAC__metadata_object_picture_set_data()
 
871
                        bool set_data(const FLAC__byte *data, FLAC__uint32 data_length);
780
872
                };
781
873
 
782
874
                /** Opaque metadata block for storing unknown types.
783
875
                 *  This should not be used unless you know what you are doing;
784
876
                 *  it is currently used only internally to support forward
785
877
                 *  compatibility of metadata blocks.
 
878
                 *  See the \link flacpp_metadata_object overview \endlink for more,
786
879
                 */
787
880
                class FLACPP_API Unknown : public Prototype {
788
881
                public:
852
945
                 * \{
853
946
                 */
854
947
 
855
 
                //! See FLAC__metadata_get_streaminfo().
856
 
                FLACPP_API bool get_streaminfo(const char *filename, StreamInfo &streaminfo);
857
 
 
858
 
                //! See FLAC__metadata_get_tags().
859
 
                FLACPP_API bool get_tags(const char *filename, VorbisComment *&tags);
860
 
                FLACPP_API bool get_tags(const char *filename, VorbisComment &tags);
 
948
                FLACPP_API bool get_streaminfo(const char *filename, StreamInfo &streaminfo); ///< See FLAC__metadata_get_streaminfo().
 
949
 
 
950
                FLACPP_API bool get_tags(const char *filename, VorbisComment *&tags); ///< See FLAC__metadata_get_tags().
 
951
                FLACPP_API bool get_tags(const char *filename, VorbisComment &tags); ///< See FLAC__metadata_get_tags().
 
952
 
 
953
                FLACPP_API bool get_cuesheet(const char *filename, CueSheet *&cuesheet); ///< See FLAC__metadata_get_cuesheet().
 
954
                FLACPP_API bool get_cuesheet(const char *filename, CueSheet &cuesheet); ///< See FLAC__metadata_get_cuesheet().
 
955
 
 
956
                FLACPP_API bool get_picture(const char *filename, Picture *&picture, ::FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, unsigned max_width, unsigned max_height, unsigned max_depth, unsigned max_colors); ///< See FLAC__metadata_get_picture().
 
957
                FLACPP_API bool get_picture(const char *filename, Picture &picture, ::FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, unsigned max_width, unsigned max_height, unsigned max_depth, unsigned max_colors); ///< See FLAC__metadata_get_picture().
861
958
 
862
959
                /* \} */
863
960
 
892
989
                 */
893
990
 
894
991
                /** This class is a wrapper around the FLAC__metadata_simple_iterator
895
 
                 *  structures and methods; see ::FLAC__Metadata_SimpleIterator.
 
992
                 *  structures and methods; see the
 
993
                 * \link flacpp_metadata_level1 usage guide \endlink and
 
994
                 * ::FLAC__Metadata_SimpleIterator.
896
995
                 */
897
996
                class FLACPP_API SimpleIterator {
898
997
                public:
 
998
                        /** This class is a wrapper around FLAC__Metadata_SimpleIteratorStatus.
 
999
                         */
899
1000
                        class FLACPP_API Status {
900
1001
                        public:
901
1002
                                inline Status(::FLAC__Metadata_SimpleIteratorStatus status): status_(status) { }
908
1009
                        SimpleIterator();
909
1010
                        virtual ~SimpleIterator();
910
1011
 
911
 
                        bool init(const char *filename, bool read_only, bool preserve_file_stats);
912
 
 
913
 
                        bool is_valid() const;
914
 
                        Status status();
915
 
                        bool is_writable() const;
916
 
 
917
 
                        bool next();
918
 
                        bool prev();
919
 
 
920
 
                        ::FLAC__MetadataType get_block_type() const;
921
 
                        Prototype *get_block();
922
 
                        bool set_block(Prototype *block, bool use_padding = true);
923
 
                        bool insert_block_after(Prototype *block, bool use_padding = true);
924
 
                        bool delete_block(bool use_padding = true);
 
1012
                        bool is_valid() const; ///< Returns \c true iff object was properly constructed.
 
1013
 
 
1014
                        bool init(const char *filename, bool read_only, bool preserve_file_stats); ///< See FLAC__metadata_simple_iterator_init().
 
1015
 
 
1016
                        Status status();                                                    ///< See FLAC__metadata_simple_iterator_status().
 
1017
                        bool is_writable() const;                                           ///< See FLAC__metadata_simple_iterator_is_writable().
 
1018
 
 
1019
                        bool next();                                                        ///< See FLAC__metadata_simple_iterator_next().
 
1020
                        bool prev();                                                        ///< See FLAC__metadata_simple_iterator_prev().
 
1021
                        bool is_last() const;                                               ///< See FLAC__metadata_simple_iterator_is_last().
 
1022
 
 
1023
                        off_t get_block_offset() const;                                     ///< See FLAC__metadata_simple_iterator_get_block_offset().
 
1024
                        ::FLAC__MetadataType get_block_type() const;                        ///< See FLAC__metadata_simple_iterator_get_block_type().
 
1025
                        unsigned get_block_length() const;                                  ///< See FLAC__metadata_simple_iterator_get_block_length().
 
1026
                        bool get_application_id(FLAC__byte *id);                            ///< See FLAC__metadata_simple_iterator_get_application_id().
 
1027
                        Prototype *get_block();                                             ///< See FLAC__metadata_simple_iterator_get_block().
 
1028
                        bool set_block(Prototype *block, bool use_padding = true);          ///< See FLAC__metadata_simple_iterator_set_block().
 
1029
                        bool insert_block_after(Prototype *block, bool use_padding = true); ///< See FLAC__metadata_simple_iterator_insert_block_after().
 
1030
                        bool delete_block(bool use_padding = true);                         ///< See FLAC__metadata_simple_iterator_delete_block().
925
1031
 
926
1032
                protected:
927
1033
                        ::FLAC__Metadata_SimpleIterator *iterator_;
969
1075
                 */
970
1076
 
971
1077
                /** This class is a wrapper around the FLAC__metadata_chain
972
 
                 *  structures and methods; see ::FLAC__Metadata_Chain.
 
1078
                 *  structures and methods; see the
 
1079
                 * \link flacpp_metadata_level2 usage guide \endlink and
 
1080
                 * ::FLAC__Metadata_Chain.
973
1081
                 */
974
1082
                class FLACPP_API Chain {
975
1083
                public:
 
1084
                        /** This class is a wrapper around FLAC__Metadata_ChainStatus.
 
1085
                         */
976
1086
                        class FLACPP_API Status {
977
1087
                        public:
978
1088
                                inline Status(::FLAC__Metadata_ChainStatus status): status_(status) { }
987
1097
 
988
1098
                        friend class Iterator;
989
1099
 
990
 
                        bool is_valid() const;
991
 
                        Status status();
992
 
 
993
 
                        bool read(const char *filename);
994
 
                        bool read(FLAC__IOHandle handle, FLAC__IOCallbacks callbacks);
995
 
 
996
 
                        bool check_if_tempfile_needed(bool use_padding);
997
 
 
998
 
                        bool write(bool use_padding = true, bool preserve_file_stats = false);
999
 
                        bool write(bool use_padding, ::FLAC__IOHandle handle, ::FLAC__IOCallbacks callbacks);
1000
 
                        bool write(bool use_padding, ::FLAC__IOHandle handle, ::FLAC__IOCallbacks callbacks, ::FLAC__IOHandle temp_handle, ::FLAC__IOCallbacks temp_callbacks);
1001
 
 
1002
 
                        void merge_padding();
1003
 
                        void sort_padding();
 
1100
                        bool is_valid() const; ///< Returns \c true iff object was properly constructed.
 
1101
 
 
1102
                        Status status();                                                ///< See FLAC__metadata_chain_status().
 
1103
 
 
1104
                        bool read(const char *filename, bool is_ogg = false);                                ///< See FLAC__metadata_chain_read(), FLAC__metadata_chain_read_ogg().
 
1105
                        bool read(FLAC__IOHandle handle, FLAC__IOCallbacks callbacks, bool is_ogg = false);  ///< See FLAC__metadata_chain_read_with_callbacks(), FLAC__metadata_chain_read_ogg_with_callbacks().
 
1106
 
 
1107
                        bool check_if_tempfile_needed(bool use_padding);                ///< See FLAC__metadata_chain_check_if_tempfile_needed().
 
1108
 
 
1109
                        bool write(bool use_padding = true, bool preserve_file_stats = false); ///< See FLAC__metadata_chain_write().
 
1110
                        bool write(bool use_padding, ::FLAC__IOHandle handle, ::FLAC__IOCallbacks callbacks); ///< See FLAC__metadata_chain_write_with_callbacks().
 
1111
                        bool write(bool use_padding, ::FLAC__IOHandle handle, ::FLAC__IOCallbacks callbacks, ::FLAC__IOHandle temp_handle, ::FLAC__IOCallbacks temp_callbacks); ///< See FLAC__metadata_chain_write_with_callbacks_and_tempfile().
 
1112
 
 
1113
                        void merge_padding();                                           ///< See FLAC__metadata_chain_merge_padding().
 
1114
                        void sort_padding();                                            ///< See FLAC__metadata_chain_sort_padding().
1004
1115
 
1005
1116
                protected:
1006
1117
                        ::FLAC__Metadata_Chain *chain_;
1008
1119
                };
1009
1120
 
1010
1121
                /** This class is a wrapper around the FLAC__metadata_iterator
1011
 
                 *  structures and methods; see ::FLAC__Metadata_Iterator.
 
1122
                 *  structures and methods; see the
 
1123
                 * \link flacpp_metadata_level2 usage guide \endlink and
 
1124
                 * ::FLAC__Metadata_Iterator.
1012
1125
                 */
1013
1126
                class FLACPP_API Iterator {
1014
1127
                public:
1015
1128
                        Iterator();
1016
1129
                        virtual ~Iterator();
1017
1130
 
1018
 
                        bool is_valid() const;
1019
 
 
1020
 
                        void init(Chain &chain);
1021
 
 
1022
 
                        bool next();
1023
 
                        bool prev();
1024
 
 
1025
 
                        ::FLAC__MetadataType get_block_type() const;
1026
 
                        Prototype *get_block();
1027
 
                        bool set_block(Prototype *block);
1028
 
                        bool delete_block(bool replace_with_padding);
1029
 
                        bool insert_block_before(Prototype *block);
1030
 
                        bool insert_block_after(Prototype *block);
 
1131
                        bool is_valid() const; ///< Returns \c true iff object was properly constructed.
 
1132
 
 
1133
 
 
1134
                        void init(Chain &chain);                       ///< See FLAC__metadata_iterator_init().
 
1135
 
 
1136
                        bool next();                                   ///< See FLAC__metadata_iterator_next().
 
1137
                        bool prev();                                   ///< See FLAC__metadata_iterator_prev().
 
1138
 
 
1139
                        ::FLAC__MetadataType get_block_type() const;   ///< See FLAC__metadata_iterator_get_block_type().
 
1140
                        Prototype *get_block();                        ///< See FLAC__metadata_iterator_get_block().
 
1141
                        bool set_block(Prototype *block);              ///< See FLAC__metadata_iterator_set_block().
 
1142
                        bool delete_block(bool replace_with_padding);  ///< See FLAC__metadata_iterator_delete_block().
 
1143
                        bool insert_block_before(Prototype *block);    ///< See FLAC__metadata_iterator_insert_block_before().
 
1144
                        bool insert_block_after(Prototype *block);     ///< See FLAC__metadata_iterator_insert_block_after().
1031
1145
 
1032
1146
                protected:
1033
1147
                        ::FLAC__Metadata_Iterator *iterator_;