91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 21KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-22
  • 語言: C/C++
  • 標簽:

資源簡介

基于QT5.7和C++的視頻播放器源碼,可實現視頻播放和音樂播放

資源截圖

代碼片段和文件信息


#include?“histogramwidget.h“
#include?

?HistogramWidget::HistogramWidget(QWidget?*parent)
????:?QWidget(parent)
?????m_levels(128)
?????m_isBusy(false)
{
????m_processor.moveToThread(&m_processorThread);
????qRegistermetaType?>(“QVector“);
????connect(&m_processor?SIGNAL(histogramReady(QVector))?SLOT(setHistogram(QVector)));
????m_processorThread.start(QThread::LowestPriority);
}

HistogramWidget::~HistogramWidget()
{
????m_processorThread.quit();
????m_processorThread.wait(10000);
}

void?HistogramWidget::processframe(QVideoframe?frame)
{
????if?(m_isBusy)
????????return;?//drop?frame

????m_isBusy?=?true;
????Qmetaobject::invokeMethod(&m_processor?“processframe“
??????????????????????????????Qt::QueuedConnection?Q_ARG(QVideoframe?frame)?Q_ARG(int?m_levels));
}

void?HistogramWidget::setHistogram(QVector?histogram)
{
????m_isBusy?=?false;
????m_histogram?=?histogram;
????update();
}

void?HistogramWidget::paintEvent(QPaintEvent?*event)
{
????Q_UNUSED(event);

????QPainter?painter(this);

????if?(m_histogram.isEmpty())?{
????????painter.fillRect(0?0?width()?height()?QColor::fromRgb(0?0?0));
????????return;
????}

????qreal?barWidth?=?width()?/?(qreal)m_histogram.size();

????for?(int?i?=?0;?i?????????qreal?h?=?m_histogram[i]?*?height();
????????//?draw?level
????????painter.fillRect(barWidth?*?i?height()?-?h?barWidth?*?(i?+?1)?height()?Qt::red);
????????//?clear?the?rest?of?the?control
????????painter.fillRect(barWidth?*?i?0?barWidth?*?(i?+?1)?height()?-?h?Qt::black);
????}
}

void?frameProcessor::processframe(QVideoframe?frame?int?levels)
{
????QVector?histogram(levels);

????do?{
????????if?(!levels)
????????????break;

????????if?(!frame.map(QAbstractVideoBuffer::ReadOnly))
????????????break;

????????if?(frame.pixelFormat()?==?QVideoframe::Format_YUV420P?||
????????????frame.pixelFormat()?==?QVideoframe::Format_NV12)?{
????????????//?Process?YUV?data
????????????uchar?*b?=?frame.bits();
????????????for?(int?y?=?0;?y?ame.height();?y++)?{
????????????????uchar?*lastPixel?=?b?+?frame.width();
????????????????for?(uchar?*curPixel?=?b;?curPixel?????????????????????histogram[(*curPixel?*?levels)?>>?8]?+=?1.0;
????????????????b?+=?frame.bytesPerLine();
????????????}
????????}?else?{
????????????QImage::Format?imageFormat?=?QVideoframe::imageFormatFromPixelFormat(frame.pixelFormat());
????????????if?(imageFormat?!=?QImage::Format_Invalid)?{
????????????????//?Process?RGB?data
????????????????QImage?image(frame.bits()?frame.width()?frame.height()?imageFormat);
????????????????image?=?image.convertToFormat(QImage::Format_RGB32);

????????????????const?QRgb*?b?=?(const?QRgb*)image.bits();
????????????????for?(int?y?=?0;?y?????????????????????const?QRgb?*lastPixel?=?b?+?frame.width();
??????????

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-01-05?16:33??mediaplayer\
?????文件????????3718??2018-01-05?15:40??mediaplayer\histogramwidget.cpp
?????文件?????????931??2018-01-04?16:46??mediaplayer\histogramwidget.h
?????文件????????3717??2018-01-04?16:05??mediaplayer\histogramwidgetcpp.cpp
?????文件?????????165??2018-01-04?15:55??mediaplayer\histogramwidgetcpp.h
?????文件????????1155??2018-01-04?16:53??mediaplayer\main.cpp
?????文件?????????643??2018-01-04?16:46??mediaplayer\mediaplayer.pro
?????文件???????23809??2018-01-05?16:17??mediaplayer\mediaplayer.pro.user
?????文件???????13621??2018-01-04?16:51??mediaplayer\player.cpp
?????文件????????2066??2018-01-04?16:16??mediaplayer\player.h
?????文件????????4552??2018-01-04?16:05??mediaplayer\playercontrols.cpp
?????文件????????1307??2018-01-04?16:16??mediaplayer\playercontrols.h
?????文件????????4552??2018-01-04?16:05??mediaplayer\playercontrolscpp.cpp
?????文件?????????160??2018-01-04?15:57??mediaplayer\playercontrolscpp.h
?????文件???????13619??2018-01-04?16:05??mediaplayer\playercpp.cpp
?????文件?????????120??2018-01-04?15:56??mediaplayer\playercpp.h
?????文件????????3403??2018-01-04?16:51??mediaplayer\playerlistmodel.cpp
?????文件????????1265??2018-01-04?16:16??mediaplayer\playerlistmodel.h
?????文件????????1052??2018-01-04?17:09??mediaplayer\videowidget.cpp
?????文件?????????377??2018-01-04?16:19??mediaplayer\videowidget.h
?????文件?????????114??2018-01-04?15:48??mediaplayer\widget.cpp
?????文件?????????195??2018-01-04?15:48??mediaplayer\widget.h

評論

共有 條評論