Detailed Description
The PInputVideoStream class represents an input video streams like a video file, a webcam or a RTSP stream; NOT thread-safe.
To create a PInputVideoSteam, use the Open() factory.
Definition at line 34 of file PInputVideoStream.h.
#include <PInputVideoStream.h>
Constructor & Destructor Documentation
◆ PInputVideoStream() [1/2]
PInputVideoStream::PInputVideoStream | ( | ) |
Constructs an empty (no stream) video stream; use PInputVideoStream::Open() factory to open a video stream.
IsOpened() will return false.
- See also
- Open()
◆ PInputVideoStream() [2/2]
PInputVideoStream::PInputVideoStream | ( | const PInputVideoStream & | other | ) |
Constructs a shared copy of other.
◆ ~PInputVideoStream()
|
virtual |
Destroys this object; the stream will be automatically closed.
Member Function Documentation
◆ CanSeek()
bool PInputVideoStream::CanSeek | ( | ) | const |
Returns true if it is possible to go to a specific frame in this video stream, false otherwise.
For example, you can seek in a video file but not in a live stream. If the stream has the canSeek property, then you can jump to a specific frame using using either GoToFrame(frameNumber) or Set(PInputVideoStream::C_PROPERTY_INT32_GO_TO_FRAME, PInt32(frameNumber)).
- See also
- GoToFrame()
◆ Close()
PResult PInputVideoStream::Close | ( | ) |
Closes (releases) this video stream.
The object is not destroyed, just closed. The behavior of this method depends on the Input Video Stream plugin; most of the time, it will return an error if the stream is already closed. Returns PResult::C_OK if success, another result otherwise.
- See also
- OpenVideoStream()
◆ GetCurrentFrameNumber()
papillon::int32 PInputVideoStream::GetCurrentFrameNumber | ( | ) | const |
Returns the current frame number (index) if the input video stream plugin supports this feature; returns -1 if this information cannot be retrieved.
This function is an helper for Get(PInputVideoStream::C_PROPERTY_INT32_FRAME_NUMBER, PInt32&)
◆ GetFrame()
Reads the next frame from this video stream.
WARNING: this method will create a NEW PFrame object and will assign it to 'frame', i.e. internal pointers will change.
The method is blocking (synchronous). It will wait for the next image until the specified amount of time is reached (10 seconds by default).
Sometimes, this function can return a valid frame but the video stream is frozen. You can use IsFrozen() to detect this problem.
Returns PResult::C_OK if success, another result otherwise.
- See also
- IsFrozen()
- SetCheckPeriod()
◆ GetFrameratePerSecond()
double PInputVideoStream::GetFrameratePerSecond | ( | ) | const |
Returns the framerate per second if the input video stream plugin supports this feature; returns 0.0 if this information cannot be retrieved.
This function is an helper for Get(PInputVideoStream::C_PROPERTY_DOUBLE_STREAM_FPS, PDouble&)
◆ GetNumberOfFrames()
papillon::int32 PInputVideoStream::GetNumberOfFrames | ( | ) | const |
Returns the number of frames if the input video stream plugin supports this feature; returns -1 if this information cannot be retrieved.
This function is an helper for Get(PInputVideoStream::C_PROPERTY_INT32_FRAME_NUMBER, PInt32&)
◆ GetResolution()
PSizei PInputVideoStream::GetResolution | ( | ) | const |
Returns the width and height of the video stream in pixels if the input video stream plugin supports this feature; returns (-1,-1) if this information cannot be retrieved.
This function is an helper for Get(PInputVideoStream::C_PROPERTY_INT32_STREAM_WIDTH, PInt32&) + Get(PInputVideoStream::C_PROPERTY_INT32_STREAM_HEIGHT, PInt32&)
◆ GetUri()
PUri PInputVideoStream::GetUri | ( | ) | const |
Returns the URI corresponding to the source of this stream.
◆ GoToFrame()
PResult PInputVideoStream::GoToFrame | ( | papillon::int32 | frameNumber | ) |
Jumps to the specified frame number if the input video stream plugin support this feature.
This function is an helper for Set(PInputVideoStream::C_PROPERTY_INT32_GO_TO_FRAME, PInt32(frameNumber)).
Note: some video streams does not accept "GoToFrame", for example "live streams".
Returns PResult::C_OK if success, another result otherwise.
- See also
- CanSeek()
◆ IsEmpty()
bool PInputVideoStream::IsEmpty | ( | ) | const |
Returns true if this video stream is empty (no video stream), false otherwise.
◆ IsFrozen()
bool PInputVideoStream::IsFrozen | ( | ) | const |
Returns true if this video stream is frozen, false otherwise.
- See also
- SetCheckPeriod()
◆ IsOpened()
bool PInputVideoStream::IsOpened | ( | ) | const |
Returns true if the video stream has been successfully opened and is ready for reading, false otherwise.
◆ Open() [1/2]
|
static |
Creates and opens an input video stream from the specified URI (this method is a factory).
This SDK offers several input video plugin in order to read most of video streams (video files, RTSP, streams, etc.). Typical plugins relies on VLC, FFMPEG or OpenCV.
By default, RTSP streams will be opened by VLC plugin and video files will be read by OpenCV plugin. You can specify (force) the plugin to be used using "decode_with" option in the URI (see examples below).
Usage:
Preferred decoding tool can be specified in the URI using "decode_with" in the query string part (e.g. "video2.mp4?decode_with=ffmpeg").
Note: this function is a shortcut for PPluginManager::GetInstance().OpenInputVideoStream().
Returns PResult::C_OK if success, another result otherwise.
◆ Open() [2/2]
|
static |
Creates and opens an input video stream from the specified URI (this method is a factory) using the specified plugin.
◆ OpenVideoStream()
PResult PInputVideoStream::OpenVideoStream | ( | ) |
Opens this video stream.
The behavior of this method depends on the Input Video Stream plugin; most of the time, it will return an error if the stream is already opened. Returns PResult::C_OK if success, another result otherwise.
- See also
- Close()
◆ operator=()
PInputVideoStream& PInputVideoStream::operator= | ( | const PInputVideoStream & | other | ) |
Performs a shared copy of other to this object.
◆ SetCheckPeriod()
void PInputVideoStream::SetCheckPeriod | ( | papillon::int32 | timeMs | ) |
Sets check period in milliseconds (5000 ms = 5 seconds by default).
This value is used to periodically check if the video stream is frozen (this sanity check is performed by GetFrame()).
- See also
- IsFrozen()
Member Data Documentation
◆ C_DEFAULT_EDGEVIS_PLUGIN
|
static |
A string constant holding the default plugin to be used to open an edge-vis video stream.
Definition at line 39 of file PInputVideoStream.h.
◆ C_DEFAULT_FILE_PLUGIN
|
static |
A string constant holding the default plugin to be used to open a video file.
Definition at line 38 of file PInputVideoStream.h.
◆ C_DEFAULT_RSTP_PLUGIN
|
static |
A string constant holding the default plugin to be used to open a RTSP video stream.
Definition at line 37 of file PInputVideoStream.h.
◆ C_PROPERTY_DOUBLE_STREAM_FPS
|
static |
A string constant holding the name of the property "stream framerate per second".
Definition at line 43 of file PInputVideoStream.h.
◆ C_PROPERTY_INT32_FRAME_COUNT
|
static |
A string constant holding the name of the property "frame count".
Definition at line 45 of file PInputVideoStream.h.
◆ C_PROPERTY_INT32_FRAME_NUMBER
|
static |
A string constant holding the name of the property "frame number".
Definition at line 46 of file PInputVideoStream.h.
◆ C_PROPERTY_INT32_GO_TO_FRAME
|
static |
A string constant holding the name of the property "go to frame".
Definition at line 44 of file PInputVideoStream.h.
◆ C_PROPERTY_INT32_STREAM_HEIGHT
|
static |
A string constant holding the name of the property "stream height" (in pixels)
Definition at line 42 of file PInputVideoStream.h.
◆ C_PROPERTY_INT32_STREAM_WIDTH
|
static |
A string constant holding the name of the property "stream width" (in pixels)
Definition at line 41 of file PInputVideoStream.h.