Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dialog to display streams' audio details #5547

Merged
merged 13 commits into from
Dec 21, 2016

Conversation

santigl
Copy link
Contributor

@santigl santigl commented Nov 30, 2016

streamdetails2

More info: #5455.

g_object_unref(discoverer_);
}

void StreamDiscoverer::discover(QString url) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the style guide: https://google.github.io/styleguide/cppguide.html

e.g. Discover not discover and `const QString& url

qLog(Debug) << "Discover" << url;
std::string url_std = url.toStdString();
const char* url_c = url_std.c_str();
if (!gst_discoverer_discover_uri_async(discoverer_, url_c)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inline url.toStdString().c_str()

if (!gst_discoverer_discover_uri_async(discoverer_, url_c)) {
qLog(Error) << "Failed to start discovering" << url
<< endl;
g_object_unref(discoverer_);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done in the destructor anyway

}

// Creating a loop and setting it to run. That way we can wait for signals.
QEventLoop loop;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WaitForSignal(this, SIGNAL(DiscovererFinished()))

loop.exec();
}

void StreamDiscoverer::on_discovered_cb(GstDiscoverer* discoverer,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OnDiscovered

// Get audio streams (we will only care about the first one, which should be the only one).
GList* audio_streams = gst_discoverer_info_get_audio_streams(info);

if (audio_streams != NULL) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nullptr

private:
GstDiscoverer* discoverer_;

static const unsigned int kDiscoveryTimeoutS;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unsigned

static void on_finished_cb(GstDiscoverer* discoverer, gpointer instance);

// Helper to return descriptive error messages:
static QString gstDiscovererErrorMessage(GstDiscovererResult result);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GstDiscovererErrorMessage

void on_buttonBox_rejected();

private:
Ui::StreamDetailsDialog* ui;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::unique_ptr<Ui::StreamDetailsDialog> ui_

void setSampleRate(unsigned int);

private slots:
void on_buttonBox_rejected();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Close()

struct StreamDetails {
QString url;
QString format;
unsigned int bitrate;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsigned just makes it harder to read.

@hatstand hatstand merged commit d3898d2 into clementine-player:master Dec 21, 2016
@santigl santigl deleted the stream-details-gui branch December 30, 2016 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants