File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -192,13 +192,18 @@ void cv::cudacodec::detail::FFmpegVideoSource::updateFormat(const FormatInfo& vi
192192
193193bool cv::cudacodec::detail::FFmpegVideoSource::get (const int propertyId, double & propertyVal) const
194194{
195+ propertyVal = cap.get (propertyId);
196+ if (propertyVal != 0 .)
197+ return true ;
198+
195199 CV_Assert (videoCaptureParams.size () % 2 == 0 );
196200 for (std::size_t i = 0 ; i < videoCaptureParams.size (); i += 2 ) {
197201 if (videoCaptureParams.at (i) == propertyId) {
198202 propertyVal = videoCaptureParams.at (i + 1 );
199203 return true ;
200204 }
201205 }
206+
202207 return false ;
203208}
204209
Original file line number Diff line number Diff line change @@ -430,6 +430,19 @@ CUDA_TEST_P(CheckParams, Reader)
430430 }
431431}
432432
433+ CUDA_TEST_P (CheckParams, CaptureProps)
434+ {
435+ std::string inputFile = std::string (cvtest::TS::ptr ()->get_data_path ()) + " ../highgui/video/big_buck_bunny.mp4" ;
436+ cv::Ptr<cv::cudacodec::VideoReader> reader = cv::cudacodec::createVideoReader (inputFile);
437+ double width, height, fps;
438+ ASSERT_TRUE (reader->get (cv::VideoCaptureProperties::CAP_PROP_FRAME_WIDTH, width));
439+ ASSERT_EQ (672 , width);
440+ ASSERT_TRUE (reader->get (cv::VideoCaptureProperties::CAP_PROP_FRAME_HEIGHT, height));
441+ ASSERT_EQ (384 , height);
442+ ASSERT_TRUE (reader->get (cv::VideoCaptureProperties::CAP_PROP_FPS, fps));
443+ ASSERT_EQ (24 , fps);
444+ }
445+
433446CUDA_TEST_P (CheckDecodeSurfaces, Reader)
434447{
435448 cv::cuda::setDevice (GET_PARAM (0 ).deviceID ());
@@ -554,6 +567,7 @@ CUDA_TEST_P(TransCode, H264ToH265)
554567}
555568
556569INSTANTIATE_TEST_CASE_P (CUDA_Codec, TransCode, ALL_DEVICES);
570+
557571#endif
558572
559573#if defined(HAVE_NVCUVENC)
You can’t perform that action at this time.
0 commit comments