QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GStreamerFrameMap.cc File Reference
#include "GStreamerFrameMap.h"
#include <QtMultimedia/QAbstractVideoBuffer>
#include <QtMultimedia/QVideoFrame>
#include <atomic>
#include <gst/gst.h>
#include <gst/video/gstvideometa.h>
#include <gst/video/video-hdr.h>
#include "GstQgcVideoFormats.h"
#include "HwBuffers/common/CpuVideoFramePool.h"
#include "QGCLoggingCategory.h"
+ Include dependency graph for GStreamerFrameMap.cc:

Go to the source code of this file.

Functions

QVideoFrameFormat::ColorSpace toQtColorSpace (GstVideoColorMatrix matrix)
 Sample-to-frame helpers for qgcqvideosink's show_frame; pure functions, streaming-thread safe.
 
QVideoFrameFormat::ColorTransfer toQtColorTransfer (GstVideoTransferFunction transfer)
 
QVideoFrameFormat::PixelFormat toQtPixelFormat (GstVideoFormat fmt)
 
QVideoFrameFormat::ColorRange toQtColorRange (GstVideoColorRange range)
 
void applyOrientationToFrame (QVideoFrame &frame, GstVideoOrientationMethod method)
 Apply rotation + mirror flags derived from GstVideoOrientationMethod.
 
void applyOrientationAndTiming (QVideoFrame &frame, GstBuffer *buffer, int streamOrientation)
 
void applyColorimetry (QVideoFrameFormat &format, const GstVideoInfo &info, GstCaps *caps)
 
QVideoFrameFormat applyCropMeta (QVideoFrameFormat format, GstBuffer *buffer)
 Apply video crop meta to format's viewport. Pass-through when no crop meta present.
 
MappedFrame mapSampleToFrame (GstBuffer *buffer, GstCaps *caps, const GstVideoInfo &info, const QVideoFrameFormat &format, const HwVideoBufferContext &hwContext, HwResolvedPathCache *pathCache) noexcept
 

Function Documentation

◆ applyColorimetry()

void applyColorimetry ( QVideoFrameFormat &  format,
const GstVideoInfo &  info,
GstCaps *  caps 
)

Set color-space/transfer/range from gst-video colorimetry + HDR (MaxCLL preferred); infers BT.601/709 from height when caps omit it.

Definition at line 164 of file GStreamerFrameMap.cc.

References toQtColorRange(), toQtColorSpace(), and toQtColorTransfer().

Referenced by gst_qgc_q_video_sink_set_caps().

◆ applyCropMeta()

QVideoFrameFormat applyCropMeta ( QVideoFrameFormat  format,
GstBuffer *  buffer 
)

Apply video crop meta to format's viewport. Pass-through when no crop meta present.

Definition at line 211 of file GStreamerFrameMap.cc.

Referenced by gst_qgc_q_video_sink_show_frame().

◆ applyOrientationAndTiming()

void applyOrientationAndTiming ( QVideoFrame &  frame,
GstBuffer *  buffer,
int  streamOrientation 
)

Per-frame orientation (meta wins, else stream fallback) + PTS/duration timing; streamOrientation is GstVideoOrientationMethod cast to int.

Definition at line 140 of file GStreamerFrameMap.cc.

References applyOrientationToFrame().

Referenced by gst_qgc_q_video_sink_show_frame().

◆ applyOrientationToFrame()

void applyOrientationToFrame ( QVideoFrame &  frame,
GstVideoOrientationMethod  method 
)

Apply rotation + mirror flags derived from GstVideoOrientationMethod.

Definition at line 93 of file GStreamerFrameMap.cc.

Referenced by applyOrientationAndTiming().

◆ mapSampleToFrame()

MappedFrame mapSampleToFrame ( GstBuffer *  buffer,
GstCaps *  caps,
const GstVideoInfo &  info,
const QVideoFrameFormat &  format,
const HwVideoBufferContext hwContext,
HwResolvedPathCache pathCache 
)
noexcept

◆ toQtColorRange()

QVideoFrameFormat::ColorRange toQtColorRange ( GstVideoColorRange  range)

Definition at line 79 of file GStreamerFrameMap.cc.

Referenced by applyColorimetry().

◆ toQtColorSpace()

QVideoFrameFormat::ColorSpace toQtColorSpace ( GstVideoColorMatrix  matrix)

Sample-to-frame helpers for qgcqvideosink's show_frame; pure functions, streaming-thread safe.

Definition at line 16 of file GStreamerFrameMap.cc.

Referenced by applyColorimetry().

◆ toQtColorTransfer()

QVideoFrameFormat::ColorTransfer toQtColorTransfer ( GstVideoTransferFunction  transfer)

Definition at line 35 of file GStreamerFrameMap.cc.

Referenced by applyColorimetry().

◆ toQtPixelFormat()

QVideoFrameFormat::PixelFormat toQtPixelFormat ( GstVideoFormat  fmt)

Definition at line 69 of file GStreamerFrameMap.cc.

References GstQgc::kVideoFormatTable.

Referenced by gst_qgc_q_video_sink_set_caps().