Example #1
0
File: common.c Project: paa/vlc
int CommonInit(vout_display_t *vd)
{
    vout_display_sys_t *sys = vd->sys;

    sys->hwnd      = NULL;
    sys->hvideownd = NULL;
    sys->hparent   = NULL;
    sys->hfswnd    = NULL;
    sys->changes   = 0;
    SetRectEmpty(&sys->rect_display);
    SetRectEmpty(&sys->rect_parent);
    sys->is_first_display = true;
    sys->is_on_top = false;

    var_Create(vd, "video-title", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
    var_Create(vd, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);

    /* */
    sys->event = EventThreadCreate(vd);
    if (!sys->event)
        return VLC_EGENERIC;

    event_cfg_t cfg;
    memset(&cfg, 0, sizeof(cfg));
#ifdef MODULE_NAME_IS_direct3d
    cfg.use_desktop = sys->use_desktop;
#endif
#ifdef MODULE_NAME_IS_directx
    cfg.use_overlay = sys->use_overlay;
#endif
    cfg.win.type   = VOUT_WINDOW_TYPE_HWND;
    cfg.win.x      = var_InheritInteger(vd, "video-x");
    cfg.win.y      = var_InheritInteger(vd, "video-y");
    cfg.win.width  = vd->cfg->display.width;
    cfg.win.height = vd->cfg->display.height;

    event_hwnd_t hwnd;
    if (EventThreadStart(sys->event, &hwnd, &cfg))
        return VLC_EGENERIC;

    sys->parent_window = hwnd.parent_window;
    sys->hparent       = hwnd.hparent;
    sys->hwnd          = hwnd.hwnd;
    sys->hvideownd     = hwnd.hvideownd;
    sys->hfswnd        = hwnd.hfswnd;

    if (vd->cfg->is_fullscreen) {
        if (CommonControlSetFullscreen(vd, true))
            vout_display_SendEventFullscreen(vd, false);
    }

    /* Why not with glwin32 */
#if !defined(UNDER_CE) && !defined(MODULE_NAME_IS_glwin32)
    var_Create(vd, "disable-screensaver", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
    DisableScreensaver (vd);
#endif

    return VLC_SUCCESS;
}
Example #2
0
int CommonInit(vout_display_t *vd)
{
    vout_display_sys_t *sys = vd->sys;

    sys->hwnd      = NULL;
    sys->hvideownd = NULL;
    sys->hparent   = NULL;
    sys->hfswnd    = NULL;
    sys->changes   = 0;
    sys->is_first_display = true;
    sys->is_on_top        = false;

#if !VLC_WINSTORE_APP
    SetRectEmpty(&sys->rect_display);
    SetRectEmpty(&sys->rect_parent);

    var_Create(vd, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
    var_Create(vd, "disable-screensaver", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);

    /* */
    sys->event = EventThreadCreate(vd);
    if (!sys->event)
        return VLC_EGENERIC;
#endif

    event_cfg_t cfg;
    memset(&cfg, 0, sizeof(cfg));
#ifdef MODULE_NAME_IS_direct3d9
    cfg.use_desktop = sys->use_desktop;
#endif
#ifdef MODULE_NAME_IS_directdraw
    cfg.use_overlay = sys->use_overlay;
#endif
    cfg.x      = var_InheritInteger(vd, "video-x");
    cfg.y      = var_InheritInteger(vd, "video-y");
    cfg.width  = vd->cfg->display.width;
    cfg.height = vd->cfg->display.height;

#if !VLC_WINSTORE_APP
    event_hwnd_t hwnd;
    if (EventThreadStart(sys->event, &hwnd, &cfg))
        return VLC_EGENERIC;

    sys->parent_window = hwnd.parent_window;
    sys->hparent       = hwnd.hparent;
    sys->hwnd          = hwnd.hwnd;
    sys->hvideownd     = hwnd.hvideownd;
    sys->hfswnd        = hwnd.hfswnd;

    if (vd->cfg->is_fullscreen) {
        if (CommonControlSetFullscreen(vd, true))
            vout_display_SendEventFullscreen(vd, false);
    }

    DisableScreensaver (vd);
#endif

    return VLC_SUCCESS;
}
Example #3
0
int CommonInit( vout_thread_t *p_vout )
{
    vout_sys_t *p_sys = p_vout->p_sys;

    p_sys->hwnd      = NULL;
    p_sys->hvideownd = NULL;
    p_sys->hparent   = NULL;
    p_sys->hfswnd    = NULL;
    p_sys->i_changes = 0;
    SetRectEmpty( &p_sys->rect_display );
    SetRectEmpty( &p_sys->rect_parent );
    vlc_mutex_init( &p_sys->lock );

    var_Create( p_vout, "video-title", VLC_VAR_STRING | VLC_VAR_DOINHERIT );

    /* Set main window's size */
    p_sys->i_window_width  = p_vout->i_window_width;
    p_sys->i_window_height = p_vout->i_window_height;

    p_sys->p_event = EventThreadCreate( p_vout );
    if( !p_sys->p_event )
        return VLC_EGENERIC;
    if( EventThreadStart( p_sys->p_event ) )
        return VLC_EGENERIC;

    /* Variable to indicate if the window should be on top of others */
    /* Trigger a callback right now */
    var_TriggerCallback( p_vout, "video-on-top" );

    /* Why not with glwin32 */
#if !defined(UNDER_CE) && !defined(MODULE_NAME_IS_glwin32)
    var_Create( p_vout, "disable-screensaver", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
    DisableScreensaver ( p_vout );
#endif

    return VLC_SUCCESS;
}
Example #4
0
int CommonWindowInit(vlc_object_t *obj, display_win32_area_t *area,
                     vout_display_sys_win32_t *sys, bool projection_gestures)
{
    if (unlikely(area->vdcfg.window == NULL))
        return VLC_EGENERIC;

    /* */
#if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
    sys->dxgidebug_dll = LoadLibrary(TEXT("DXGIDEBUG.DLL"));
#endif
    sys->hvideownd = NULL;
    sys->hparent   = NULL;

    /* */
    sys->event = EventThreadCreate(obj, area->vdcfg.window);
    if (!sys->event)
        return VLC_EGENERIC;

    /* */
    event_cfg_t cfg;
    memset(&cfg, 0, sizeof(cfg));
    cfg.width  = area->vdcfg.display.width;
    cfg.height = area->vdcfg.display.height;
    cfg.is_projected = projection_gestures;

    event_hwnd_t hwnd;
    if (EventThreadStart(sys->event, &hwnd, &cfg))
        return VLC_EGENERIC;

    sys->hparent       = hwnd.hparent;
    sys->hvideownd     = hwnd.hvideownd;

    CommonPlacePicture(obj, area, sys);

    return VLC_SUCCESS;
}
Example #5
0
FSTATUS
SmaAddDevice(
	IN	EUI64			CaGuid,
	OUT void			**Context
	)
{
	FSTATUS				status = FSUCCESS;
	SMA_CA_OBJ_PRIVATE	*pCaObj=NULL;
	uint32				i;
	
	_DBG_ENTER_LVL(_DBG_LVL_MAIN, SmaAddDevice);

	pCaObj = (SMA_CA_OBJ_PRIVATE*)MemoryAllocateAndClear(sizeof(SMA_CA_OBJ_PRIVATE), FALSE, SMA_MEM_TAG);
	if ( NULL == pCaObj ) 
	{
		_DBG_ERROR(("MemAlloc failed for pCaObj/WorkReq!\n"));
		status = FINSUFFICIENT_MEMORY;
		goto done;
	}

	pCaObj->CaPublic.CaGuid = CaGuid;
	pCaObj->CaPublic.SmaCaContext = pCaObj;

	EventThreadInitState(&pCaObj->SmaEventThread);
	if (! EventThreadCreate(&pCaObj->SmaEventThread, "Smi",
		THREAD_PRI_VERY_HIGH, SmaCompletionCallback, pCaObj))
	{
		_DBG_ERROR(("Sma Event Thread Create FAILED\n"));
		goto failsmathread;
	}
		
	EventThreadInitState(&pCaObj->GsaEventThread);
	if (! EventThreadCreate(&pCaObj->GsaEventThread, "Gsi",
		THREAD_PRI_VERY_HIGH, GsaCompletionThreadCallback, pCaObj))
	{
		_DBG_ERROR(("Gsa Event Thread Create FAILED\n"));
		goto failgsathread;
	}

	status = iba_open_ca( CaGuid, SmaGsaCompletionCallback,
				SmaAsyncEventCallback, pCaObj/*Context*/, &pCaObj->CaHandle);
	if ( FSUCCESS != status )
	{
		_DBG_ERROR(("OpenCA() failed!\n"));
		goto failopen;
	}
	status = SetCAInternal(pCaObj->CaHandle);
	if ( FSUCCESS != status )
	{
		_DBG_ERROR(("SetCAInternal() failed!\n"));
		goto failinternal;
	}

	// Reserve CQ/QP/PD...
	status = SmaDeviceReserve( pCaObj );
	if ( FSUCCESS != status )
	{
		goto failreserve;
	}
	// we hold the Mutex across Bind and addition to Ca list
	// so that CreateDgrmPool cannot race and cause double
	// registration of memory in new DgrmPool
	AcquireMemListMutex();
	status = SmaBindGlobalMem( pCaObj );
	if (status != FSUCCESS)
	{
		ReleaseMemListMutex();
		// TBD need to undo SmaDeviceReserve
		goto failreserve;
	}

	// lock

	// update global info
	SpinLockAcquire(&g_Sma->CaListLock);
	g_Sma->NumCa++;
	pCaObj->Next = g_Sma->CaObj;
	pCaObj->Prev = NULL;
	if ( NULL != g_Sma->CaObj )
		g_Sma->CaObj->Prev = pCaObj;
	g_Sma->CaObj = pCaObj;
	pCaObj->UseCount++;	// hold reference so we can use object below
	SpinLockRelease(&g_Sma->CaListLock);

	ReleaseMemListMutex();

	// QPConfig 
	status = SmaDeviceConfig( pCaObj, QPTypeSMI );
	status = SmaDeviceConfig( pCaObj, QPTypeGSI );

	// Create GSA data structures
	GsaUpdateCaList();

	// Preallocate Buffers based on per device.
	// If we know the amount of buffers we need per device and go ahead
	// and allocate them in advance, subnet sweeps will not allocate
	// any buffers in the speed path
	//
	// NOTE: This call can fail if there are no system resources
	SmaAllocToBin( g_Settings.PreAllocSMPsPerDevice, FALSE );
	
	// post some descriptors on recv side if port is up or something...
	for (i=0; i<pCaObj->CaPublic.Ports; i++)
	{
		status = iba_smi_post_recv( NULL, pCaObj, (uint8)(i+1), 
							g_Settings.MinSMPsToPostPerPort );	
	}

	// Set Port capabilities across all CA's
	SetPortCapabilities();

	// Rearm CQ to receive event notifications.
	// The next Work Completion written to the CQ 
	// will generate an event
	status = iba_rearm_cq( pCaObj->CqHandle, CQEventSelNextWC);						
	SpinLockAcquire(&g_Sma->CaListLock);
	pCaObj->UseCount--;
	SpinLockRelease(&g_Sma->CaListLock);

	// Bind 
		
	// unlock

	// notify users through callbacks!
	IbtNotifyGroup( CaGuid, IB_NOTIFY_CA_ADD );
	// TBD - failure above causes bad status return here, can confuse caller
	// also does not cleanup QPs, CQ, PD, MRs, buffers
	// SmaRemoveCaObj might solve, but not clear if safe to call it
	// need some peers to the SmaDeviceReserve and SmaDeviceConfig routines
	// to undo their effects

done:
	_DBG_LEAVE_LVL(_DBG_LVL_MAIN);
      
    return status;

failreserve:
failinternal:
	iba_close_ca( pCaObj->CaHandle );
failopen:
	EventThreadDestroy(&pCaObj->GsaEventThread);
failgsathread:
	EventThreadDestroy(&pCaObj->SmaEventThread);
failsmathread:
	MemoryDeallocate( pCaObj );
	goto done;
}