1 #ifndef __XDCAM_Handler_hpp__
2 #define __XDCAM_Handler_hpp__	1
3 
4 // =================================================================================================
5 // ADOBE SYSTEMS INCORPORATED
6 // Copyright 2007 Adobe Systems Incorporated
7 // All Rights Reserved
8 //
9 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms
10 // of the Adobe license agreement accompanying it.
11 // =================================================================================================
12 
13 #include "public/include/XMP_Environment.h"	// ! This must be the first include.
14 
15 #include "XMPFiles/source/XMPFiles_Impl.hpp"
16 
17 #include "source/ExpatAdapter.hpp"
18 
19 // =================================================================================================
20 /// \file XDCAM_Handler.hpp
21 /// \brief Folder format handler for XDCAM.
22 ///
23 /// This header ...
24 ///
25 // =================================================================================================
26 
IsDigit(char c)27 inline bool IsDigit( char c )
28 {
29 	return c >= '0' && c <= '9';
30 }
31 
32 class XDCAM_MetaHandler : public XMPFileHandler
33 {
34 public:
35 
36 	bool GetFileModDate ( XMP_DateTime * modDate );
37 
FillAssociatedResources(std::vector<std::string> *)38 	virtual void FillAssociatedResources ( std::vector<std::string> * /*resourceList*/ ) {};
39 	bool IsMetadataWritable ( ) ;
40 
41 	void CacheFileData();
42 	void ProcessXMP();
43 
44 	void UpdateFile ( bool doSafeUpdate );
45     void WriteTempFile ( XMP_IO* tempRef );
46 
GetSerializeOptions()47 	XMP_OptionBits GetSerializeOptions()	// *** These should be standard for standalone XMP files.
48 		{ return (kXMP_UseCompactFormat | kXMP_OmitPacketWrapper); };
49 
50 	XDCAM_MetaHandler ( XMPFiles * _parent );
51 	virtual ~XDCAM_MetaHandler();
52 
53 protected:
54 
XDCAM_MetaHandler()55 	XDCAM_MetaHandler() : expat(0), clipMetadata(0) {};	// Hidden on purpose.
56 
MakeClipFilePath(std::string *,XMP_StringPtr,bool checkFile=false)57 	virtual bool MakeClipFilePath ( std::string * /*path*/, XMP_StringPtr /*suffix*/, bool checkFile = false ) { IgnoreParam(checkFile); return false; }
SetPathVariables(const std::string &)58 	virtual void SetPathVariables ( const std::string & /*clientPath*/ )  { }
GetMediaProMetadata(SXMPMeta *,const std::string &,bool)59 	virtual bool GetMediaProMetadata ( SXMPMeta * /*xmpObjPtr*/, const std::string& /*clipUMID*/, bool /*digestFound*/ ) {
60 		return false;
61 	}
62 	bool MakeMediaproPath ( std::string * path, bool checkFile = false );
GetClipUmid(std::string &)63 	virtual bool GetClipUmid ( std::string & /*clipUmid*/ ) { return false; }
64 	void readXMLFile( XMP_StringPtr filePath,ExpatAdapter* &expat );
65 	bool RefersClipUmid ( std::string clipUmid , XMP_StringPtr editInfoPath )  ;
66 	std::string rootPath, clipName, sidecarPath;
67 
68 	std::string mNRTFilePath;
69 	std::string oldSidecarPath;
70 
71 private:
72 
73 	void FillMetadataFiles ( std::vector<std::string> * metadataFiles );
74 	void MakeLegacyDigest ( std::string * digestStr );
75 	void CleanupLegacyXML();
76 
77 	std::string xdcNS, legacyNS;
78 
79 	ExpatAdapter * expat;
80 	XML_Node * clipMetadata;	// ! Don't delete, points into the Expat tree.
81 
82 };	// XDCAM_MetaHandler
83 
84 // =================================================================================================
85 
86 #endif /* __XDCAM_Handler_hpp__ */
87