Skip to content

Commit

Permalink
misc: wrong option parse result. wrong signal param
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Nov 4, 2014
1 parent 0088504 commit be7fd4c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions examples/common/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ void load_qm(const QStringList &names)
foreach(QString qm, qms) {
QTranslator *ts = new QTranslator(qApp);
QString path = qApp->applicationDirPath() + "/i18n/" + qm + "_" + QLocale::system().name();
qDebug() << "loading qm: " << path;
//qDebug() << "loading qm: " << path;
if (ts->load(path)) {
qApp->installTranslator(ts);
} else {
path = ":/i18n/" + qm + "_" + QLocale::system().name();
qDebug() << "loading qm: " << path;
//qDebug() << "loading qm: " << path;
if (ts->load(path))
qApp->installTranslator(ts);
else
Expand Down
11 changes: 5 additions & 6 deletions examples/common/qoptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ bool QOptions::parse(int argc, const char *const*argv)
if (it->startsWith("--")) {
int e = it->indexOf('=');
for (it_list = mOptions.begin(); it_list != mOptions.end(); ++it_list) {
if (it_list->longName().startsWith(it->mid(2,e-2))) {
if (it_list->longName() == it->mid(2,e-2)) {
if (it_list->type()==QOption::NoToken) {
it_list->setValue(true);
//qDebug("%d %s", __LINE__, qPrintable(it_list->value().toString()));
Expand Down Expand Up @@ -240,11 +240,10 @@ bool QOptions::parse(int argc, const char *const*argv)
for (it_list = mOptions.begin(); it_list != mOptions.end(); ++it_list) {
QString sname = it_list->shortName();
int sname_len = sname.length(); //usally is 1
//Not endsWith, -oabco
if (it->indexOf(sname) == 1) {
//TODO: startsWith(-height,-h) Not endsWith, -oabco
if (it->midRef(1).compare(sname) == 0) {
if (it_list->type() == QOption::NoToken) {
it_list->setValue(true);
//qDebug("%d %s", __LINE__, qPrintable(it_list->value().toString()));
it = args.erase(it);
break;
}
Expand All @@ -254,10 +253,10 @@ bool QOptions::parse(int argc, const char *const*argv)
break;
it_list->setValue(*it);
//qDebug("%d %s", __LINE__, qPrintable(it_list->value().toString()));
} else {
} else {
it_list->setValue(it->mid(sname_len+1));
//qDebug("%d %s", __LINE__, qPrintable(it_list->value().toString()));
}
}
it = args.erase(it);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/player/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void MainWindow::initPlayer()
onCaptureConfigChanged();
onAVFilterConfigChanged();
connect(&Config::instance(), SIGNAL(captureDirChanged(QString)), SLOT(onCaptureConfigChanged()));
connect(&Config::instance(), SIGNAL(captureFormatChanged(QByteArray)), SLOT(onCaptureConfigChanged()));
connect(&Config::instance(), SIGNAL(captureFormatChanged(QString)), SLOT(onCaptureConfigChanged()));
connect(&Config::instance(), SIGNAL(captureQualityChanged(int)), SLOT(onCaptureConfigChanged()));
connect(&Config::instance(), SIGNAL(avfilterChanged()), SLOT(onAVFilterConfigChanged()));
connect(mpStopBtn, SIGNAL(clicked()), mpPlayer, SLOT(stop()));
Expand Down
2 changes: 1 addition & 1 deletion examples/player/config/DecoderConfigPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ DecoderConfigPage::DecoderConfigPage(QWidget *parent) :
hb->addWidget(mpUp);
hb->addWidget(mpDown);
vb->addLayout(hb);
connect(&Config::instance(), SIGNAL(decoderPriorityChanged(QVector<QtAV::VideoDecoderId>)), SLOT(onConfigChanged()));
connect(&Config::instance(), SIGNAL(decoderPriorityNamesChanged()), SLOT(onConfigChanged()));
updateDecodersUi();
}

Expand Down
10 changes: 8 additions & 2 deletions tests/extract/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,22 @@ int main(int argc, char** argv)
int t = 0;
if (idx > 0)
t = a.arguments().at(idx+1).toInt();
int n = 1;
idx = a.arguments().indexOf("-n");
if (idx > 0)
n = a.arguments().at(idx+1).toInt();
bool async = a.arguments().contains("-async");


VideoFrameExtractor extractor;
extractor.setAsync(true);
extractor.setAsync(async);
VideoFrameObserver obs;
QObject::connect(&extractor, SIGNAL(frameExtracted(QtAV::VideoFrame)), &obs, SLOT(onVideoFrameExtracted(QtAV::VideoFrame)));
extractor.setSource(file);

QElapsedTimer timer;
timer.start();
for (int i = 0; i < 30; ++i) {
for (int i = 0; i < n; ++i) {
extractor.setPosition(t + 1000*i);
}
qDebug("elapsed: %lld", timer.elapsed());
Expand Down

0 comments on commit be7fd4c

Please sign in to comment.