Пример #1
0
int CreateWindows()
{ 
    if (!InitApplication(NULL)) 
        return FALSE; 
 
    if (!InitInstance(NULL, TRUE)) 
        return FALSE; 
 
    // register the video window class
    WNDCLASSEX wcx; 
 
    wcx.cbSize = sizeof(wcx);          // size of structure 
    wcx.style = 0;                     // redraw if size changes 
    wcx.lpfnWndProc = MainWndProc;     // points to window procedure 
    wcx.cbClsExtra = 0;                // no extra class memory 
    wcx.cbWndExtra = 0;                // no extra window memory 
    wcx.hInstance = NULL;              // handle to instance 
    wcx.hIcon = LoadIcon(NULL, 
        IDI_APPLICATION);              // predefined app. icon 
    wcx.hCursor = LoadCursor(NULL, 
        IDC_ARROW);                    // predefined arrow 
    wcx.hbrBackground = (HBRUSH)GetStockObject( 
        BLACK_BRUSH);                  // black background brush 
    wcx.lpszMenuName =  NULL;          // name of menu resource 
    wcx.lpszClassName = "PlaceCallVideoClass";  // name of window class 
    wcx.hIconSm = NULL;
    ATOM x = RegisterClassEx(&wcx);
    // create the Preview Window and the Video Window
    HWND hPreview = createPreviewWindow(hMain);
    HWND hVideo = createVideoWindow(hMain);
        
    return 0; 
} 
MediaPlayerPrivateMediaFoundation::MediaPlayerPrivateMediaFoundation(MediaPlayer* player) 
    : m_player(player)
    , m_visible(false)
    , m_loadingProgress(false)
    , m_paused(false)
    , m_hasAudio(false)
    , m_hasVideo(false)
    , m_hwndVideo(nullptr)
    , m_readyState(MediaPlayer::HaveNothing)
    , m_weakPtrFactory(this)
{
    createSession();
    createVideoWindow();
}
MediaPlayerPrivateMediaFoundation::MediaPlayerPrivateMediaFoundation(MediaPlayer* player) 
    : m_player(player)
    , m_visible(false)
    , m_loadingProgress(false)
    , m_paused(false)
    , m_hasAudio(false)
    , m_hasVideo(false)
    , m_hwndVideo(nullptr)
    , m_readyState(MediaPlayer::HaveNothing)
    , m_mediaSession(nullptr)
    , m_sourceResolver(nullptr)
    , m_mediaSource(nullptr)
    , m_topology(nullptr)
    , m_sourcePD(nullptr)
    , m_videoDisplay(nullptr)
{
    createSession();
    createVideoWindow();
}