- Use quality instead of bitrate.

- pagestep for slidebar is now one.
This commit is contained in:
Andreas 2014-05-15 20:07:46 +02:00
parent 3452da4525
commit 6137d047e9
4 changed files with 24 additions and 12 deletions

View File

@ -134,7 +134,7 @@ void StreamServer::SendStream(const QUrl& url, QTcpSocket* socket) {
decodebin, audioconvert, audioresample, vorbisenc, oggmux, fdsink,
NULL);
g_object_set(vorbisenc, "bitrate", getBitrate(), NULL);
g_object_set(vorbisenc, "quality", getQuality(), NULL);
g_object_set(decodebin, "uri", url.toString().toUtf8().constData(), NULL);
g_object_set(fdsink, "fd", socket->socketDescriptor(), NULL);
@ -161,8 +161,8 @@ void StreamServer::AsyncLoadComplete(const UrlHandler::LoadResult& result) {
SendStream(result.media_url_, socket);
}
int StreamServer::getBitrate() {
double StreamServer::getQuality() {
QSettings s;
s.beginGroup(kSettingsGroup);
return s.value("bitrate", 128).toInt() * 1000;
return s.value("quality", 0.3).toDouble();
}

View File

@ -30,7 +30,7 @@ class StreamServer : public QObject {
private:
QByteArray ParseRequest(const QByteArray& data);
void SendStream(const QUrl& url, QTcpSocket* socket);
int getBitrate();
double getQuality();
Player* player_;
QTcpServer* server_;

View File

@ -42,7 +42,7 @@ void StreamingSettingsPage::Load() {
ui_->stream_port->setValue(
s.value("port", StreamServer::kDefaultServerPort).toInt());
ui_->bitrate_box->setValue(s.value("bitrate", 128).toInt());
ui_->bitrate_box->setValue(s.value("quality", 0.3).toDouble() * 10);
s.endGroup();
}
@ -55,7 +55,7 @@ void StreamingSettingsPage::Save() {
s.setValue("use_streaming", ui_->use_streaming->isChecked());
s.setValue("port", ui_->stream_port->value());
s.setValue("bitrate", ui_->bitrate_box->value());
s.setValue("quality", double(ui_->bitrate_box->value()) / 10);
s.endGroup();

View File

@ -84,7 +84,7 @@
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Bitrate</string>
<string>Quality</string>
</property>
</widget>
</item>
@ -92,11 +92,17 @@
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSlider" name="bitrate_slider">
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>250</number>
<number>10</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>128</number>
<number>3</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -106,13 +112,19 @@
<item>
<widget class="QSpinBox" name="bitrate_box">
<property name="suffix">
<string> kBps</string>
<string/>
</property>
<property name="prefix">
<string>q</string>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>250</number>
<number>10</number>
</property>
<property name="value">
<number>128</number>
<number>3</number>
</property>
</widget>
</item>