修改ledok

This commit is contained in:
gangphon 2022-10-27 15:07:45 +08:00
parent b6e2a745f4
commit 778f0df097
158 changed files with 4367 additions and 3820 deletions

View File

@ -6,7 +6,7 @@ QT += serialport
QT += opengl QT += opengl
QT += webenginewidgets QT += webenginewidgets
CONFIG += c++11 CONFIG += c++20
CONFIG += lrelease CONFIG += lrelease
CONFIG += embed_translations CONFIG += embed_translations
# CONFIG += console # CONFIG += console
@ -17,7 +17,7 @@ CONFIG += embed_translations
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
TARGET = $$quote(LedOK Express) TARGET = $$quote(LedOK Express)
VERSION = 1.2.9 VERSION = 1.3.0
DEFINES += APP_VERSION=\\\"$$VERSION\\\" DEFINES += APP_VERSION=\\\"$$VERSION\\\"
msvc { msvc {
QMAKE_CXXFLAGS += -execution-charset:utf-8 QMAKE_CXXFLAGS += -execution-charset:utf-8
@ -36,22 +36,23 @@ QMAKE_LFLAGS += /LARGEADDRESSAWARE
} }
SOURCES += \ SOURCES += \
LoUIClass/aboutdlg.cpp \ base/aboutdlg.cpp \
LoUIClass/changepasswordform.cpp \ base/changepasswordform.cpp \
LoUIClass/customprogressindicator.cpp \ base/customprogressindicator.cpp \
LoUIClass/loemptydialog.cpp \ base/loemptydialog.cpp \
LoUIClass/pixbmpshowdialog.cpp \ base/pixbmpshowdialog.cpp \
LoUIClass/qiplineedit.cpp \ base/qiplineedit.cpp \
LoUIClass/softconfigdialog.cpp \ base/softconfigdialog.cpp \
LoUIClass/switchcontrol.cpp \ base/switchcontrol.cpp \
LoUIClass/taesclass.cpp \ base/taesclass.cpp \
LoUIClass/updateledset3dialog.cpp \ base/updateledset3dialog.cpp \
LoUIClass/updaterdialog.cpp \ base/updaterdialog.cpp \
LoUIClass/x_checkboxdelegate.cpp \ base/x_checkboxdelegate.cpp \
LoUIClass/x_spinboxdelegate.cpp \ base/x_spinboxdelegate.cpp \
LoUIClass/x_timeeditdelegate.cpp \ base/x_timeeditdelegate.cpp \
LoUIClass/x_uimsgboxok.cpp \ base/x_uimsgboxok.cpp \
base/extendedgroupbox.cpp \ base/extendedgroupbox.cpp \
base/ffutil.cpp \
base/locolorselector.cpp \ base/locolorselector.cpp \
base/lodateselector.cpp \ base/lodateselector.cpp \
base/loqtitlebar.cpp \ base/loqtitlebar.cpp \
@ -98,12 +99,12 @@ SOURCES += \
wDevicesManager/controlpowerschedule.cpp \ wDevicesManager/controlpowerschedule.cpp \
wDevicesManager/controlpowerwidget.cpp \ wDevicesManager/controlpowerwidget.cpp \
wDevicesManager/controltestwidget.cpp \ wDevicesManager/controltestwidget.cpp \
wDevicesManager/controlverifyclockwidget.cpp \
wDevicesManager/controlvolumemanual.cpp \ wDevicesManager/controlvolumemanual.cpp \
wDevicesManager/controlvolumeschedule.cpp \ wDevicesManager/controlvolumeschedule.cpp \
wDevicesManager/controlvolumewidget.cpp \ wDevicesManager/controlvolumewidget.cpp \
wDevicesManager/ctrladvancedpanel.cpp \ wDevicesManager/ctrladvancedpanel.cpp \
wDevicesManager/ctrlbrightpanel.cpp \ wDevicesManager/ctrlbrightpanel.cpp \
wDevicesManager/ctrlverifyclockpanel.cpp \
wDevicesManager/ledcard.cpp \ wDevicesManager/ledcard.cpp \
wDevicesManager/threadupgradeapk.cpp \ wDevicesManager/threadupgradeapk.cpp \
wDevicesManager/upgradeapkdialog.cpp \ wDevicesManager/upgradeapkdialog.cpp \
@ -120,7 +121,7 @@ SOURCES += \
wProgramManager/etimer.cpp \ wProgramManager/etimer.cpp \
wProgramManager/evideo.cpp \ wProgramManager/evideo.cpp \
wProgramManager/eweb.cpp \ wProgramManager/eweb.cpp \
wProgramManager/mconverter.cpp \ wProgramManager/gentmpthread.cpp \
wProgramManager/pageeditor.cpp \ wProgramManager/pageeditor.cpp \
wProgramManager/pagelistitem.cpp \ wProgramManager/pagelistitem.cpp \
wProgramManager/progcreatedlg.cpp \ wProgramManager/progcreatedlg.cpp \
@ -130,27 +131,28 @@ SOURCES += \
wProgramManager/sendprogthread.cpp \ wProgramManager/sendprogthread.cpp \
wProgramManager/threadexportprogrampro.cpp \ wProgramManager/threadexportprogrampro.cpp \
wProgramManager/usbdetectdialog.cpp \ wProgramManager/usbdetectdialog.cpp \
wProgramManager/videosplitthread.cpp \
wProgramManager/wexportprogramitem.cpp \ wProgramManager/wexportprogramitem.cpp \
wProgramManager/wplanitem.cpp \ wProgramManager/wplanitem.cpp \
wProgramManager/wplanlist.cpp \ wProgramManager/wplanlist.cpp \
wProgramManager/wprogrampublishitem.cpp \ wProgramManager/wprogrampublishitem.cpp \
HEADERS += \ HEADERS += \
LoUIClass/aboutdlg.h \ base/aboutdlg.h \
LoUIClass/changepasswordform.h \ base/changepasswordform.h \
LoUIClass/customprogressindicator.h \ base/customprogressindicator.h \
LoUIClass/loemptydialog.h \ base/loemptydialog.h \
LoUIClass/pixbmpshowdialog.h \ base/pixbmpshowdialog.h \
LoUIClass/qiplineedit.h \ base/qiplineedit.h \
LoUIClass/softconfigdialog.h \ base/softconfigdialog.h \
LoUIClass/switchcontrol.h \ base/switchcontrol.h \
LoUIClass/taesclass.h \ base/taesclass.h \
LoUIClass/updateledset3dialog.h \ base/updateledset3dialog.h \
LoUIClass/updaterdialog.h \ base/updaterdialog.h \
LoUIClass/x_checkboxdelegate.h \ base/x_checkboxdelegate.h \
LoUIClass/x_spinboxdelegate.h \ base/x_spinboxdelegate.h \
LoUIClass/x_timeeditdelegate.h \ base/x_timeeditdelegate.h \
LoUIClass/x_uimsgboxok.h \ base/x_uimsgboxok.h \
base/extendedgroupbox.h \ base/extendedgroupbox.h \
base/locolorselector.h \ base/locolorselector.h \
base/lodateselector.h \ base/lodateselector.h \
@ -197,12 +199,12 @@ HEADERS += \
wDevicesManager/controlpowerschedule.h \ wDevicesManager/controlpowerschedule.h \
wDevicesManager/controlpowerwidget.h \ wDevicesManager/controlpowerwidget.h \
wDevicesManager/controltestwidget.h \ wDevicesManager/controltestwidget.h \
wDevicesManager/controlverifyclockwidget.h \
wDevicesManager/controlvolumemanual.h \ wDevicesManager/controlvolumemanual.h \
wDevicesManager/controlvolumeschedule.h \ wDevicesManager/controlvolumeschedule.h \
wDevicesManager/controlvolumewidget.h \ wDevicesManager/controlvolumewidget.h \
wDevicesManager/ctrladvancedpanel.h \ wDevicesManager/ctrladvancedpanel.h \
wDevicesManager/ctrlbrightpanel.h \ wDevicesManager/ctrlbrightpanel.h \
wDevicesManager/ctrlverifyclockpanel.h \
wDevicesManager/ledcard.h \ wDevicesManager/ledcard.h \
wDevicesManager/threadupgradeapk.h \ wDevicesManager/threadupgradeapk.h \
wDevicesManager/upgradeapkdialog.h \ wDevicesManager/upgradeapkdialog.h \
@ -219,7 +221,7 @@ HEADERS += \
wProgramManager/etimer.h \ wProgramManager/etimer.h \
wProgramManager/evideo.h \ wProgramManager/evideo.h \
wProgramManager/eweb.h \ wProgramManager/eweb.h \
wProgramManager/mconverter.h \ wProgramManager/gentmpthread.h \
wProgramManager/pageeditor.h \ wProgramManager/pageeditor.h \
wProgramManager/pagelistitem.h \ wProgramManager/pagelistitem.h \
wProgramManager/progcreatedlg.h \ wProgramManager/progcreatedlg.h \
@ -229,16 +231,17 @@ HEADERS += \
wProgramManager/sendprogthread.h \ wProgramManager/sendprogthread.h \
wProgramManager/threadexportprogrampro.h \ wProgramManager/threadexportprogrampro.h \
wProgramManager/usbdetectdialog.h \ wProgramManager/usbdetectdialog.h \
wProgramManager/videosplitthread.h \
wProgramManager/wexportprogramitem.h \ wProgramManager/wexportprogramitem.h \
wProgramManager/wplanitem.h \ wProgramManager/wplanitem.h \
wProgramManager/wplanlist.h \ wProgramManager/wplanlist.h \
wProgramManager/wprogrampublishitem.h \ wProgramManager/wprogrampublishitem.h \
FORMS += \ FORMS += \
LoUIClass/pixbmpshowdialog.ui \ base/pixbmpshowdialog.ui \
LoUIClass/updateledset3dialog.ui \ base/updateledset3dialog.ui \
LoUIClass/updaterdialog.ui \ base/updaterdialog.ui \
LoUIClass/x_uimsgboxok.ui \ base/x_uimsgboxok.ui \
mguangyingpinwidget.ui \ mguangyingpinwidget.ui \
tipdialog.ui \ tipdialog.ui \
wDevicesManager/controlencryptwidget.ui \ wDevicesManager/controlencryptwidget.ui \
@ -247,7 +250,6 @@ FORMS += \
wDevicesManager/controlpowerschedule.ui \ wDevicesManager/controlpowerschedule.ui \
wDevicesManager/controlpowerwidget.ui \ wDevicesManager/controlpowerwidget.ui \
wDevicesManager/controltestwidget.ui \ wDevicesManager/controltestwidget.ui \
wDevicesManager/controlverifyclockwidget.ui \
wDevicesManager/controlvolumemanual.ui \ wDevicesManager/controlvolumemanual.ui \
wDevicesManager/controlvolumeschedule.ui \ wDevicesManager/controlvolumeschedule.ui \
wDevicesManager/controlvolumewidget.ui \ wDevicesManager/controlvolumewidget.ui \

273
LedOK/base/ffutil.cpp Normal file
View File

@ -0,0 +1,273 @@
#include "ffutil.h"
#include <QPainter>
#include <QDebug>
extern "C"{
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
}
QString videoInfo(QByteArray url, QImage &img, int64_t *dur, AVCodecID *codec_id) {
AVFormatContext *fmt_ctx = avformat_alloc_context();
QString err;
{
if(avformat_open_input(&fmt_ctx, url.constData(), nullptr, nullptr) != 0) {
err = "Couldn't open input stream";
goto free;
}
if(avformat_find_stream_info(fmt_ctx, nullptr) < 0) {
err = "Couldn't find stream information";
goto free;
}
if(dur!=nullptr) *dur = fmt_ctx->duration;
int vi_idx = -1;
for(uint ss=0; ss<fmt_ctx->nb_streams; ss++) if(fmt_ctx->streams[ss]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) vi_idx = ss;
if(vi_idx == -1) {
err = "Didn't find a Video Stream";
goto free;
}
auto codecpar = fmt_ctx->streams[vi_idx]->codecpar;
if(codec_id!=nullptr) *codec_id = codecpar->codec_id;
qDebug()<<"codec_id"<<codecpar->codec_id<<avcodec_get_name(codecpar->codec_id);
if(av_seek_frame(fmt_ctx, -1, 1000000, AVSEEK_FLAG_BACKWARD) < 0) {
err = "av_seek_frame fail";
goto free;
}
const AVCodec *decoder = avcodec_find_decoder(codecpar->codec_id);
if(decoder==nullptr) {
err = "Could not found Video Decoder";
goto free;
}
auto vcCtx = avcodec_alloc_context3(decoder);
avcodec_parameters_to_context(vcCtx, codecpar);
if(avcodec_open2(vcCtx, decoder, nullptr) < 0) {
err = "Could not open Video Codec Ctx";
avcodec_free_context(&vcCtx);
goto free;
}
auto sws_ctx = sws_getContext(vcCtx->width, vcCtx->height, vcCtx->pix_fmt, vcCtx->width, vcCtx->height, AV_PIX_FMT_RGB32, SWS_FAST_BILINEAR, nullptr, nullptr, nullptr);
auto packet = av_packet_alloc();
auto frm = av_frame_alloc();
while(1) {
if(av_read_frame(fmt_ctx, packet) < 0) break;
if(packet->stream_index != vi_idx) continue;
int res = avcodec_send_packet(vcCtx, packet);
if(res < 0) break;
while((res = avcodec_receive_frame(vcCtx, frm)) != AVERROR(EAGAIN)) {
if(res < 0) goto free2;
img = QImage(vcCtx->width, vcCtx->height, QImage::Format_ARGB32);
uint8_t *dst[4]{img.bits()};
int dstStride[4]{img.bytesPerLine()};
sws_scale(sws_ctx, frm->data, frm->linesize, 0, vcCtx->height, dst, dstStride);
goto free2;
}
}
free2:
av_frame_free(&frm);
av_packet_free(&packet);
avcodec_free_context(&vcCtx);
sws_freeContext(sws_ctx);
}
free:
avformat_close_input(&fmt_ctx);
return err;
}
QString videoTrans(int sw, int sh, int dw, int dh, int cnt, QPointF pos, QByteArray file) {
AVFormatContext *in_fmt = avformat_alloc_context(), *out_fmt = 0;
AVCodecContext *de_ctx = 0, *en_ctx = 0;
QString err;
char buf[AV_ERROR_MAX_STRING_SIZE];
int ret;
{
if((ret = avformat_open_input(&in_fmt, file.constData(), nullptr, nullptr)) < 0) {
err = QString("Couldn't open input stream. ")+av_make_error_string(buf, AV_ERROR_MAX_STRING_SIZE, ret);
goto free;
}
if((ret = avformat_find_stream_info(in_fmt, nullptr)) < 0) {
err = QString("Couldn't find stream information. ")+av_make_error_string(buf, AV_ERROR_MAX_STRING_SIZE, ret);
goto free;
}
auto outfile = file+"-square.mp4";
if((ret = avformat_alloc_output_context2(&out_fmt, 0, "mp4", outfile.constData())) < 0) {
err = QString("avformat_alloc_output_context2 fail. ")+av_make_error_string(buf, AV_ERROR_MAX_STRING_SIZE, ret);
goto free;
}
int vi_idx = -1;
for(uint ss=0; ss<in_fmt->nb_streams; ss++) {
AVStream *stream = in_fmt->streams[ss];
AVStream *out_stream = avformat_new_stream(out_fmt, 0);
if((ret = avcodec_parameters_copy(out_stream->codecpar, stream->codecpar)) < 0) {
err = QString("avcodec_parameters_copy fail. ") + av_make_error_string(buf, AV_ERROR_MAX_STRING_SIZE, ret);
goto free;
}
out_stream->time_base = stream->time_base;
out_stream->start_time = stream->start_time;
out_stream->duration = stream->duration;
out_stream->avg_frame_rate = stream->avg_frame_rate;
out_stream->sample_aspect_ratio = {1,1};
if(vi_idx == -1 && stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) vi_idx = ss;
}
if(vi_idx == -1) {
err = "Didn't find a Video Stream";
goto free;
}
auto codecpar = in_fmt->streams[vi_idx]->codecpar;
qDebug()<<"codec_id"<<codecpar->codec_id<<avcodec_get_name(codecpar->codec_id);
auto decoder = avcodec_find_decoder(codecpar->codec_id);
if(decoder==0) {
err = "Could not found Video Decoder";
goto free;
}
de_ctx = avcodec_alloc_context3(decoder);
avcodec_parameters_to_context(de_ctx, codecpar);
if(avcodec_open2(de_ctx, decoder, 0) < 0) {
err = "Could not open Video decode Ctx";
goto free;
}
auto out_codecpar = out_fmt->streams[vi_idx]->codecpar;
out_codecpar->codec_id = AV_CODEC_ID_H264;
out_codecpar->format = AV_PIX_FMT_YUV420P;
out_codecpar->width = dw;
out_codecpar->height = dh;
out_codecpar->sample_aspect_ratio = {1,1};
out_fmt->streams[vi_idx]->sample_aspect_ratio = {1,1};
auto encoder = avcodec_find_encoder(out_codecpar->codec_id);
if(encoder==0) {
fprintf(stderr, "Codec not found\n");
goto free;
}
en_ctx = avcodec_alloc_context3(encoder);
avcodec_parameters_to_context(en_ctx, out_codecpar);
en_ctx->bit_rate = dw*dh*6;
en_ctx->gop_size = de_ctx->gop_size;
en_ctx->max_b_frames = 3;
en_ctx->framerate = de_ctx->framerate;
en_ctx->time_base = out_fmt->streams[vi_idx]->time_base;
if((ret = avcodec_open2(en_ctx, encoder, 0)) < 0) {
err = QString("Open video encode ctx failed. ") + av_make_error_string(buf, AV_ERROR_MAX_STRING_SIZE, ret);
goto free;
}
if(out_fmt->flags & AVFMT_NOFILE) qDebug()<<"AVFMT_NOFILE";
else if((ret = avio_open(&out_fmt->pb, outfile.constData(), AVIO_FLAG_WRITE)) < 0) {
err = QString("avio_open fail. ")+av_make_error_string(buf, AV_ERROR_MAX_STRING_SIZE, ret);
goto free;
}
if((ret = avformat_write_header(out_fmt, 0)) < 0) {
err = QString("avformat_write_header fail. ")+av_make_error_string(buf, AV_ERROR_MAX_STRING_SIZE, ret);
goto free;
}
auto sws_ctx = sws_getContext(de_ctx->width, de_ctx->height, de_ctx->pix_fmt, sw, sh, AV_PIX_FMT_0RGB, SWS_FAST_BILINEAR, 0, 0, 0);
auto out_sws_ctx = sws_getContext(dw, dh, AV_PIX_FMT_0RGB, dw, dh, AV_PIX_FMT_YUV420P, SWS_FAST_BILINEAR, 0, 0, 0);
auto packet = av_packet_alloc();
auto frm = av_frame_alloc();
auto out_frm = av_frame_alloc();
QImage img(sw, sh, QImage::Format_RGB32);
uint8_t *img_data[4]{img.bits(), 0, 0, 0};
int img_linesize[4]{img.bytesPerLine(), 0, 0, 0};
QImage out_img(dw, dh, QImage::Format_RGB32);
uint8_t *out_img_data[4]{out_img.bits(), 0, 0, 0};
int out_img_linesize[4]{out_img.bytesPerLine(), 0, 0, 0};
QPainter painter(&out_img);
while(1) {
if((ret = av_read_frame(in_fmt, packet)) < 0) {
if(ret!=AVERROR_EOF) {
err = QString("Read packet fail: ")+av_make_error_string(buf, AV_ERROR_MAX_STRING_SIZE, ret);
break;
}
ret = avcodec_send_packet(de_ctx, 0);
} else {
if(packet->stream_index != vi_idx) {
av_interleaved_write_frame(out_fmt, packet);
continue;
}
ret = avcodec_send_packet(de_ctx, packet);
}
if(ret < 0) {
err = QString("avcodec_send_packet fail. ")+av_make_error_string(buf, AV_ERROR_MAX_STRING_SIZE, ret);
break;
}
while((ret = avcodec_receive_frame(de_ctx, frm)) != AVERROR(EAGAIN)) {
if(ret < 0) {
if(ret!=AVERROR_EOF) {
err = QString("Receive frame fail: ")+av_make_error_string(buf, AV_ERROR_MAX_STRING_SIZE, ret);
goto free2;
}
ret = avcodec_send_frame(en_ctx, 0);
} else {
sws_scale(sws_ctx, frm->data, frm->linesize, 0, de_ctx->height, img_data, img_linesize);
painter.drawImage(pos, img);
auto apos = pos;
for(int i=1; i<cnt; i++) {
apos.rx() -= dw;
apos.ry() += dh/cnt;
painter.drawImage(apos, img);
}
av_frame_unref(out_frm);
av_frame_copy_props(out_frm, frm);
out_frm->format = AV_PIX_FMT_YUV420P;
out_frm->width = dw;
out_frm->height = dh;
out_frm->sample_aspect_ratio = {1,1};
if((ret = av_frame_get_buffer(out_frm, 0)) < 0) {
err = QString("av_frame_get_buffer fail. ")+av_make_error_string(buf, AV_ERROR_MAX_STRING_SIZE, ret);
goto free2;
}
sws_scale(out_sws_ctx, out_img_data, out_img_linesize, 0, dh, out_frm->data, out_frm->linesize);
ret = avcodec_send_frame(en_ctx, out_frm);
}
if(ret < 0) {
err = QString("avcodec_send_frame fail. ")+av_make_error_string(buf, AV_ERROR_MAX_STRING_SIZE, ret);
goto free2;
}
while((ret = avcodec_receive_packet(en_ctx, packet)) != AVERROR(EAGAIN)) {
if(ret < 0) {
if(ret!=AVERROR_EOF) err = QString("Receive frame fail: ")+av_make_error_string(buf, AV_ERROR_MAX_STRING_SIZE, ret);
else {
av_interleaved_write_frame(out_fmt, 0);
av_write_trailer(out_fmt);
}
goto free2;
} else {
av_interleaved_write_frame(out_fmt, packet);
}
}
}
}
free2:
av_frame_free(&frm);
av_frame_free(&out_frm);
av_packet_free(&packet);
sws_freeContext(sws_ctx);
sws_freeContext(out_sws_ctx);
}
free:
avcodec_free_context(&de_ctx);
avcodec_free_context(&en_ctx);
avformat_close_input(&in_fmt);
avio_closep(&out_fmt->pb);
if(out_fmt) avformat_free_context(out_fmt);
return err;
}
QString audioInfo(QByteArray url, int64_t *dur) {
AVFormatContext *fmt_ctx = avformat_alloc_context();
QString err;
{
if(avformat_open_input(&fmt_ctx, url.constData(), nullptr, nullptr) != 0) {
err = "Couldn't open input stream";
goto free;
}
if(avformat_find_stream_info(fmt_ctx, nullptr) < 0) {
err = "Couldn't find stream information";
goto free;
}
if(dur!=nullptr) *dur = fmt_ctx->duration;
}
free:
avformat_close_input(&fmt_ctx);
return err;
}

13
LedOK/base/ffutil.h Normal file
View File

@ -0,0 +1,13 @@
#ifndef FFUTIL_H
#define FFUTIL_H
#include <QImage>
extern "C"{
#include <libavcodec/avcodec.h>
}
QString videoInfo(QByteArray url, QImage &, int64_t *dur, AVCodecID *);
QString videoTrans(int sw, int sh, int dw, int dh, int cnt, QPointF pos, QByteArray file);
QString audioInfo(QByteArray url, int64_t *dur);
#endif // FFUTIL_H

View File

@ -2,7 +2,7 @@
#define LOEMPTYDIALOG_H #define LOEMPTYDIALOG_H
#include <basedlg.h> #include <basedlg.h>
#include <LoUIClass/customprogressindicator.h> #include <base/customprogressindicator.h>
#include <QLabel> #include <QLabel>
class LoEmptyDialog : public BaseDlg { class LoEmptyDialog : public BaseDlg {

View File

@ -7,25 +7,27 @@
#include <QSettings> #include <QSettings>
SoftConfigDialog::SoftConfigDialog(QWidget *parent) : BaseDlg(parent) { SoftConfigDialog::SoftConfigDialog(QWidget *parent) : BaseDlg(parent) {
setAttribute(Qt::WA_DeleteOnClose);
resize(400, 300); resize(400, 300);
setWindowTitle(tr("Software Configuration")); setWindowTitle(tr("Software Configuration"));
auto vbox = new QVBoxLayout(this); auto vbox = new QVBoxLayout(this);
auto pushButton = new QPushButton("X"); auto pushButton = new QPushButton("X");
pushButton->setFixedSize(30, 24); pushButton->setMinimumSize(30, 24);
connect(pushButton, &QPushButton::clicked, this, &QWidget::close); connect(pushButton, &QPushButton::clicked, this, &QWidget::close);
vbox->addWidget(pushButton, 0, Qt::AlignRight); vbox->addWidget(pushButton, 0, Qt::AlignRight);
press_fd = new QCheckBox(tr("Video compress to")+" 720p"); press_fd = new QCheckBox(tr("Video compress to")+" 720p");
press_fd->setChecked(gVideoCompress);
vbox->addWidget(press_fd); vbox->addWidget(press_fd);
trans_fd = new QCheckBox(tr("Video transcoding to")+" h264"); trans_fd = new QCheckBox(tr("Video transcoding to")+" h264");
trans_fd->setChecked(gVideoTranscoding);
vbox->addWidget(trans_fd); vbox->addWidget(trans_fd);
auto hbox = new QHBoxLayout(); auto hbox = new QHBoxLayout();
hbox->setContentsMargins(-1, 0, -1, -1); hbox->setContentsMargins(-1, 0, -1, -1);
anti_fd = new QCheckBox(tr("Text antialiasing")); anti_fd = new QCheckBox(tr("Text antialiasing"));
anti_fd->setChecked(gTextAntialiasing);
hbox->addWidget(anti_fd, 0, Qt::AlignTop); hbox->addWidget(anti_fd, 0, Qt::AlignTop);
auto anti_tip = new QLabel(tr("TextAntilaTip")); auto anti_tip = new QLabel(tr("TextAntilaTip"));
@ -36,24 +38,21 @@ SoftConfigDialog::SoftConfigDialog(QWidget *parent) : BaseDlg(parent) {
vbox->addLayout(hbox); vbox->addLayout(hbox);
vbox->addWidget(guangying_fd = new QCheckBox(tr("GuangYinPin"))); vbox->addWidget(guangying_fd = new QCheckBox(tr("GuangYinPin")));
guangying_fd->setChecked(gShowLoraScreen);
vbox->addWidget(fdWidthSplit = new QCheckBox(tr("Width Split")));
fdWidthSplit->setChecked(gWidthSplit);
QSettings settings;
press_fd->setChecked(settings.value("VideoCompress", true).toBool());
trans_fd->setChecked(settings.value("VideoTranscoding", true).toBool());
anti_fd->setChecked(settings.value("TextAntialiasing", false).toBool());
guangying_fd->setChecked(settings.value("GuangYingPin", false).toBool());
auto ok_btn = new QPushButton(tr("OK")); auto ok_btn = new QPushButton(tr("OK"));
vbox->addWidget(ok_btn, 0, Qt::AlignCenter); vbox->addWidget(ok_btn, 0, Qt::AlignCenter);
connect(ok_btn, &QPushButton::clicked, this, [this]() { connect(ok_btn, &QPushButton::clicked, this, [this]() {
QSettings settings; QSettings settings;
settings.setValue("VideoCompress", press_fd->isChecked()); settings.setValue("VideoCompress", gVideoCompress = press_fd->isChecked());
settings.setValue("VideoTranscoding", trans_fd->isChecked()); settings.setValue("VideoTranscoding", gVideoTranscoding = trans_fd->isChecked());
gTextAntialiasing = anti_fd->isChecked(); settings.setValue("TextAntialiasing", gTextAntialiasing = anti_fd->isChecked());
settings.setValue("TextAntialiasing", gTextAntialiasing); settings.setValue("GuangYingPin",gShowLoraScreen = guangying_fd->isChecked());
gShowLoraScreen = guangying_fd->isChecked(); settings.setValue("WidthSplit", gWidthSplit = fdWidthSplit->isChecked());
settings.setValue("GuangYingPin",gShowLoraScreen);
accept(); accept();
}); });
} }

View File

@ -9,7 +9,7 @@ class SoftConfigDialog : public BaseDlg {
public: public:
explicit SoftConfigDialog(QWidget *parent = nullptr); explicit SoftConfigDialog(QWidget *parent = nullptr);
QCheckBox *press_fd, *trans_fd, *anti_fd, *guangying_fd; QCheckBox *press_fd, *trans_fd, *anti_fd, *guangying_fd, *fdWidthSplit;
}; };
#endif // SOFTCONFIGDIALOG_H #endif // SOFTCONFIGDIALOG_H

View File

@ -2,7 +2,7 @@
#include <QBoxLayout> #include <QBoxLayout>
#include <QTimerEvent> #include <QTimerEvent>
WaitingDlg::WaitingDlg(QWidget *parent, QString text) : BaseDlg{parent} { WaitingDlg::WaitingDlg(QWidget *parent, QString text, QString sucText) : BaseDlg{parent}, sucText(sucText) {
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
setModal(true); setModal(true);
@ -43,7 +43,7 @@ void WaitingDlg::timerEvent(QTimerEvent *event) {
} else BaseDlg::timerEvent(event); } else BaseDlg::timerEvent(event);
} }
void WaitingDlg::success() { void WaitingDlg::success() {
fdText->setText(tr("Success")); fdText->setText(sucText.isEmpty() ? tr("Success") : sucText);
mIndicator->setBackground(":/res/success.png"); mIndicator->setBackground(":/res/success.png");
mIndicator->stopAnimation(); mIndicator->stopAnimation();
closeTimerId = startTimer(800); closeTimerId = startTimer(800);

View File

@ -2,17 +2,20 @@
#define WAITINGDLG_H #define WAITINGDLG_H
#include "basedlg.h" #include "basedlg.h"
#include "LoUIClass/customprogressindicator.h" #include "base/customprogressindicator.h"
#include <QLabel> #include <QLabel>
class WaitingDlg : public BaseDlg { class WaitingDlg : public BaseDlg {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitingDlg(QWidget *parent = nullptr, QString text = 0); explicit WaitingDlg(QWidget *parent = nullptr, QString text = 0, QString sucText = 0);
void success();
QLabel *fdText; QLabel *fdText;
QString sucText;
CustomProgressIndicator *mIndicator; CustomProgressIndicator *mIndicator;
public slots:
void success();
protected: protected:
void timerEvent(QTimerEvent *) override; void timerEvent(QTimerEvent *) override;
private: private:

View File

@ -8,7 +8,7 @@
#include <wDevicesManager/ctrlbrightpanel.h> #include <wDevicesManager/ctrlbrightpanel.h>
#include <wDevicesManager/controlpowerwidget.h> #include <wDevicesManager/controlpowerwidget.h>
#include <wDevicesManager/controlnetconfigwidget.h> #include <wDevicesManager/controlnetconfigwidget.h>
#include <wDevicesManager/controlverifyclockwidget.h> #include <wDevicesManager/ctrlverifyclockpanel.h>
#include <wDevicesManager/controlhdmiwidget.h> #include <wDevicesManager/controlhdmiwidget.h>
#include <wDevicesManager/controlvolumewidget.h> #include <wDevicesManager/controlvolumewidget.h>
#include <wDevicesManager/controlencryptwidget.h> #include <wDevicesManager/controlencryptwidget.h>
@ -55,7 +55,7 @@ DeviceCtrlPanel::DeviceCtrlPanel(DevicePanel *parent) : QWidget(parent), mDevWgt
if(index==Setting_Bright) wgts[index] = new CtrlBrightPanel(this); if(index==Setting_Bright) wgts[index] = new CtrlBrightPanel(this);
else if(index==Setting_PowerControl) wgts[index] = new ControlPowerWidget(this,m_pLedlist); else if(index==Setting_PowerControl) wgts[index] = new ControlPowerWidget(this,m_pLedlist);
else if(index==Setting_NetCfg) wgts[index] = new ControlNetConfigWidget(this,m_pLedlist); else if(index==Setting_NetCfg) wgts[index] = new ControlNetConfigWidget(this,m_pLedlist);
else if(index==Setting_VerifyClock) wgts[index] = new ControlVerifyClockWidget(this,m_pLedlist); else if(index==Setting_VerifyClock) wgts[index] = new CtrlVerifyClockPanel(this);
else if(index==Setting_Encrypt) wgts[index] = new ControlEncryptWidget(this,m_pLedlist); else if(index==Setting_Encrypt) wgts[index] = new ControlEncryptWidget(this,m_pLedlist);
else if(index==Setting_HDMI) wgts[index] = new ControlHdmiWidget(this,m_pLedlist); else if(index==Setting_HDMI) wgts[index] = new ControlHdmiWidget(this,m_pLedlist);
else if(index==Setting_Volume) wgts[index] = new ControlVolumeWidget(this,m_pLedlist); else if(index==Setting_Volume) wgts[index] = new ControlVolumeWidget(this,m_pLedlist);

View File

@ -1,7 +1,7 @@
#include "deviceitem.h" #include "deviceitem.h"
#include "tools.h" #include "tools.h"
#include "passwordindlg.h" #include "passwordindlg.h"
#include "LoUIClass/x_uimsgboxok.h" #include "base/x_uimsgboxok.h"
#include <QMessageBox> #include <QMessageBox>
#include <QJsonObject> #include <QJsonObject>
#include <QJsonDocument> #include <QJsonDocument>
@ -11,9 +11,9 @@
#include <cfg.h> #include <cfg.h>
#include <QHttpMultiPart> #include <QHttpMultiPart>
#include <QUuid> #include <QUuid>
#include "LoUIClass/updaterdialog.h" #include "base/updaterdialog.h"
#include <QBuffer> #include <QBuffer>
#include "LoUIClass/pixbmpshowdialog.h" #include "base/pixbmpshowdialog.h"
#include <QThread> #include <QThread>
#include <QTcpSocket> #include <QTcpSocket>
#include <QHostAddress> #include <QHostAddress>
@ -396,21 +396,6 @@ void DeviceItem::OnProHttpResponse(QString url, QString postMD5, QByteArray data
setData(DeviceTable_Brightness, 0, QString::number(m_pLedCard->brightness*100/m_pLedCard->BrightnessLevel)+"% ("+bright+")"); setData(DeviceTable_Brightness, 0, QString::number(m_pLedCard->brightness*100/m_pLedCard->BrightnessLevel)+"% ("+bright+")");
emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("GetBrightness")+tr("success")+","+tr("brightness")+"="+bright); emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("GetBrightness")+tr("success")+","+tr("brightness")+"="+bright);
} }
else if(strType == "IsMasterSlave")
{
if(jsonObject["result"].toBool())
{
emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("Lora identity")+":"+tr("Master"));
}
else
{
emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("Lora identity")+":"+tr("Slave"));
}
}
else if(strType == "MasterSlaveSwitch")
{
emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("MasterSlaveSwitch")+":"+tr("success"));
}
else if(strType == "SetBrightness") else if(strType == "SetBrightness")
{ {
emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("SetBrightness")+":"+tr("success")); emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("SetBrightness")+":"+tr("success"));
@ -477,11 +462,6 @@ void DeviceItem::OnProHttpResponse(QString url, QString postMD5, QByteArray data
{ {
emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("SetTimingScreenTask")+":"+tr("success")); emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("SetTimingScreenTask")+":"+tr("success"));
} }
else if(strType == "GetControllerDate")
{
QString strDate=jsonObject["date"].toString();
emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("GetControllerDate")+":"+strDate);
}
else if(strType == "SetHighForBusy") else if(strType == "SetHighForBusy")
{ {
emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("SetHighForBusy")+":"+tr("success")); emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("SetHighForBusy")+":"+tr("success"));
@ -531,23 +511,9 @@ void DeviceItem::OnProHttpResponse(QString url, QString postMD5, QByteArray data
{ {
emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("GetRealtimeServer")+":"+jsonObject["server"].toString()); emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("GetRealtimeServer")+":"+jsonObject["server"].toString());
} }
else if(strType == "SetNtpServer") emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("SetNtpServer")+":"+tr("success"));
else if(strType == "GetNtpServer") emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("GetNtpServer")+":"+jsonObject["ntpServer"].toString());
else if(strType == "SetLanguage") emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-设置语言: "+tr("success"));
else if(strType == "GetLanguage") emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-获取语言: "+(jsonObject["language"].toInt()==1?"中文":"英文"));
else if(strType == "SyncTime")
{
emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("SyncTime")+":"+tr("success"));
}
else if(strType == "DelPrograms") else if(strType == "DelPrograms")
{ {
emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("DelPrograms")+":"+tr("success")); emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("DelPrograms")+":"+tr("success"));
}
else if(strType == "SetingSyncMethod")
{
emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("SetingSyncMethod")+":"+tr("success"));
} }
else if(strType == "GetCurrentSensorBrightness") else if(strType == "GetCurrentSensorBrightness")
{ {
@ -590,44 +556,6 @@ void DeviceItem::OnProHttpResponse(QString url, QString postMD5, QByteArray data
else if(strType == "GetMaxBrightness") else if(strType == "GetMaxBrightness")
{ {
emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("GetMaxBrightness")+":"+QString::number(jsonObject["brightness"].toInt())); emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("GetMaxBrightness")+":"+QString::number(jsonObject["brightness"].toInt()));
}
else if(strType == "GetingSyncMethod") {
QString strOtherSyncItem = tr("screenSwitch") + ":" + (jsonObject["screenSwitch"].toBool() ? tr("YES") : tr("NO"))
+ " " + tr("volume") + ":" + (jsonObject["volume"].toBool() ? tr("YES") : tr("NO"))
+ " " + tr("brightness") + ":" + (jsonObject["brightness"].toBool() ? tr("YES") : tr("NO"));
QString lastSynchronousTime = QDateTime::fromMSecsSinceEpoch(jsonObject["lastSynchronousTime"].toDouble()).toString("yyyy-MM-dd HH:mm:ss");
QString time = jsonObject["time"].toString();
QString lower = time.toLower();
if(lower=="serial") {
QString strOut = m_pLedCard->m_strCardId+": "+tr("receive")+"<-"+tr("GetingSyncMethod")+": Lora\r\n "
+tr("identificationCode")+": "+jsonObject["identificationCode"].toString()+"\r\n "
+tr("delaySync")+": "+QString::number(jsonObject["delaySync"].toInt())+tr("msec")+"\r\n "
+tr("OtherSyncItem")+": "+strOtherSyncItem+"\r\n "
+tr("lastSynchronousTime")+": "+lastSynchronousTime;
emit sigOutputInfo(strOut);
} else if(lower=="ntp") {
QString strOut = m_pLedCard->m_strCardId+": "+tr("receive")+"<-"+tr("GetingSyncMethod")+": "+time+"\r\n "
+tr("checkNtpTime")+": "+QString::number(jsonObject["checkNtpTime"].toInt())+"\r\n "
+tr("OtherSyncItem")+": "+strOtherSyncItem+"\r\n "
+tr("lastSynchronousTime")+": "+lastSynchronousTime;
emit sigOutputInfo(strOut);
} else if(lower=="gps") {
QString strOut=m_pLedCard->m_strCardId+": "+tr("receive")+"<-"+tr("GetingSyncMethod")+": "+time+"\r\n "
+tr("OtherSyncItem")+": "+strOtherSyncItem+"\r\n "
+tr("lastSynchronousTime")+": "+lastSynchronousTime;
emit sigOutputInfo(strOut);
} else if(lower=="lan") {
QString strOut=m_pLedCard->m_strCardId+": "+tr("receive")+"<-"+tr("GetingSyncMethod")+": "+tr("LAN")+"\r\n "
+tr("identificationCode")+": "+jsonObject["identificationCode"].toString()+"\r\n "
+tr("delaySync")+": "+QString::number(jsonObject["delaySync"].toInt())+tr("msec")+"\r\n "
+tr("OtherSyncItem")+": "+strOtherSyncItem+"\r\n "
+tr("lastSynchronousTime")+": "+lastSynchronousTime;
emit sigOutputInfo(strOut);
} else {
QString strOut = m_pLedCard->m_strCardId+": "+tr("receive")+"<-"+tr("GetingSyncMethod")+": "+time+"\r\n "+data;
emit sigOutputInfo(strOut);
}
} else if(strType == "GetScreenshotFull") { } else if(strType == "GetScreenshotFull") {
MACRO_ASKTIME_STOP MACRO_ASKTIME_STOP
MACRO_POSTING_DLG_UNLOCK MACRO_POSTING_DLG_UNLOCK
@ -644,7 +572,6 @@ void DeviceItem::OnProHttpResponse(QString url, QString postMD5, QByteArray data
dlg->m_PixMap.loadFromData(Ret_bytearray); dlg->m_PixMap.loadFromData(Ret_bytearray);
dlg->ResizeByPixmap(m_pLedCard->m_iWidth,m_pLedCard->m_iHeight); dlg->ResizeByPixmap(m_pLedCard->m_iWidth,m_pLedCard->m_iHeight);
dlg->exec(); dlg->exec();
emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("GetingSyncMethod")+":"+tr("success"));
} }
} else {//失败应答,打印失败和错误信息 } else {//失败应答,打印失败和错误信息
if(strType == "UpgradeSoftware") { if(strType == "UpgradeSoftware") {

View File

@ -11,7 +11,7 @@
#include <communication/hpptclient.h> #include <communication/hpptclient.h>
#include <QLabel> #include <QLabel>
#include <QMap> #include <QMap>
#include <LoUIClass/loemptydialog.h> #include <base/loemptydialog.h>
enum DeviceTableField { enum DeviceTableField {
DeviceTable_Check = 0, DeviceTable_Check = 0,

View File

@ -1,165 +1,674 @@
GNU LESSER GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007 Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.
Preamble
This version of the GNU Lesser General Public License incorporates The GNU General Public License is a free, copyleft license for
the terms and conditions of version 3 of the GNU General Public software and other kinds of works.
License, supplemented by the additional permissions listed below.
0. Additional Definitions. The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
As used herein, "this License" refers to version 3 of the GNU Lesser When we speak of free software, we are referring to freedom, not
General Public License, and the "GNU GPL" refers to version 3 of the GNU price. Our General Public Licenses are designed to make sure that you
General Public License. have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
"The Library" refers to a covered work governed by this License, To protect your rights, we need to prevent others from denying you
other than an Application or a Combined Work as defined below. these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
An "Application" is any work that makes use of an interface provided For example, if you distribute copies of such a program, whether
by the Library, but which is not otherwise based on the Library. gratis or for a fee, you must pass on to the recipients the same
Defining a subclass of a class defined by the Library is deemed a mode freedoms that you received. You must make sure that they, too, receive
of using an interface provided by the Library. or can get the source code. And you must show them these terms so they
know their rights.
A "Combined Work" is a work produced by combining or linking an Developers that use the GNU GPL protect your rights with two steps:
Application with the Library. The particular version of the Library (1) assert copyright on the software, and (2) offer you this License
with which the Combined Work was made is also called the "Linked giving you legal permission to copy, distribute and/or modify it.
Version".
The "Minimal Corresponding Source" for a Combined Work means the For the developers' and authors' protection, the GPL clearly explains
Corresponding Source for the Combined Work, excluding any source code that there is no warranty for this free software. For both users' and
for portions of the Combined Work that, considered in isolation, are authors' sake, the GPL requires that modified versions be marked as
based on the Application, and not on the Linked Version. changed, so that their problems will not be attributed erroneously to
authors of previous versions.
The "Corresponding Application Code" for a Combined Work means the Some devices are designed to deny users access to install or run
object code and/or source code for the Application, including any data modified versions of the software inside them, although the manufacturer
and utility programs needed for reproducing the Combined Work from the can do so. This is fundamentally incompatible with the aim of
Application, but excluding the System Libraries of the Combined Work. protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
1. Exception to Section 3 of the GNU GPL. Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
You may convey a covered work under sections 3 and 4 of this License The precise terms and conditions for copying, distribution and
without being bound by section 3 of the GNU GPL. modification follow.
2. Conveying Modified Versions. TERMS AND CONDITIONS
If you modify a copy of the Library, and, in your modifications, a 0. Definitions.
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to "This License" refers to version 3 of the GNU General Public License.
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of "Copyright" also means copyright-like laws that apply to other kinds of
this License applicable to that copy. works, such as semiconductor masks.
3. Object Code Incorporating Material from Library Header Files. "The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
The object code form of an Application may incorporate material from To "modify" a work means to copy from or adapt all or part of the work
a header file that is part of the Library. You may convey such object in a fashion requiring copyright permission, other than the making of an
code under terms of your choice, provided that, if the incorporated exact copy. The resulting work is called a "modified version" of the
material is not limited to numerical parameters, data structure earlier work or a work "based on" the earlier work.
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the A "covered work" means either the unmodified Program or a work based
Library is used in it and that the Library and its use are on the Program.
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license To "propagate" a work means to do anything with it that, without
document. permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
4. Combined Works. To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
You may convey a Combined Work under terms of your choice that, An interactive user interface displays "Appropriate Legal Notices"
taken together, effectively do not restrict modification of the to the extent that it includes a convenient and prominently visible
portions of the Library contained in the Combined Work and reverse feature that (1) displays an appropriate copyright notice, and (2)
engineering for debugging such modifications, if you also do each of tells the user that there is no warranty for the work (except to the
the following: extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
a) Give prominent notice with each copy of the Combined Work that 1. Source Code.
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license The "source code" for a work means the preferred form of the work
document. for making modifications to it. "Object code" means any non-source
form of a work.
c) For a Combined Work that displays copyright notices during A "Standard Interface" means an interface that either is an official
execution, include the copyright notice for the Library among standard defined by a recognized standards body, or, in the case of
these notices, as well as a reference directing the user to the interfaces specified for a particular programming language, one that
copies of the GNU GPL and this license document. is widely used among developers working in that language.
d) Do one of the following: The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
0) Convey the Minimal Corresponding Source under the terms of this The "Corresponding Source" for a work in object code form means all
License, and the Corresponding Application Code in a form the source code needed to generate, install, and (for an executable
suitable for, and under terms that permit, the user to work) run the object code and to modify the work, including scripts to
recombine or relink the Application with a modified version of control those activities. However, it does not include the work's
the Linked Version to produce a modified Combined Work, in the System Libraries, or general-purpose tools or generally available free
manner specified by section 6 of the GNU GPL for conveying programs which are used unmodified in performing those activities but
Corresponding Source. which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
1) Use a suitable shared library mechanism for linking with the The Corresponding Source need not include anything that users
Library. A suitable mechanism is one that (a) uses at run time can regenerate automatically from other parts of the Corresponding
a copy of the Library already present on the user's computer Source.
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise The Corresponding Source for a work in source code form is that
be required to provide such information under section 6 of the same work.
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries. 2. Basic Permissions.
You may place library facilities that are a work based on the All rights granted under this License are granted for the term of
Library side by side in a single library together with other library copyright on the Program, and are irrevocable provided the stated
facilities that are not Applications and are not covered by this conditions are met. This License explicitly affirms your unlimited
License, and convey such a combined library under terms of your permission to run the unmodified Program. The output from running a
choice, if you do both of the following: covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
a) Accompany the combined library with a copy of the same work based You may make, run and propagate covered works that you do not
on the Library, uncombined with any other library facilities, convey, without conditions so long as your license otherwise remains
conveyed under the terms of this License. in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
b) Give prominent notice with the combined library that part of it Conveying under any other circumstances is permitted solely under
is a work based on the Library, and explaining where to find the the conditions stated below. Sublicensing is not allowed; section 10
accompanying uncombined form of the same work. makes it unnecessary.
6. Revised Versions of the GNU Lesser General Public License. 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
The Free Software Foundation may publish revised and/or new versions No covered work shall be deemed part of an effective technological
of the GNU Lesser General Public License from time to time. Such new measure under any applicable law fulfilling obligations under article
versions will be similar in spirit to the present version, but may 11 of the WIPO copyright treaty adopted on 20 December 1996, or
differ in detail to address new problems or concerns. similar laws prohibiting or restricting circumvention of such
measures.
Each version is given a distinguishing version number. If the When you convey a covered work, you waive any legal power to forbid
Library as you received it specifies that a certain numbered version circumvention of technological measures to the extent such circumvention
of the GNU Lesser General Public License "or any later version" is effected by exercising rights under this License with respect to
applies to it, you have the option of following the terms and the covered work, and you disclaim any intention to limit operation or
conditions either of that published version or of any later version modification of the work as a means of enforcing, against the work's
published by the Free Software Foundation. If the Library as you users, your or third parties' legal rights to forbid circumvention of
received it does not specify a version number of the GNU Lesser technological measures.
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide 4. Conveying Verbatim Copies.
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is You may convey verbatim copies of the Program's source code as you
permanent authorization for you to choose that version for the receive it, in any medium, provided that you conspicuously and
Library. appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -231,16 +231,6 @@ typedef struct RcOverride{
* decoded frame in stream. * decoded frame in stream.
*/ */
#define AV_CODEC_FLAG_DROPCHANGED (1 << 5) #define AV_CODEC_FLAG_DROPCHANGED (1 << 5)
/**
* Request the encoder to output reconstructed frames, i.e. frames that would be
* produced by decoding the encoded bistream. These frames may be retrieved by
* calling avcodec_receive_frame() immediately after a successful call to
* avcodec_receive_packet().
*
* Should only be used with encoders flagged with the
* AV_CODEC_CAP_ENCODER_RECON_FRAME capability.
*/
#define AV_CODEC_FLAG_RECON_FRAME (1 << 6)
/** /**
* Use internal 2pass ratecontrol in first pass mode. * Use internal 2pass ratecontrol in first pass mode.
*/ */
@ -341,12 +331,13 @@ typedef struct RcOverride{
* Do not reset ASS ReadOrder field on flush (subtitles decoding) * Do not reset ASS ReadOrder field on flush (subtitles decoding)
*/ */
#define AV_CODEC_FLAG2_RO_FLUSH_NOOP (1 << 30) #define AV_CODEC_FLAG2_RO_FLUSH_NOOP (1 << 30)
/**
* Generate/parse ICC profiles on encode/decode, as appropriate for the type of /* Unsupported options :
* file. No effect on codecs which cannot contain embedded ICC profiles, or * Syntax Arithmetic coding (SAC)
* when compiled without support for lcms2. * Reference Picture Selection
*/ * Independent Segment Decoding */
#define AV_CODEC_FLAG2_ICC_PROFILES (1U << 31) /* /Fx */
/* codec capabilities */
/* Exported side data. /* Exported side data.
These flags can be passed in AVCodecContext.export_side_data before initialization. These flags can be passed in AVCodecContext.export_side_data before initialization.
@ -1388,26 +1379,13 @@ typedef struct AVCodecContext {
const struct AVHWAccel *hwaccel; const struct AVHWAccel *hwaccel;
/** /**
* Legacy hardware accelerator context. * Hardware accelerator context.
* * For some hardware accelerators, a global context needs to be
* For some hardware acceleration methods, the caller may use this field to * provided by the user. In that case, this holds display-dependent
* signal hwaccel-specific data to the codec. The struct pointed to by this * data FFmpeg cannot instantiate itself. Please refer to the
* pointer is hwaccel-dependent and defined in the respective header. Please * FFmpeg HW accelerator documentation to know how to fill this.
* refer to the FFmpeg HW accelerator documentation to know how to fill * - encoding: unused
* this. * - decoding: Set by user
*
* In most cases this field is optional - the necessary information may also
* be provided to libavcodec through @ref hw_frames_ctx or @ref
* hw_device_ctx (see avcodec_get_hw_config()). However, in some cases it
* may be the only method of signalling some (optional) information.
*
* The struct and its contents are owned by the caller.
*
* - encoding: May be set by the caller before avcodec_open2(). Must remain
* valid until avcodec_free_context().
* - decoding: May be set by the caller in the get_format() callback.
* Must remain valid until the next get_format() call,
* or avcodec_free_context() (whichever comes first).
*/ */
void *hwaccel_context; void *hwaccel_context;
@ -2617,23 +2595,21 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt); int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt);
/** /**
* Return decoded output data from a decoder or encoder (when the * Return decoded output data from a decoder.
* AV_CODEC_FLAG_RECON_FRAME flag is used).
* *
* @param avctx codec context * @param avctx codec context
* @param frame This will be set to a reference-counted video or audio * @param frame This will be set to a reference-counted video or audio
* frame (depending on the decoder type) allocated by the * frame (depending on the decoder type) allocated by the
* codec. Note that the function will always call * decoder. Note that the function will always call
* av_frame_unref(frame) before doing anything else. * av_frame_unref(frame) before doing anything else.
* *
* @return * @return
* 0: success, a frame was returned * 0: success, a frame was returned
* AVERROR(EAGAIN): output is not available in this state - user must try * AVERROR(EAGAIN): output is not available in this state - user must try
* to send new input * to send new input
* AVERROR_EOF: the codec has been fully flushed, and there will be * AVERROR_EOF: the decoder has been fully flushed, and there will be
* no more output frames * no more output frames
* AVERROR(EINVAL): codec not opened, or it is an encoder without * AVERROR(EINVAL): codec not opened, or it is an encoder
* the AV_CODEC_FLAG_RECON_FRAME flag enabled
* AVERROR_INPUT_CHANGED: current decoded frame has changed parameters * AVERROR_INPUT_CHANGED: current decoded frame has changed parameters
* with respect to first decoded frame. Applicable * with respect to first decoded frame. Applicable
* when flag AV_CODEC_FLAG_DROPCHANGED is set. * when flag AV_CODEC_FLAG_DROPCHANGED is set.

View File

@ -182,14 +182,6 @@
*/ */
#define AV_CODEC_CAP_ENCODER_FLUSH (1 << 21) #define AV_CODEC_CAP_ENCODER_FLUSH (1 << 21)
/**
* The encoder is able to output reconstructed frame data, i.e. raw frames that
* would be produced by decoding the encoded bitstream.
*
* Reconstructed frame output is enabled by the AV_CODEC_FLAG_RECON_FRAME flag.
*/
#define AV_CODEC_CAP_ENCODER_RECON_FRAME (1 << 22)
/** /**
* AVProfile. * AVProfile.
*/ */

View File

@ -24,8 +24,6 @@
#include "libavutil/avutil.h" #include "libavutil/avutil.h"
#include "libavutil/samplefmt.h" #include "libavutil/samplefmt.h"
#include "version_major.h"
/** /**
* @addtogroup lavc_core * @addtogroup lavc_core
* @{ * @{
@ -253,9 +251,7 @@ enum AVCodecID {
AV_CODEC_ID_AVRP, AV_CODEC_ID_AVRP,
AV_CODEC_ID_012V, AV_CODEC_ID_012V,
AV_CODEC_ID_AVUI, AV_CODEC_ID_AVUI,
#if FF_API_AYUV_CODECID
AV_CODEC_ID_AYUV, AV_CODEC_ID_AYUV,
#endif
AV_CODEC_ID_TARGA_Y216, AV_CODEC_ID_TARGA_Y216,
AV_CODEC_ID_V308, AV_CODEC_ID_V308,
AV_CODEC_ID_V408, AV_CODEC_ID_V408,
@ -316,8 +312,6 @@ enum AVCodecID {
AV_CODEC_ID_JPEGXL, AV_CODEC_ID_JPEGXL,
AV_CODEC_ID_QOI, AV_CODEC_ID_QOI,
AV_CODEC_ID_PHM, AV_CODEC_ID_PHM,
AV_CODEC_ID_RADIANCE_HDR,
AV_CODEC_ID_WBMP,
/* various PCM "codecs" */ /* various PCM "codecs" */
AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
@ -527,7 +521,6 @@ enum AVCodecID {
AV_CODEC_ID_FASTAUDIO, AV_CODEC_ID_FASTAUDIO,
AV_CODEC_ID_MSNSIREN, AV_CODEC_ID_MSNSIREN,
AV_CODEC_ID_DFPWM, AV_CODEC_ID_DFPWM,
AV_CODEC_ID_BONK,
/* subtitle codecs */ /* subtitle codecs */
AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.

View File

@ -21,7 +21,7 @@
#ifndef AVCODEC_QSV_H #ifndef AVCODEC_QSV_H
#define AVCODEC_QSV_H #define AVCODEC_QSV_H
#include <mfxvideo.h> #include <mfx/mfxvideo.h>
#include "libavutil/buffer.h" #include "libavutil/buffer.h"
@ -61,8 +61,6 @@ typedef struct AVQSVContext {
* required by the encoder and the user-provided value nb_opaque_surfaces. * required by the encoder and the user-provided value nb_opaque_surfaces.
* The array of the opaque surfaces will be exported to the caller through * The array of the opaque surfaces will be exported to the caller through
* the opaque_surfaces field. * the opaque_surfaces field.
*
* The caller must set this field to zero for oneVPL (MFX_VERSION >= 2.0)
*/ */
int opaque_alloc; int opaque_alloc;

View File

@ -29,7 +29,7 @@
#include "version_major.h" #include "version_major.h"
#define LIBAVCODEC_VERSION_MINOR 43 #define LIBAVCODEC_VERSION_MINOR 37
#define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

View File

@ -50,6 +50,5 @@
#define FF_API_SUB_TEXT_FORMAT (LIBAVCODEC_VERSION_MAJOR < 60) #define FF_API_SUB_TEXT_FORMAT (LIBAVCODEC_VERSION_MAJOR < 60)
#define FF_API_IDCT_NONE (LIBAVCODEC_VERSION_MAJOR < 60) #define FF_API_IDCT_NONE (LIBAVCODEC_VERSION_MAJOR < 60)
#define FF_API_SVTAV1_OPTS (LIBAVCODEC_VERSION_MAJOR < 60) #define FF_API_SVTAV1_OPTS (LIBAVCODEC_VERSION_MAJOR < 60)
#define FF_API_AYUV_CODECID (LIBAVCODEC_VERSION_MAJOR < 60)
#endif /* AVCODEC_VERSION_MAJOR_H */ #endif /* AVCODEC_VERSION_MAJOR_H */

View File

@ -29,8 +29,8 @@
#include "version_major.h" #include "version_major.h"
#define LIBAVDEVICE_VERSION_MINOR 8 #define LIBAVDEVICE_VERSION_MINOR 7
#define LIBAVDEVICE_VERSION_MICRO 101 #define LIBAVDEVICE_VERSION_MICRO 100
#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \ #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
LIBAVDEVICE_VERSION_MINOR, \ LIBAVDEVICE_VERSION_MINOR, \

View File

@ -31,7 +31,7 @@
#include "version_major.h" #include "version_major.h"
#define LIBAVFILTER_VERSION_MINOR 48 #define LIBAVFILTER_VERSION_MINOR 44
#define LIBAVFILTER_VERSION_MICRO 100 #define LIBAVFILTER_VERSION_MICRO 100

View File

@ -1121,15 +1121,12 @@ typedef struct AVStream {
struct AVCodecParserContext *av_stream_get_parser(const AVStream *s); struct AVCodecParserContext *av_stream_get_parser(const AVStream *s);
#if FF_API_GET_END_PTS
/** /**
* Returns the pts of the last muxed packet + its duration * Returns the pts of the last muxed packet + its duration
* *
* the retuned value is undefined when used with a demuxer. * the retuned value is undefined when used with a demuxer.
*/ */
attribute_deprecated
int64_t av_stream_get_end_pts(const AVStream *st); int64_t av_stream_get_end_pts(const AVStream *st);
#endif
#define AV_PROGRAM_RUNNING 1 #define AV_PROGRAM_RUNNING 1

View File

@ -31,7 +31,7 @@
#include "version_major.h" #include "version_major.h"
#define LIBAVFORMAT_VERSION_MINOR 31 #define LIBAVFORMAT_VERSION_MINOR 27
#define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \

View File

@ -46,7 +46,6 @@
#define FF_API_AVIOCONTEXT_WRITTEN (LIBAVFORMAT_VERSION_MAJOR < 60) #define FF_API_AVIOCONTEXT_WRITTEN (LIBAVFORMAT_VERSION_MAJOR < 60)
#define FF_HLS_TS_OPTIONS (LIBAVFORMAT_VERSION_MAJOR < 60) #define FF_HLS_TS_OPTIONS (LIBAVFORMAT_VERSION_MAJOR < 60)
#define FF_API_AVSTREAM_CLASS (LIBAVFORMAT_VERSION_MAJOR > 59) #define FF_API_AVSTREAM_CLASS (LIBAVFORMAT_VERSION_MAJOR > 59)
#define FF_API_GET_END_PTS (LIBAVFORMAT_VERSION_MAJOR < 60)
#define FF_API_R_FRAME_RATE 1 #define FF_API_R_FRAME_RATE 1

View File

@ -1,5 +1,5 @@
/* Automatically generated by version.sh, do not manually edit! */ /* Automatically generated by version.sh, do not manually edit! */
#ifndef AVUTIL_FFVERSION_H #ifndef AVUTIL_FFVERSION_H
#define AVUTIL_FFVERSION_H #define AVUTIL_FFVERSION_H
#define FFMPEG_VERSION "N-108116-g50a4dff69f-20220913" #define FFMPEG_VERSION "n5.1.2-4-gf5455889fd-20221023"
#endif /* AVUTIL_FFVERSION_H */ #endif /* AVUTIL_FFVERSION_H */

View File

@ -18,8 +18,7 @@
/** /**
* @file * @file
* @ingroup lavu_fifo * a very simple circular buffer FIFO implementation
* A generic FIFO API
*/ */
#ifndef AVUTIL_FIFO_H #ifndef AVUTIL_FIFO_H
@ -31,14 +30,6 @@
#include "attributes.h" #include "attributes.h"
#include "version.h" #include "version.h"
/**
* @defgroup lavu_fifo AVFifo
* @ingroup lavu_data
*
* @{
* A generic FIFO API
*/
typedef struct AVFifo AVFifo; typedef struct AVFifo AVFifo;
/** /**
@ -97,13 +88,7 @@ void av_fifo_auto_grow_limit(AVFifo *f, size_t max_elems);
size_t av_fifo_can_read(const AVFifo *f); size_t av_fifo_can_read(const AVFifo *f);
/** /**
* @return Number of elements that can be written into the given FIFO without * @return number of elements that can be written into the given FIFO.
* growing it.
*
* In other words, this number of elements or less is guaranteed to fit
* into the FIFO. More data may be written when the
* AV_FIFO_FLAG_AUTO_GROW flag was specified at FIFO creation, but this
* may involve memory allocation, which can fail.
*/ */
size_t av_fifo_can_write(const AVFifo *f); size_t av_fifo_can_write(const AVFifo *f);
@ -124,12 +109,9 @@ int av_fifo_grow2(AVFifo *f, size_t inc);
/** /**
* Write data into a FIFO. * Write data into a FIFO.
* *
* In case nb_elems > av_fifo_can_write(f) and the AV_FIFO_FLAG_AUTO_GROW flag * In case nb_elems > av_fifo_can_write(f), nothing is written and an error
* was not specified at FIFO creation, nothing is written and an error
* is returned. * is returned.
* *
* Calling function is guaranteed to succeed if nb_elems <= av_fifo_can_write(f).
*
* @param f the FIFO buffer * @param f the FIFO buffer
* @param buf Data to be written. nb_elems * av_fifo_elem_size(f) bytes will be * @param buf Data to be written. nb_elems * av_fifo_elem_size(f) bytes will be
* read from buf on success. * read from buf on success.
@ -441,8 +423,4 @@ static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs)
#endif #endif
#endif #endif
/**
* @}
*/
#endif /* AVUTIL_FIFO_H */ #endif /* AVUTIL_FIFO_H */

View File

@ -22,7 +22,6 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include "version.h"
#include "attributes.h" #include "attributes.h"
/** /**
@ -56,7 +55,6 @@ int av_file_map(const char *filename, uint8_t **bufptr, size_t *size,
*/ */
void av_file_unmap(uint8_t *bufptr, size_t size); void av_file_unmap(uint8_t *bufptr, size_t size);
#if FF_API_AV_FOPEN_UTF8
/** /**
* Wrapper to work around the lack of mkstemp() on mingw. * Wrapper to work around the lack of mkstemp() on mingw.
* Also, tries to create file in /tmp first, if possible. * Also, tries to create file in /tmp first, if possible.
@ -69,8 +67,6 @@ void av_file_unmap(uint8_t *bufptr, size_t size);
* libraries and could interfere with the calling application. * libraries and could interfere with the calling application.
* @deprecated as fd numbers cannot be passed saftely between libs on some platforms * @deprecated as fd numbers cannot be passed saftely between libs on some platforms
*/ */
attribute_deprecated
int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx); int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx);
#endif
#endif /* AVUTIL_FILE_H */ #endif /* AVUTIL_FILE_H */

View File

@ -604,18 +604,13 @@ typedef struct AVFrame {
*/ */
int64_t pkt_pos; int64_t pkt_pos;
#if FF_API_PKT_DURATION
/** /**
* duration of the corresponding packet, expressed in * duration of the corresponding packet, expressed in
* AVStream->time_base units, 0 if unknown. * AVStream->time_base units, 0 if unknown.
* - encoding: unused * - encoding: unused
* - decoding: Read by user. * - decoding: Read by user.
*
* @deprecated use duration instead
*/ */
attribute_deprecated
int64_t pkt_duration; int64_t pkt_duration;
#endif
/** /**
* metadata. * metadata.
@ -707,11 +702,6 @@ typedef struct AVFrame {
* Channel layout of the audio data. * Channel layout of the audio data.
*/ */
AVChannelLayout ch_layout; AVChannelLayout ch_layout;
/**
* Duration of the frame, in the same units as pts. 0 if unknown.
*/
int64_t duration;
} AVFrame; } AVFrame;
@ -828,8 +818,7 @@ int av_frame_is_writable(AVFrame *frame);
* Ensure that the frame data is writable, avoiding data copy if possible. * Ensure that the frame data is writable, avoiding data copy if possible.
* *
* Do nothing if the frame is writable, allocate new buffers and copy the data * Do nothing if the frame is writable, allocate new buffers and copy the data
* if it is not. Non-refcounted frames behave as non-writable, i.e. a copy * if it is not.
* is always made.
* *
* @return 0 on success, a negative AVERROR on error. * @return 0 on success, a negative AVERROR on error.
* *

View File

@ -19,7 +19,7 @@
#ifndef AVUTIL_HWCONTEXT_QSV_H #ifndef AVUTIL_HWCONTEXT_QSV_H
#define AVUTIL_HWCONTEXT_QSV_H #define AVUTIL_HWCONTEXT_QSV_H
#include <mfxvideo.h> #include <mfx/mfxvideo.h>
/** /**
* @file * @file
@ -34,17 +34,6 @@
*/ */
typedef struct AVQSVDeviceContext { typedef struct AVQSVDeviceContext {
mfxSession session; mfxSession session;
/**
* The mfxLoader handle used for mfxSession creation
*
* This field is only available for oneVPL user. For non-oneVPL user, this
* field must be set to NULL.
*
* Filled by the user before calling av_hwdevice_ctx_init() and should be
* cast to mfxLoader handle. Deallocating the AVHWDeviceContext will always
* release this interface.
*/
void *loader;
} AVQSVDeviceContext; } AVQSVDeviceContext;
/** /**

View File

@ -23,7 +23,6 @@
#include <VideoToolbox/VideoToolbox.h> #include <VideoToolbox/VideoToolbox.h>
#include "frame.h"
#include "pixfmt.h" #include "pixfmt.h"
/** /**

View File

@ -367,25 +367,6 @@ enum AVPixelFormat {
AV_PIX_FMT_P416BE, ///< interleaved chroma YUV 4:4:4, 48bpp, big-endian AV_PIX_FMT_P416BE, ///< interleaved chroma YUV 4:4:4, 48bpp, big-endian
AV_PIX_FMT_P416LE, ///< interleaved chroma YUV 4:4:4, 48bpp, little-endian AV_PIX_FMT_P416LE, ///< interleaved chroma YUV 4:4:4, 48bpp, little-endian
AV_PIX_FMT_VUYA, ///< packed VUYA 4:4:4, 32bpp, VUYAVUYA...
AV_PIX_FMT_RGBAF16BE, ///< IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., big-endian
AV_PIX_FMT_RGBAF16LE, ///< IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., little-endian
AV_PIX_FMT_VUYX, ///< packed VUYX 4:4:4, 32bpp, Variant of VUYA where alpha channel is left undefined
AV_PIX_FMT_P012LE, ///< like NV12, with 12bpp per component, data in the high bits, zeros in the low bits, little-endian
AV_PIX_FMT_P012BE, ///< like NV12, with 12bpp per component, data in the high bits, zeros in the low bits, big-endian
AV_PIX_FMT_Y212BE, ///< packed YUV 4:2:2 like YUYV422, 24bpp, data in the high bits, zeros in the low bits, big-endian
AV_PIX_FMT_Y212LE, ///< packed YUV 4:2:2 like YUYV422, 24bpp, data in the high bits, zeros in the low bits, little-endian
AV_PIX_FMT_XV30BE, ///< packed XVYU 4:4:4, 32bpp, (msb)2X 10V 10Y 10U(lsb), big-endian, variant of Y410 where alpha channel is left undefined
AV_PIX_FMT_XV30LE, ///< packed XVYU 4:4:4, 32bpp, (msb)2X 10V 10Y 10U(lsb), little-endian, variant of Y410 where alpha channel is left undefined
AV_PIX_FMT_XV36BE, ///< packed XVYU 4:4:4, 48bpp, data in the high bits, zeros in the low bits, big-endian, variant of Y412 where alpha channel is left undefined
AV_PIX_FMT_XV36LE, ///< packed XVYU 4:4:4, 48bpp, data in the high bits, zeros in the low bits, little-endian, variant of Y412 where alpha channel is left undefined
AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
}; };
@ -472,13 +453,9 @@ enum AVPixelFormat {
#define AV_PIX_FMT_NV20 AV_PIX_FMT_NE(NV20BE, NV20LE) #define AV_PIX_FMT_NV20 AV_PIX_FMT_NE(NV20BE, NV20LE)
#define AV_PIX_FMT_AYUV64 AV_PIX_FMT_NE(AYUV64BE, AYUV64LE) #define AV_PIX_FMT_AYUV64 AV_PIX_FMT_NE(AYUV64BE, AYUV64LE)
#define AV_PIX_FMT_P010 AV_PIX_FMT_NE(P010BE, P010LE) #define AV_PIX_FMT_P010 AV_PIX_FMT_NE(P010BE, P010LE)
#define AV_PIX_FMT_P012 AV_PIX_FMT_NE(P012BE, P012LE)
#define AV_PIX_FMT_P016 AV_PIX_FMT_NE(P016BE, P016LE) #define AV_PIX_FMT_P016 AV_PIX_FMT_NE(P016BE, P016LE)
#define AV_PIX_FMT_Y210 AV_PIX_FMT_NE(Y210BE, Y210LE) #define AV_PIX_FMT_Y210 AV_PIX_FMT_NE(Y210BE, Y210LE)
#define AV_PIX_FMT_Y212 AV_PIX_FMT_NE(Y212BE, Y212LE)
#define AV_PIX_FMT_XV30 AV_PIX_FMT_NE(XV30BE, XV30LE)
#define AV_PIX_FMT_XV36 AV_PIX_FMT_NE(XV36BE, XV36LE)
#define AV_PIX_FMT_X2RGB10 AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE) #define AV_PIX_FMT_X2RGB10 AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE)
#define AV_PIX_FMT_X2BGR10 AV_PIX_FMT_NE(X2BGR10BE, X2BGR10LE) #define AV_PIX_FMT_X2BGR10 AV_PIX_FMT_NE(X2BGR10BE, X2BGR10LE)
@ -487,8 +464,6 @@ enum AVPixelFormat {
#define AV_PIX_FMT_P216 AV_PIX_FMT_NE(P216BE, P216LE) #define AV_PIX_FMT_P216 AV_PIX_FMT_NE(P216BE, P216LE)
#define AV_PIX_FMT_P416 AV_PIX_FMT_NE(P416BE, P416LE) #define AV_PIX_FMT_P416 AV_PIX_FMT_NE(P416BE, P416LE)
#define AV_PIX_FMT_RGBAF16 AV_PIX_FMT_NE(RGBAF16BE, RGBAF16LE)
/** /**
* Chromaticity coordinates of the source primaries. * Chromaticity coordinates of the source primaries.
* These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.1 and ITU-T H.273. * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.1 and ITU-T H.273.

View File

@ -79,8 +79,8 @@
*/ */
#define LIBAVUTIL_VERSION_MAJOR 57 #define LIBAVUTIL_VERSION_MAJOR 57
#define LIBAVUTIL_VERSION_MINOR 36 #define LIBAVUTIL_VERSION_MINOR 28
#define LIBAVUTIL_VERSION_MICRO 101 #define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \ LIBAVUTIL_VERSION_MINOR, \
@ -114,7 +114,6 @@
#define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 58) #define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 58)
#define FF_API_OLD_CHANNEL_LAYOUT (LIBAVUTIL_VERSION_MAJOR < 58) #define FF_API_OLD_CHANNEL_LAYOUT (LIBAVUTIL_VERSION_MAJOR < 58)
#define FF_API_AV_FOPEN_UTF8 (LIBAVUTIL_VERSION_MAJOR < 58) #define FF_API_AV_FOPEN_UTF8 (LIBAVUTIL_VERSION_MAJOR < 58)
#define FF_API_PKT_DURATION (LIBAVUTIL_VERSION_MAJOR < 58)
/** /**
* @} * @}

View File

@ -0,0 +1,107 @@
/*
* Copyright (C) 2001-2003 Michael Niedermayer (michaelni@gmx.at)
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef POSTPROC_POSTPROCESS_H
#define POSTPROC_POSTPROCESS_H
/**
* @file
* @ingroup lpp
* external API header
*/
/**
* @defgroup lpp libpostproc
* Video postprocessing library.
*
* @{
*/
#include "libpostproc/version_major.h"
#ifndef HAVE_AV_CONFIG_H
/* When included as part of the ffmpeg build, only include the major version
* to avoid unnecessary rebuilds. When included externally, keep including
* the full version information. */
#include "libpostproc/version.h"
#endif
/**
* Return the LIBPOSTPROC_VERSION_INT constant.
*/
unsigned postproc_version(void);
/**
* Return the libpostproc build-time configuration.
*/
const char *postproc_configuration(void);
/**
* Return the libpostproc license.
*/
const char *postproc_license(void);
#define PP_QUALITY_MAX 6
#include <inttypes.h>
typedef void pp_context;
typedef void pp_mode;
extern const char pp_help[]; ///< a simple help text
void pp_postprocess(const uint8_t * src[3], const int srcStride[3],
uint8_t * dst[3], const int dstStride[3],
int horizontalSize, int verticalSize,
const int8_t *QP_store, int QP_stride,
pp_mode *mode, pp_context *ppContext, int pict_type);
/**
* Return a pp_mode or NULL if an error occurred.
*
* @param name the string after "-pp" on the command line
* @param quality a number from 0 to PP_QUALITY_MAX
*/
pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality);
void pp_free_mode(pp_mode *mode);
pp_context *pp_get_context(int width, int height, int flags);
void pp_free_context(pp_context *ppContext);
#define PP_CPU_CAPS_MMX 0x80000000
#define PP_CPU_CAPS_MMX2 0x20000000
#define PP_CPU_CAPS_3DNOW 0x40000000
#define PP_CPU_CAPS_ALTIVEC 0x10000000
#define PP_CPU_CAPS_AUTO 0x00080000
#define PP_FORMAT 0x00000008
#define PP_FORMAT_420 (0x00000011|PP_FORMAT)
#define PP_FORMAT_422 (0x00000001|PP_FORMAT)
#define PP_FORMAT_411 (0x00000002|PP_FORMAT)
#define PP_FORMAT_444 (0x00000000|PP_FORMAT)
#define PP_FORMAT_440 (0x00000010|PP_FORMAT)
#define PP_PICT_TYPE_QP2 0x00000010 ///< MPEG2 style QScale
/**
* @}
*/
#endif /* POSTPROC_POSTPROCESS_H */

View File

@ -0,0 +1,46 @@
/*
* Version macros.
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef POSTPROC_VERSION_H
#define POSTPROC_VERSION_H
/**
* @file
* Libpostproc version macros
*/
#include "libavutil/version.h"
#include "version_major.h"
#define LIBPOSTPROC_VERSION_MINOR 6
#define LIBPOSTPROC_VERSION_MICRO 100
#define LIBPOSTPROC_VERSION_INT AV_VERSION_INT(LIBPOSTPROC_VERSION_MAJOR, \
LIBPOSTPROC_VERSION_MINOR, \
LIBPOSTPROC_VERSION_MICRO)
#define LIBPOSTPROC_VERSION AV_VERSION(LIBPOSTPROC_VERSION_MAJOR, \
LIBPOSTPROC_VERSION_MINOR, \
LIBPOSTPROC_VERSION_MICRO)
#define LIBPOSTPROC_BUILD LIBPOSTPROC_VERSION_INT
#define LIBPOSTPROC_IDENT "postproc" AV_STRINGIFY(LIBPOSTPROC_VERSION)
#endif /* POSTPROC_VERSION_H */

View File

@ -0,0 +1,31 @@
/*
* Version macros.
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef POSTPROC_VERSION_MAJOR_H
#define POSTPROC_VERSION_MAJOR_H
/**
* @file
* Libpostproc version macros
*/
#define LIBPOSTPROC_VERSION_MAJOR 56
#endif /* POSTPROC_VERSION_MAJOR_H */

View File

@ -286,8 +286,8 @@ struct SwrContext *swr_alloc_set_opts(struct SwrContext *s,
* On error, the Swr context is freed and *ps set to NULL. * On error, the Swr context is freed and *ps set to NULL.
*/ */
int swr_alloc_set_opts2(struct SwrContext **ps, int swr_alloc_set_opts2(struct SwrContext **ps,
const AVChannelLayout *out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate, AVChannelLayout *out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate,
const AVChannelLayout *in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate, AVChannelLayout *in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate,
int log_offset, void *log_ctx); int log_offset, void *log_ctx);
/** /**
* @} * @}

View File

@ -30,7 +30,7 @@
#include "version_major.h" #include "version_major.h"
#define LIBSWRESAMPLE_VERSION_MINOR 9 #define LIBSWRESAMPLE_VERSION_MINOR 7
#define LIBSWRESAMPLE_VERSION_MICRO 100 #define LIBSWRESAMPLE_VERSION_MICRO 100
#define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \ #define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \

View File

@ -28,8 +28,8 @@
#include "version_major.h" #include "version_major.h"
#define LIBSWSCALE_VERSION_MINOR 8 #define LIBSWSCALE_VERSION_MINOR 7
#define LIBSWSCALE_VERSION_MICRO 112 #define LIBSWSCALE_VERSION_MICRO 100
#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
LIBSWSCALE_VERSION_MINOR, \ LIBSWSCALE_VERSION_MINOR, \

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -5,9 +5,9 @@ includedir=${prefix}/include
Name: libavcodec Name: libavcodec
Description: FFmpeg codec library Description: FFmpeg codec library
Version: 59.43.100 Version: 59.37.100
Requires: Requires:
Requires.private: libswresample >= 4.9.100, libavutil >= 57.36.101 Requires.private: libswresample >= 4.7.100, libavutil >= 57.28.100
Conflicts: Conflicts:
Libs: -L${libdir} -lavcodec Libs: -L${libdir} -lavcodec
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@ -5,9 +5,9 @@ includedir=${prefix}/include
Name: libavdevice Name: libavdevice
Description: FFmpeg device handling library Description: FFmpeg device handling library
Version: 59.8.101 Version: 59.7.100
Requires: Requires:
Requires.private: libavfilter >= 8.48.100, libswscale >= 6.8.112, libavformat >= 59.31.100, libavcodec >= 59.43.100, libswresample >= 4.9.100, libavutil >= 57.36.101 Requires.private: libavfilter >= 8.44.100, libswscale >= 6.7.100, libpostproc >= 56.6.100, libavformat >= 59.27.100, libavcodec >= 59.37.100, libswresample >= 4.7.100, libavutil >= 57.28.100
Conflicts: Conflicts:
Libs: -L${libdir} -lavdevice Libs: -L${libdir} -lavdevice
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@ -5,9 +5,9 @@ includedir=${prefix}/include
Name: libavfilter Name: libavfilter
Description: FFmpeg audio/video filtering library Description: FFmpeg audio/video filtering library
Version: 8.48.100 Version: 8.44.100
Requires: Requires:
Requires.private: libswscale >= 6.8.112, libavformat >= 59.31.100, libavcodec >= 59.43.100, libswresample >= 4.9.100, libavutil >= 57.36.101 Requires.private: libswscale >= 6.7.100, libpostproc >= 56.6.100, libavformat >= 59.27.100, libavcodec >= 59.37.100, libswresample >= 4.7.100, libavutil >= 57.28.100
Conflicts: Conflicts:
Libs: -L${libdir} -lavfilter Libs: -L${libdir} -lavfilter
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@ -5,9 +5,9 @@ includedir=${prefix}/include
Name: libavformat Name: libavformat
Description: FFmpeg container format library Description: FFmpeg container format library
Version: 59.31.100 Version: 59.27.100
Requires: Requires:
Requires.private: libavcodec >= 59.43.100, libswresample >= 4.9.100, libavutil >= 57.36.101 Requires.private: libavcodec >= 59.37.100, libswresample >= 4.7.100, libavutil >= 57.28.100
Conflicts: Conflicts:
Libs: -L${libdir} -lavformat Libs: -L${libdir} -lavformat
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@ -5,7 +5,7 @@ includedir=${prefix}/include
Name: libavutil Name: libavutil
Description: FFmpeg utility library Description: FFmpeg utility library
Version: 57.36.101 Version: 57.28.100
Requires: Requires:
Requires.private: Requires.private:
Conflicts: Conflicts:

View File

@ -0,0 +1,13 @@
prefix=${pcfiledir}/../..
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include
Name: libpostproc
Description: FFmpeg postprocessing library
Version: 56.6.100
Requires:
Requires.private: libavutil >= 57.28.100
Conflicts:
Libs: -L${libdir} -lpostproc
Cflags: -I${includedir}

View File

@ -5,9 +5,9 @@ includedir=${prefix}/include
Name: libswresample Name: libswresample
Description: FFmpeg audio resampling library Description: FFmpeg audio resampling library
Version: 4.9.100 Version: 4.7.100
Requires: Requires:
Requires.private: libavutil >= 57.36.101 Requires.private: libavutil >= 57.28.100
Conflicts: Conflicts:
Libs: -L${libdir} -lswresample Libs: -L${libdir} -lswresample
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@ -5,9 +5,9 @@ includedir=${prefix}/include
Name: libswscale Name: libswscale
Description: FFmpeg image rescaling library Description: FFmpeg image rescaling library
Version: 6.8.112 Version: 6.7.100
Requires: Requires:
Requires.private: libavutil >= 57.36.101 Requires.private: libavutil >= 57.28.100
Conflicts: Conflicts:
Libs: -L${libdir} -lswscale Libs: -L${libdir} -lswscale
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@ -0,0 +1,11 @@
EXPORTS
postproc_configuration
postproc_ffversion
postproc_license
postproc_version
pp_free_context
pp_free_mode
pp_get_context
pp_get_mode_by_name_and_quality
pp_help
pp_postprocess

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -10,7 +10,6 @@
using namespace std; using namespace std;
AVFmt::AVFmt(QByteArray url) { AVFmt::AVFmt(QByteArray url) {
qInfo()<<"Path"<<url.constData();
fmt_ctx = avformat_alloc_context(); fmt_ctx = avformat_alloc_context();
int res = avformat_open_input(&fmt_ctx, url.constData(), nullptr, nullptr); int res = avformat_open_input(&fmt_ctx, url.constData(), nullptr, nullptr);
if(res < 0) { if(res < 0) {
@ -29,8 +28,8 @@ AVFmt::AVFmt(QByteArray url) {
if(vi.idx == -1) qWarning()<<"Didn't find a Video Stream"; if(vi.idx == -1) qWarning()<<"Didn't find a Video Stream";
else { else {
auto viStream = fmt_ctx->streams[vi.idx]; auto viStream = fmt_ctx->streams[vi.idx];
const AVCodec *decoder = avcodec_find_decoder(viStream->codecpar->codec_id); auto decoder = avcodec_find_decoder(viStream->codecpar->codec_id);
if(decoder==nullptr) { if(decoder==0) {
vi.idx = -1; vi.idx = -1;
qInfo()<<"Couldn't found Video Decoder"; qInfo()<<"Couldn't found Video Decoder";
} else { } else {
@ -41,8 +40,7 @@ AVFmt::AVFmt(QByteArray url) {
vi.idx = -1; vi.idx = -1;
qInfo()<<"Couldn't open Video Codec Ctx"; qInfo()<<"Couldn't open Video Codec Ctx";
} else { } else {
sws_ctx = sws_getContext(vi.ctx->width, vi.ctx->height, vi.ctx->pix_fmt, vi.ctx->width, vi.ctx->height, AV_PIX_FMT_RGB24, SWS_FAST_BILINEAR, nullptr, nullptr, nullptr); sws_ctx = sws_getContext(vi.ctx->width, vi.ctx->height, vi.ctx->pix_fmt, vi.ctx->width, vi.ctx->height, AV_PIX_FMT_RGB32, SWS_FAST_BILINEAR, 0, 0, 0);
qInfo()<<vi.ctx->width<<"x"<<vi.ctx->height<<vi.ctx->framerate.num<<"/"<<vi.ctx->framerate.den<<"color_primaries"<<vi.ctx->color_primaries<<"colorspace"<<vi.ctx->colorspace;
if(vi.ctx->color_primaries==AVCOL_PRI_BT2020) { if(vi.ctx->color_primaries==AVCOL_PRI_BT2020) {
res = sws_setColorspaceDetails(sws_ctx, sws_getCoefficients(SWS_CS_BT2020), 0, sws_getCoefficients(SWS_CS_DEFAULT), 0, -0x2200, 0x1c000, 0x18000); //0x12800, 0x40000 res = sws_setColorspaceDetails(sws_ctx, sws_getCoefficients(SWS_CS_BT2020), 0, sws_getCoefficients(SWS_CS_DEFAULT), 0, -0x2200, 0x1c000, 0x18000); //0x12800, 0x40000
qInfo()<<"sws_setColorspaceDetails"<<res; qInfo()<<"sws_setColorspaceDetails"<<res;
@ -139,9 +137,12 @@ AVFmt::AVFmt(QByteArray url) {
au.idx = -1; au.idx = -1;
qWarning()<<"Couldn't open aCodecCtx"; qWarning()<<"Couldn't open aCodecCtx";
} else { } else {
swr_ctx = swr_alloc_set_opts(nullptr, out_ch_layout.order = AV_CHANNEL_ORDER_NATIVE;
AV_CH_LAYOUT_STEREO, packed_sample_fmt, audioFmt.sampleRate(), out_ch_layout.nb_channels = 2;
au.ctx->channel_layout, au.ctx->sample_fmt, au.ctx->sample_rate, 0, nullptr); out_ch_layout.u.mask = AV_CH_LAYOUT_STEREO;
swr_alloc_set_opts2(&swr_ctx,
&out_ch_layout, packed_sample_fmt, audioFmt.sampleRate(),
&au.ctx->ch_layout, au.ctx->sample_fmt, au.ctx->sample_rate, 0, nullptr);
if(swr_init(swr_ctx) < 0) { if(swr_init(swr_ctx) < 0) {
au.idx = -1; au.idx = -1;
qCritical()<<"Couldn't init swrCtx"; qCritical()<<"Couldn't init swrCtx";
@ -201,14 +202,14 @@ void AVFmt::mainRead() {
if(au.idx!=-1) { if(au.idx!=-1) {
unique_lock<mutex> lock(au.pkts.mtx); unique_lock<mutex> lock(au.pkts.mtx);
au.pkts.delAll(); au.pkts.delAll();
au.pkts.add(new Packet{nullptr, nullptr, 'R'}); au.pkts.add(new Packet{0, 0, 'R'});
lock.unlock(); lock.unlock();
au.pkts.cv.notify_all(); au.pkts.cv.notify_all();
} }
if(vi.idx!=-1) { if(vi.idx!=-1) {
unique_lock<mutex> lock(vi.pkts.mtx); unique_lock<mutex> lock(vi.pkts.mtx);
vi.pkts.delAll(); vi.pkts.delAll();
vi.pkts.add(new Packet{nullptr, nullptr, 'R'}); vi.pkts.add(new Packet{0, 0, 'R'});
lock.unlock(); lock.unlock();
vi.pkts.cv.notify_all(); vi.pkts.cv.notify_all();
} }
@ -217,14 +218,14 @@ void AVFmt::mainRead() {
if(au.idx!=-1) { if(au.idx!=-1) {
unique_lock<mutex> lock(au.pkts.mtx); unique_lock<mutex> lock(au.pkts.mtx);
au.pkts.delAll(); au.pkts.delAll();
au.pkts.add(new Packet{nullptr, nullptr, 'Q'}); au.pkts.add(new Packet{0, 0, 'Q'});
lock.unlock(); lock.unlock();
au.pkts.cv.notify_all(); au.pkts.cv.notify_all();
} }
if(vi.idx!=-1) { if(vi.idx!=-1) {
unique_lock<mutex> lock(vi.pkts.mtx); unique_lock<mutex> lock(vi.pkts.mtx);
vi.pkts.delAll(); vi.pkts.delAll();
vi.pkts.add(new Packet{nullptr, nullptr, 'Q'}); vi.pkts.add(new Packet{0, 0, 'Q'});
lock.unlock(); lock.unlock();
vi.pkts.cv.notify_all(); vi.pkts.cv.notify_all();
} }
@ -238,8 +239,8 @@ void AVFmt::mainRead() {
if(vi.pkts.size > 120 || au.pkts.size > 200) {wait = 100; continue;} if(vi.pkts.size > 120 || au.pkts.size > 200) {wait = 100; continue;}
res = av_read_frame(fmt_ctx, packet); res = av_read_frame(fmt_ctx, packet);
if(res < 0) { if(res < 0) {
if(au.idx > -1) au.pkts.lockAddNtf(new Packet{nullptr, nullptr, 0}); if(au.idx > -1) au.pkts.lockAddNtf(new Packet{0, 0, 0});
if(vi.idx > -1) vi.pkts.lockAddNtf(new Packet{nullptr, nullptr, 0}); if(vi.idx > -1) vi.pkts.lockAddNtf(new Packet{0, 0, 0});
if(res!=AVERROR_EOF) { if(res!=AVERROR_EOF) {
qCritical()<<"Read Packet fail:"<<errStr(res); qCritical()<<"Read Packet fail:"<<errStr(res);
wait = 500; continue; wait = 500; continue;
@ -248,7 +249,6 @@ void AVFmt::mainRead() {
qInfo()<<"Read Packet End"; qInfo()<<"Read Packet End";
wait = 500; continue; wait = 500; continue;
} }
av_packet_unref(packet);
int res_seek = av_seek_frame(fmt_ctx, -1, 0, AVSEEK_FLAG_BACKWARD); int res_seek = av_seek_frame(fmt_ctx, -1, 0, AVSEEK_FLAG_BACKWARD);
if(res_seek < 0) { if(res_seek < 0) {
qCritical()<<"Seek Packet fail:"<<errStr(res_seek); qCritical()<<"Seek Packet fail:"<<errStr(res_seek);
@ -261,10 +261,10 @@ void AVFmt::mainRead() {
} }
} }
if(packet->stream_index == vi.idx) { if(packet->stream_index == vi.idx) {
vi.pkts.lockAddNtf(new Packet{packet, nullptr, 0}); vi.pkts.lockAddNtf(new Packet{packet, 0, 0});
packet = av_packet_alloc(); packet = av_packet_alloc();
} else if(packet->stream_index == au.idx) { } else if(packet->stream_index == au.idx) {
au.pkts.lockAddNtf(new Packet{packet, nullptr, 0}); au.pkts.lockAddNtf(new Packet{packet, 0, 0});
packet = av_packet_alloc(); packet = av_packet_alloc();
} }
wait = 0; wait = 0;
@ -272,15 +272,16 @@ void AVFmt::mainRead() {
} }
void AVFmt::mainViDecode() { void AVFmt::mainViDecode() {
while(true) { while(true) {
if(vi_frms.size >= 9) { if(vi_frms.size >= 7) {
unique_lock<mutex> lock(vi.pkts.mtx); unique_lock<mutex> lock(vi.pkts.mtx);
if(vi.pkts.first!=nullptr && vi.pkts.first->act=='Q') return; if(vi.pkts.first && vi.pkts.first->act=='Q') return;
vi.pkts.cv.wait_for(lock, chrono::milliseconds(20)); vi.pkts.cv.wait_for(lock, chrono::milliseconds(20));
continue; continue;
} }
auto pkt = vi.pkts.take(); auto pkt = vi.pkts.take();
if(pkt->act=='R') { if(pkt->act=='R') {
avcodec_flush_buffers(vi.ctx); avcodec_flush_buffers(vi.ctx);
vi.deLoop = 0;
vi.stop = false; vi.stop = false;
} else if(pkt->act=='Q') { } else if(pkt->act=='Q') {
delete pkt; delete pkt;
@ -292,7 +293,7 @@ void AVFmt::mainViDecode() {
while((res = avcodec_receive_frame(vi.ctx, vi.frm)) != AVERROR(EAGAIN)) { while((res = avcodec_receive_frame(vi.ctx, vi.frm)) != AVERROR(EAGAIN)) {
if(res == AVERROR_EOF) break; if(res == AVERROR_EOF) break;
else if(res < 0) {qCritical()<<"Video receive frame fail:"<<errStr(res); break;} else if(res < 0) {qCritical()<<"Video receive frame fail:"<<errStr(res); break;}
QImage img(vi.ctx->width, vi.ctx->height, QImage::Format_RGB888); QImage img(vi.ctx->width, vi.ctx->height, QImage::Format_ARGB32);
uint8_t *dst[4]{img.bits()}; uint8_t *dst[4]{img.bits()};
int dstStride[4]{(int)img.bytesPerLine()}; int dstStride[4]{(int)img.bytesPerLine()};
sws_scale(sws_ctx, vi.frm->data, vi.frm->linesize, 0, vi.ctx->height, dst, dstStride); sws_scale(sws_ctx, vi.frm->data, vi.frm->linesize, 0, vi.ctx->height, dst, dstStride);
@ -300,10 +301,10 @@ void AVFmt::mainViDecode() {
lock_guard<mutex> lock(vi_frms.mtx); lock_guard<mutex> lock(vi_frms.mtx);
if(vi.stop) goto end; if(vi.stop) goto end;
viLmt = (vi.frm->best_effort_timestamp + vi.frm->pkt_duration) * vi.time_num / vi.time_den; viLmt = (vi.frm->best_effort_timestamp + vi.frm->pkt_duration) * vi.time_num / vi.time_den;
vi_frms.add(new Img{img, vi.frm->best_effort_timestamp * vi.time_num / vi.time_den, viLmt, vi.deLoop, nullptr}); vi_frms.add(new Img{img, vi.frm->best_effort_timestamp * vi.time_num / vi.time_den, viLmt, vi.deLoop, 0});
} }
} }
if(pkt->pkt==nullptr) { if(pkt->pkt==0) {
avcodec_flush_buffers(vi.ctx); avcodec_flush_buffers(vi.ctx);
vi.deLoop++; vi.deLoop++;
} }
@ -316,13 +317,14 @@ void AVFmt::mainAuDecode() {
while(true) { while(true) {
if(au_frms.size >= 9) { if(au_frms.size >= 9) {
unique_lock<mutex> lock(au.pkts.mtx); unique_lock<mutex> lock(au.pkts.mtx);
if(au.pkts.first!=nullptr && au.pkts.first->act=='Q') return; if(au.pkts.first && au.pkts.first->act=='Q') return;
au.pkts.cv.wait_for(lock, chrono::milliseconds(20)); au.pkts.cv.wait_for(lock, chrono::milliseconds(20));
continue; continue;
} }
auto pkt = au.pkts.take(); auto pkt = au.pkts.take();
if(pkt->act=='R') { if(pkt->act=='R') {
avcodec_flush_buffers(au.ctx); avcodec_flush_buffers(au.ctx);
au.deLoop = 0;
au.stop = false; au.stop = false;
} else if(pkt->act=='Q') { } else if(pkt->act=='Q') {
delete pkt; delete pkt;
@ -348,10 +350,10 @@ void AVFmt::mainAuDecode() {
delete [] pcm; delete [] pcm;
goto end; goto end;
} }
au_frms.add(new Pcm{pcm, samp_cnt * pcm_sample_size, au.frm->best_effort_timestamp * au.time_num / au.time_den, (au.frm->best_effort_timestamp + au.frm->pkt_duration) * au.time_num / au.time_den, au.deLoop, nullptr}); au_frms.add(new Pcm{pcm, samp_cnt * pcm_sample_size, au.frm->best_effort_timestamp * au.time_num / au.time_den, (au.frm->best_effort_timestamp + au.frm->pkt_duration) * au.time_num / au.time_den, au.deLoop, 0});
} }
} }
if(pkt->pkt==nullptr) { if(pkt->pkt==0) {
avcodec_flush_buffers(au.ctx); avcodec_flush_buffers(au.ctx);
au.deLoop++; au.deLoop++;
} }
@ -369,7 +371,7 @@ void AVFmt::checkAndUpd(FFPlayer *player, qint64 now_epoch) {
if(au.isNull()) { if(au.isNull()) {
player->hasImg = false; player->hasImg = false;
auto viFrm = vi_frms.lockGet(); auto viFrm = vi_frms.lockGet();
if(viFrm==nullptr) return; if(viFrm==0) return;
if(start_epoch==0) { if(start_epoch==0) {
if(vi.start > viFrm->st) { if(vi.start > viFrm->st) {
vi.start = viFrm->st; vi.start = viFrm->st;
@ -380,14 +382,14 @@ void AVFmt::checkAndUpd(FFPlayer *player, qint64 now_epoch) {
} }
qint64 cur = now_epoch - start_epoch; qint64 cur = now_epoch - start_epoch;
checkFrm: checkFrm:
if(viFrm->loop!=curLoop) { if(viFrm->loop!=playLoop) {
curLoop = viFrm->loop; playLoop = viFrm->loop;
start_epoch = now_epoch - start + 12500; start_epoch = now_epoch - start + 12500;
qInfo()<<"Restart"; qInfo()<<"Restart";
return; return;
} }
if(viFrm->et < cur - 8334) { if(viFrm->et < cur - 8334) {
if(viFrm->next!=nullptr) { if(viFrm->next) {
qWarning() << "Drop video frame. st-cur" << (viFrm->st - cur)/1000 << "st" << viFrm->st/1000 << "cur" << cur/1000 << "Video Only"; qWarning() << "Drop video frame. st-cur" << (viFrm->st - cur)/1000 << "st" << viFrm->st/1000 << "cur" << cur/1000 << "Video Only";
viFrm = vi_frms.lockDelGetNext(); viFrm = vi_frms.lockDelGetNext();
goto checkFrm; goto checkFrm;
@ -407,38 +409,38 @@ void AVFmt::checkAndUpd(FFPlayer *player, qint64 now_epoch) {
auto auFrm = au_frms.lockGet(); auto auFrm = au_frms.lockGet();
auto viFrm = vi_frms.lockGet(); auto viFrm = vi_frms.lockGet();
if(start_epoch==0) { if(start_epoch==0) {
if(viFrm==nullptr) { if(viFrm==0) {
if(vi.start < start+500000) return; if(vi.start < start+500000) return;
} else if(vi.start > viFrm->st) { } else if(vi.start > viFrm->st) {
vi.start = viFrm->st; vi.start = viFrm->st;
if(start > viFrm->st) start = viFrm->st; if(start > viFrm->st) start = viFrm->st;
} }
if(auFrm==nullptr) { if(auFrm==0) {
if(au.start < start+500000) return; if(au.start < start+500000) return;
} else if(au.start > auFrm->st) { } else if(au.start > auFrm->st) {
au.start = auFrm->st; au.start = auFrm->st;
if(start > auFrm->st) start = auFrm->st; if(start > auFrm->st) start = auFrm->st;
} }
start_epoch = now_epoch - (start - 12500); start_epoch = now_epoch - (start - 12500);
playAudio(auFrm, player, now_epoch, vi.deLoop!=curLoop || vi.pkts.first==nullptr ? INT64_MAX : viLmt); playAudio(auFrm, player, now_epoch, vi.pkts.lockGet()==0 ? INT64_MAX : viLmt);
return; return;
} }
if(viFrm==nullptr) { if(viFrm==0) {
if(vi.deLoop!=curLoop || vi.pkts.lockGet()==nullptr) playAudio(auFrm, player, now_epoch); if(vi.pkts.lockGet()==0) playAudio(auFrm, player, now_epoch);
return; return;
} }
if(viFrm->loop!=curLoop) { if(viFrm->loop!=playLoop) {
playAudio(auFrm, player, now_epoch); playAudio(auFrm, player, now_epoch);
return; return;
} }
qint64 cur = now_epoch - start_epoch; qint64 cur = now_epoch - start_epoch;
if(auFrm!=nullptr && auFrm->st < cur && auFrm->loop==curLoop) { if(auFrm && auFrm->st < cur && auFrm->loop==playLoop) {
qInfo() << "Audio Adjust Start. st-cur" << (auFrm->st - cur)/1000 << "st" << auFrm->st/1000 << "cur" << cur/1000; qInfo() << "Audio Adjust Start. st-cur" << (auFrm->st - cur)/1000 << "st" << auFrm->st/1000 << "cur" << cur/1000;
cur = auFrm->st; cur = auFrm->st;
start_epoch = now_epoch - cur; start_epoch = now_epoch - cur;
} }
qint64 curPre = cur - 8334; qint64 curPre = cur - 8334;
while(viFrm->et < curPre && viFrm->next!=nullptr && viFrm->next->loop==curLoop) { while(viFrm->et < curPre && viFrm->next && viFrm->next->loop==playLoop) {
qWarning() << "Drop video frame. st-cur" << (viFrm->st - cur)/1000 << "st" << viFrm->st/1000 << "cur" << cur/1000; qWarning() << "Drop video frame. st-cur" << (viFrm->st - cur)/1000 << "st" << viFrm->st/1000 << "cur" << cur/1000;
viFrm = vi_frms.lockDelGetNext(); viFrm = vi_frms.lockDelGetNext();
} }
@ -451,7 +453,7 @@ void AVFmt::checkAndUpd(FFPlayer *player, qint64 now_epoch) {
start_epoch = now_epoch - cur; start_epoch = now_epoch - cur;
} else qInfo() << "Video et < cur. st-cur" << (viFrm->st - cur)/1000 << "st" << viFrm->st/1000 << "cur" << cur/1000; } else qInfo() << "Video et < cur. st-cur" << (viFrm->st - cur)/1000 << "st" << viFrm->st/1000 << "cur" << cur/1000;
} }
if(auFrm!=nullptr && bytesFree >= auFrm->size && auFrm->loop==curLoop) whiteAudio(auFrm, player, isIdle, cur, vi.deLoop!=curLoop || vi.pkts.lockGet()==nullptr ? INT64_MAX : viLmt); if(auFrm && bytesFree >= auFrm->size && auFrm->loop==playLoop) whiteAudio(auFrm, player, isIdle, cur, vi.deLoop!=playLoop || vi.pkts.lockGet()==0 ? INT64_MAX : viLmt);
if(viFrm->st > cur) return; if(viFrm->st > cur) return;
player->img = viFrm->img; player->img = viFrm->img;
player->hasImg = true; player->hasImg = true;
@ -459,7 +461,7 @@ void AVFmt::checkAndUpd(FFPlayer *player, qint64 now_epoch) {
delete vi_frms.lockPoll(); delete vi_frms.lockPoll();
} }
void AVFmt::playAudio(Pcm *auFrm, FFPlayer *player, qint64 now_epoch, qint64 lmt) { void AVFmt::playAudio(Pcm *auFrm, FFPlayer *player, qint64 now_epoch, qint64 lmt) {
if(auFrm==nullptr) return; if(auFrm==0) return;
auto bytesFree = sink->bytesFree(); auto bytesFree = sink->bytesFree();
if(bytesFree < auFrm->size) return; if(bytesFree < auFrm->size) return;
bool isIdle = bytesFree==buf_size || sink->state()==QAudio::IdleState; bool isIdle = bytesFree==buf_size || sink->state()==QAudio::IdleState;
@ -471,9 +473,9 @@ void AVFmt::playAudio(Pcm *auFrm, FFPlayer *player, qint64 now_epoch, qint64 lmt
} }
cur = start - 12500; cur = start - 12500;
start_epoch = now_epoch - cur; start_epoch = now_epoch - cur;
} else if(auFrm->loop!=curLoop) { } else if(auFrm->loop!=playLoop) {
if(! isIdle) return; if(! isIdle) return;
curLoop = auFrm->loop; playLoop = auFrm->loop;
cur = start - 12500; cur = start - 12500;
start_epoch = now_epoch - cur; start_epoch = now_epoch - cur;
qInfo()<<"Restart"; qInfo()<<"Restart";
@ -502,7 +504,7 @@ void AVFmt::whiteAudio(Pcm *auFrm, FFPlayer *player, bool isIdle, qint64 cur, qi
sinkWriter->write((char*)auFrm->data, auFrm->size); sinkWriter->write((char*)auFrm->data, auFrm->size);
player->auCurTime = auFrm->st; player->auCurTime = auFrm->st;
auFrm = au_frms.lockDelGetNext(); auFrm = au_frms.lockDelGetNext();
} while(auFrm!=nullptr && auFrm->data!=nullptr && sink->bytesFree() >= auFrm->size && auFrm->st < lmt); } while(auFrm && auFrm->data && sink->bytesFree() >= auFrm->size && auFrm->st < lmt);
} }
FFPlayer::FFPlayer() { FFPlayer::FFPlayer() {
@ -514,6 +516,7 @@ FFPlayer::FFPlayer() {
connect(this, &FFPlayer::emOpen, this, &FFPlayer::onOpen); connect(this, &FFPlayer::emOpen, this, &FFPlayer::onOpen);
connect(this, &FFPlayer::emClose, this, &FFPlayer::onClose); connect(this, &FFPlayer::emClose, this, &FFPlayer::onClose);
connect(this, &FFPlayer::emPlay, this, &FFPlayer::onPlay); connect(this, &FFPlayer::emPlay, this, &FFPlayer::onPlay);
connect(this, &FFPlayer::emPause, this, &FFPlayer::onPause);
connect(this, &FFPlayer::emStop, this, &FFPlayer::onStop); connect(this, &FFPlayer::emStop, this, &FFPlayer::onStop);
connect(this, &FFPlayer::emVol, this, &FFPlayer::onVol); connect(this, &FFPlayer::emVol, this, &FFPlayer::onVol);
thread->start(); thread->start();
@ -529,13 +532,13 @@ void FFPlayer::onQuit() {
void FFPlayer::onOpen(QByteArray url) { void FFPlayer::onOpen(QByteArray url) {
onClose(); onClose();
ctx = new AVFmt(url); ctx = new AVFmt(url);
if(mVol!=1.0 && ctx->sink!=nullptr) ctx->sink->setVolume(mVol); if(mVol!=1.0 && ctx->sink) ctx->sink->setVolume(mVol);
if(ctx->err.isEmpty()) status = Paused; if(ctx->err.isEmpty()) status = Paused;
else { else {
qCritical()<<ctx->err; qCritical()<<ctx->err;
emit emError(ctx->err); emit emError(ctx->err);
delete ctx; delete ctx;
ctx = nullptr; ctx = 0;
} }
} }
void FFPlayer::onClose() { void FFPlayer::onClose() {
@ -544,28 +547,34 @@ void FFPlayer::onClose() {
killTimer(audioDaemonTimerId); killTimer(audioDaemonTimerId);
audioDaemonTimerId = 0; audioDaemonTimerId = 0;
} }
if(ctx==nullptr) return; if(ctx==0) return;
if(ctx->sink!=nullptr) { if(ctx->sink) {
ctx->sink->stop(); ctx->sink->stop();
delete ctx->sink; delete ctx->sink;
} }
delete ctx; delete ctx;
ctx = nullptr; ctx = 0;
emit emUpd(QImage()); emit emUpd(QImage());
} }
void FFPlayer::onPlay() { void FFPlayer::onPlay() {
if(ctx==nullptr) return; if(ctx==0) return;
status = Playing; status = Playing;
ctx->sink->resume();
startAudioDaemon(); startAudioDaemon();
} }
void FFPlayer::onPause() {
if(ctx==0) return;
status = Paused;
ctx->sink->suspend();
}
void FFPlayer::onStop() { void FFPlayer::onStop() {
if(audioDaemonTimerId!=0) { if(audioDaemonTimerId!=0) {
killTimer(audioDaemonTimerId); killTimer(audioDaemonTimerId);
audioDaemonTimerId = 0; audioDaemonTimerId = 0;
} }
if(ctx==nullptr) return; if(ctx==0) return;
if(ctx->sink!=nullptr) { if(ctx->sink) {
ctx->sink->stop(); ctx->sink->stop();
ctx->sinkWriter = ctx->sink->start(); ctx->sinkWriter = ctx->sink->start();
} }
@ -574,25 +583,26 @@ void FFPlayer::onStop() {
ctx->au.stop = true; ctx->au.stop = true;
status = Paused; status = Paused;
ctx->start_epoch = 0; ctx->start_epoch = 0;
ctx->playLoop = 0;
ctx->au_frms.lockDelAll(); ctx->au_frms.lockDelAll();
ctx->vi_frms.lockDelAll(); ctx->vi_frms.lockDelAll();
img = QImage(); img = QImage();
ctx->acts.add(new Act{0, nullptr, 'S'}); ctx->acts.add(new Act{0, 0, 'S'});
ctx->acts.cv.notify_all(); ctx->acts.cv.notify_all();
} }
void FFPlayer::onVol(qreal vol) { void FFPlayer::onVol(qreal vol) {
mVol = vol; mVol = vol;
if(ctx!=nullptr && ctx->sink!=nullptr) ctx->sink->setVolume(vol); if(ctx && ctx->sink) ctx->sink->setVolume(vol);
} }
void FFPlayer::updFrame() { void FFPlayer::updFrame() {
if(ctx==nullptr) return; if(ctx==0) return;
if(status!=Playing) { if(status!=Playing) {
if(img.isNull()) { if(img.isNull()) {
lock_guard<mutex> lock(ctx->vi_frms.mtx); lock_guard<mutex> lock(ctx->vi_frms.mtx);
viSize = ctx->vi_frms.size; viSize = ctx->vi_frms.size;
auSize = ctx->au_frms.size; auSize = ctx->au_frms.size;
if(ctx->vi_frms.first==nullptr) return; if(ctx->vi_frms.first==0) return;
img = ctx->vi_frms.first->img; img = ctx->vi_frms.first->img;
emit emUpd(img); emit emUpd(img);
} }
@ -615,7 +625,7 @@ void FFPlayer::updFrame() {
} }
void FFPlayer::timerEvent(QTimerEvent *event) { void FFPlayer::timerEvent(QTimerEvent *event) {
if(event->timerId()!=audioDaemonTimerId) return; if(event->timerId()!=audioDaemonTimerId) return;
if(ctx==nullptr || status!=Playing) { if(ctx==0 || status!=Playing) {
if(audioDaemonTimerId!=0) { if(audioDaemonTimerId!=0) {
killTimer(audioDaemonTimerId); killTimer(audioDaemonTimerId);
audioDaemonTimerId = 0; audioDaemonTimerId = 0;

View File

@ -185,6 +185,7 @@ protected:
SwsContext *sws_ctx{0}; SwsContext *sws_ctx{0};
SwrContext *swr_ctx{0}; SwrContext *swr_ctx{0};
AVChannelLayout out_ch_layout;
int sample_rate{0}, pcm_sample_size{0}; int sample_rate{0}, pcm_sample_size{0};
QAudioSink *sink{0}; QAudioSink *sink{0};
QIODevice *sinkWriter{0}; QIODevice *sinkWriter{0};
@ -195,7 +196,7 @@ protected:
ConQueue<Img> vi_frms; ConQueue<Img> vi_frms;
ConQueue<Pcm> au_frms; ConQueue<Pcm> au_frms;
qint64 start_epoch{0}; qint64 start_epoch{0};
uint curLoop{0}; uint playLoop{0};
}; };
class FFPlayer : public QObject { class FFPlayer : public QObject {
@ -213,6 +214,7 @@ public:
} }
inline void close() {emit emClose();} inline void close() {emit emClose();}
inline void play() {emit emPlay();} inline void play() {emit emPlay();}
inline void pause() {emit emPause();}
inline void stop() {emit emStop();} inline void stop() {emit emStop();}
inline void setVol(qreal vol) {emit emVol(vol);} inline void setVol(qreal vol) {emit emVol(vol);}
inline void quit() {emit emQuit();} inline void quit() {emit emQuit();}
@ -228,6 +230,7 @@ signals:
void emOpen(QByteArray url); void emOpen(QByteArray url);
void emClose(); void emClose();
void emPlay(); void emPlay();
void emPause();
void emStop(); void emStop();
void emVol(qreal vol); void emVol(qreal vol);
void emUpd(QImage); void emUpd(QImage);
@ -237,6 +240,7 @@ protected slots:
void onOpen(QByteArray url); void onOpen(QByteArray url);
void onClose(); void onClose();
void onPlay(); void onPlay();
void onPause();
void onStop(); void onStop();
void onVol(qreal vol); void onVol(qreal vol);
void onQuit(); void onQuit();

Some files were not shown because too many files have changed in this diff Show More