Example #1
0
void __stdcall tTVPFlashOverlay::GetAudioVolume( long *volume )
{
	if(Shutdown) return;
	TVPThrowExceptionMessage(L"GetAudioVolume: Currently not supported");
}
Example #2
0
void __stdcall tTVPFlashOverlay::DisableAudioStream( void )
{
	if(Shutdown) return;
	TVPThrowExceptionMessage(L"DisableAudioStream: Currently not supported");
}
Example #3
0
void __stdcall tTVPFlashOverlay::GetPlayRate( double *rate )
{
	if(Shutdown) return;
	TVPThrowExceptionMessage(L"GetPlayRate: Currently not supported");
}
Example #4
0
void __stdcall tTVPFlashOverlay::SetAudioBalance( long balance )
{
	if(Shutdown) return;
	TVPThrowExceptionMessage(L"SetAudioBalance: Currently not supported");
}
Example #5
0
//----------------------------------------------------------------------------
//! @brief	  	DirectShow 例外を 吉里吉里例外として送出
//! この関数は戻らない(例外が発生するため)
//! @param 		comment : コメント
//! @param		hr : HRESULT
//----------------------------------------------------------------------------
void ThrowDShowException(const tjs_char *comment, HRESULT hr)
{
	TVPThrowExceptionMessage((ttstr(comment) + TJS_W(" : [0x") +
		TJSInt32ToHex((tjs_uint32)hr) + TJS_W("] ") +
		DShowException(hr).what()).c_str());
}
Example #6
0
void __stdcall tTVPFlashOverlay::SetDefaultStopFrame()
{
	if(Shutdown) return;
	TVPThrowExceptionMessage(L"SetDefaultStopFrame: Currently not supported");
}
Example #7
0
void __stdcall tTVPFlashOverlay::GetFrontBuffer( BYTE **buff )
{
	if(Shutdown) return;
	TVPThrowExceptionMessage(L"GetFrontBuffer: Currently not supported");
}
Example #8
0
void __stdcall tTVPFlashOverlay::GetEnableVideoStreamNum( long *num )
{
	if(Shutdown) return;
	TVPThrowExceptionMessage(L"GetEnableVideoStreamNum: Currently not supported");
}
Example #9
0
void __stdcall tTVPFlashOverlay::GetTotalTime( __int64 *t )
{
	if(Shutdown) return;
	TVPThrowExceptionMessage(L"GetTotalTime: Currently not supported");
}
Example #10
0
void __stdcall tTVPFlashOverlay::GetVideoSize( long *width, long *height )
{
	if(Shutdown) return;
	TVPThrowExceptionMessage(L"GetVideoSize: Currently not supported");
}
Example #11
0
void __stdcall tTVPFlashOverlay::Rewind()
{
	if(Shutdown) return;
	TVPThrowExceptionMessage(L"Rewind: Currently not supported");
}
Example #12
0
//---------------------------------------------------------------------------
// Start:	Add:	T.Imoto
void __stdcall tTVPFlashOverlay::FreeEventParams(long evcode, long param1, long param2)
{
	if(Shutdown) return;
	TVPThrowExceptionMessage(L"FreeEventParams: Currently not supported");
}
Example #13
0
//---------------------------------------------------------------------------
void __stdcall  tTVPFlashOverlay::GetPosition(unsigned __int64 *tick)
{
	if(Shutdown) return;
	TVPThrowExceptionMessage(L"GetPosition: Currently not supported");
}
Example #14
0
void __stdcall tTVPFlashOverlay::GetNumberOfVideoStream( unsigned long *streamCount )
{
	if(Shutdown) return;
	TVPThrowExceptionMessage(L"GetNumberOfVideoStream: Currently not supported");
}
Example #15
0
void __stdcall tTVPFlashOverlay::SetVideoBuffer( BYTE *buff1, BYTE *buff2, long size )
{
	if(Shutdown) return;
	TVPThrowExceptionMessage(L"SetVideoBuffer: Currently not supported");
}
Example #16
0
void __stdcall tTVPFlashOverlay::SelectVideoStream( unsigned long num )
{
	if(Shutdown) return;
	TVPThrowExceptionMessage(L"SelectVideoStream: Currently not supported");
}
Example #17
0
void __stdcall tTVPFlashOverlay::GetStopFrame( int *frame )
{
	if(Shutdown) return;
	TVPThrowExceptionMessage(L"GetStopFrame: Currently not supported");
}
Example #18
0
void __stdcall tTVPFlashOverlay::SetMixingBitmap( HDC hdc, RECT *dest, float alpha )
{
	if(Shutdown) return;
	TVPThrowExceptionMessage(L"SetMixingBitmap: Currently not supported");
}
Example #19
0
/**
 * コンストラクタ
 * @param fontname	フォント名
 * @param options	オプション
 */
tNativeFreeTypeFace::tNativeFreeTypeFace(const std::wstring &fontname,
        tjs_uint32 options)
{
    // フィールドのクリア
    FaceName = fontname;
    Face = NULL;
    memset(&Stream, 0, sizeof(Stream));
    DC = NULL;
    OldFont = NULL;
    IsTTC = false;

    unsigned char *name_content    = NULL; // Windows から取得した name タグの内容
    unsigned char *name_content_ft = NULL; // FreeType から取得した name タグの内容
    tjs_int name_content_size;

    // TrueType ライブラリをフック
    try
    {
        // 指定のフォントを持ったデバイスコンテキストを作成する
        // TODO: Italic, Bold handling

        DC = GetDC(0);
        LOGFONT l;
        l.lfHeight = -12;
        l.lfWidth = 0;
        l.lfEscapement = 0;
        l.lfOrientation = 0;
        l.lfWeight = 400;
        l.lfItalic = FALSE;
        l.lfUnderline = FALSE;
        l.lfStrikeOut = FALSE;
        l.lfCharSet = DEFAULT_CHARSET;
        l.lfOutPrecision = OUT_DEFAULT_PRECIS;
        l.lfQuality = DEFAULT_QUALITY;
        l.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
        _tcscpy( l.lfFaceName, fontname.c_str() );
        l.lfFaceName[LF_FACESIZE-1] = TJS_W('\0');

        HFONT newfont = CreateFontIndirect(&l);
        OldFont = static_cast<HFONT>(SelectObject(DC, newfont));

        // このフォントが GetFontData API で扱えるかどうかを
        // 'name' タグの内容を取得しようとすることでチェックする
        // (name タグは GetFontData が扱うような TrueType/OpenType フォントには
        //  必ず入っている)
        DWORD result = GetFontData(DC, TVP_TT_TABLE_name, 0, NULL, 0);
        if(result == GDI_ERROR)
        {
            // エラー; GetFontData では扱えなかった
            TVPThrowExceptionMessage( TJS_W("Font '%1$s' cannot be used"), fontname );
        }

        //- この時点で result は name タグの内容が入るのに必要なバイト数
        name_content_size = result;
        name_content = new unsigned char [name_content_size]; // メモリを確保
        name_content_ft = new unsigned char [name_content_size]; // メモリを確保

        //- name タグの内容をメモリに読み込む
        result = GetFontData(DC, TVP_TT_TABLE_name, 0, name_content, name_content_size);
        if(result == GDI_ERROR)
        {
            // エラー; メモリに読み込むことが出来なかった
            TVPThrowExceptionMessage( TJS_W("Font '%1$s' cannot be used"), fontname );
        }

        // フォントファイルのサイズを取得する
        tjs_int fontsize;

        //- TTC (True Type Collection) ファイルのチェック
        //- GetFontData API の仕様では、TTC ファイルに対しては、現在選択されている
        //- フォントに対する情報しか返さない。しかし FreeType は TTC ファイル全体の
        //- 情報を必要とする。この場合、GetFontData に 'ttcf' を得るように指示すると
        //- ファイル全体の情報を得ることが出来る。
        //- 参照 : microsoft.public.win32.programmer.gdi GetFontData and TTC fonts
        unsigned char buf[4];
        result = GetFontData(DC, TVP_TT_TABLE_ttcf, 0, &buf, 1);
        if(result == 1)
        {
            // TTC ファイルだと思われる
            result = GetFontData(DC, TVP_TT_TABLE_ttcf, 0, NULL, 0);
            IsTTC = true;
        }
        else
        {
            result = GetFontData(DC, 0, 0, NULL, 0);
        }

        if(result == GDI_ERROR)
        {
            // エラー; GetFontData では扱えなかった
            TVPThrowExceptionMessage( TJS_W("Font '%1$s' cannot be used"), fontname );
        }
        fontsize = result;

        // FT_StreamRec の各フィールドを埋める
        FT_StreamRec * fsr = &Stream;
        fsr->base = 0;
        fsr->size = fontsize;
        fsr->pos = 0;
        fsr->descriptor.pointer = this;
        fsr->pathname.pointer = NULL;
        fsr->read = IoFunc;
        fsr->close = CloseFunc;

        // FreeType で開く
        // 試しに 0 番の Face を開く
        // (この時点で開くことが出来なければ例外を発生させる)
        int index = 0;
        if(!OpenFaceByIndex(index))
        {
            TVPThrowExceptionMessage( TJS_W("Font '%1$s' cannot be used"), fontname );
        }

        // GDIが現在選択しているファイルとFreeTypeがアクセスしているファイルが
        // 実際に合致しているかどうかを、name タグの一致で見る。
        // とくに TTC ファイルの場合は、name タグの一致を見ながら、face のインデッ
        // クスを一つずつ増やしながら、対象とするフォントを探さなければならない。
        while(true)
        {
            // FreeType から、name タグのサイズを取得する
            FT_ULong length = 0;
            FT_Error err = FT_Load_Sfnt_Table(Face, TTAG_name, 0, NULL, &length);
            if(err)
            {
                TVPThrowExceptionMessage( TJS_W("Font '%1$s' cannot be used"), fontname );
            }

            // FreeType から得た name タグの長さを Windows から得た長さと比較
            if(length == name_content_size)
            {
                // FreeType から name タグを取得
                err = FT_Load_Sfnt_Table(Face, TTAG_name, 0, name_content_ft, &length);
                if(err)
                {
                    TVPThrowExceptionMessage( TJS_W("Font '%1$s' cannot be used"), fontname );
                }
                // FreeType から読み込んだ name タグの内容と、Windows から読み込んだ
                // name タグの内容を比較する。
                // 一致していればその index のフォントを使う。
                if(!memcmp(name_content, name_content_ft, name_content_size))
                {
                    // 一致した
                    // face は開いたまま
                    break; // ループを抜ける
                }
            }

            // 一致しなかった
            // インデックスを一つ増やし、その face を開く
            index ++;

            if(!OpenFaceByIndex(index))
            {
                // 一致する face がないまま インデックスが範囲を超えたと見られる
                // index を 0 に設定してその index を開き、ループを抜ける
                index = 0;
                if(!OpenFaceByIndex(index))
                {
                    TVPThrowExceptionMessage( TJS_W("Font '%1$s' cannot be used"), fontname );
                }
                break;
            }
        }

    }
    catch(...)
    {
        Clear();
        if(name_content) delete [] name_content;
        if(name_content_ft) delete [] name_content_ft;
        throw;
    }
    delete [] name_content;
    delete [] name_content_ft;

}