Пример #1
0
bool
loadVideoSource(const char *video_file,
                unsigned int &width    , unsigned int &height,
                unsigned int &dispWidth, unsigned int &dispHeight)
{
    std::auto_ptr<FrameQueue> apFrameQueue(new FrameQueue);
    std::auto_ptr<VideoSource> apVideoSource(new VideoSource(video_file, apFrameQueue.get()));

    // retrieve the video source (width,height)
    apVideoSource->getSourceDimensions(width, height);
    apVideoSource->getSourceDimensions(dispWidth, dispHeight);

    std::cout << apVideoSource->format() << std::endl;

    if (g_bFrameRepeat)
    {
        g_iRepeatFactor = (60.0f / ceil((float)apVideoSource->format().frame_rate.numerator / (float)apVideoSource->format().frame_rate.denominator));
        printf("Frame Rate Playback Speed = %d fps\n", 60 / g_iRepeatFactor);
    }

    g_pFrameQueue  = apFrameQueue.release();
    g_pVideoSource = apVideoSource.release();

    if (g_pVideoSource->format().codec == cudaVideoCodec_JPEG ||
        g_pVideoSource->format().codec == cudaVideoCodec_MPEG2)
    {
        g_eVideoCreateFlags = cudaVideoCreate_PreferCUDA;
    }

    bool IsProgressive = 0;
    g_pVideoSource->getProgressive(IsProgressive);
    return IsProgressive;
}
	bool CudaVideoRender::loadVideoSource(const wchar_t *video_file, 
		unsigned int &width    , unsigned int &height,
		unsigned int &dispWidth, unsigned int &dispHeight)
	{
		std::auto_ptr<FrameQueue> apFrameQueue(new FrameQueue);
		std::auto_ptr<VideoSource> apVideoSource(new VideoSource(video_file, apFrameQueue.get()));

		// retrieve the video source (width,height)    
		apVideoSource->getSourceDimensions(width, height);
		apVideoSource->getSourceDimensions(dispWidth, dispHeight);

		std::cout << apVideoSource->format() << std::endl;

		m_pFrameQueue  = apFrameQueue.release();
		m_pVideoSource = apVideoSource.release();

		if (m_pVideoSource->format().codec == cudaVideoCodec_JPEG ||
			m_pVideoSource->format().codec == cudaVideoCodec_MPEG2) 
		{
			m_eVideoCreateFlags = cudaVideoCreate_PreferCUDA;
		}

		bool IsProgressive = 0;
		m_pVideoSource->getProgressive(IsProgressive);
		return IsProgressive;
	}