コード例 #1
0
	CUVIDEOFORMAT
		VideoSource::format()
		const
	{
		CUVIDEOFORMAT oFormat;
		CUresult oResult = cuvidGetSourceVideoFormat(hVideoSource_, &oFormat, 0);
		assert(CUDA_SUCCESS == oResult);

		return oFormat;
	}
コード例 #2
0
ファイル: cuvid_video_source.cpp プロジェクト: 4auka/opencv
cv::gpu::detail::CuvidVideoSource::CuvidVideoSource(const std::string& fname)
{
    CUVIDSOURCEPARAMS params;
    std::memset(&params, 0, sizeof(CUVIDSOURCEPARAMS));

    // Fill parameter struct
    params.pUserData = this;                        // will be passed to data handlers
    params.pfnVideoDataHandler = HandleVideoData;   // our local video-handler callback
    params.pfnAudioDataHandler = 0;

    // now create the actual source
    CUresult res = cuvidCreateVideoSource(&videoSource_, fname.c_str(), &params);
    if (res == CUDA_ERROR_INVALID_SOURCE)
        throw std::runtime_error("Unsupported video source");
    cuSafeCall( res );

    CUVIDEOFORMAT vidfmt;
    cuSafeCall( cuvidGetSourceVideoFormat(videoSource_, &vidfmt, 0) );

    format_.codec = static_cast<VideoReader_GPU::Codec>(vidfmt.codec);
    format_.chromaFormat = static_cast<VideoReader_GPU::ChromaFormat>(vidfmt.chroma_format);
    format_.width = vidfmt.coded_width;
    format_.height = vidfmt.coded_height;
}