summaryrefslogtreecommitdiffstats
path: root/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf
diff options
context:
space:
mode:
Diffstat (limited to 'debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf')
-rw-r--r--debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/CoverArtBox.cpp261
-rw-r--r--debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/CoverArtBox.h121
-rw-r--r--debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/Tags.cpp897
-rw-r--r--debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/Tags.h210
-rw-r--r--debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/generic.cpp476
-rw-r--r--debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/generic.h66
-rw-r--r--debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/impl.h34
-rw-r--r--debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/itmf.h45
-rw-r--r--debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/type.cpp314
-rw-r--r--debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/type.h296
10 files changed, 2720 insertions, 0 deletions
diff --git a/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/CoverArtBox.cpp b/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/CoverArtBox.cpp
new file mode 100644
index 00000000..01253624
--- /dev/null
+++ b/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/CoverArtBox.cpp
@@ -0,0 +1,261 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// The contents of this file are subject to the Mozilla Public License
+// Version 1.1 (the "License"); you may not use this file except in
+// compliance with the License. You may obtain a copy of the License at
+// http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS"
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+// License for the specific language governing rights and limitations
+// under the License.
+//
+// The Original Code is MP4v2.
+//
+// The Initial Developer of the Original Code is Kona Blend.
+// Portions created by Kona Blend are Copyright (C) 2008.
+// All Rights Reserved.
+//
+// Contributors:
+// Kona Blend, kona8lend@@gmail.com
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "impl.h"
+
+namespace mp4v2 { namespace impl { namespace itmf {
+
+///////////////////////////////////////////////////////////////////////////////
+
+CoverArtBox::Item::Item()
+ : type ( BT_UNDEFINED )
+ , buffer ( NULL )
+ , size ( 0 )
+ , autofree ( false )
+{
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+CoverArtBox::Item::Item( const Item& rhs )
+ : type ( BT_UNDEFINED )
+ , buffer ( NULL )
+ , size ( 0 )
+ , autofree ( false )
+{
+ operator=( rhs );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+CoverArtBox::Item::~Item()
+{
+ reset();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+CoverArtBox::Item&
+CoverArtBox::Item::operator=( const Item& rhs )
+{
+ type = rhs.type;
+ size = rhs.size;
+ autofree = rhs.autofree;
+
+ if( rhs.autofree ) {
+ buffer = (uint8_t*)MP4Malloc(rhs.size);
+ memcpy( buffer, rhs.buffer, rhs.size );
+ }
+ else {
+ buffer = rhs.buffer;
+ }
+
+ return *this;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+CoverArtBox::Item::reset()
+{
+ if( autofree && buffer )
+ MP4Free( buffer );
+
+ type = BT_UNDEFINED;
+ buffer = NULL;
+ size = 0;
+ autofree = false;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool
+CoverArtBox::add( MP4FileHandle hFile, const Item& item )
+{
+ MP4File& file = *((MP4File*)hFile);
+
+ const char* const covr_name = "moov.udta.meta.ilst.covr";
+ MP4Atom* covr = file.FindAtom( covr_name );
+ if( !covr ) {
+ file.AddDescendantAtoms( "moov", "udta.meta.ilst.covr" );
+
+ covr = file.FindAtom( covr_name );
+ if( !covr )
+ return true;
+ }
+
+ // use empty data atom if one exists
+ MP4Atom* data = NULL;
+ uint32_t index = 0;
+ const uint32_t atomc = covr->GetNumberOfChildAtoms();
+ for( uint32_t i = 0; i < atomc; i++ ) {
+ MP4Atom* atom = covr->GetChildAtom( i );
+
+ MP4BytesProperty* metadata = NULL;
+ if( !atom->FindProperty( "data.metadata", (MP4Property**)&metadata ))
+ continue;
+
+ if( metadata->GetCount() )
+ continue;
+
+ data = atom;
+ index = i;
+ break;
+ }
+
+ // no empty atom found, create one.
+ if( !data ) {
+ data = MP4Atom::CreateAtom( file, covr, "data" );
+ covr->AddChildAtom( data );
+ data->Generate();
+ index = covr->GetNumberOfChildAtoms() - 1;
+ }
+
+ return set( hFile, item, index );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool
+CoverArtBox::get( MP4FileHandle hFile, Item& item, uint32_t index )
+{
+ item.reset();
+ MP4File& file = *((MP4File*)hFile);
+
+ MP4Atom* covr = file.FindAtom( "moov.udta.meta.ilst.covr" );
+ if( !covr )
+ return true;
+
+ if( !(index < covr->GetNumberOfChildAtoms()) )
+ return true;
+
+ MP4DataAtom* data = static_cast<MP4DataAtom*>( covr->GetChildAtom( index ));
+ if( !data )
+ return true;
+
+ MP4BytesProperty* metadata = NULL;
+ if ( !data->FindProperty( "data.metadata", (MP4Property**)&metadata ))
+ return true;
+
+ metadata->GetValue( &item.buffer, &item.size );
+ item.autofree = true;
+ item.type = data->typeCode.GetValue();
+
+ return false;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool
+CoverArtBox::list( MP4FileHandle hFile, ItemList& out )
+{
+ out.clear();
+ MP4File& file = *((MP4File*)hFile);
+ MP4ItmfItemList* itemList = genericGetItemsByCode( file, "covr" ); // alloc
+
+ if( itemList->size ) {
+ MP4ItmfDataList& dataList = itemList->elements[0].dataList;
+ out.resize( dataList.size );
+ for( uint32_t i = 0; i < dataList.size; i++ )
+ get( hFile, out[i], i );
+ }
+
+ genericItemListFree( itemList ); // free
+ return false;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool
+CoverArtBox::remove( MP4FileHandle hFile, uint32_t index )
+{
+ MP4File& file = *((MP4File*)hFile);
+
+ MP4Atom* covr = file.FindAtom( "moov.udta.meta.ilst.covr" );
+ if( !covr )
+ return true;
+
+ // wildcard mode: delete covr and all images
+ if( index == numeric_limits<uint32_t>::max() ) {
+ covr->GetParentAtom()->DeleteChildAtom( covr );
+ delete covr;
+ return false;
+ }
+
+ if( !(index < covr->GetNumberOfChildAtoms()) )
+ return true;
+
+ MP4Atom* data = covr->GetChildAtom( index );
+ if( !data )
+ return true;
+
+ // delete single image
+ covr->DeleteChildAtom( data );
+ delete data;
+
+ // delete empty covr
+ if( covr->GetNumberOfChildAtoms() == 0 ) {
+ covr->GetParentAtom()->DeleteChildAtom( covr );
+ delete covr;
+ }
+
+ return false;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool
+CoverArtBox::set( MP4FileHandle hFile, const Item& item, uint32_t index )
+{
+ MP4File& file = *((MP4File*)hFile);
+
+ MP4Atom* covr = file.FindAtom( "moov.udta.meta.ilst.covr" );
+ if( !covr )
+ return true;
+
+ if( !(index < covr->GetNumberOfChildAtoms()) )
+ return true;
+
+ MP4DataAtom* data = static_cast<MP4DataAtom*>( covr->GetChildAtom( index ));
+ if( !data )
+ return true;
+
+ MP4BytesProperty* metadata = NULL;
+ if ( !data->FindProperty( "data.metadata", (MP4Property**)&metadata ))
+ return true;
+
+ // autodetect type if BT_UNDEFINED
+ const BasicType final_type = (item.type == BT_UNDEFINED)
+ ? computeBasicType( item.buffer, item.size )
+ : item.type;
+
+ // set type; note: not really flags due to b0rked atom structure
+ data->typeCode.SetValue( final_type );
+ metadata->SetValue( item.buffer, item.size );
+
+ return false;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+}}} // namespace mp4v2::impl::itmf
diff --git a/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/CoverArtBox.h b/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/CoverArtBox.h
new file mode 100644
index 00000000..023e3c90
--- /dev/null
+++ b/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/CoverArtBox.h
@@ -0,0 +1,121 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// The contents of this file are subject to the Mozilla Public License
+// Version 1.1 (the "License"); you may not use this file except in
+// compliance with the License. You may obtain a copy of the License at
+// http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS"
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+// License for the specific language governing rights and limitations
+// under the License.
+//
+// The Original Code is MP4v2.
+//
+// The Initial Developer of the Original Code is Kona Blend.
+// Portions created by Kona Blend are Copyright (C) 2008.
+// All Rights Reserved.
+//
+// Contributors:
+// Kona Blend, kona8lend@@gmail.com
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef MP4V2_IMPL_ITMF_COVERARTBOX_H
+#define MP4V2_IMPL_ITMF_COVERARTBOX_H
+
+namespace mp4v2 { namespace impl { namespace itmf {
+
+///////////////////////////////////////////////////////////////////////////////
+
+/// Functional class for covr-box (Cover-art Box) support.
+///
+class MP4V2_EXPORT CoverArtBox
+{
+public:
+ /// Data object for covr-box item.
+ /// This object correlates to one covr->data atom and offers automatic
+ /// memory freeing when <b>autofree</b> is true.
+ ///
+ class MP4V2_EXPORT Item
+ {
+ public:
+ Item();
+ Item( const Item& );
+ ~Item();
+
+ Item& operator=( const Item& );
+
+ /// Reset to state of newly constructed object.
+ /// If <b>buffer</b> is not NULL and <b>autofree</b> is true the
+ /// buffer will be free'd.
+ void reset();
+
+ BasicType type; ///< covr-box type.
+ uint8_t* buffer; ///< buffer point to raw covr-box data.
+ uint32_t size; ///< size of covr-box buffer size in bytes.
+ bool autofree; ///< when true invoke free(buffer) upon destruction.
+ };
+
+ /// Object representing a list of covr-box items.
+ typedef vector<Item> ItemList;
+
+ /// Fetch list of covr-box items from file.
+ ///
+ /// @param hFile on which to operate.
+ /// @param out vector of ArtItem objects.
+ ///
+ /// @return <b>true</b> on failure, <b>false</b> on success.
+ ///
+ static bool list( MP4FileHandle hFile, ItemList& out );
+
+ /// Add covr-box item to file.
+ /// Any necessary metadata atoms are first created.
+ /// Additionally, if an empty data-atom exists it will be used,
+ /// otherwise a new data-atom is added to <b>covr-atom</b>.
+ ///
+ /// @param hFile on which to operate.
+ /// @param item covr-box object to place in file.
+ ///
+ /// @return <b>true</b> on failure, <b>false</b> on success.
+ ///
+ static bool add( MP4FileHandle hFile, const Item& item );
+
+ /// Replace covr-box item in file.
+ ///
+ /// @param hFile on which to operate.
+ /// @param item covr-box object to place in file.
+ /// @param index 0-based index of image to replace.
+ ///
+ /// @return <b>true</b> on failure, <b>false</b> on success.
+ ///
+ static bool set( MP4FileHandle hFile, const Item& item, uint32_t index );
+
+ /// Fetch covr-box item from file.
+ ///
+ /// @param hFile on which to operate.
+ /// @param item covr-box object populated with data.
+ /// The resulting object owns the malloc'd buffer and <b>item.autofree</b>
+ /// is set to true for convenient memory management.
+ /// @param index 0-based index of image to fetch.
+ ///
+ /// @return <b>true</b> on failure, <b>false</b> on success.
+ ///
+ static bool get( MP4FileHandle hFile, Item& item, uint32_t index );
+
+ /// Remove covr-box item from file.
+ ///
+ /// @param hFile on which to operate.
+ /// @param index 0-based index of image to remove.
+ /// Default value indicates wildcard behavior to remove all items.
+ ///
+ /// @return <b>true</b> on failure, <b>false</b> on success.
+ ///
+ static bool remove( MP4FileHandle hFile, uint32_t index = numeric_limits<uint32_t>::max() );
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+}}} // namespace mp4v2::impl::itmf
+
+#endif // MP4V2_IMPL_ITMF_COVERARTBOX_H
diff --git a/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/Tags.cpp b/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/Tags.cpp
new file mode 100644
index 00000000..e8ca4816
--- /dev/null
+++ b/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/Tags.cpp
@@ -0,0 +1,897 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// The contents of this file are subject to the Mozilla Public License
+// Version 1.1 (the "License"); you may not use this file except in
+// compliance with the License. You may obtain a copy of the License at
+// http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS"
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+// License for the specific language governing rights and limitations
+// under the License.
+//
+// The Original Code is MP4v2.
+//
+// The Initial Developer of the Original Code is Kona Blend.
+// Portions created by Kona Blend are Copyright (C) 2008.
+// Portions created by David Byron are Copyright (C) 2011.
+// All Rights Reserved.
+//
+// Contributors:
+// Kona Blend, kona8lend@@gmail.com
+// Rouven Wessling, [email protected]
+// David Byron, [email protected]
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "impl.h"
+
+namespace mp4v2 { namespace impl { namespace itmf {
+
+///////////////////////////////////////////////////////////////////////////////
+
+Tags::Tags()
+ : hasMetadata(false)
+{
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+Tags::~Tags()
+{
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::c_addArtwork( MP4Tags*& tags, MP4TagArtwork& c_artwork )
+{
+ artwork.resize( artwork.size() + 1 );
+ c_setArtwork( tags, (uint32_t)artwork.size() - 1, c_artwork );
+ updateArtworkShadow( tags );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::c_alloc( MP4Tags*& tags )
+{
+ tags = new MP4Tags();
+ memset( tags, 0, sizeof(MP4Tags) ); // safe: pure C-struct
+ tags->__handle = this;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::c_fetch( MP4Tags*& tags, MP4FileHandle hFile )
+{
+ MP4Tags& c = *tags;
+ MP4File& file = *static_cast<MP4File*>(hFile);
+
+ MP4ItmfItemList* itemList = genericGetItems( file ); // alloc
+
+ hasMetadata = (itemList->size > 0);
+
+ /* create code -> item map.
+ * map will only be used for items which do not repeat; we do not care if
+ * cover-art is inserted multiple times.
+ */
+ CodeItemMap cim;
+ for( uint32_t i = 0; i < itemList->size; i++ ) {
+ MP4ItmfItem& item = itemList->elements[i];
+ cim.insert( CodeItemMap::value_type( item.code, &item ));
+ }
+
+ fetchString( cim, CODE_NAME, name, c.name );
+ fetchString( cim, CODE_ARTIST, artist, c.artist );
+ fetchString( cim, CODE_ALBUMARTIST, albumArtist, c.albumArtist );
+ fetchString( cim, CODE_ALBUM, album, c.album );
+ fetchString( cim, CODE_GROUPING, grouping, c.grouping );
+ fetchString( cim, CODE_COMPOSER, composer, c.composer );
+ fetchString( cim, CODE_COMMENTS, comments, c.comments );
+
+ fetchString( cim, CODE_GENRE, genre, c.genre );
+ fetchGenre( cim, genreType, c.genreType );
+
+ fetchString( cim, CODE_RELEASEDATE, releaseDate, c.releaseDate );
+ fetchTrack( cim, track, c.track );
+ fetchDisk( cim, disk, c.disk );
+ fetchInteger( cim, CODE_TEMPO, tempo, c.tempo );
+ fetchInteger( cim, CODE_COMPILATION, compilation, c.compilation );
+
+ fetchString( cim, CODE_TVSHOW, tvShow, c.tvShow );
+ fetchString( cim, CODE_TVNETWORK, tvNetwork, c.tvNetwork );
+ fetchString( cim, CODE_TVEPISODEID, tvEpisodeID, c.tvEpisodeID );
+ fetchInteger( cim, CODE_TVSEASON, tvSeason, c.tvSeason );
+ fetchInteger( cim, CODE_TVEPISODE, tvEpisode, c.tvEpisode );
+
+ fetchString( cim, CODE_SORTNAME, sortName, c.sortName );
+ fetchString( cim, CODE_SORTARTIST, sortArtist, c.sortArtist );
+ fetchString( cim, CODE_SORTALBUMARTIST, sortAlbumArtist, c.sortAlbumArtist );
+ fetchString( cim, CODE_SORTALBUM, sortAlbum, c.sortAlbum );
+ fetchString( cim, CODE_SORTCOMPOSER, sortComposer, c.sortComposer );
+ fetchString( cim, CODE_SORTTVSHOW, sortTVShow, c.sortTVShow );
+
+ fetchString( cim, CODE_DESCRIPTION, description, c.description );
+ fetchString( cim, CODE_LONGDESCRIPTION, longDescription, c.longDescription );
+ fetchString( cim, CODE_LYRICS, lyrics, c.lyrics );
+
+ fetchString( cim, CODE_COPYRIGHT, copyright, c.copyright );
+ fetchString( cim, CODE_ENCODINGTOOL, encodingTool, c.encodingTool );
+ fetchString( cim, CODE_ENCODEDBY, encodedBy, c.encodedBy );
+ fetchString( cim, CODE_PURCHASEDATE, purchaseDate, c.purchaseDate );
+
+ fetchInteger( cim, CODE_PODCAST, podcast, c.podcast );
+ fetchString( cim, CODE_KEYWORDS, keywords, c.keywords );
+ fetchString( cim, CODE_CATEGORY, category, c.category );
+
+ fetchInteger( cim, CODE_HDVIDEO, hdVideo, c.hdVideo );
+ fetchInteger( cim, CODE_MEDIATYPE, mediaType, c.mediaType );
+ fetchInteger( cim, CODE_CONTENTRATING, contentRating, c.contentRating );
+ fetchInteger( cim, CODE_GAPLESS, gapless, c.gapless );
+
+ fetchString( cim, CODE_ITUNESACCOUNT, iTunesAccount, c.iTunesAccount );
+ fetchInteger( cim, CODE_ITUNESACCOUNTTYPE, iTunesAccountType, c.iTunesAccountType );
+ fetchInteger( cim, CODE_ITUNESCOUNTRY, iTunesCountry, c.iTunesCountry );
+
+ fetchInteger( cim, CODE_CONTENTID, contentID, c.contentID );
+ fetchInteger( cim, CODE_ARTISTID, artistID, c.artistID );
+ fetchInteger( cim, CODE_PLAYLISTID, playlistID, c.playlistID );
+ fetchInteger( cim, CODE_GENREID, genreID, c.genreID );
+ fetchInteger( cim, CODE_COMPOSERID, composerID, c.composerID );
+ fetchString( cim, CODE_XID, xid, c.xid );
+
+ genericItemListFree( itemList ); // free
+
+ // fetch full list and overwrite our copy, otherwise clear
+ {
+ CoverArtBox::ItemList items;
+ if( CoverArtBox::list( hFile, items ))
+ artwork.clear();
+ else
+ artwork = items;
+
+ updateArtworkShadow( tags );
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::c_free( MP4Tags*& tags )
+{
+ MP4Tags* c = const_cast<MP4Tags*>(tags);
+
+ delete[] c->artwork;
+ delete c;
+
+ tags = NULL;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::c_removeArtwork( MP4Tags*& tags, uint32_t index )
+{
+ if( !(index < artwork.size()) )
+ return;
+
+ artwork.erase( artwork.begin() + index );
+ updateArtworkShadow( tags );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::c_setArtwork( MP4Tags*& tags, uint32_t index, MP4TagArtwork& c_artwork )
+{
+ if( !(index < artwork.size()) )
+ return;
+
+ CoverArtBox::Item& item = artwork[index];
+
+ switch( c_artwork.type ) {
+ case MP4_ART_BMP:
+ item.type = BT_BMP;
+ break;
+
+ case MP4_ART_GIF:
+ item.type = BT_GIF;
+ break;
+
+ case MP4_ART_JPEG:
+ item.type = BT_JPEG;
+ break;
+
+ case MP4_ART_PNG:
+ item.type = BT_PNG;
+ break;
+
+ case MP4_ART_UNDEFINED:
+ default:
+ item.type = computeBasicType( c_artwork.data, c_artwork.size );
+ break;
+ }
+
+ item.buffer = (uint8_t*)malloc( c_artwork.size );
+ item.size = c_artwork.size;
+ item.autofree = true;
+
+ memcpy( item.buffer, c_artwork.data, c_artwork.size );
+ updateArtworkShadow( tags );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::c_setInteger( const uint8_t* value, uint8_t& cpp, const uint8_t*& c )
+{
+ if( !value ) {
+ cpp = 0;
+ c = NULL;
+ }
+ else {
+ cpp = *value;
+ c = &cpp;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::c_setInteger( const uint16_t* value, uint16_t& cpp, const uint16_t*& c )
+{
+ if( !value ) {
+ cpp = 0;
+ c = NULL;
+ }
+ else {
+ cpp = *value;
+ c = &cpp;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::c_setInteger( const uint32_t* value, uint32_t& cpp, const uint32_t*& c )
+{
+ if( !value ) {
+ cpp = 0;
+ c = NULL;
+ }
+ else {
+ cpp = *value;
+ c = &cpp;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::c_setInteger( const uint64_t* value, uint64_t& cpp, const uint64_t*& c )
+{
+ if( !value ) {
+ cpp = 0;
+ c = NULL;
+ }
+ else {
+ cpp = *value;
+ c = &cpp;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::c_setString( const char* value, string& cpp, const char*& c )
+{
+ if( !value ) {
+ cpp.clear();
+ c = NULL;
+ }
+ else {
+ cpp = value;
+ c = cpp.c_str();
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::c_setTrack( const MP4TagTrack* value, MP4TagTrack& cpp, const MP4TagTrack*& c )
+{
+ if( !value ) {
+ cpp.index = 0;
+ cpp.total = 0;
+ c = NULL;
+ }
+ else {
+ cpp.index = value->index;
+ cpp.total = value->total;
+ c = &cpp;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::c_setDisk( const MP4TagDisk* value, MP4TagDisk& cpp, const MP4TagDisk*& c )
+{
+ if( !value ) {
+ cpp.index = 0;
+ cpp.total = 0;
+ c = NULL;
+ }
+ else {
+ cpp.index = value->index;
+ cpp.total = value->total;
+ c = &cpp;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::c_store( MP4Tags*& tags, MP4FileHandle hFile )
+{
+ MP4Tags& c = *tags;
+ MP4File& file = *static_cast<MP4File*>(hFile);
+
+ storeString( file, CODE_NAME, name, c.name );
+ storeString( file, CODE_ARTIST, artist, c.artist );
+ storeString( file, CODE_ALBUMARTIST, albumArtist, c.albumArtist );
+ storeString( file, CODE_ALBUM, album, c.album );
+ storeString( file, CODE_GROUPING, grouping, c.grouping );
+ storeString( file, CODE_COMPOSER, composer, c.composer );
+ storeString( file, CODE_COMMENTS, comments, c.comments );
+
+ storeString( file, CODE_GENRE, genre, c.genre );
+ storeGenre( file, genreType, c.genreType );
+
+ storeString( file, CODE_RELEASEDATE, releaseDate, c.releaseDate );
+ storeTrack( file, track, c.track );
+ storeDisk( file, disk, c.disk );
+ storeInteger( file, CODE_TEMPO, tempo, c.tempo );
+ storeInteger( file, CODE_COMPILATION, compilation, c.compilation );
+
+ storeString( file, CODE_TVSHOW, tvShow, c.tvShow );
+ storeString( file, CODE_TVNETWORK, tvNetwork, c.tvNetwork );
+ storeString( file, CODE_TVEPISODEID, tvEpisodeID, c.tvEpisodeID );
+ storeInteger( file, CODE_TVSEASON, tvSeason, c.tvSeason );
+ storeInteger( file, CODE_TVEPISODE, tvEpisode, c.tvEpisode );
+
+ storeString( file, CODE_SORTNAME, sortName, c.sortName );
+ storeString( file, CODE_SORTARTIST, sortArtist, c.sortArtist );
+ storeString( file, CODE_SORTALBUMARTIST, sortAlbumArtist, c.sortAlbumArtist );
+ storeString( file, CODE_SORTALBUM, sortAlbum, c.sortAlbum );
+ storeString( file, CODE_SORTCOMPOSER, sortComposer, c.sortComposer );
+ storeString( file, CODE_SORTTVSHOW, sortTVShow, c.sortTVShow );
+
+ storeString( file, CODE_DESCRIPTION, description, c.description );
+ storeString( file, CODE_LONGDESCRIPTION, longDescription, c.longDescription );
+ storeString( file, CODE_LYRICS, lyrics, c.lyrics );
+
+ storeString( file, CODE_COPYRIGHT, copyright, c.copyright );
+ storeString( file, CODE_ENCODINGTOOL, encodingTool, c.encodingTool );
+ storeString( file, CODE_ENCODEDBY, encodedBy, c.encodedBy );
+ storeString( file, CODE_PURCHASEDATE, purchaseDate, c.purchaseDate );
+
+ storeInteger( file, CODE_PODCAST, podcast, c.podcast );
+ storeString( file, CODE_KEYWORDS, keywords, c.keywords );
+ storeString( file, CODE_CATEGORY, category, c.category );
+
+ storeInteger( file, CODE_HDVIDEO, hdVideo, c.hdVideo );
+ storeInteger( file, CODE_MEDIATYPE, mediaType, c.mediaType );
+ storeInteger( file, CODE_CONTENTRATING, contentRating, c.contentRating );
+ storeInteger( file, CODE_GAPLESS, gapless, c.gapless );
+
+ storeString( file, CODE_ITUNESACCOUNT, iTunesAccount, c.iTunesAccount );
+ storeInteger( file, CODE_ITUNESACCOUNTTYPE, iTunesAccountType, c.iTunesAccountType );
+ storeInteger( file, CODE_ITUNESCOUNTRY, iTunesCountry, c.iTunesCountry );
+
+ storeInteger( file, CODE_CONTENTID, contentID, c.contentID );
+ storeInteger( file, CODE_ARTISTID, artistID, c.artistID );
+ storeInteger( file, CODE_PLAYLISTID, playlistID, c.playlistID );
+ storeInteger( file, CODE_GENREID, genreID, c.genreID );
+ storeInteger( file, CODE_COMPOSERID, composerID, c.composerID );
+ storeString( file, CODE_XID, xid, c.xid );
+
+ // destroy all cover-art then add each
+ {
+ CoverArtBox::remove( hFile );
+ const CoverArtBox::ItemList::size_type max = artwork.size();
+ for( CoverArtBox::ItemList::size_type i = 0; i < max; i++ )
+ CoverArtBox::add( hFile, artwork[i] );
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::fetchGenre( const CodeItemMap& cim, uint16_t& cpp, const uint16_t*& c )
+{
+ cpp = 0;
+ c = NULL;
+
+ CodeItemMap::const_iterator f = cim.find( CODE_GENRETYPE );
+ if( f == cim.end() || 0 == f->second->dataList.size )
+ return;
+
+ MP4ItmfData& data = f->second->dataList.elements[0];
+ if( NULL == data.value )
+ return;
+
+ cpp = (uint16_t(data.value[0]) << 8)
+ | (uint16_t(data.value[1]) );
+
+ c = &cpp;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::fetchDisk( const CodeItemMap& cim, MP4TagDisk& cpp, const MP4TagDisk*& c )
+{
+ cpp.index = 0;
+ cpp.total = 0;
+ c = NULL;
+
+ CodeItemMap::const_iterator f = cim.find( CODE_DISK );
+ if( f == cim.end() || 0 == f->second->dataList.size )
+ return;
+
+ MP4ItmfData& data = f->second->dataList.elements[0];
+
+ if( NULL == data.value )
+ return;
+
+ cpp.index = (uint16_t(data.value[2]) << 8)
+ | (uint16_t(data.value[3]) );
+
+ cpp.total = (uint16_t(data.value[4]) << 8)
+ | (uint16_t(data.value[5]) );
+
+ c = &cpp;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::fetchTrack( const CodeItemMap& cim, MP4TagTrack& cpp, const MP4TagTrack*& c )
+{
+ cpp.index = 0;
+ cpp.total = 0;
+ c = NULL;
+
+ CodeItemMap::const_iterator f = cim.find( CODE_TRACK );
+ if( f == cim.end() || 0 == f->second->dataList.size )
+ return;
+
+ MP4ItmfData& data = f->second->dataList.elements[0];
+
+ if( NULL == data.value )
+ return;
+
+ cpp.index = (uint16_t(data.value[2]) << 8)
+ | (uint16_t(data.value[3]) );
+
+ cpp.total = (uint16_t(data.value[4]) << 8)
+ | (uint16_t(data.value[5]) );
+
+ c = &cpp;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::fetchInteger( const CodeItemMap& cim, const string& code, uint8_t& cpp, const uint8_t*& c )
+{
+ cpp = 0;
+ c = NULL;
+
+ CodeItemMap::const_iterator f = cim.find( code );
+ if( f == cim.end() || 0 == f->second->dataList.size )
+ return;
+
+ MP4ItmfData& data = f->second->dataList.elements[0];
+ if( NULL == data.value )
+ return;
+
+ cpp = data.value[0];
+ c = &cpp;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::fetchInteger( const CodeItemMap& cim, const string& code, uint16_t& cpp, const uint16_t*& c )
+{
+ cpp = 0;
+ c = NULL;
+
+ CodeItemMap::const_iterator f = cim.find( code );
+ if( f == cim.end() || 0 == f->second->dataList.size )
+ return;
+
+ MP4ItmfData& data = f->second->dataList.elements[0];
+
+ if( NULL == data.value )
+ return;
+
+ cpp = (uint16_t(data.value[0]) << 8)
+ | (uint16_t(data.value[1]) );
+
+ c = &cpp;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::fetchInteger( const CodeItemMap& cim, const string& code, uint32_t& cpp, const uint32_t*& c )
+{
+ cpp = 0;
+ c = NULL;
+
+ CodeItemMap::const_iterator f = cim.find( code );
+ if( f == cim.end() || 0 == f->second->dataList.size )
+ return;
+
+ MP4ItmfData& data = f->second->dataList.elements[0];
+
+ if( NULL == data.value )
+ return;
+
+ cpp = (uint32_t(data.value[0]) << 24)
+ | (uint32_t(data.value[1]) << 16)
+ | (uint32_t(data.value[2]) << 8)
+ | (uint32_t(data.value[3]) );
+
+ c = &cpp;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::fetchInteger( const CodeItemMap& cim, const string& code, uint64_t& cpp, const uint64_t*& c )
+{
+ cpp = 0;
+ c = NULL;
+
+ CodeItemMap::const_iterator f = cim.find( code );
+ if( f == cim.end() || 0 == f->second->dataList.size )
+ return;
+
+ MP4ItmfData& data = f->second->dataList.elements[0];
+
+ if( NULL == data.value )
+ return;
+
+ cpp = (uint64_t(data.value[0]) << 56)
+ | (uint64_t(data.value[1]) << 48)
+ | (uint64_t(data.value[2]) << 40)
+ | (uint64_t(data.value[3]) << 32)
+ | (uint64_t(data.value[4]) << 24)
+ | (uint64_t(data.value[5]) << 16)
+ | (uint64_t(data.value[6]) << 8)
+ | (uint64_t(data.value[7]) );
+
+ c = &cpp;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::fetchString( const CodeItemMap& cim, const string& code, string& cpp, const char*& c )
+{
+ cpp.clear();
+ c = NULL;
+
+ CodeItemMap::const_iterator f = cim.find( code );
+ if( f == cim.end() || 0 == f->second->dataList.size )
+ return;
+
+ MP4ItmfData& data = f->second->dataList.elements[0];
+
+ if( NULL == data.value )
+ return;
+
+ cpp.append( reinterpret_cast<char*>( data.value ), data.valueSize );
+ c = cpp.c_str();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::remove( MP4File& file, const string& code )
+{
+ MP4ItmfItemList* itemList = genericGetItemsByCode( file, code ); // alloc
+
+ if( itemList->size )
+ genericRemoveItem( file, &itemList->elements[0] );
+
+ genericItemListFree( itemList ); // free
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::store( MP4File& file, const string& code, MP4ItmfBasicType basicType, const void* buffer, uint32_t size )
+{
+ // remove existing item
+ remove( file, code );
+
+ // add item
+ MP4ItmfItem& item = *genericItemAlloc( code, 1 ); // alloc
+ MP4ItmfData& data = item.dataList.elements[0];
+
+ data.typeCode = basicType;
+ data.valueSize = size;
+ data.value = (uint8_t*)malloc( data.valueSize );
+ memcpy( data.value, buffer, data.valueSize );
+
+ genericAddItem( file, &item );
+ genericItemFree( &item ); // free
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::storeGenre( MP4File& file, uint16_t cpp, const uint16_t* c )
+{
+ if( c ) {
+ uint8_t buf[2];
+
+ buf[0] = uint8_t((cpp & 0xff00) >> 8);
+ buf[1] = uint8_t((cpp & 0x00ff) );
+
+ // it's not clear if you must use implicit in these situations and iirc iTunes and other software are not consistent in this regard.
+ // many other tags must be integer type yet no issues there. Silly that iTunes insists it must be implict, which is then hardcoded
+ // to interpret as genres anyways.
+ store( file, CODE_GENRETYPE, MP4_ITMF_BT_IMPLICIT, buf, sizeof(buf) );
+ }
+ else {
+ remove( file, CODE_GENRETYPE );
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::storeDisk( MP4File& file, const MP4TagDisk& cpp, const MP4TagDisk* c )
+{
+ if( c ) {
+ uint8_t buf[6];
+ memset( buf, 0, sizeof(buf) );
+
+ buf[2] = uint8_t((cpp.index & 0xff00) >> 8);
+ buf[3] = uint8_t((cpp.index & 0x00ff) );
+ buf[4] = uint8_t((cpp.total & 0xff00) >> 8);
+ buf[5] = uint8_t((cpp.total & 0x00ff) );
+
+ store( file, CODE_DISK, MP4_ITMF_BT_IMPLICIT, buf, sizeof(buf) );
+ }
+ else {
+ remove( file, CODE_DISK );
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::storeTrack( MP4File& file, const MP4TagTrack& cpp, const MP4TagTrack* c )
+{
+ if( c ) {
+ uint8_t buf[8]; // iTMF spec says 7 but iTunes media is 8
+ memset( buf, 0, sizeof(buf) );
+
+ buf[2] = uint8_t((cpp.index & 0xff00) >> 8);
+ buf[3] = uint8_t((cpp.index & 0x00ff) );
+ buf[4] = uint8_t((cpp.total & 0xff00) >> 8);
+ buf[5] = uint8_t((cpp.total & 0x00ff) );
+
+ store( file, CODE_TRACK, MP4_ITMF_BT_IMPLICIT, buf, sizeof(buf) );
+ }
+ else {
+ remove( file, CODE_TRACK );
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::storeInteger( MP4File& file, const string& code, uint8_t cpp, const uint8_t* c )
+{
+ if( c )
+ store( file, code, MP4_ITMF_BT_INTEGER, &cpp, sizeof(cpp) );
+ else
+ remove( file, code );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::storeInteger( MP4File& file, const string& code, uint16_t cpp, const uint16_t* c )
+{
+ if( c ) {
+ uint8_t buf[2];
+
+ buf[0] = uint8_t((cpp & 0xff00) >> 8);
+ buf[1] = uint8_t((cpp & 0x00ff) );
+
+ store( file, code, MP4_ITMF_BT_INTEGER, buf, sizeof(buf) );
+ }
+ else {
+ remove( file, code );
+ }
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::storeInteger( MP4File& file, const string& code, uint32_t cpp, const uint32_t* c )
+{
+ if( c ) {
+ uint8_t buf[4];
+
+ buf[0] = uint8_t((cpp & 0xff000000) >> 24 );
+ buf[1] = uint8_t((cpp & 0x00ff0000) >> 16 );
+ buf[2] = uint8_t((cpp & 0x0000ff00) >> 8 );
+ buf[3] = uint8_t((cpp & 0x000000ff) );
+
+ store( file, code, MP4_ITMF_BT_INTEGER, buf, sizeof(buf) );
+ }
+ else {
+ remove( file, code );
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::storeInteger( MP4File& file, const string& code, uint64_t cpp, const uint64_t* c )
+{
+ if( c ) {
+ uint8_t buf[8];
+
+ buf[0] = uint8_t((cpp & 0xff00000000000000LL) >> 56 );
+ buf[1] = uint8_t((cpp & 0x00ff000000000000LL) >> 48 );
+ buf[2] = uint8_t((cpp & 0x0000ff0000000000LL) >> 40 );
+ buf[3] = uint8_t((cpp & 0x000000ff00000000LL) >> 32 );
+ buf[4] = uint8_t((cpp & 0x00000000ff000000LL) >> 24 );
+ buf[5] = uint8_t((cpp & 0x0000000000ff0000LL) >> 16 );
+ buf[6] = uint8_t((cpp & 0x000000000000ff00LL) >> 8 );
+ buf[7] = uint8_t((cpp & 0x00000000000000ffLL) );
+
+ store( file, code, MP4_ITMF_BT_INTEGER, buf, sizeof(buf) );
+ }
+ else {
+ remove( file, code );
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::storeString( MP4File& file, const string& code, const string& cpp, const char* c )
+{
+ if( c )
+ store( file, code, MP4_ITMF_BT_UTF8, cpp.c_str(), (uint32_t)cpp.size() );
+ else
+ remove( file, code );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+Tags::updateArtworkShadow( MP4Tags*& tags )
+{
+ if( tags->artwork ) {
+ delete[] tags->artwork;
+ tags->artwork = NULL;
+ tags->artworkCount = 0;
+ }
+
+ if( artwork.empty() )
+ return;
+
+ MP4TagArtwork* const cartwork = new MP4TagArtwork[ artwork.size() ];
+ uint32_t max = (uint32_t)artwork.size();
+
+ for( uint32_t i = 0; i < max; i++ ) {
+ MP4TagArtwork& a = cartwork[i];
+ CoverArtBox::Item& item = artwork[i];
+
+ a.data = item.buffer;
+ a.size = item.size;
+
+ switch( item.type ) {
+ case BT_BMP:
+ a.type = MP4_ART_BMP;
+ break;
+
+ case BT_GIF:
+ a.type = MP4_ART_GIF;
+ break;
+
+ case BT_JPEG:
+ a.type = MP4_ART_JPEG;
+ break;
+
+ case BT_PNG:
+ a.type = MP4_ART_PNG;
+ break;
+
+ default:
+ a.type = MP4_ART_UNDEFINED;
+ break;
+ }
+ }
+
+ tags->artwork = cartwork;
+ tags->artworkCount = max;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+const string Tags::CODE_NAME = "\xa9" "nam";
+const string Tags::CODE_ARTIST = "\xa9" "ART";
+const string Tags::CODE_ALBUMARTIST = "aART";
+const string Tags::CODE_ALBUM = "\xa9" "alb";
+const string Tags::CODE_GROUPING = "\xa9" "grp";
+const string Tags::CODE_COMPOSER = "\xa9" "wrt";
+const string Tags::CODE_COMMENTS = "\xa9" "cmt";
+const string Tags::CODE_GENRE = "\xa9" "gen";
+const string Tags::CODE_GENRETYPE = "gnre";
+const string Tags::CODE_RELEASEDATE = "\xa9" "day";
+const string Tags::CODE_TRACK = "trkn";
+const string Tags::CODE_DISK = "disk";
+const string Tags::CODE_TEMPO = "tmpo";
+const string Tags::CODE_COMPILATION = "cpil";
+
+const string Tags::CODE_TVSHOW = "tvsh";
+const string Tags::CODE_TVNETWORK = "tvnn";
+const string Tags::CODE_TVEPISODEID = "tven";
+const string Tags::CODE_TVSEASON = "tvsn";
+const string Tags::CODE_TVEPISODE = "tves";
+
+const string Tags::CODE_DESCRIPTION = "desc";
+const string Tags::CODE_LONGDESCRIPTION = "ldes";
+const string Tags::CODE_LYRICS = "\xa9" "lyr";
+
+const string Tags::CODE_SORTNAME = "sonm";
+const string Tags::CODE_SORTARTIST = "soar";
+const string Tags::CODE_SORTALBUMARTIST = "soaa";
+const string Tags::CODE_SORTALBUM = "soal";
+const string Tags::CODE_SORTCOMPOSER = "soco";
+const string Tags::CODE_SORTTVSHOW = "sosn";
+
+const string Tags::CODE_COPYRIGHT = "cprt";
+const string Tags::CODE_ENCODINGTOOL = "\xa9" "too";
+const string Tags::CODE_ENCODEDBY = "\xa9" "enc";
+const string Tags::CODE_PURCHASEDATE = "purd";
+
+const string Tags::CODE_PODCAST = "pcst";
+const string Tags::CODE_KEYWORDS = "keyw";
+const string Tags::CODE_CATEGORY = "catg";
+
+const string Tags::CODE_HDVIDEO = "hdvd";
+const string Tags::CODE_MEDIATYPE = "stik";
+const string Tags::CODE_CONTENTRATING = "rtng";
+const string Tags::CODE_GAPLESS = "pgap";
+
+const string Tags::CODE_ITUNESACCOUNT = "apID";
+const string Tags::CODE_ITUNESACCOUNTTYPE = "akID";
+const string Tags::CODE_ITUNESCOUNTRY = "sfID";
+const string Tags::CODE_CONTENTID = "cnID";
+const string Tags::CODE_ARTISTID = "atID";
+const string Tags::CODE_PLAYLISTID = "plID";
+const string Tags::CODE_GENREID = "geID";
+const string Tags::CODE_COMPOSERID = "cmID";
+const string Tags::CODE_XID = "xid ";
+
+///////////////////////////////////////////////////////////////////////////////
+
+}}} // namespace mp4v2::impl::itmf
diff --git a/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/Tags.h b/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/Tags.h
new file mode 100644
index 00000000..57ef82cb
--- /dev/null
+++ b/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/Tags.h
@@ -0,0 +1,210 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// The contents of this file are subject to the Mozilla Public License
+// Version 1.1 (the "License"); you may not use this file except in
+// compliance with the License. You may obtain a copy of the License at
+// http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS"
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+// License for the specific language governing rights and limitations
+// under the License.
+//
+// The Original Code is MP4v2.
+//
+// The Initial Developer of the Original Code is Kona Blend.
+// Portions created by Kona Blend are Copyright (C) 2008.
+// Portions created by David Byron are Copyright (C) 2011.
+// All Rights Reserved.
+//
+// Contributors:
+// Kona Blend, [email protected]
+// Rouven Wessling, [email protected]
+// David Byron, [email protected]
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef MP4V2_IMPL_ITMF_TAGS_H
+#define MP4V2_IMPL_ITMF_TAGS_H
+
+namespace mp4v2 { namespace impl { namespace itmf {
+
+///////////////////////////////////////////////////////////////////////////////
+
+class Tags
+{
+public:
+ static const string CODE_NAME;
+ static const string CODE_ARTIST;
+ static const string CODE_ALBUMARTIST;
+ static const string CODE_ALBUM;
+ static const string CODE_GROUPING;
+ static const string CODE_COMPOSER;
+ static const string CODE_COMMENTS;
+ static const string CODE_GENRE;
+ static const string CODE_GENRETYPE;
+ static const string CODE_RELEASEDATE;
+ static const string CODE_TRACK;
+ static const string CODE_DISK;
+ static const string CODE_TEMPO;
+ static const string CODE_COMPILATION;
+
+ static const string CODE_TVSHOW;
+ static const string CODE_TVNETWORK;
+ static const string CODE_TVEPISODEID;
+ static const string CODE_TVSEASON;
+ static const string CODE_TVEPISODE;
+
+ static const string CODE_DESCRIPTION;
+ static const string CODE_LONGDESCRIPTION;
+ static const string CODE_LYRICS;
+
+ static const string CODE_SORTNAME;
+ static const string CODE_SORTARTIST;
+ static const string CODE_SORTALBUMARTIST;
+ static const string CODE_SORTALBUM;
+ static const string CODE_SORTCOMPOSER;
+ static const string CODE_SORTTVSHOW;
+
+ static const string CODE_COPYRIGHT;
+ static const string CODE_ENCODINGTOOL;
+ static const string CODE_ENCODEDBY;
+ static const string CODE_PURCHASEDATE;
+
+ static const string CODE_PODCAST;
+ static const string CODE_KEYWORDS;
+ static const string CODE_CATEGORY;
+
+ static const string CODE_HDVIDEO;
+ static const string CODE_MEDIATYPE;
+ static const string CODE_CONTENTRATING;
+ static const string CODE_GAPLESS;
+
+ static const string CODE_ITUNESACCOUNT;
+ static const string CODE_ITUNESACCOUNTTYPE;
+ static const string CODE_ITUNESCOUNTRY;
+ static const string CODE_CONTENTID;
+ static const string CODE_ARTISTID;
+ static const string CODE_PLAYLISTID;
+ static const string CODE_GENREID;
+ static const string CODE_COMPOSERID;
+ static const string CODE_XID;
+
+public:
+ string name;
+ string artist;
+ string albumArtist;
+ string album;
+ string grouping;
+ string composer;
+ string comments;
+ string genre;
+ uint16_t genreType;
+ string releaseDate;
+ MP4TagTrack track;
+ MP4TagDisk disk;
+ uint16_t tempo;
+ uint8_t compilation;
+
+ string tvShow;
+ string tvEpisodeID;
+ uint32_t tvSeason;
+ uint32_t tvEpisode;
+ string tvNetwork;
+
+ string description;
+ string longDescription;
+ string lyrics;
+
+ string sortName;
+ string sortArtist;
+ string sortAlbumArtist;
+ string sortAlbum;
+ string sortComposer;
+ string sortTVShow;
+
+ CoverArtBox::ItemList artwork;
+
+ string copyright;
+ string encodingTool;
+ string encodedBy;
+ string purchaseDate;
+
+ uint8_t podcast;
+ string keywords;
+ string category;
+
+ uint8_t hdVideo;
+ uint8_t mediaType;
+ uint8_t contentRating;
+ uint8_t gapless;
+
+ string iTunesAccount;
+ uint8_t iTunesAccountType;
+ uint32_t iTunesCountry;
+ uint32_t contentID;
+ uint32_t artistID;
+ uint64_t playlistID;
+ uint32_t genreID;
+ uint32_t composerID;
+ string xid;
+
+ bool hasMetadata;
+
+public:
+ Tags();
+ ~Tags();
+
+ void c_alloc ( MP4Tags*& );
+ void c_fetch ( MP4Tags*&, MP4FileHandle );
+ void c_store ( MP4Tags*&, MP4FileHandle );
+ void c_free ( MP4Tags*& );
+
+ void c_addArtwork ( MP4Tags*&, MP4TagArtwork& );
+ void c_setArtwork ( MP4Tags*&, uint32_t, MP4TagArtwork& );
+ void c_removeArtwork ( MP4Tags*&, uint32_t );
+
+ void c_setString ( const char*, string&, const char*& );
+ void c_setInteger ( const uint8_t*, uint8_t&, const uint8_t*& );
+ void c_setInteger ( const uint16_t*, uint16_t&, const uint16_t*& );
+ void c_setInteger ( const uint32_t*, uint32_t&, const uint32_t*& );
+ void c_setInteger ( const uint64_t*, uint64_t&, const uint64_t*& );
+
+ void c_setTrack ( const MP4TagTrack*, MP4TagTrack&, const MP4TagTrack*& );
+ void c_setDisk ( const MP4TagDisk*, MP4TagDisk&, const MP4TagDisk*& );
+
+private:
+ typedef map<string,MP4ItmfItem*> CodeItemMap;
+
+private:
+ void fetchString ( const CodeItemMap&, const string&, string&, const char*& );
+ void fetchInteger ( const CodeItemMap&, const string&, uint8_t&, const uint8_t*& );
+ void fetchInteger ( const CodeItemMap&, const string&, uint16_t&, const uint16_t*& );
+ void fetchInteger ( const CodeItemMap&, const string&, uint32_t&, const uint32_t*& );
+ void fetchInteger ( const CodeItemMap&, const string&, uint64_t&, const uint64_t*& );
+
+ void fetchGenre ( const CodeItemMap&, uint16_t&, const uint16_t*& );
+ void fetchTrack ( const CodeItemMap&, MP4TagTrack&, const MP4TagTrack*& );
+ void fetchDisk ( const CodeItemMap&, MP4TagDisk&, const MP4TagDisk*& );
+
+ void storeString ( MP4File&, const string&, const string&, const char* );
+ void storeInteger ( MP4File&, const string&, uint8_t, const uint8_t* );
+ void storeInteger ( MP4File&, const string&, uint16_t, const uint16_t* );
+ void storeInteger ( MP4File&, const string&, uint32_t, const uint32_t* );
+ void storeInteger ( MP4File&, const string&, uint64_t, const uint64_t* );
+
+ void storeGenre ( MP4File&, uint16_t, const uint16_t* );
+ void storeTrack ( MP4File&, const MP4TagTrack&, const MP4TagTrack* );
+ void storeDisk ( MP4File&, const MP4TagDisk&, const MP4TagDisk* );
+
+ void remove ( MP4File&, const string& );
+ void store ( MP4File&, const string&, MP4ItmfBasicType, const void*, uint32_t );
+
+ void updateArtworkShadow( MP4Tags*& );
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+}}} // namespace mp4v2::impl::itmf
+
+#endif // MP4V2_IMPL_ITMF_TAGS_H
diff --git a/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/generic.cpp b/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/generic.cpp
new file mode 100644
index 00000000..184cd74b
--- /dev/null
+++ b/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/generic.cpp
@@ -0,0 +1,476 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// The contents of this file are subject to the Mozilla Public License
+// Version 1.1 (the "License"); you may not use this file except in
+// compliance with the License. You may obtain a copy of the License at
+// http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS"
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+// License for the specific language governing rights and limitations
+// under the License.
+//
+// The Original Code is MP4v2.
+//
+// The Initial Developer of the Original Code is Kona Blend.
+// Portions created by Kona Blend are Copyright (C) 2008.
+// All Rights Reserved.
+//
+// Contributors:
+// Kona Blend, kona8lend@@gmail.com
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "impl.h"
+
+namespace mp4v2 { namespace impl { namespace itmf { namespace {
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+__dataInit( MP4ItmfData& data )
+{
+ data.typeSetIdentifier = 0;
+ data.typeCode = MP4_ITMF_BT_IMPLICIT;
+ data.locale = 0;
+ data.value = NULL;
+ data.valueSize = 0;
+}
+
+void
+__dataClear( MP4ItmfData& data )
+{
+ if( data.value )
+ free( data.value );
+ __dataInit( data );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+__dataListInit( MP4ItmfDataList& list )
+{
+ list.elements = NULL;
+ list.size = 0;
+}
+
+void
+__dataListClear( MP4ItmfDataList& list )
+{
+ if( list.elements ) {
+ for( uint32_t i = 0; i < list.size; i++ )
+ __dataClear( list.elements[i] );
+ free( list.elements );
+ }
+
+ __dataListInit( list );
+}
+
+void
+__dataListResize( MP4ItmfDataList& list, uint32_t size )
+{
+ __dataListClear( list );
+
+ list.elements = (MP4ItmfData*)malloc( sizeof( MP4ItmfData ) * size );
+ list.size = size;
+
+ for( uint32_t i = 0; i < size; i++ )
+ __dataInit( list.elements[i] );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+__itemInit( MP4ItmfItem& item )
+{
+ item.__handle = NULL;
+ item.code = NULL;
+ item.mean = NULL;
+ item.name = NULL;
+
+ __dataListInit( item.dataList );
+}
+
+void
+__itemClear( MP4ItmfItem& item )
+{
+ if( item.code )
+ free( item.code );
+ if( item.mean )
+ free( item.mean );
+ if( item.name )
+ free( item.name );
+
+ __dataListClear( item.dataList );
+ __itemInit( item );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+__itemListInit( MP4ItmfItemList& list )
+{
+ list.elements = NULL;
+ list.size = 0;
+}
+
+void
+__itemListClear( MP4ItmfItemList& list )
+{
+ if( list.elements ) {
+ for( uint32_t i = 0; i < list.size; i++ )
+ __itemClear( list.elements[i] );
+ free( list.elements );
+ }
+
+ __itemListInit( list );
+}
+
+void
+__itemListResize( MP4ItmfItemList& list, uint32_t size )
+{
+ __itemListClear( list );
+ if( !size )
+ return;
+
+ list.elements = (MP4ItmfItem*)malloc( sizeof( MP4ItmfItem ) * size );
+ list.size = size;
+
+ for( uint32_t i = 0; i < size; i++ )
+ __itemInit( list.elements[i] );
+}
+
+MP4ItmfItemList*
+__itemListAlloc()
+{
+ MP4ItmfItemList& list = *(MP4ItmfItemList*)malloc( sizeof( MP4ItmfItemList ));
+ __itemListInit( list );
+ return &list;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+static bool
+__itemAtomToModel( MP4ItemAtom& item_atom, MP4ItmfItem& model )
+{
+ __itemClear( model );
+ model.__handle = &item_atom;
+ model.code = strdup( item_atom.GetType() );
+
+ // handle special meaning atom
+ if( ATOMID( item_atom.GetType() ) == ATOMID( "----" )) {
+ // meaning is mandatory
+ MP4MeanAtom* mean = (MP4MeanAtom*)item_atom.FindAtom( "----.mean" );
+ if( !mean )
+ return true;
+
+ // copy atom UTF-8 value (not NULL-terminated) to model (NULL-terminated)
+ model.mean = mean->value.GetValueStringAlloc();
+
+ // name is optional
+ MP4NameAtom* name = (MP4NameAtom*)item_atom.FindAtom( "----.name" );
+ if( name ) {
+ // copy atom UTF-8 value (not NULL-terminated) to model (NULL-terminated)
+ model.name = name->value.GetValueStringAlloc();
+ }
+ }
+
+ // pass 1: count data atoms
+ const uint32_t childCount = item_atom.GetNumberOfChildAtoms();
+ uint32_t dataCount = 0;
+ for( uint32_t i = 0; i < childCount; i++ ) {
+ if( ATOMID( item_atom.GetChildAtom( i )->GetType() ) != ATOMID( "data" ))
+ continue;
+ dataCount++;
+ }
+
+ // one or more data atoms is mandatory
+ if( dataCount < 1 )
+ return true;
+
+ __dataListResize( model.dataList, dataCount );
+
+ // pass 2: populate data model
+ for( uint32_t i = 0, idata = 0; i < childCount; i++ ) {
+ MP4Atom* atom = item_atom.GetChildAtom( i );
+ if( ATOMID( atom->GetType() ) != ATOMID( "data" ))
+ continue;
+
+ MP4DataAtom& data_atom = *(MP4DataAtom*)atom;
+ MP4ItmfData& data_model = model.dataList.elements[idata];
+
+ data_model.typeSetIdentifier = data_atom.typeSetIdentifier.GetValue();
+ data_model.typeCode = (MP4ItmfBasicType)data_atom.typeCode.GetValue();
+ data_model.locale = data_atom.locale.GetValue();
+
+ data_atom.metadata.GetValue( &data_model.value, &data_model.valueSize );
+ idata++;
+ }
+
+ return false;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+static bool
+__itemModelToAtom( const MP4ItmfItem& model, MP4ItemAtom& atom )
+{
+ if( ATOMID( atom.GetType() ) == ATOMID( "----" )) {
+ ASSERT( model.mean ); // mandatory
+ MP4MeanAtom& meanAtom = *(MP4MeanAtom*)MP4Atom::CreateAtom( atom.GetFile(), &atom, "mean" );
+ atom.AddChildAtom( &meanAtom );
+ meanAtom.value.SetValue( (const uint8_t*)model.mean, (uint32_t)strlen( model.mean ));
+
+ if( model.name ) {
+ MP4NameAtom& nameAtom = *(MP4NameAtom*)MP4Atom::CreateAtom( atom.GetFile(), &atom, "name" );
+ atom.AddChildAtom( &nameAtom );
+ nameAtom.value.SetValue( (const uint8_t*)model.name, (uint32_t)strlen( model.name ));
+ }
+ }
+
+ for( uint32_t i = 0; i < model.dataList.size; i++ ) {
+ MP4ItmfData& dataModel = model.dataList.elements[i];
+ MP4DataAtom& dataAtom = *(MP4DataAtom*)MP4Atom::CreateAtom( atom.GetFile(), &atom, "data" );
+ atom.AddChildAtom( &dataAtom );
+
+ dataAtom.typeSetIdentifier.SetValue( dataModel.typeSetIdentifier );
+ dataAtom.typeCode.SetValue( (itmf::BasicType)dataModel.typeCode );
+ dataAtom.locale.SetValue( dataModel.locale );
+ dataAtom.metadata.SetValue( dataModel.value, dataModel.valueSize );
+ }
+
+ return true;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+} // namespace anonymous
+
+///////////////////////////////////////////////////////////////////////////////
+
+MP4ItmfItem*
+genericItemAlloc( const string& code, uint32_t numData )
+{
+ MP4ItmfItem* item = (MP4ItmfItem*)malloc( sizeof( MP4ItmfItem ));
+ if( !item )
+ return NULL;
+
+ __itemInit( *item );
+ item->code = strdup( code.c_str() );
+
+ // always create array size of 1
+ __dataListResize( item->dataList, numData );
+
+ return item;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+genericItemFree( MP4ItmfItem* item )
+{
+ if( !item )
+ return;
+
+ __itemClear( *item );
+ free( item );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void
+genericItemListFree( MP4ItmfItemList* list )
+{
+ if( !list )
+ return;
+
+ __itemListClear( *list );
+ free( list );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+MP4ItmfItemList*
+genericGetItems( MP4File& file )
+{
+ MP4Atom* ilst = file.FindAtom( "moov.udta.meta.ilst" );
+ if( !ilst )
+ return __itemListAlloc();
+
+ const uint32_t itemCount = ilst->GetNumberOfChildAtoms();
+ if( itemCount < 1 )
+ return __itemListAlloc();
+
+ MP4ItmfItemList& list = *__itemListAlloc();
+ __itemListResize( list, itemCount );
+
+ for( uint32_t i = 0; i < list.size; i++ )
+ __itemAtomToModel( *(MP4ItemAtom*)ilst->GetChildAtom( i ), list.elements[i] );
+
+ return &list;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+MP4ItmfItemList*
+genericGetItemsByCode( MP4File& file, const string& code )
+{
+ MP4Atom* ilst = file.FindAtom( "moov.udta.meta.ilst" );
+ if( !ilst )
+ return __itemListAlloc();
+
+ // pass 1: filter by code and populate indexList
+ const uint32_t childCount = ilst->GetNumberOfChildAtoms();
+ vector<uint32_t> indexList;
+ for( uint32_t i = 0; i < childCount; i++ ) {
+ if( ATOMID( ilst->GetChildAtom( i )->GetType() ) != ATOMID( code.c_str() ))
+ continue;
+ indexList.push_back( i );
+ }
+
+ if( indexList.size() < 1 )
+ return __itemListAlloc();
+
+ MP4ItmfItemList& list = *__itemListAlloc();
+ __itemListResize( list, (uint32_t)indexList.size() );
+
+ // pass 2: process each atom
+ const vector<uint32_t>::size_type max = indexList.size();
+ for( vector<uint32_t>::size_type i = 0; i < max; i++ ) {
+ uint32_t& aidx = indexList[i];
+ __itemAtomToModel( *(MP4ItemAtom*)ilst->GetChildAtom( aidx ), list.elements[i] );
+ }
+
+ return &list;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+MP4ItmfItemList*
+genericGetItemsByMeaning( MP4File& file, const string& meaning, const string& name )
+{
+ MP4Atom* ilst = file.FindAtom( "moov.udta.meta.ilst" );
+ if( !ilst )
+ return __itemListAlloc();
+
+ // pass 1: filter by code and populate indexList
+ const uint32_t childCount = ilst->GetNumberOfChildAtoms();
+ vector<uint32_t> indexList;
+ for( uint32_t i = 0; i < childCount; i++ ) {
+ MP4Atom& atom = *ilst->GetChildAtom( i );
+ if( ATOMID( atom.GetType() ) != ATOMID( "----" ))
+ continue;
+
+ // filter-out meaning mismatch
+ MP4MeanAtom* meanAtom = (MP4MeanAtom*)atom.FindAtom( "----.mean" );
+ if( !meanAtom )
+ continue;
+ if( meanAtom->value.CompareToString( meaning ))
+ continue;
+
+ if( !name.empty() ) {
+ // filter-out name mismatch
+ MP4MeanAtom* nameAtom = (MP4MeanAtom*)atom.FindAtom( "----.name" );
+ if( !nameAtom )
+ continue;
+ if( nameAtom->value.CompareToString( name ))
+ continue;
+ }
+
+ indexList.push_back( i );
+ }
+
+ if( indexList.size() < 1 )
+ return __itemListAlloc();
+
+ MP4ItmfItemList& list = *__itemListAlloc();
+ __itemListResize( list, (uint32_t)indexList.size() );
+
+ // pass 2: process each atom
+ const vector<uint32_t>::size_type max = indexList.size();
+ for( vector<uint32_t>::size_type i = 0; i < max; i++ ) {
+ uint32_t& aidx = indexList[i];
+ __itemAtomToModel( *(MP4ItemAtom*)ilst->GetChildAtom( aidx ), list.elements[i] );
+ }
+
+ return &list;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool
+genericAddItem( MP4File& file, const MP4ItmfItem* item )
+{
+ if( !item )
+ return false;
+
+ MP4Atom* ilst = file.FindAtom( "moov.udta.meta.ilst" );
+ if( !ilst ) {
+ file.AddDescendantAtoms( "moov", "udta.meta.ilst" );
+ ilst = file.FindAtom( "moov.udta.meta.ilst" );
+ ASSERT( ilst );
+ }
+
+ MP4ItemAtom& itemAtom = *(MP4ItemAtom*)MP4Atom::CreateAtom( file, ilst, item->code );
+ ilst->AddChildAtom( &itemAtom );
+
+ return __itemModelToAtom( *item, itemAtom );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool
+genericSetItem( MP4File& file, const MP4ItmfItem* item )
+{
+ if( !item || !item->__handle )
+ return false;
+
+ MP4Atom* ilst = file.FindAtom( "moov.udta.meta.ilst" );
+ if( !ilst )
+ return false;
+
+ MP4ItemAtom* const old = static_cast<MP4ItemAtom*>(item->__handle);
+ const uint32_t childCount = ilst->GetNumberOfChildAtoms();
+ uint32_t fidx = numeric_limits<uint32_t>::max();
+ for( uint32_t i = 0; i < childCount; i++ ) {
+ MP4Atom* atom = ilst->GetChildAtom( i );
+ if( atom == old ) {
+ fidx = i;
+ break;
+ }
+ }
+
+ if( fidx == numeric_limits<uint32_t>::max() )
+ return false;
+
+ ilst->DeleteChildAtom( old );
+ delete old;
+
+ MP4ItemAtom& itemAtom = *(MP4ItemAtom*)MP4Atom::CreateAtom( file, ilst, item->code );
+ ilst->InsertChildAtom( &itemAtom, fidx );
+
+ return __itemModelToAtom( *item, itemAtom );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool
+genericRemoveItem( MP4File& file, const MP4ItmfItem* item )
+{
+ if( !item || !item->__handle )
+ return false;
+
+ MP4Atom* ilst = file.FindAtom( "moov.udta.meta.ilst" );
+ if( !ilst )
+ return false;
+
+ MP4ItemAtom* const old = static_cast<MP4ItemAtom*>(item->__handle);
+ ilst->DeleteChildAtom( old );
+ delete old;
+
+ return true;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+}}} // namespace mp4v2::impl::itmf
diff --git a/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/generic.h b/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/generic.h
new file mode 100644
index 00000000..9edc7eb6
--- /dev/null
+++ b/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/generic.h
@@ -0,0 +1,66 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// The contents of this file are subject to the Mozilla Public License
+// Version 1.1 (the "License"); you may not use this file except in
+// compliance with the License. You may obtain a copy of the License at
+// http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS"
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+// License for the specific language governing rights and limitations
+// under the License.
+//
+// The Original Code is MP4v2.
+//
+// The Initial Developer of the Original Code is Kona Blend.
+// Portions created by Kona Blend are Copyright (C) 2008.
+// All Rights Reserved.
+//
+// Contributors:
+// KonaBlend, [email protected]
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef MP4V2_IMPL_ITMF_GENERIC_H
+#define MP4V2_IMPL_ITMF_GENERIC_H
+
+namespace mp4v2 { namespace impl { namespace itmf {
+
+///////////////////////////////////////////////////////////////////////////////
+
+MP4ItmfItem*
+genericItemAlloc( const string& code, uint32_t numData );
+
+void
+genericItemFree( MP4ItmfItem* item );
+
+void
+genericItemListFree( MP4ItmfItemList* list );
+
+///////////////////////////////////////////////////////////////////////////////
+
+MP4ItmfItemList*
+genericGetItems( MP4File& file );
+
+MP4ItmfItemList*
+genericGetItemsByCode( MP4File& file, const string& code );
+
+MP4ItmfItemList*
+genericGetItemsByMeaning( MP4File& file, const string& meaning, const string& name );
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool
+genericAddItem( MP4File& file, const MP4ItmfItem* item );
+
+bool
+genericSetItem( MP4File& file, const MP4ItmfItem* item );
+
+bool
+genericRemoveItem( MP4File& file, const MP4ItmfItem* item );
+
+///////////////////////////////////////////////////////////////////////////////
+
+}}} // namespace mp4v2::impl::itmf
+
+#endif // MP4V2_IMPL_ITMF_GENERIC_H
diff --git a/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/impl.h b/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/impl.h
new file mode 100644
index 00000000..9c7eb44f
--- /dev/null
+++ b/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/impl.h
@@ -0,0 +1,34 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// The contents of this file are subject to the Mozilla Public License
+// Version 1.1 (the "License"); you may not use this file except in
+// compliance with the License. You may obtain a copy of the License at
+// http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS"
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+// License for the specific language governing rights and limitations
+// under the License.
+//
+// The Original Code is MP4v2.
+//
+// The Initial Developer of the Original Code is Kona Blend.
+// Portions created by Kona Blend are Copyright (C) 2008.
+// All Rights Reserved.
+//
+// Contributors:
+// Kona Blend, kona8lend@@gmail.com
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef MP4V2_IMPL_ITMF_IMPL_H
+#define MP4V2_IMPL_ITMF_IMPL_H
+
+///////////////////////////////////////////////////////////////////////////////
+
+#include "src/impl.h"
+#include "itmf.h"
+
+///////////////////////////////////////////////////////////////////////////////
+
+#endif // MP4V2_IMPL_ITMF_IMPL_H
diff --git a/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/itmf.h b/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/itmf.h
new file mode 100644
index 00000000..cad38ed0
--- /dev/null
+++ b/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/itmf.h
@@ -0,0 +1,45 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// The contents of this file are subject to the Mozilla Public License
+// Version 1.1 (the "License"); you may not use this file except in
+// compliance with the License. You may obtain a copy of the License at
+// http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS"
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+// License for the specific language governing rights and limitations
+// under the License.
+//
+// The Original Code is MP4v2.
+//
+// The Initial Developer of the Original Code is Kona Blend.
+// Portions created by Kona Blend are Copyright (C) 2008.
+// All Rights Reserved.
+//
+// Contributors:
+// Kona Blend, kona8lend@@gmail.com
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef MP4V2_IMPL_ITMF_ITMF_H
+#define MP4V2_IMPL_ITMF_ITMF_H
+
+/// @namespace mp4v2::impl::itmf (private) iTunes Metadata Format.
+/// <b>WARNING: THIS IS A PRIVATE NAMESPACE. NOT FOR PUBLIC CONSUMPTION.</b>
+///
+/// This namespace implements some features that are specified by the
+/// iTunes Metadata Format Specification, revision 2008-04-16.
+///
+namespace mp4v2 { namespace impl { namespace itmf {
+ ;
+}}}
+
+///////////////////////////////////////////////////////////////////////////////
+
+#include "CoverArtBox.h"
+#include "Tags.h"
+#include "generic.h"
+
+///////////////////////////////////////////////////////////////////////////////
+
+#endif // MP4V2_IMPL_ITMF_ITMF_H
diff --git a/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/type.cpp b/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/type.cpp
new file mode 100644
index 00000000..44254f8d
--- /dev/null
+++ b/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/type.cpp
@@ -0,0 +1,314 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// The contents of this file are subject to the Mozilla Public License
+// Version 1.1 (the "License"); you may not use this file except in
+// compliance with the License. You may obtain a copy of the License at
+// http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS"
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+// License for the specific language governing rights and limitations
+// under the License.
+//
+// The Original Code is MP4v2.
+//
+// The Initial Developer of the Original Code is Kona Blend.
+// Portions created by Kona Blend are Copyright (C) 2008.
+// All Rights Reserved.
+//
+// Contributors:
+// Kona Blend, kona8lend@@gmail.com
+// Rouven Wessling, [email protected]
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "impl.h"
+
+namespace mp4v2 { namespace impl {
+
+///////////////////////////////////////////////////////////////////////////////
+
+template <>
+const itmf::EnumBasicType::Entry itmf::EnumBasicType::data[] = {
+ { mp4v2::impl::itmf::BT_IMPLICIT, "implicit", "implicit" },
+ { mp4v2::impl::itmf::BT_UTF8, "utf8", "UTF-8" },
+ { mp4v2::impl::itmf::BT_UTF16, "utf16", "UTF-16" },
+ { mp4v2::impl::itmf::BT_SJIS, "sjis", "S/JIS" },
+ { mp4v2::impl::itmf::BT_HTML, "html", "HTML" },
+ { mp4v2::impl::itmf::BT_XML, "xml", "XML" },
+ { mp4v2::impl::itmf::BT_UUID, "uuid", "UUID" },
+ { mp4v2::impl::itmf::BT_ISRC, "isrc", "ISRC" },
+ { mp4v2::impl::itmf::BT_MI3P, "mi3p", "MI3P" },
+ { mp4v2::impl::itmf::BT_GIF, "gif", "GIF" },
+ { mp4v2::impl::itmf::BT_JPEG, "jpeg", "JPEG" },
+ { mp4v2::impl::itmf::BT_PNG, "png", "PNG" },
+ { mp4v2::impl::itmf::BT_URL, "url", "URL" },
+ { mp4v2::impl::itmf::BT_DURATION, "duration", "duration" },
+ { mp4v2::impl::itmf::BT_DATETIME, "datetime", "date/time" },
+ { mp4v2::impl::itmf::BT_GENRES, "genres", "genres" },
+ { mp4v2::impl::itmf::BT_INTEGER, "integer", "integer" },
+ { mp4v2::impl::itmf::BT_RIAA_PA, "riaapa", "RIAA-PA" },
+ { mp4v2::impl::itmf::BT_UPC, "upc", "UPC" },
+ { mp4v2::impl::itmf::BT_BMP, "bmp", "BMP" },
+
+ { mp4v2::impl::itmf::BT_UNDEFINED } // must be last
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+template <>
+const itmf::EnumGenreType::Entry itmf::EnumGenreType::data[] = {
+ { mp4v2::impl::itmf::GENRE_BLUES, "blues", "Blues" },
+ { mp4v2::impl::itmf::GENRE_CLASSIC_ROCK, "classicrock", "Classic Rock" },
+ { mp4v2::impl::itmf::GENRE_COUNTRY, "country", "Country" },
+ { mp4v2::impl::itmf::GENRE_DANCE, "dance", "Dance" },
+ { mp4v2::impl::itmf::GENRE_DISCO, "disco", "Disco" },
+ { mp4v2::impl::itmf::GENRE_FUNK, "funk", "Funk" },
+ { mp4v2::impl::itmf::GENRE_GRUNGE, "grunge", "Grunge" },
+ { mp4v2::impl::itmf::GENRE_HIP_HOP, "hiphop", "Hop-Hop" },
+ { mp4v2::impl::itmf::GENRE_JAZZ, "jazz", "Jazz" },
+ { mp4v2::impl::itmf::GENRE_METAL, "metal", "Metal" },
+ { mp4v2::impl::itmf::GENRE_NEW_AGE, "newage", "New Age" },
+ { mp4v2::impl::itmf::GENRE_OLDIES, "oldies", "Oldies" },
+ { mp4v2::impl::itmf::GENRE_OTHER, "other", "Other" },
+ { mp4v2::impl::itmf::GENRE_POP, "pop", "Pop" },
+ { mp4v2::impl::itmf::GENRE_R_AND_B, "rand_b", "R&B" },
+ { mp4v2::impl::itmf::GENRE_RAP, "rap", "Rap" },
+ { mp4v2::impl::itmf::GENRE_REGGAE, "reggae", "Reggae" },
+ { mp4v2::impl::itmf::GENRE_ROCK, "rock", "Rock" },
+ { mp4v2::impl::itmf::GENRE_TECHNO, "techno", "Techno" },
+ { mp4v2::impl::itmf::GENRE_INDUSTRIAL, "industrial", "Industrial" },
+ { mp4v2::impl::itmf::GENRE_ALTERNATIVE, "alternative", "Alternative" },
+ { mp4v2::impl::itmf::GENRE_SKA, "ska", "Ska" },
+ { mp4v2::impl::itmf::GENRE_DEATH_METAL, "deathmetal", "Death Metal" },
+ { mp4v2::impl::itmf::GENRE_PRANKS, "pranks", "Pranks" },
+ { mp4v2::impl::itmf::GENRE_SOUNDTRACK, "soundtrack", "Soundtrack" },
+ { mp4v2::impl::itmf::GENRE_EURO_TECHNO, "eurotechno", "Euro-Techno" },
+ { mp4v2::impl::itmf::GENRE_AMBIENT, "ambient", "Ambient" },
+ { mp4v2::impl::itmf::GENRE_TRIP_HOP, "triphop", "Trip-Hop" },
+ { mp4v2::impl::itmf::GENRE_VOCAL, "vocal", "Vocal" },
+ { mp4v2::impl::itmf::GENRE_JAZZ_FUNK, "jazzfunk", "Jazz+Funk" },
+ { mp4v2::impl::itmf::GENRE_FUSION, "fusion", "Fusion" },
+ { mp4v2::impl::itmf::GENRE_TRANCE, "trance", "Trance" },
+ { mp4v2::impl::itmf::GENRE_CLASSICAL, "classical", "Classical" },
+ { mp4v2::impl::itmf::GENRE_INSTRUMENTAL, "instrumental", "Instrumental" },
+ { mp4v2::impl::itmf::GENRE_ACID, "acid", "Acid" },
+ { mp4v2::impl::itmf::GENRE_HOUSE, "house", "House" },
+ { mp4v2::impl::itmf::GENRE_GAME, "game", "Game" },
+ { mp4v2::impl::itmf::GENRE_SOUND_CLIP, "soundclip", "Sound Clip" },
+ { mp4v2::impl::itmf::GENRE_GOSPEL, "gospel", "Gospel" },
+ { mp4v2::impl::itmf::GENRE_NOISE, "noise", "Noise" },
+ { mp4v2::impl::itmf::GENRE_ALTERNROCK, "alternrock", "AlternRock" },
+ { mp4v2::impl::itmf::GENRE_BASS, "bass", "Bass" },
+ { mp4v2::impl::itmf::GENRE_SOUL, "soul", "Soul" },
+ { mp4v2::impl::itmf::GENRE_PUNK, "punk", "Punk" },
+ { mp4v2::impl::itmf::GENRE_SPACE, "space", "Space" },
+ { mp4v2::impl::itmf::GENRE_MEDITATIVE, "meditative", "Meditative" },
+ { mp4v2::impl::itmf::GENRE_INSTRUMENTAL_POP, "instrumentalpop", "Instrumental Pop" },
+ { mp4v2::impl::itmf::GENRE_INSTRUMENTAL_ROCK, "instrumentalrock", "Instrumental Rock" },
+ { mp4v2::impl::itmf::GENRE_ETHNIC, "ethnic", "Ethnic" },
+ { mp4v2::impl::itmf::GENRE_GOTHIC, "gothic", "Gothic" },
+ { mp4v2::impl::itmf::GENRE_DARKWAVE, "darkwave", "Darkwave" },
+ { mp4v2::impl::itmf::GENRE_TECHNO_INDUSTRIAL, "technoindustrial", "Techno-Industrial" },
+ { mp4v2::impl::itmf::GENRE_ELECTRONIC, "electronic", "Electronic" },
+ { mp4v2::impl::itmf::GENRE_POP_FOLK, "popfolk", "Pop-Folk" },
+ { mp4v2::impl::itmf::GENRE_EURODANCE, "eurodance", "Eurodance" },
+ { mp4v2::impl::itmf::GENRE_DREAM, "dream", "Dream" },
+ { mp4v2::impl::itmf::GENRE_SOUTHERN_ROCK, "southernrock", "Southern Rock" },
+ { mp4v2::impl::itmf::GENRE_COMEDY, "comedy", "Comedy" },
+ { mp4v2::impl::itmf::GENRE_CULT, "cult", "Cult" },
+ { mp4v2::impl::itmf::GENRE_GANGSTA, "gangsta", "Gangsta" },
+ { mp4v2::impl::itmf::GENRE_TOP_40, "top40", "Top 40" },
+ { mp4v2::impl::itmf::GENRE_CHRISTIAN_RAP, "christianrap", "Christian Rap" },
+ { mp4v2::impl::itmf::GENRE_POP_FUNK, "popfunk", "Pop/Funk" },
+ { mp4v2::impl::itmf::GENRE_JUNGLE, "jungle", "Jungle" },
+ { mp4v2::impl::itmf::GENRE_NATIVE_AMERICAN, "nativeamerican", "Native American" },
+ { mp4v2::impl::itmf::GENRE_CABARET, "cabaret", "Cabaret" },
+ { mp4v2::impl::itmf::GENRE_NEW_WAVE, "newwave", "New Wave" },
+ { mp4v2::impl::itmf::GENRE_PSYCHEDELIC, "psychedelic", "Psychedelic" },
+ { mp4v2::impl::itmf::GENRE_RAVE, "rave", "Rave" },
+ { mp4v2::impl::itmf::GENRE_SHOWTUNES, "showtunes", "Showtunes" },
+ { mp4v2::impl::itmf::GENRE_TRAILER, "trailer", "Trailer" },
+ { mp4v2::impl::itmf::GENRE_LO_FI, "lofi", "Lo-Fi" },
+ { mp4v2::impl::itmf::GENRE_TRIBAL, "tribal", "Tribal" },
+ { mp4v2::impl::itmf::GENRE_ACID_PUNK, "acidpunk", "Acid Punk" },
+ { mp4v2::impl::itmf::GENRE_ACID_JAZZ, "acidjazz", "Acid Jazz" },
+ { mp4v2::impl::itmf::GENRE_POLKA, "polka", "Polka" },
+ { mp4v2::impl::itmf::GENRE_RETRO, "retro", "Retro" },
+ { mp4v2::impl::itmf::GENRE_MUSICAL, "musical", "Musical" },
+ { mp4v2::impl::itmf::GENRE_ROCK_AND_ROLL, "rockand_roll", "Rock & Roll" },
+
+ { mp4v2::impl::itmf::GENRE_HARD_ROCK, "hardrock", "Hard Rock" },
+ { mp4v2::impl::itmf::GENRE_FOLK, "folk", "Folk" },
+ { mp4v2::impl::itmf::GENRE_FOLK_ROCK, "folkrock", "Folk-Rock" },
+ { mp4v2::impl::itmf::GENRE_NATIONAL_FOLK, "nationalfolk", "National Folk" },
+ { mp4v2::impl::itmf::GENRE_SWING, "swing", "Swing" },
+ { mp4v2::impl::itmf::GENRE_FAST_FUSION, "fastfusion", "Fast Fusion" },
+ { mp4v2::impl::itmf::GENRE_BEBOB, "bebob", "Bebob" },
+ { mp4v2::impl::itmf::GENRE_LATIN, "latin", "Latin" },
+ { mp4v2::impl::itmf::GENRE_REVIVAL, "revival", "Revival" },
+ { mp4v2::impl::itmf::GENRE_CELTIC, "celtic", "Celtic" },
+ { mp4v2::impl::itmf::GENRE_BLUEGRASS, "bluegrass", "Bluegrass" },
+ { mp4v2::impl::itmf::GENRE_AVANTGARDE, "avantgarde", "Avantgarde" },
+ { mp4v2::impl::itmf::GENRE_GOTHIC_ROCK, "gothicrock", "Gothic Rock" },
+ { mp4v2::impl::itmf::GENRE_PROGRESSIVE_ROCK, "progressiverock", "Progresive Rock" },
+ { mp4v2::impl::itmf::GENRE_PSYCHEDELIC_ROCK, "psychedelicrock", "Psychedelic Rock" },
+ { mp4v2::impl::itmf::GENRE_SYMPHONIC_ROCK, "symphonicrock", "SYMPHONIC_ROCK" },
+ { mp4v2::impl::itmf::GENRE_SLOW_ROCK, "slowrock", "Slow Rock" },
+ { mp4v2::impl::itmf::GENRE_BIG_BAND, "bigband", "Big Band" },
+ { mp4v2::impl::itmf::GENRE_CHORUS, "chorus", "Chorus" },
+ { mp4v2::impl::itmf::GENRE_EASY_LISTENING, "easylistening", "Easy Listening" },
+ { mp4v2::impl::itmf::GENRE_ACOUSTIC, "acoustic", "Acoustic" },
+ { mp4v2::impl::itmf::GENRE_HUMOUR, "humour", "Humor" },
+ { mp4v2::impl::itmf::GENRE_SPEECH, "speech", "Speech" },
+ { mp4v2::impl::itmf::GENRE_CHANSON, "chanson", "Chason" },
+ { mp4v2::impl::itmf::GENRE_OPERA, "opera", "Opera" },
+ { mp4v2::impl::itmf::GENRE_CHAMBER_MUSIC, "chambermusic", "Chamber Music" },
+ { mp4v2::impl::itmf::GENRE_SONATA, "sonata", "Sonata" },
+ { mp4v2::impl::itmf::GENRE_SYMPHONY, "symphony", "Symphony" },
+ { mp4v2::impl::itmf::GENRE_BOOTY_BASS, "bootybass", "Booty Bass" },
+ { mp4v2::impl::itmf::GENRE_PRIMUS, "primus", "Primus" },
+ { mp4v2::impl::itmf::GENRE_PORN_GROOVE, "porngroove", "Porn Groove" },
+ { mp4v2::impl::itmf::GENRE_SATIRE, "satire", "Satire" },
+ { mp4v2::impl::itmf::GENRE_SLOW_JAM, "slowjam", "Slow Jam" },
+ { mp4v2::impl::itmf::GENRE_CLUB, "club", "Club" },
+ { mp4v2::impl::itmf::GENRE_TANGO, "tango", "Tango" },
+ { mp4v2::impl::itmf::GENRE_SAMBA, "samba", "Samba" },
+ { mp4v2::impl::itmf::GENRE_FOLKLORE, "folklore", "Folklore" },
+ { mp4v2::impl::itmf::GENRE_BALLAD, "ballad", "Ballad" },
+ { mp4v2::impl::itmf::GENRE_POWER_BALLAD, "powerballad", "Power Ballad" },
+ { mp4v2::impl::itmf::GENRE_RHYTHMIC_SOUL, "rhythmicsoul", "Rhythmic Soul" },
+ { mp4v2::impl::itmf::GENRE_FREESTYLE, "freestyle", "Freestyle" },
+ { mp4v2::impl::itmf::GENRE_DUET, "duet", "Duet" },
+ { mp4v2::impl::itmf::GENRE_PUNK_ROCK, "punkrock", "Punk Rock" },
+ { mp4v2::impl::itmf::GENRE_DRUM_SOLO, "drumsolo", "Drum Solo" },
+ { mp4v2::impl::itmf::GENRE_A_CAPELLA, "acapella", "A capella" },
+ { mp4v2::impl::itmf::GENRE_EURO_HOUSE, "eurohouse", "Euro-House" },
+ { mp4v2::impl::itmf::GENRE_DANCE_HALL, "dancehall", "Dance Hall" },
+ { mp4v2::impl::itmf::GENRE_NONE, "none", "none" },
+
+ { mp4v2::impl::itmf::GENRE_UNDEFINED } // must be last
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+template <>
+const itmf::EnumStikType::Entry itmf::EnumStikType::data[] = {
+ { mp4v2::impl::itmf::STIK_OLD_MOVIE, "oldmovie", "Movie" },
+ { mp4v2::impl::itmf::STIK_NORMAL, "normal", "Normal" },
+ { mp4v2::impl::itmf::STIK_AUDIOBOOK, "audiobook", "Audio Book" },
+ { mp4v2::impl::itmf::STIK_MUSIC_VIDEO, "musicvideo", "Music Video" },
+ { mp4v2::impl::itmf::STIK_MOVIE, "movie", "Movie" },
+ { mp4v2::impl::itmf::STIK_TV_SHOW, "tvshow", "TV Show" },
+ { mp4v2::impl::itmf::STIK_BOOKLET, "booklet", "Booklet" },
+ { mp4v2::impl::itmf::STIK_RINGTONE, "ringtone", "Ringtone" },
+
+ { mp4v2::impl::itmf::STIK_UNDEFINED } // must be last
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+template <>
+const itmf::EnumAccountType::Entry itmf::EnumAccountType::data[] = {
+ { mp4v2::impl::itmf::AT_ITUNES, "itunes", "iTunes" },
+ { mp4v2::impl::itmf::AT_AOL, "aol", "AOL" },
+
+ { mp4v2::impl::itmf::AT_UNDEFINED } // must be last
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+template <>
+const itmf::EnumCountryCode::Entry itmf::EnumCountryCode::data[] = {
+ { mp4v2::impl::itmf::CC_USA, "usa", "United States" },
+ { mp4v2::impl::itmf::CC_USA, "fra", "France" },
+ { mp4v2::impl::itmf::CC_DEU, "ger", "Germany" },
+ { mp4v2::impl::itmf::CC_GBR, "gbr", "United Kingdom" },
+ { mp4v2::impl::itmf::CC_AUT, "aut", "Austria" },
+ { mp4v2::impl::itmf::CC_BEL, "bel", "Belgium" },
+ { mp4v2::impl::itmf::CC_FIN, "fin", "Finland" },
+ { mp4v2::impl::itmf::CC_GRC, "grc", "Greece" },
+ { mp4v2::impl::itmf::CC_IRL, "irl", "Ireland" },
+ { mp4v2::impl::itmf::CC_ITA, "ita", "Italy" },
+ { mp4v2::impl::itmf::CC_LUX, "lux", "Luxembourg" },
+ { mp4v2::impl::itmf::CC_NLD, "nld", "Netherlands" },
+ { mp4v2::impl::itmf::CC_PRT, "prt", "Portugal" },
+ { mp4v2::impl::itmf::CC_ESP, "esp", "Spain" },
+ { mp4v2::impl::itmf::CC_CAN, "can", "Canada" },
+ { mp4v2::impl::itmf::CC_SWE, "swe", "Sweden" },
+ { mp4v2::impl::itmf::CC_NOR, "nor", "Norway" },
+ { mp4v2::impl::itmf::CC_DNK, "dnk", "Denmark" },
+ { mp4v2::impl::itmf::CC_CHE, "che", "Switzerland" },
+ { mp4v2::impl::itmf::CC_AUS, "aus", "Australia" },
+ { mp4v2::impl::itmf::CC_NZL, "nzl", "New Zealand" },
+ { mp4v2::impl::itmf::CC_JPN, "jpn", "Japan" },
+
+ { mp4v2::impl::itmf::CC_UNDEFINED } // must be last
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+template <>
+const itmf::EnumContentRating::Entry itmf::EnumContentRating::data[] = {
+ { mp4v2::impl::itmf::CR_NONE, "none", "None" },
+ { mp4v2::impl::itmf::CR_CLEAN, "clean", "Clean" },
+ { mp4v2::impl::itmf::CR_EXPLICIT, "explicit", "Explicit" },
+
+ { mp4v2::impl::itmf::CR_UNDEFINED } // must be last
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+namespace itmf {
+
+///////////////////////////////////////////////////////////////////////////////
+
+// must come after static data init
+const EnumBasicType enumBasicType;
+const EnumGenreType enumGenreType;
+const EnumStikType enumStikType;
+const EnumAccountType enumAccountType;
+const EnumCountryCode enumCountryCode;
+const EnumContentRating enumContentRating;
+
+///////////////////////////////////////////////////////////////////////////////
+
+namespace {
+ struct ImageHeader {
+ BasicType type;
+ string data;
+ };
+
+ // POD static init does not need singletons
+ static ImageHeader IMAGE_HEADERS[] = {
+ { BT_BMP, "\x42\x4d" },
+ { BT_GIF, "GIF87a" },
+ { BT_GIF, "GIF89a" },
+ { BT_JPEG, "\xff\xd8\xff\xe0" },
+ { BT_PNG, "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a" },
+ { BT_UNDEFINED } // must be last
+ };
+}
+
+BasicType
+computeBasicType( const void* buffer, uint32_t size )
+{
+ ImageHeader* found = NULL;
+ for( ImageHeader* p = IMAGE_HEADERS; p->type != BT_UNDEFINED; p++ ) {
+ ImageHeader& h = *p;
+
+ if( size < h.data.size() )
+ continue;
+
+ if( memcmp(h.data.data(), buffer, h.data.size()) == 0 ) {
+ found = &h;
+ break;
+ }
+ }
+
+ return found ? found->type : BT_IMPLICIT;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+}}} // namespace mp4v2::impl::itmf
diff --git a/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/type.h b/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/type.h
new file mode 100644
index 00000000..484c241c
--- /dev/null
+++ b/debian/mp4v2/mp4v2-2.0.0~dfsg0/src/itmf/type.h
@@ -0,0 +1,296 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// The contents of this file are subject to the Mozilla Public License
+// Version 1.1 (the "License"); you may not use this file except in
+// compliance with the License. You may obtain a copy of the License at
+// http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS"
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+// License for the specific language governing rights and limitations
+// under the License.
+//
+// The Original Code is MP4v2.
+//
+// The Initial Developer of the Original Code is Kona Blend.
+// Portions created by Kona Blend are Copyright (C) 2008.
+// All Rights Reserved.
+//
+// Contributors:
+// Kona Blend, kona8lend@@gmail.com
+// Rouven Wessling, [email protected]
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef MP4V2_IMPL_ITMF_TYPE_H
+#define MP4V2_IMPL_ITMF_TYPE_H
+
+namespace mp4v2 { namespace impl { namespace itmf {
+
+///////////////////////////////////////////////////////////////////////////////
+
+/// Basic set of types as detailed in spec.
+enum BasicType {
+ BT_IMPLICIT = 0, ///< for use with tags for which no type needs to be indicated
+ BT_UTF8 = 1, ///< without any count or null terminator
+ BT_UTF16 = 2, ///< also known as UTF-16BE
+ BT_SJIS = 3, ///< deprecated unless it is needed for special Japanese characters
+ BT_HTML = 6, ///< the HTML file header specifies which HTML version
+ BT_XML = 7, ///< the XML header must identify the DTD or schemas
+ BT_UUID = 8, ///< also known as GUID; stored as 16 bytes in binary (valid as an ID)
+ BT_ISRC = 9, ///< stored as UTF-8 text (valid as an ID)
+ BT_MI3P = 10, ///< stored as UTF-8 text (valid as an ID)
+ BT_GIF = 12, ///< (deprecated) a GIF image
+ BT_JPEG = 13, ///< a JPEG image
+ BT_PNG = 14, ///< a PNG image
+ BT_URL = 15, ///< absolute, in UTF-8 characters
+ BT_DURATION = 16, ///< in milliseconds, 32-bit integer
+ BT_DATETIME = 17, ///< in UTC, counting seconds since midnight, January 1, 1904; 32 or 64-bits
+ BT_GENRES = 18, ///< a list of enumerated values, see #Genre
+ BT_INTEGER = 21, ///< a signed big-endian integer with length one of { 1,2,3,4,8 } bytes
+ BT_RIAA_PA = 24, ///< RIAA parental advisory; { -1=no, 1=yes, 0=unspecified }, 8-bit ingteger
+ BT_UPC = 25, ///< Universal Product Code, in text UTF-8 format (valid as an ID)
+ BT_BMP = 27, ///< Windows bitmap image
+
+ BT_UNDEFINED = 255
+};
+
+typedef Enum<BasicType,BT_UNDEFINED> EnumBasicType;
+MP4V2_EXPORT extern const EnumBasicType enumBasicType;
+
+///////////////////////////////////////////////////////////////////////////////
+
+/// enumerated genre as defined in ID3v1 specification but +1 as per iTMF spec.
+/// Note values 80 and higher are Winamp extensions.
+enum GenreType {
+ GENRE_UNDEFINED = 0,
+
+ /* ID3v1 standard */
+ GENRE_BLUES = 1,
+ GENRE_CLASSIC_ROCK = 2,
+ GENRE_COUNTRY = 3,
+ GENRE_DANCE = 4,
+ GENRE_DISCO = 5,
+ GENRE_FUNK = 6,
+ GENRE_GRUNGE = 7,
+ GENRE_HIP_HOP = 8,
+ GENRE_JAZZ = 9,
+ GENRE_METAL = 10,
+ GENRE_NEW_AGE = 11,
+ GENRE_OLDIES = 12,
+ GENRE_OTHER = 13,
+ GENRE_POP = 14,
+ GENRE_R_AND_B = 15,
+ GENRE_RAP = 16,
+ GENRE_REGGAE = 17,
+ GENRE_ROCK = 18,
+ GENRE_TECHNO = 19,
+ GENRE_INDUSTRIAL = 20,
+ GENRE_ALTERNATIVE = 21,
+ GENRE_SKA = 22,
+ GENRE_DEATH_METAL = 23,
+ GENRE_PRANKS = 24,
+ GENRE_SOUNDTRACK = 25,
+ GENRE_EURO_TECHNO = 26,
+ GENRE_AMBIENT = 27,
+ GENRE_TRIP_HOP = 28,
+ GENRE_VOCAL = 29,
+ GENRE_JAZZ_FUNK = 30,
+ GENRE_FUSION = 31,
+ GENRE_TRANCE = 32,
+ GENRE_CLASSICAL = 33,
+ GENRE_INSTRUMENTAL = 34,
+ GENRE_ACID = 35,
+ GENRE_HOUSE = 36,
+ GENRE_GAME = 37,
+ GENRE_SOUND_CLIP = 38,
+ GENRE_GOSPEL = 39,
+ GENRE_NOISE = 40,
+ GENRE_ALTERNROCK = 41,
+ GENRE_BASS = 42,
+ GENRE_SOUL = 43,
+ GENRE_PUNK = 44,
+ GENRE_SPACE = 45,
+ GENRE_MEDITATIVE = 46,
+ GENRE_INSTRUMENTAL_POP = 47,
+ GENRE_INSTRUMENTAL_ROCK = 48,
+ GENRE_ETHNIC = 49,
+ GENRE_GOTHIC = 50,
+ GENRE_DARKWAVE = 51,
+ GENRE_TECHNO_INDUSTRIAL = 52,
+ GENRE_ELECTRONIC = 53,
+ GENRE_POP_FOLK = 54,
+ GENRE_EURODANCE = 55,
+ GENRE_DREAM = 56,
+ GENRE_SOUTHERN_ROCK = 57,
+ GENRE_COMEDY = 58,
+ GENRE_CULT = 59,
+ GENRE_GANGSTA = 60,
+ GENRE_TOP_40 = 61,
+ GENRE_CHRISTIAN_RAP = 62,
+ GENRE_POP_FUNK = 63,
+ GENRE_JUNGLE = 64,
+ GENRE_NATIVE_AMERICAN = 65,
+ GENRE_CABARET = 66,
+ GENRE_NEW_WAVE = 67,
+ GENRE_PSYCHEDELIC = 68,
+ GENRE_RAVE = 69,
+ GENRE_SHOWTUNES = 70,
+ GENRE_TRAILER = 71,
+ GENRE_LO_FI = 72,
+ GENRE_TRIBAL = 73,
+ GENRE_ACID_PUNK = 74,
+ GENRE_ACID_JAZZ = 75,
+ GENRE_POLKA = 76,
+ GENRE_RETRO = 77,
+ GENRE_MUSICAL = 78,
+ GENRE_ROCK_AND_ROLL = 79,
+
+ /* Winamp extension */
+ GENRE_HARD_ROCK = 80,
+ GENRE_FOLK = 81,
+ GENRE_FOLK_ROCK = 82,
+ GENRE_NATIONAL_FOLK = 83,
+ GENRE_SWING = 84,
+ GENRE_FAST_FUSION = 85,
+ GENRE_BEBOB = 86,
+ GENRE_LATIN = 87,
+ GENRE_REVIVAL = 88,
+ GENRE_CELTIC = 89,
+ GENRE_BLUEGRASS = 90,
+ GENRE_AVANTGARDE = 91,
+ GENRE_GOTHIC_ROCK = 92,
+ GENRE_PROGRESSIVE_ROCK = 93,
+ GENRE_PSYCHEDELIC_ROCK = 94,
+ GENRE_SYMPHONIC_ROCK = 95,
+ GENRE_SLOW_ROCK = 96,
+ GENRE_BIG_BAND = 97,
+ GENRE_CHORUS = 98,
+ GENRE_EASY_LISTENING = 99,
+ GENRE_ACOUSTIC = 100,
+ GENRE_HUMOUR = 101,
+ GENRE_SPEECH = 102,
+ GENRE_CHANSON = 103,
+ GENRE_OPERA = 104,
+ GENRE_CHAMBER_MUSIC = 105,
+ GENRE_SONATA = 106,
+ GENRE_SYMPHONY = 107,
+ GENRE_BOOTY_BASS = 108,
+ GENRE_PRIMUS = 109,
+ GENRE_PORN_GROOVE = 110,
+ GENRE_SATIRE = 111,
+ GENRE_SLOW_JAM = 112,
+ GENRE_CLUB = 113,
+ GENRE_TANGO = 114,
+ GENRE_SAMBA = 115,
+ GENRE_FOLKLORE = 116,
+ GENRE_BALLAD = 117,
+ GENRE_POWER_BALLAD = 118,
+ GENRE_RHYTHMIC_SOUL = 119,
+ GENRE_FREESTYLE = 120,
+ GENRE_DUET = 121,
+ GENRE_PUNK_ROCK = 122,
+ GENRE_DRUM_SOLO = 123,
+ GENRE_A_CAPELLA = 124,
+ GENRE_EURO_HOUSE = 125,
+ GENRE_DANCE_HALL = 126,
+
+ GENRE_NONE = 255
+};
+
+typedef Enum<GenreType,GENRE_UNDEFINED> EnumGenreType;
+MP4V2_EXPORT extern const EnumGenreType enumGenreType;
+
+///////////////////////////////////////////////////////////////////////////////
+
+/// enumerated 8-bit Video Type used by iTunes.
+/// Note values are not formally defined in any specification.
+enum StikType {
+ STIK_OLD_MOVIE = 0,
+ STIK_NORMAL = 1,
+ STIK_AUDIOBOOK = 2,
+ STIK_MUSIC_VIDEO = 6,
+ STIK_MOVIE = 9,
+ STIK_TV_SHOW = 10,
+ STIK_BOOKLET = 11,
+ STIK_RINGTONE = 14,
+
+ STIK_UNDEFINED = 255
+};
+
+typedef Enum<StikType,STIK_UNDEFINED> EnumStikType;
+MP4V2_EXPORT extern const EnumStikType enumStikType;
+
+///////////////////////////////////////////////////////////////////////////////
+
+/// enumerated 8-bit Account Type used by the iTunes Store.
+/// Note values are not formally defined in any specification.
+enum AccountType {
+ AT_ITUNES = 0,
+ AT_AOL = 1,
+
+ AT_UNDEFINED = 255
+};
+
+typedef Enum<AccountType,AT_UNDEFINED> EnumAccountType;
+MP4V2_EXPORT extern const EnumAccountType enumAccountType;
+
+///////////////////////////////////////////////////////////////////////////////
+
+/// enumerated 32-bit Country Code used by the iTunes Store.
+/// Note values are not formally defined in any specification.
+enum CountryCode {
+ CC_USA = 143441,
+ CC_FRA = 143442,
+ CC_DEU = 143443,
+ CC_GBR = 143444,
+ CC_AUT = 143445,
+ CC_BEL = 143446,
+ CC_FIN = 143447,
+ CC_GRC = 143448,
+ CC_IRL = 143449,
+ CC_ITA = 143450,
+ CC_LUX = 143451,
+ CC_NLD = 143452,
+ CC_PRT = 143453,
+ CC_ESP = 143454,
+ CC_CAN = 143455,
+ CC_SWE = 143456,
+ CC_NOR = 143457,
+ CC_DNK = 143458,
+ CC_CHE = 143459,
+ CC_AUS = 143460,
+ CC_NZL = 143461,
+ CC_JPN = 143462,
+
+ CC_UNDEFINED = 0
+};
+
+typedef Enum<CountryCode,CC_UNDEFINED> EnumCountryCode;
+MP4V2_EXPORT extern const EnumCountryCode enumCountryCode;
+
+///////////////////////////////////////////////////////////////////////////////
+
+/// enumerated 8-bit Content Rating used by iTunes.
+/// Note values are not formally defined in any specification.
+enum ContentRating {
+ CR_NONE = 0,
+ CR_CLEAN = 2,
+ CR_EXPLICIT = 4,
+
+ CR_UNDEFINED = 255
+};
+
+typedef Enum<ContentRating,CR_UNDEFINED> EnumContentRating;
+MP4V2_EXPORT extern const EnumContentRating enumContentRating;
+
+///////////////////////////////////////////////////////////////////////////////
+/// compute BasicType by examining raw bytes header.
+MP4V2_EXPORT BasicType
+computeBasicType( const void* buffer, uint32_t size );
+
+///////////////////////////////////////////////////////////////////////////////
+
+}}} // namespace mp4v2::impl::itmf
+
+#endif // MP4V2_IMPL_ITMF_TYPE_H