bool StreamCapabilities::InitVideoH264(const uint8_t *pSPS, uint32_t spsLength, const uint8_t *pPPS, uint32_t ppsLength) { ClearVideo(); if (!avc.Init(pSPS, spsLength, pPPS, ppsLength)) { ClearVideo(); return false; } videoCodecId = CODEC_VIDEO_AVC; return true; }
bool VideoPlayerPanel::SetVideo( const char *pVideoFile ) { ClearVideo(); // clearing the video? if ( pVideoFile == NULL || pVideoFile[0] == 0x00 ) { return true; } // create the material m_VideoMaterial = g_pVideo->CreateVideoMaterial( "VideoPlayerMaterial", pVideoFile, "GAME", VideoPlaybackFlags::DEFAULT_MATERIAL_OPTIONS, VideoSystem::DETERMINE_FROM_FILE_EXTENSION, true ); if ( m_VideoMaterial == NULL ) { return false; } // save filename int sLen = V_strlen( pVideoFile ) + 1; m_VideoFileName = new char[ sLen ]; V_strncpy( m_VideoFileName, pVideoFile, sLen ); // compute Playback dimensions int nWidth, nHeight; m_VideoMaterial->GetVideoImageSize( &nWidth, &nHeight ); m_VideoMaterial->GetVideoTexCoordRange( &m_flU, &m_flV ); float flFrameRatio = ( (float) GetWide() / (float) GetTall() ); float flVideoRatio = ( (float) nWidth / (float) nHeight ); if ( flVideoRatio > flFrameRatio ) { m_nPlaybackWidth = GetWide(); m_nPlaybackHeight = ( GetWide() / flVideoRatio ); m_letterBox = 1; } else if ( flVideoRatio < flFrameRatio ) { m_nPlaybackWidth = ( GetTall() * flVideoRatio ); m_nPlaybackHeight = GetTall(); m_letterBox = 2; } else { m_nPlaybackWidth = GetWide(); m_nPlaybackHeight = GetTall(); m_letterBox = 0; } m_pMaterial = m_VideoMaterial->GetMaterial(); m_VideoDuration = m_VideoMaterial->GetVideoDuration(); m_VideoLoaded = true; return true; }
//----------------------------------------------------------------------------- // Properly shutdown out materials //----------------------------------------------------------------------------- VideoPlayerPanel::~VideoPlayerPanel( void ) { SetParent( (vgui::Panel *) NULL ); StopVideo(); ClearVideo(); }
VideoPlayerPanel::VideoPlayerPanel( vgui::Panel *parent, const char *panelName, int nXpos, int nYpos, int nWidth, int nHeight, const char *pVideoFile ) : BaseClass( parent, panelName ), m_VideoMaterial( NULL ), m_VideoFileName( NULL ), m_VideoLoaded( false ), m_VideoPlaying( false ) { Assert( g_pVideo != NULL ); // init all the video realted member vars ClearVideo(); SetVisible( false ); SetKeyBoardInputEnabled( false ); SetMouseInputEnabled( false ); SetProportional( false ); SetPaintBackgroundEnabled( false ); SetPaintBorderEnabled( false ); // Set us up SetTall( nHeight ); SetWide( nWidth ); SetPos( nXpos, nYpos ); // use defaults for scheme and control settings for now // SetScheme( vgui::scheme()->LoadSchemeFromFile( "resource/VideoPlayerPanelScheme.res", "VideoPlayerPanelScheme")); //LoadControlSettings("resource/UI/VideoPlayerPanel.res"); // Assign video file if supplied SetVideo( pVideoFile ); SetVisible( true ); }
void StreamCapabilities::Clear() { ClearVideo(); ClearAudio(); bandwidthHint = 0; }
bool Output::Clear() { bool aret = ClearAudio(); bool vret = ClearVideo(); return aret && vret; }