1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
#ifndef __QuickTime_Support_hpp__
#define __QuickTime_Support_hpp__ 1
// =================================================================================================
// ADOBE SYSTEMS INCORPORATED
// Copyright 2009 Adobe Systems Incorporated
// All Rights Reserved
//
// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms
// of the Adobe license agreement accompanying it.
// =================================================================================================
#include "XMP_Environment.h" // ! This must be the first include.
#include <string>
#include <vector>
#include <map>
#include "XMPFiles_Impl.hpp"
#include "LargeFileAccess.hpp"
#include "ISOBaseMedia_Support.hpp"
#include "MOOV_Support.hpp"
// =================================================================================================
// =================================================================================================
// =================================================================================================
// TradQT_Manager
// ==============
// Support for selected traditional QuickTime metadata items. The supported items are the children
// of the 'moov'/'udta' box whose type begins with 0xA9, a MacRoman copyright symbol. Each of these
// is a box whose contents are a sequence of "mini boxes" analogous to XMP AltText arrays. Each mini
// box has a 16-bit size, 16-bit language code, and text. The language code values are the old
// Macintosh Script Manager langXyz codes, the text encoding is implicit, see Mac Script.h.
enum { // List of recognized items from the QuickTime 'moov'/'udta' box.
// These items are defined by Adobe.
kQTilst_Reel = 0xA952454CUL, // 'REL'
kQTilst_Timecode = 0xA954494DUL, // 'TIM'
kQTilst_TimeScale = 0xA9545343UL, // 'TSC'
kQTilst_TimeSize = 0xA954535AUL // 'TSZ'
};
enum {
kNoMacLang = 0xFFFF,
kNoMacScript = 0xFFFF
};
extern bool ConvertToMacLang ( const std::string & utf8Value, XMP_Uns16 macLang, std::string * macValue );
extern bool ConvertFromMacLang ( const std::string & macValue, XMP_Uns16 macLang, std::string * utf8Value );
class TradQT_Manager {
public:
TradQT_Manager() : changed(false) {};
bool ParseCachedBoxes ( const MOOV_Manager & moovMgr );
bool ImportSimpleXMP ( XMP_Uns32 id, SXMPMeta * xmp, XMP_StringPtr ns, XMP_StringPtr prop ) const;
bool ImportLangAltXMP ( XMP_Uns32 id, SXMPMeta * xmp, XMP_StringPtr ns, XMP_StringPtr langArray ) const;
void ExportSimpleXMP ( XMP_Uns32 id, const SXMPMeta & xmp, XMP_StringPtr ns, XMP_StringPtr prop,
bool createWithZeroLang = false );
void ExportLangAltXMP ( XMP_Uns32 id, const SXMPMeta & xmp, XMP_StringPtr ns, XMP_StringPtr langArray );
bool IsChanged() const { return this->changed; };
void UpdateChangedBoxes ( MOOV_Manager * moovMgr );
private:
struct ValueInfo {
bool marked;
XMP_Uns16 macLang;
XMP_StringPtr xmpLang; // ! Only set if macLang is known, i.e. the value can be converted.
std::string macValue;
ValueInfo() : marked(false), macLang(kNoMacLang), xmpLang("") {};
};
typedef std::vector<ValueInfo> ValueVector;
typedef ValueVector::iterator ValueInfoPos;
typedef ValueVector::const_iterator ValueInfoCPos;
struct ParsedBoxInfo {
XMP_Uns32 id;
ValueVector values;
bool changed;
ParsedBoxInfo() : id(0), changed(false) {};
ParsedBoxInfo ( XMP_Uns32 _id ) : id(_id), changed(false) {};
};
typedef std::map < XMP_Uns32, ParsedBoxInfo > InfoMap; // Metadata item kind and content info.
typedef InfoMap::iterator InfoMapPos;
typedef InfoMap::const_iterator InfoMapCPos;
InfoMap parsedBoxes;
bool changed;
bool ImportLangItem ( const ValueInfo & qtItem, SXMPMeta * xmp, XMP_StringPtr ns, XMP_StringPtr langArray ) const;
}; // TradQT_Manager
#endif // __QuickTime_Support_hpp__
|