mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-14 10:46:51 -07:00
parent
ffe7d09088
commit
8c651b0890
11 changed files with 269 additions and 40 deletions
|
@ -28,15 +28,36 @@ extern "C"
|
|||
#include <libavcodec/avcodec.h>
|
||||
}
|
||||
|
||||
#define MAX_PANES 3
|
||||
|
||||
class VideoDecoder;
|
||||
class AVOpenGLFrameUploader;
|
||||
|
||||
struct PlaneConfig
|
||||
{
|
||||
unsigned int width_divider;
|
||||
unsigned int height_divider;
|
||||
unsigned int data_per_pixel;
|
||||
GLint internal_format;
|
||||
GLenum format;
|
||||
};
|
||||
|
||||
struct ConversionConfig
|
||||
{
|
||||
enum AVPixelFormat pixel_format;
|
||||
const char *shader_vert_glsl;
|
||||
const char *shader_frag_glsl;
|
||||
unsigned int planes;
|
||||
struct PlaneConfig plane_configs[MAX_PANES];
|
||||
};
|
||||
|
||||
struct AVOpenGLFrame
|
||||
{
|
||||
GLuint pbo[3];
|
||||
GLuint tex[3];
|
||||
GLuint pbo[MAX_PANES];
|
||||
GLuint tex[MAX_PANES];
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
ConversionConfig *conversion_config;
|
||||
|
||||
bool Update(AVFrame *frame, ChiakiLog *log);
|
||||
};
|
||||
|
@ -61,6 +82,8 @@ class AVOpenGLWidget: public QOpenGLWidget
|
|||
|
||||
QTimer *mouse_timer;
|
||||
|
||||
ConversionConfig *conversion_config;
|
||||
|
||||
public:
|
||||
static QSurfaceFormat CreateSurfaceFormat();
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <chiaki/session.h>
|
||||
|
||||
#include "host.h"
|
||||
#include "videodecoder.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
|
@ -76,6 +77,9 @@ class Settings : public QObject
|
|||
unsigned int GetBitrate() const;
|
||||
void SetBitrate(unsigned int bitrate);
|
||||
|
||||
HardwareDecodeEngine GetHardwareDecodeEngine() const;
|
||||
void SetHardwareDecodeEngine(HardwareDecodeEngine enabled);
|
||||
|
||||
unsigned int GetAudioBufferSizeDefault() const;
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,6 +39,7 @@ class SettingsDialog : public QDialog
|
|||
QComboBox *fps_combo_box;
|
||||
QLineEdit *bitrate_edit;
|
||||
QLineEdit *audio_buffer_size_edit;
|
||||
QComboBox *hardware_decode_combo_box;
|
||||
|
||||
QListWidget *registered_hosts_list_widget;
|
||||
QPushButton *delete_registered_host_button;
|
||||
|
@ -52,6 +53,7 @@ class SettingsDialog : public QDialog
|
|||
void FPSSelected();
|
||||
void BitrateEdited();
|
||||
void AudioBufferSizeEdited();
|
||||
void HardwareDecodeEngineSelected();
|
||||
|
||||
void UpdateRegisteredHosts();
|
||||
void UpdateRegisteredHostsButtons();
|
||||
|
|
|
@ -49,6 +49,7 @@ class ChiakiException: public Exception
|
|||
struct StreamSessionConnectInfo
|
||||
{
|
||||
QMap<Qt::Key, int> key_map;
|
||||
HardwareDecodeEngine hw_decode_engine;
|
||||
uint32_t log_level_mask;
|
||||
QString log_file;
|
||||
QString host;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "exception.h"
|
||||
|
||||
#include <QMap>
|
||||
#include <QMutex>
|
||||
#include <QObject>
|
||||
|
||||
|
@ -32,6 +33,20 @@ extern "C"
|
|||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
typedef enum {
|
||||
HW_DECODE_NONE = 0,
|
||||
HW_DECODE_VAAPI = 1,
|
||||
HW_DECODE_VDPAU = 2,
|
||||
} HardwareDecodeEngine;
|
||||
|
||||
|
||||
static const QMap<HardwareDecodeEngine, const char *> hardware_decode_engine_names = {
|
||||
{ HW_DECODE_NONE, "none"},
|
||||
{ HW_DECODE_VAAPI, "vaapi"},
|
||||
{ HW_DECODE_VDPAU, "vdpau"},
|
||||
};
|
||||
|
||||
class VideoDecoderException: public Exception
|
||||
{
|
||||
public:
|
||||
|
@ -43,23 +58,31 @@ class VideoDecoder: public QObject
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
VideoDecoder(ChiakiLog *log);
|
||||
VideoDecoder(HardwareDecodeEngine hw_decode_engine, ChiakiLog *log);
|
||||
~VideoDecoder();
|
||||
|
||||
void PushFrame(uint8_t *buf, size_t buf_size);
|
||||
AVFrame *PullFrame();
|
||||
AVFrame *GetFromHardware(AVFrame *hw_frame);
|
||||
|
||||
ChiakiLog *GetChiakiLog() { return log; }
|
||||
|
||||
enum AVPixelFormat PixelFormat() { return hw_decode_engine?AV_PIX_FMT_NV12:AV_PIX_FMT_YUV420P; }
|
||||
|
||||
signals:
|
||||
void FramesAvailable();
|
||||
|
||||
private:
|
||||
HardwareDecodeEngine hw_decode_engine;
|
||||
|
||||
ChiakiLog *log;
|
||||
QMutex mutex;
|
||||
|
||||
AVCodec *codec;
|
||||
AVCodecContext *codec_context;
|
||||
|
||||
enum AVPixelFormat hw_pix_fmt;
|
||||
AVBufferRef *hw_device_ctx;
|
||||
};
|
||||
|
||||
#endif // CHIAKI_VIDEODECODER_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue