Frame type property for ffmpeg video capture

This commit is contained in:
Philipp Hutterer 2022-06-26 17:30:31 +02:00
parent 35f1a90df7
commit 90f2e1f8b5
2 changed files with 3 additions and 0 deletions

View File

@ -202,6 +202,7 @@ enum VideoCaptureProperties {
CAP_PROP_AUDIO_SYNCHRONIZE = 66, //!< (open, read) Enables audio synchronization.
CAP_PROP_LRF_HAS_KEY_FRAME = 67, //!< FFmpeg back-end only - Indicates whether the Last Raw Frame (LRF), output from VideoCapture::read() when VideoCapture is initialized with VideoCapture::open(CAP_FFMPEG, {CAP_PROP_FORMAT, -1}) or VideoCapture::set(CAP_PROP_FORMAT,-1) is called before the first call to VideoCapture::read(), contains encoded data for a key frame.
CAP_PROP_CODEC_EXTRADATA_INDEX = 68, //!< Positive index indicates that returning extra data is supported by the video back end. This can be retrieved as cap.retrieve(data, <returned index>). E.g. When reading from a h264 encoded RTSP stream, the FFmpeg backend could return the SPS and/or PPS if available (if sent in reply to a DESCRIBE request), from calls to cap.retrieve(data, <returned index>).
CAP_PROP_FRAME_TYPE = 69, //!< (read-only) FFmpeg back-end only - Frame type ascii code (73 = 'I', 80 = 'P', 66 = 'B' or 63 = '?' if unknown) of the most recently read frame.
#ifndef CV_DOXYGEN
CV__CAP_PROP_LATEST
#endif

View File

@ -1695,6 +1695,8 @@ double CvCapture_FFMPEG::getProperty( int property_id ) const
return (double)((rotation_auto && ((rotation_angle%180) != 0)) ? frame.height : frame.width);
case CAP_PROP_FRAME_HEIGHT:
return (double)((rotation_auto && ((rotation_angle%180) != 0)) ? frame.width : frame.height);
case CAP_PROP_FRAME_TYPE:
return (double)av_get_picture_type_char(picture->pict_type);
case CAP_PROP_FPS:
return get_fps();
case CAP_PROP_FOURCC: