Skip to content

Commit

Permalink
Added codecs and formats blacklist in MultiSink. Disabled slow an con…
Browse files Browse the repository at this point in the history
…flictive codecs. Fixed memory leak with FFmpeg when recording.
  • Loading branch information
hipersayanX committed Feb 18, 2017
1 parent 39c3690 commit 9fb7d9c
Show file tree
Hide file tree
Showing 15 changed files with 388 additions and 136 deletions.
14 changes: 13 additions & 1 deletion StandAlone/src/recording.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ Recording::Recording(QQmlApplicationEngine *engine, QObject *parent):
SIGNAL(supportedFormatsChanged(const QStringList &)),
this,
SLOT(supportedFormatsUpdated(const QStringList &)));
QObject::connect(this->m_record.data(),
SIGNAL(supportedFormatsChanged(const QStringList &)),
this,
SLOT(updateFormat()));
QObject::connect(this->m_record.data(),
SIGNAL(codecLibChanged(const QString &)),
this,
Expand Down Expand Up @@ -491,8 +495,16 @@ void Recording::capsUpdated()
this->loadStreams(format);
}

void Recording::updateFormat(const QString &codecLib)
void Recording::updateFormat()
{
if (!this->m_record)
return;

auto codecLib = this->m_record->property("codecLib").toString();

if (codecLib.isEmpty())
return;

this->setFormat(codecLib == "gstreamer"? "webmmux": "webm");
}

Expand Down
2 changes: 1 addition & 1 deletion StandAlone/src/recording.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class Recording: public QObject
void supportedFormatsUpdated(const QStringList &availableFormats);
void userControlsUpdated(const QVariantMap &userControls);
void capsUpdated();
void updateFormat(const QString &codecLib);
void updateFormat();
void loadProperties();
void loadFormatOptions(const QString &format);
void loadStreams(const QString &format);
Expand Down
16 changes: 10 additions & 6 deletions libAvKys/Plugins/FrameOverlap/src/frameoverlapelement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,16 @@ AkPacket FrameOverlapElement::iStream(const AkPacket &packet)
n++;
}

r /= n;
g /= n;
b /= n;
a /= n;

dstBits[x] = qRgba(r, g, b, a);
if (n > 0) {
r /= n;
g /= n;
b /= n;
a /= n;

dstBits[x] = qRgba(r, g, b, a);
} else {
dstBits[x] = qRgba(0, 0, 0, 0);
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion libAvKys/Plugins/MultiSink/share/qml/CodecControl.qml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ GridLayout {
description: description
});
}

cbxMenu.currentIndex = currentMenuIndex(controlParams);
}

function currentMenuIndex(controlParams)
Expand Down Expand Up @@ -214,7 +216,6 @@ GridLayout {
id: menuModel
}
textRole: "description"
currentIndex: currentMenuIndex(controlParams)
Layout.fillWidth: true
visible: false

Expand Down
27 changes: 20 additions & 7 deletions libAvKys/Plugins/MultiSink/share/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,17 @@ ColumnLayout {
MultiSink.supportedCodecs(MultiSink.outputFormat,
streamCaps.mimeType)

for (var codec in supportedCodecs)
streamOptions.codecList.append({codec: supportedCodecs[codec],
description: supportedCodecs[codec]
+ " - "
+ MultiSink.codecDescription(supportedCodecs[codec])})
for (var codec in supportedCodecs) {
var codecName = supportedCodecs[codec];
var codecDescription = MultiSink.codecDescription(supportedCodecs[codec]);
var description = codecName;

if (codecDescription.length > 0)
description += " - " + codecDescription;

streamOptions.codecList.append({codec: codecName,
description: description});
}

streamOptions.codec = streamConfig.codec

Expand Down Expand Up @@ -166,11 +172,18 @@ ColumnLayout {
id: lstOutputFormats
}

onCurrentIndexChanged: MultiSink.outputFormat = lstOutputFormats.get(currentIndex).format
onCurrentIndexChanged: {
var opt = lstOutputFormats.get(currentIndex);

if (opt)
MultiSink.outputFormat = opt.format
}
}
TextField {
visible: !MultiSink.showFormatOptions
text: lstOutputFormats.get(cbxOutputFormats.currentIndex).description
text: lstOutputFormats.get(cbxOutputFormats.currentIndex)?
lstOutputFormats.get(cbxOutputFormats.currentIndex).description:
""
readOnly: true
Layout.fillWidth: true
}
Expand Down
Loading

0 comments on commit 9fb7d9c

Please sign in to comment.