]> git.tdb.fi Git - xinema.git/commitdiff
Display stream size and codecs on the playback page
authorMikko Rasa <tdb@tdb.fi>
Sun, 18 Oct 2015 11:13:48 +0000 (14:13 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 18 Oct 2015 11:13:48 +0000 (14:13 +0300)
remote/qml/components/StreamInfo.qml [new file with mode: 0644]
remote/qml/pages/PlaybackPage.qml
remote/source/streamcontrolitem.cpp
remote/source/streamcontrolitem.h
remote/source/xinemacontrol.cpp
remote/source/xinemacontrol.h

diff --git a/remote/qml/components/StreamInfo.qml b/remote/qml/components/StreamInfo.qml
new file mode 100644 (file)
index 0000000..6ad4457
--- /dev/null
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+Label
+{
+       anchors
+       {
+               left: parent.left
+               right: parent.right
+               margins: Theme.horizontalPageMargin
+       }
+
+       horizontalAlignment: Text.AlignHCenter
+       color: Theme.secondaryColor
+       font.pixelSize: Theme.fontSizeSmall
+}
index bf1d976c0b382eccc18a14dbc844ea9dac388633..abbd0d84ea95814d6b2eebb1d6a47aafe7731cd2 100644 (file)
@@ -30,6 +30,27 @@ Page
                        wrapMode: Text.WordWrap
                }
 
+               Column
+               {
+                       width: parent.width
+                       spacing: Theme.paddingSmall
+
+                       StreamInfo
+                       {
+                               text: streamControl.videoSize.width+"×"+streamControl.videoSize.height+" @ "+streamControl.framerate.toFixed(2)+"fps"
+                       }
+
+                       StreamInfo
+                       {
+                               text: streamControl.videoCodec
+                       }
+
+                       StreamInfo
+                       {
+                               text: streamControl.audioCodec
+                       }
+               }
+
                Slider
                {
                        id: slider
index fb518bf0ab8fd102a645edcac30d42d0160b156b..3bd94b87f445b8d9911c1e8f5acafd27f1e24a93 100644 (file)
@@ -19,6 +19,9 @@ void StreamControlItem::set_control(XinemaControlItem *c)
                connect(&xc, &XinemaControl::title_changed, this, &StreamControlItem::title_changed);
                connect(&xc, &XinemaControl::duration_changed, this, &StreamControlItem::duration_changed);
                connect(&xc, &XinemaControl::position_changed, this, &StreamControlItem::position_changed);
+               connect(&xc, &XinemaControl::size_changed, this, &StreamControlItem::size_changed);
+               connect(&xc, &XinemaControl::framerate_changed, this, &StreamControlItem::framerate_changed);
+               connect(&xc, &XinemaControl::codecs_changed, this, &StreamControlItem::codecs_changed);
                connect(&xc, &XinemaControl::channels_changed, this, &StreamControlItem::control_channels_changed);
                connect(&xc, &XinemaControl::current_audio_channel_changed, this, &StreamControlItem::current_audio_channel_changed);
                connect(&xc, &XinemaControl::current_spu_channel_changed, this, &StreamControlItem::current_spu_channel_changed);
@@ -32,6 +35,9 @@ void StreamControlItem::set_control(XinemaControlItem *c)
                emit title_changed();
                emit duration_changed();
                emit position_changed();
+               emit size_changed();
+               emit framerate_changed();
+               emit codecs_changed();
                emit channels_changed();
                emit current_audio_channel_changed();
                emit current_spu_channel_changed();
@@ -90,6 +96,38 @@ float StreamControlItem::get_position() const
        return control->get_control().get_position();
 }
 
+QSize StreamControlItem::get_video_size() const
+{
+       if(!control)
+               return QSize();
+
+       return control->get_control().get_video_size();
+}
+
+float StreamControlItem::get_framerate() const
+{
+       if(!control)
+               return 0.0f;
+
+       return control->get_control().get_framerate();
+}
+
+QString StreamControlItem::get_video_codec() const
+{
+       if(!control)
+               return QString();
+
+       return control->get_control().get_video_codec();
+}
+
+QString StreamControlItem::get_audio_codec() const
+{
+       if(!control)
+               return QString();
+
+       return control->get_control().get_audio_codec();
+}
+
 QStringList StreamControlItem::get_audio_channels() const
 {
        if(!control)
index 8bb2ccee397a19f0ed4ec16755cf66d7d9a8d8a8..be7bcc869c69256bfb7883e2c1b0ec35d71a8960 100644 (file)
@@ -15,6 +15,10 @@ class StreamControlItem: public QQuickItem
        Q_PROPERTY(QString title READ get_title NOTIFY title_changed)
        Q_PROPERTY(float duration READ get_duration NOTIFY duration_changed)
        Q_PROPERTY(float position READ get_position WRITE set_position NOTIFY position_changed)
+       Q_PROPERTY(QSize videoSize READ get_video_size NOTIFY size_changed)
+       Q_PROPERTY(float framerate READ get_framerate NOTIFY framerate_changed)
+       Q_PROPERTY(QString videoCodec READ get_video_codec NOTIFY codecs_changed)
+       Q_PROPERTY(QString audioCodec READ get_audio_codec NOTIFY codecs_changed)
        Q_PROPERTY(QStringList audioChannels READ get_audio_channels NOTIFY channels_changed)
        Q_PROPERTY(QStringList spuChannels READ get_spu_channels NOTIFY channels_changed)
        Q_PROPERTY(int currentAudioChannel READ get_current_audio_channel WRITE select_audio_channel NOTIFY current_audio_channel_changed)
@@ -45,6 +49,10 @@ public:
        float get_duration() const;
        void set_position(float);
        float get_position() const;
+       QSize get_video_size() const;
+       float get_framerate() const;
+       QString get_video_codec() const;
+       QString get_audio_codec() const;
        QStringList get_audio_channels() const;
        QStringList get_spu_channels() const;
        void select_audio_channel(int);
@@ -58,6 +66,9 @@ signals:
        void title_changed();
        void duration_changed();
        void position_changed();
+       void size_changed();
+       void framerate_changed();
+       void codecs_changed();
        void channels_changed();
        void current_audio_channel_changed();
        void current_spu_channel_changed();
index eb2ec47e5706b0a67016491cedde811468c31ede..7a013dfd0ad0e0880b92b3b5122294d6cc0b710d 100644 (file)
@@ -4,6 +4,7 @@ XinemaControl::XinemaControl():
        playback_state(STOPPED),
        duration(0.0f),
        position(0.0f),
+       framerate(0.0f),
        current_audio_channel(-1),
        current_spu_channel(-1)
 {
@@ -147,6 +148,27 @@ void XinemaControl::process_reply(const QString &reply)
                position = args.toFloat();
                emit position_changed(position);
        }
+       else if(keyword=="video_size")
+       {
+               space = args.indexOf(' ');
+               video_size = QSize(args.mid(0, space).toInt(), args.mid(space+1).toInt());
+               emit size_changed(video_size);
+       }
+       else if(keyword=="framerate")
+       {
+               framerate = args.toFloat();
+               emit framerate_changed(framerate);
+       }
+       else if(keyword=="video_codec")
+       {
+               video_codec = args;
+               emit codecs_changed(video_codec, audio_codec);
+       }
+       else if(keyword=="audio_codec")
+       {
+               audio_codec = args;
+               emit codecs_changed(video_codec, audio_codec);
+       }
        else if(keyword=="audio_count")
                resize_list(audio_channels, args.toInt());
        else if(keyword=="audio")
index 573207365c27b2dcfcbd0422620f176bd688faba..fb62bab51be97583c2d37cc4d6910664e9a20b3f 100644 (file)
@@ -2,6 +2,7 @@
 #define XINEMACONTROL_H_
 
 #include <QObject>
+#include <QSize>
 #include <QTcpSocket>
 
 class XinemaControl: public QObject
@@ -28,6 +29,10 @@ private:
        QString title;
        float duration;
        float position;
+       QSize video_size;
+       float framerate;
+       QString video_codec;
+       QString audio_codec;
        QStringList audio_channels;
        QStringList spu_channels;
        int current_audio_channel;
@@ -46,6 +51,10 @@ public:
        const QString &get_title() const { return title; }
        float get_duration() const { return duration; }
        float get_position() const { return position; }
+       const QSize &get_video_size() const { return video_size; }
+       float get_framerate() const { return framerate; }
+       const QString &get_video_codec() const { return video_codec; }
+       const QString &get_audio_codec() const { return audio_codec; }
 
        void play();
        void seek(float);
@@ -69,6 +78,9 @@ signals:
        void title_changed(const QString &);
        void duration_changed(float);
        void position_changed(float);
+       void size_changed(const QSize &);
+       void framerate_changed(float);
+       void codecs_changed(const QString &, const QString &);
        void channels_changed();
        void current_audio_channel_changed(int);
        void current_spu_channel_changed(int);