Skip to content

Commit 386efd8

Browse files
committed
修改QRGBAPlayer 已知bug
1 parent c5ff154 commit 386efd8

File tree

11 files changed

+54
-55
lines changed

11 files changed

+54
-55
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
1+
#RGBAPlayer
2+
#YUV420PPlayer

examples/test/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
#include <QCoreApplication>
22
#include <QApplication>
3-
#include <Qt6FFmpeg/QYUV420Player>
4-
#include <Qt6FFmpeg/QRGBAPlayer>
3+
#include <Qt6FFmpeg/YUV420PPlayer>
4+
#include <Qt6FFmpeg/RGBAPlayer>
55
#include <QDebug>
66
int main(int argc, char *argv[])
77
{
88
QApplication a(argc, argv);
9-
//Qt6FFmpeg::QYUV420Player player;
10-
Qt6FFmpeg::QRGBAPlayer player;
9+
//Qt6FFmpeg::YUV420PPlayer player;
10+
Qt6FFmpeg::RGBAPlayer player;
1111
//player.resize(800,600);
1212
player.resize(800,600);
1313
player.play("https://cesium.com/public/SandcastleSampleData/big-buck-bunny_trailer.mp4");
14-
a.connect(&player,&Qt6FFmpeg::QRGBAPlayer::reject,[&](int err){
14+
a.connect(&player,&Qt6FFmpeg::RGBAPlayer::reject,[&](int err){
1515
qDebug() << "error:" << err;
1616
player.stop();
1717
a.exit();

libQt6FFmpeg/RGBAPlayer.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
1-
#include "QRGBAPlayer.h"
1+
#include "RGBAPlayer.h"
22
#include <QOpenGLExtraFunctions>
33
#include <QDebug>
44
#include <QImageReader>
55
#include <QResizeEvent>
6-
Qt6FFmpeg::QRGBAPlayer::QRGBAPlayer(QWidget *parent)
6+
7+
Qt6FFmpeg::RGBAPlayer::RGBAPlayer(QWidget *parent)
78
:QOpenGLWidget(parent),
89
demuxer(new FFmpegDemuxer(this)),
910
audio_decoder(new AudioDecoder(this)),
1011
video_decoder(new VideoDecoder(this))
1112
{
12-
connect(demuxer,&FFmpegDemuxer::reject,this,&Qt6FFmpeg::QRGBAPlayer::rejectCallback);
13+
connect(demuxer,&FFmpegDemuxer::reject,this,&Qt6FFmpeg::RGBAPlayer::rejectCallback);
1314
connect(this->video_decoder,&VideoDecoder::sigFirst,[=](uint8_t * data[],int w,int h){
1415
dstImageData =*data;
1516
dstImageWidth=w;
1617
dstImageHeight=h;
1718
});
18-
connect(this->video_decoder,&VideoDecoder::newFrame,this,&Qt6FFmpeg::QRGBAPlayer::refresh);
19+
connect(this->video_decoder,&VideoDecoder::newFrame,this,&Qt6FFmpeg::RGBAPlayer::refresh);
1920
}
2021

2122

22-
void Qt6FFmpeg::QRGBAPlayer::play(const QString &url)
23+
void Qt6FFmpeg::RGBAPlayer::play(const QString &url)
2324
{
2425
demuxer->pause();
2526
audio_decoder->pause();
@@ -40,42 +41,41 @@ void Qt6FFmpeg::QRGBAPlayer::play(const QString &url)
4041
demuxer->resume();
4142
}
4243

43-
void Qt6FFmpeg::QRGBAPlayer::pause()
44+
void Qt6FFmpeg::RGBAPlayer::pause()
4445
{
4546
demuxer->pause();
4647
audio_decoder->pause();
4748
video_decoder->pause();
4849
}
4950

50-
void Qt6FFmpeg::QRGBAPlayer::resume()
51+
void Qt6FFmpeg::RGBAPlayer::resume()
5152
{
5253
audio_decoder->resume();
5354
video_decoder->resume();
5455
demuxer->resume();
5556
}
5657

57-
void Qt6FFmpeg::QRGBAPlayer::stop()
58+
void Qt6FFmpeg::RGBAPlayer::stop()
5859
{
5960
audio_decoder->release();
6061
video_decoder->release();
6162
demuxer->release();
6263
}
6364

64-
void Qt6FFmpeg::QRGBAPlayer::rejectCallback(int err)
65+
void Qt6FFmpeg::RGBAPlayer::rejectCallback(int err)
6566
{
6667
emit reject(err);
6768
}
6869

6970

7071

71-
Qt6FFmpeg::QRGBAPlayer::~QRGBAPlayer()
72-
{
73-
demuxer->release();
72+
Qt6FFmpeg::RGBAPlayer::~RGBAPlayer()
73+
{ demuxer->release();
7474
audio_decoder->release();
7575
video_decoder->release();
7676
}
7777

78-
void Qt6FFmpeg::QRGBAPlayer::initializeGL()
78+
void Qt6FFmpeg::RGBAPlayer::initializeGL()
7979
{
8080
initializeOpenGLFunctions();
8181
glClearColor(0.0f, 0.0f, 0.0f,1.0f); // 设置背景色
@@ -103,13 +103,13 @@ void Qt6FFmpeg::QRGBAPlayer::initializeGL()
103103
finished=true;
104104
}
105105

106-
void Qt6FFmpeg::QRGBAPlayer::resizeGL(int w, int h)
106+
void Qt6FFmpeg::RGBAPlayer::resizeGL(int w, int h)
107107
{
108108
if(h<=0) h=1;
109109
glViewport(0,0,w,h);
110110
}
111111

112-
void Qt6FFmpeg::QRGBAPlayer::paintGL()
112+
void Qt6FFmpeg::RGBAPlayer::paintGL()
113113
{
114114
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
115115
if (!currentFrame.isNull()) {
@@ -131,7 +131,7 @@ void Qt6FFmpeg::QRGBAPlayer::paintGL()
131131
}
132132
}
133133

134-
void Qt6FFmpeg::QRGBAPlayer::refresh()
134+
void Qt6FFmpeg::RGBAPlayer::refresh()
135135
{
136136
if(finished){
137137
QImage glImage(dstImageData,dstImageWidth,dstImageHeight,QImage::Format_RGBA8888);

libQt6FFmpeg/RGBAPlayer.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef QRGBAPLAYER_H
2-
#define QRGBAPLAYER_H
1+
#ifndef RGBAPLAYER_H
2+
#define RGBAPLAYER_H
33

44

55
#include <QObject>
@@ -17,13 +17,13 @@
1717
#include "libQt6FFmpeg_global.h"
1818

1919
namespace Qt6FFmpeg {
20-
class LIBQT6FFMPEG_EXPORT QRGBAPlayer : public QOpenGLWidget,public QOpenGLFunctions
20+
class LIBQT6FFMPEG_EXPORT RGBAPlayer : public QOpenGLWidget,public QOpenGLFunctions
2121
{
2222
Q_OBJECT
2323
public:
2424

25-
explicit QRGBAPlayer(QWidget *parent = nullptr);
26-
~QRGBAPlayer();
25+
explicit RGBAPlayer(QWidget *parent = nullptr);
26+
~RGBAPlayer();
2727
void play(const QString & url);
2828
void pause();
2929
void resume();
@@ -55,4 +55,4 @@ public slots:
5555

5656
}
5757

58-
#endif // QRGBAPLAYER_H
58+
#endif // RGBAPLAYER_H

libQt6FFmpeg/YUV420PPlayer.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
#include "QYUV420Player.h"
1+
#include "YUV420PPlayer.h"
22
#include <QDebug>
33

44

5-
Qt6FFmpeg::QYUV420Player::QYUV420Player(QWidget *parent)
5+
Qt6FFmpeg::YUV420PPlayer::YUV420PPlayer(QWidget *parent)
66
:QOpenGLWidget(parent),
77
demuxer(new FFmpegDemuxer(this)),
88
audio_decoder(new AudioDecoder(this)),
99
video_decoder(new VideoDecoder(this))
1010
{
1111

1212

13-
connect(demuxer,&FFmpegDemuxer::reject,this,&Qt6FFmpeg::QYUV420Player::rejectCallback);
13+
connect(demuxer,&FFmpegDemuxer::reject,this,&Qt6FFmpeg::YUV420PPlayer::rejectCallback);
1414
connect(this->video_decoder,&VideoDecoder::sigFirst,[=](uint8_t * data[],int w,int h){
1515
ptr = *data;
1616
width = w;
@@ -23,15 +23,15 @@ Qt6FFmpeg::QYUV420Player::QYUV420Player(QWidget *parent)
2323

2424
}
2525

26-
Qt6FFmpeg::QYUV420Player::~QYUV420Player()
26+
Qt6FFmpeg::YUV420PPlayer::~YUV420PPlayer()
2727
{
2828

2929
demuxer->release();
3030
audio_decoder->release();
3131
video_decoder->release();
3232

3333
}
34-
void Qt6FFmpeg::QYUV420Player::play(const QString &url)
34+
void Qt6FFmpeg::YUV420PPlayer::play(const QString &url)
3535
{
3636

3737
demuxer->pause();
@@ -59,21 +59,21 @@ void Qt6FFmpeg::QYUV420Player::play(const QString &url)
5959

6060
}
6161

62-
void Qt6FFmpeg::QYUV420Player::pause()
62+
void Qt6FFmpeg::YUV420PPlayer::pause()
6363
{
6464
demuxer->pause();
6565
audio_decoder->pause();
6666
video_decoder->pause();
6767
}
6868

69-
void Qt6FFmpeg::QYUV420Player::resume()
69+
void Qt6FFmpeg::YUV420PPlayer::resume()
7070
{
7171
audio_decoder->resume();
7272
video_decoder->resume();
7373
demuxer->resume();
7474
}
7575

76-
void Qt6FFmpeg::QYUV420Player::stop()
76+
void Qt6FFmpeg::YUV420PPlayer::stop()
7777
{
7878

7979

@@ -84,7 +84,7 @@ void Qt6FFmpeg::QYUV420Player::stop()
8484

8585

8686

87-
void Qt6FFmpeg::QYUV420Player::initializeGL()
87+
void Qt6FFmpeg::YUV420PPlayer::initializeGL()
8888
{
8989
initializeOpenGLFunctions();
9090
const char *vsrc =
@@ -142,14 +142,14 @@ void Qt6FFmpeg::QYUV420Player::initializeGL()
142142
idV = ids[2];
143143
}
144144

145-
void Qt6FFmpeg::QYUV420Player::resizeGL(int w, int h)
145+
void Qt6FFmpeg::YUV420PPlayer::resizeGL(int w, int h)
146146
{
147147
if(h<=0) h=1;
148148

149149
glViewport(0,0,w,h);
150150
}
151151

152-
void Qt6FFmpeg::QYUV420Player::paintGL()
152+
void Qt6FFmpeg::YUV420PPlayer::paintGL()
153153
{
154154
if(!ptr) return;
155155

@@ -198,7 +198,7 @@ void Qt6FFmpeg::QYUV420Player::paintGL()
198198
}
199199

200200

201-
void Qt6FFmpeg::QYUV420Player::rejectCallback(int err)
201+
void Qt6FFmpeg::YUV420PPlayer::rejectCallback(int err)
202202
{
203203
emit reject(err);
204204
}

libQt6FFmpeg/YUV420PPlayer.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef QYUV420PLAYER_H
2-
#define QYUV420PLAYER_H
1+
#ifndef YUV420PPLAYER_H
2+
#define YUV420PPLAYER_H
33

44
#include <QObject>
55
#include <QOpenGLFunctions>
@@ -15,12 +15,12 @@
1515
#include "libQt6FFmpeg_global.h"
1616

1717
namespace Qt6FFmpeg {
18-
class LIBQT6FFMPEG_EXPORT QYUV420Player : public QOpenGLWidget,public QOpenGLFunctions
18+
class LIBQT6FFMPEG_EXPORT YUV420PPlayer : public QOpenGLWidget,public QOpenGLFunctions
1919
{
2020
Q_OBJECT
2121
public:
22-
explicit QYUV420Player(QWidget *parent = nullptr);
23-
~QYUV420Player();
22+
explicit YUV420PPlayer(QWidget *parent = nullptr);
23+
~YUV420PPlayer();
2424
void play(const QString & url);
2525
void pause();
2626
void resume();
@@ -56,4 +56,4 @@ public slots:
5656
}
5757

5858

59-
#endif // QYUV420PLAYER_H
59+
#endif // YUV420PPLAYER_H

libQt6FFmpeg/include/Qt6FFmpeg/QRGBAPlayer

Lines changed: 0 additions & 1 deletion
This file was deleted.

libQt6FFmpeg/include/Qt6FFmpeg/QYUV420Player

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "../RGBAPlayer.h"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "../YUV420PPlayer.h"

0 commit comments

Comments
 (0)