ARGB8888 --> ARGB4444&Other Formats

int  argb8888;
int  a = (argb8888  &   0xff000000 ) >> 24 ;
int  r = (argb8888  &   0x00ff0000 ) >> 16 ;
int  g = (argb8888  &   0x0000ff00 ) >> 8 ;
int  b = (argb8888  &   0x000000ff ) >> 0 ;
 
short  argb4444 = ((a >> 4 ) << 12 ) | ((r >> 4 ) << 8 ) | ((g >> 4 ) << 4 ) | ((b >> 4 ) << 0 );
short  rgb555 = ((r >> 3 ) << 10 ) | ((g >> 3 ) << 5 ) | ((b >> 3 ) << 0 ); 
short  rgb565 = ((r >> 3 ) << 11 ) | ((g >> 2 ) << 5 ) | (b >> 3 ); 

 
看起来这个错误是因为 QMediaPlayer 没有名为 videoFrameChanged 的成员。我猜测你可能想要使用 QAbstractVideoSurface::videoFrameChanged 信号,这是在视频帧更改时发出的信号。你需要创建一个自定义的 QAbstractVideoSurface 子类,并将其设置为 QMediaPlayer 的视频输出面。然后,你可以连接 QAbstractVideoSurface::videoFrameChanged 信号到一个槽函数,该函数会在视频帧更改时被调用,从而更新显示的图像。以下是一个基本的示例: ``` class VideoSurface : public QAbstractVideoSurface { Q_OBJECT public: VideoSurface(QObject *parent = nullptr) : QAbstractVideoSurface(parent) {} QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const override { Q_UNUSED(handleType); return QList<QVideoFrame::PixelFormat>() << QVideoFrame::Format_ARGB32; } bool present(const QVideoFrame &frame) override { if (frame.isValid()) { QImage image(frame.bits(), frame.width(), frame.height(), frame.bytesPerLine(), QVideoFrame::imageFormatFromPixelFormat(frame.pixelFormat())); emit videoFrameChanged(image); return true; } return false; } signals: void videoFrameChanged(const QImage &image); }; ``` 然后在你的代码中使用该类: ``` VideoSurface *surface = new VideoSurface(this); player->setVideoOutput(surface); connect(surface, &VideoSurface::videoFrameChanged, [=](const QImage &image) { ui->pictrue_lab->setPixmap(QPixmap::fromImage(image)); }); ``` 这样每当视频帧更改时,就会发出 VideoSurface::videoFrameChanged 信号,并将新图像传递给槽函数来更新 QLabel 中的图像。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值