Skip to content

Commit

Permalink
Merge branch 'expose_media_type_enum' into 'master'
Browse files Browse the repository at this point in the history
Expose media type enum. Contributes to JB#53968 OMP#JOLLA-73

See merge request mer-core/qtgrilo!8
  • Loading branch information
pvuorela committed May 7, 2021
2 parents 509eab3 + 71178ec commit a2bf509
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
Makefile
moc_*
*.o
8 changes: 4 additions & 4 deletions src/grilomedia.cpp
Expand Up @@ -100,14 +100,14 @@ QUrl GriloMedia::url() const
return url;
}

int GriloMedia::duration() const
int GriloMedia::mediaType() const
{
return grl_media_get_duration(m_media);
return static_cast<int>(grl_media_get_media_type(m_media));
}

bool GriloMedia::isContainer() const
int GriloMedia::duration() const
{
return grl_media_is_container(m_media) == TRUE;
return grl_media_get_duration(m_media);
}

QString GriloMedia::author() const
Expand Down
16 changes: 13 additions & 3 deletions src/grilomedia.h
Expand Up @@ -35,11 +35,11 @@
class GRILO_QT_EXPORT GriloMedia : public QObject
{
Q_OBJECT

Q_ENUMS(MediaType)
Q_PROPERTY(QString id READ id CONSTANT)
Q_PROPERTY(QString title READ title CONSTANT)
Q_PROPERTY(QUrl url READ url CONSTANT)
Q_PROPERTY(bool container READ isContainer CONSTANT)
Q_PROPERTY(int mediaType READ mediaType CONSTANT)
Q_PROPERTY(int duration READ duration CONSTANT)
Q_PROPERTY(QString author READ author CONSTANT)
Q_PROPERTY(QString album READ album CONSTANT)
Expand All @@ -54,14 +54,24 @@ class GRILO_QT_EXPORT GriloMedia : public QObject
Q_PROPERTY(int height READ height CONSTANT)
Q_PROPERTY(int orientation READ orientation CONSTANT)
Q_PROPERTY(int width READ width CONSTANT)


public:
enum MediaType {
TypeUnknown = GRL_MEDIA_TYPE_UNKNOWN,
TypeAudio = GRL_MEDIA_TYPE_AUDIO,
TypeVideo = GRL_MEDIA_TYPE_VIDEO,
TypeImage = GRL_MEDIA_TYPE_IMAGE,
TypeContainer = GRL_MEDIA_TYPE_CONTAINER
};

GriloMedia(GrlMedia *media, QObject *parent = 0);
~GriloMedia();

QString id() const;
QString title() const;
QUrl url() const;
bool isContainer() const;
int mediaType() const;
int duration() const;
QString author() const;
QString album() const;
Expand Down

0 comments on commit a2bf509

Please sign in to comment.