#pragma once #include "AACFile.h" // CMP4File command target //このヘッダーでmp4ff.hのインクルードは避けたいので、構造体の型のみ宣言しておきます。 typedef void* mp4ff_t; //mp4ff.h 45行目 typedef struct の後に構造体名_mp4ff_callback_tを追加。 typedef struct _mp4ff_callback_t mp4ff_callback_t; typedef void *MP4FileHandle; class CMP4File : public CAACFile { public: //コンストラクタ CMP4File(CWnd* pWndOwner=NULL); //デストラクタ virtual ~CMP4File(); //メンバー変数の初期化 void Init(); //メンバー変数の削除(オーバーライド) virtual void Delete(); //AACファイルがオープンされているかどうか?(オーバーライド) virtual BOOL IsAACFile(){return ((m_hDecoder)&&(!m_mp4Stream));}; //MP4ファイルがオープンされているかどうか?(オーバーライド) virtual BOOL IsMP4File(){return ((m_hDecoder)&&(m_mp4Stream));}; //MP4ファイルのAAC音声をWave音源にデコードして、引数のバッファに格納します。(オーバーライド) virtual UINT StreamIn(LPVOID pBuffer,UINT nBufSize,UINT* pIndexSample); //faacEncConfiguration構造体の初期化 void InitEncConfiguration(); //faacEncConfiguration構造体の取得(オーバーライド) virtual BOOL GetEncConfiguration(faacEncConfigurationPtr pConfigAAC,faacEncConfigurationPtr pConfigMP4); //faacEncConfiguration構造体の設定(オーバーライド) virtual BOOL SetEncConfiguration(faacEncConfigurationPtr pConfigAAC,faacEncConfigurationPtr pConfigMP4); //現在保持しているメタ文字列数の取得 UINT GetMetaCount(); //メタ文字列の取得 BOOL GetMetaTextByIndex(UINT index,CString& strItem,CString& strValue); //メタ文字列の検索 CString FindMetaTextByName(LPCTSTR lpszItem); //メタ文字列の挿入 BOOL InsertMetaTextByIndex(UINT index,CString& strItem,CString& strValue); //メタ文字列の追加 BOOL AddMetaText(CString& strItem,CString& strValue); BOOL AddMetaText(LPCTSTR lpszItem,LPCTSTR lpszValue); //メタ文字列の設定 BOOL SetMetaTextByIndex(UINT index,CString& strItem,CString& strValue); //メタ文字列の削除 void DeleteMetaTextByIndex(UINT index); //すべてのメタ文字列の削除 void DeleteAllMetaText(){for(int i=0;i<2;i++) m_listMeta[i].RemoveAll();}; //画像をファイルから読み込みます。 BOOL LoadImage(LPCTSTR lpszPathName,CString& strImage); //メタ文字列格納用CStringArrayクラス // m_listMeta[0]:アイテム [1]:メタデータ CStringArray m_listMeta[2]; protected: //MP4(AAC音声)ファイルを開きます。(オーバーライド) // lpszFileName:ファイルのパス名 virtual BOOL ReadFile(LPCTSTR lpszFileName); //MP4(AAC音声)ヘッダーの読み込み BOOL ReadHeader(CFile* infile); //MP4 AAC音声ファイルの書き込み(オーバーライド) virtual BOOL WriteFile(LPCTSTR lpszFileName); //MP4 AAC音声ストリームの書き込み BOOL StreamOut(MP4FileHandle outfile,faacEncConfigurationPtr pConfig=NULL); mp4ff_t* m_mp4Stream; //MP4ファイルストリーム mp4ff_callback_t *m_mp4cb; //コールバック構造体 DWORD m_mp4IndexSample; //現在再生するフレーム番号 int m_aacTrack; //AAC音源のあるトラック番号 faacEncConfiguration* m_pConfig;//エンコーダー構成 //メタデータを残したままで、ファイルを再度開き直します。(オーバーライド) virtual BOOL ResetStream(); };