medacontent

This commit is contained in:
Andrei Yankovich 2018-03-29 00:23:53 +03:00
parent 1ef62656c0
commit ff5a910d33
12 changed files with 268 additions and 143 deletions

View File

@ -94,7 +94,7 @@ QVariant PlayListModel::data(const QModelIndex &index, int role) const
bool PlayListModel::select(int id){ bool PlayListModel::select(int id){
for(QList<syncLib::SongHeader>::Iterator i = playList.begin(); i < playList.end(); i++){ for(QList<syncLib::SongStorage>::Iterator i = playList.begin(); i < playList.end(); i++){
if(i->id == id){ if(i->id == id){
if((i->isSelected = !i->isSelected)){ if((i->isSelected = !i->isSelected)){
@ -114,7 +114,7 @@ bool PlayListModel::select(int id){
QList<int> PlayListModel::getSelected(){ QList<int> PlayListModel::getSelected(){
QList<int> result; QList<int> result;
for(QList<syncLib::SongHeader>::Iterator i = playList.begin(); i < playList.end(); i++){ for(QList<syncLib::SongStorage>::Iterator i = playList.begin(); i < playList.end(); i++){
if(i->isSelected){ if(i->isSelected){
result.push_back(i->id); result.push_back(i->id);
} }
@ -124,7 +124,7 @@ QList<int> PlayListModel::getSelected(){
bool PlayListModel::isSelected(int id){ bool PlayListModel::isSelected(int id){
for(QList<syncLib::SongHeader>::Iterator i = playList.begin(); i < playList.end(); i++){ for(QList<syncLib::SongStorage>::Iterator i = playList.begin(); i < playList.end(); i++){
if(i->id == id){ if(i->id == id){
return i->isSelected; return i->isSelected;
} }

View File

@ -16,7 +16,7 @@ class PlayListModel : public QAbstractListModel
private: private:
SyncEngine * syncEngine; SyncEngine * syncEngine;
QList<syncLib::SongHeader> playList; QList<syncLib::SongStorage> playList;
QString playListName; QString playListName;
int itemCount; int itemCount;

View File

@ -140,7 +140,7 @@ int SyncEngine::repeat()const{
} }
void SyncEngine::setRepeat(int flag){ void SyncEngine::setRepeat(int flag){
sync->setRepeat((syncLib::Repeat)flag); sync->setRepeat((QMediaPlaylist::PlaybackMode)flag);
} }
bool SyncEngine::setPlayList(const QString& name){ bool SyncEngine::setPlayList(const QString& name){
@ -157,7 +157,7 @@ bool SyncEngine::setPlayList(const QString& name){
} }
bool SyncEngine::getPlayList(QList<syncLib::SongHeader> &playList, const QString &name){ bool SyncEngine::getPlayList(QList<syncLib::SongStorage> &playList, const QString &name){
return sqlApi->updateAvailableSongs(playList, name, true); return sqlApi->updateAvailableSongs(playList, name, true);
} }

View File

@ -138,7 +138,7 @@ public slots:
* @param name - name of selected playList * @param name - name of selected playList
* @return * @return
*/ */
bool getPlayList(QList<syncLib::SongHeader> &playList, const QString& name); bool getPlayList(QList<syncLib::SongStorage> &playList, const QString& name);
/** /**
* @brief lastError - message of last error * @brief lastError - message of last error

View File

@ -3,6 +3,7 @@
#include <QtSql> #include <QtSql>
#include "exaptions.h" #include "exaptions.h"
#include <QSettings> #include <QSettings>
#include <QMediaPlaylist>
namespace syncLib{ namespace syncLib{
@ -118,6 +119,59 @@ void MySql::initDB(const QString &database){
} }
} }
bool MySql::find(const QMediaContent &song, SongStorage &response){
QList<SongStorage> songs;
if(!updateAvailableSongs(songs)){
return false;
}
for(SongStorage &i: songs){
if(i == song){
response = i;
return true;
}
}
return false;
}
bool MySql::find(const QMediaContent &song, SongHeader &response){
QList<SongStorage> songs;
if(!updateAvailableSongs(songs)){
return false;
}
for(SongStorage &i: songs){
if(i == song){
response = (SongHeader&)i;
return true;
}
}
return false;
}
bool MySql::find(const SongHeader &song, QMediaContent &response){
QList<SongStorage> songs;
if(!updateAvailableSongs(songs)){
return false;
}
for(SongStorage &i: songs){
if((SongHeader&)i == song){
response = i.toMedia();
return true;
}
}
return false;
}
void MySql::setSoundDir(const QString &str){ void MySql::setSoundDir(const QString &str){
songDir = str; songDir = str;
QSettings().setValue(MAIN_FOLDER_KEY, songDir); QSettings().setValue(MAIN_FOLDER_KEY, songDir);
@ -149,7 +203,7 @@ void MySql::sqlErrorLog(const QString &qyery)const{
#endif #endif
} }
int MySql::save(const Song &song){ int MySql::save(const Song &song , bool onlyDataBase){
QString qyer = QString("SELECT id from songs where name='%0' and size=%1").arg(song.name, QString qyer = QString("SELECT id from songs where name='%0' and size=%1").arg(song.name,
QString::number(song.size)); QString::number(song.size));
if(!qyery->exec(qyer)){ if(!qyery->exec(qyer)){
@ -162,7 +216,7 @@ int MySql::save(const Song &song){
} }
QUrl url; QUrl url;
if(!saveToStorage(url, song)){ if(!onlyDataBase && !saveToStorage(url, song)){
return false; return false;
} }
@ -187,28 +241,18 @@ int MySql::save(const Song &song){
} }
int MySql::save(const QString &url){ int MySql::save(const QString &url){
QFile f(QUrl(url).toLocalFile());
if(!f.open(QIODevice::ReadOnly)){ SongStorage song(QUrl::fromLocalFile(url));
return -1;
}
QByteArray bytes = f.readAll();
f.close();
QString name = url.right(url.lastIndexOf(QRegularExpression("[\\\/]")));
Song song;
song.name = name;
song.size = bytes.size();
song.source = bytes;
if(!song.isNameValid()){ if(!song.isNameValid()){
return -1; return -1;
} }
return save(song); return save(song, true);
} }
bool MySql::load(const SongHeader &song,Song &result){ bool MySql::load(const SongHeader &song, SongStorage &result){
result.clear();
if(song.id > -1){ if(song.id > -1){
QString qyer = QString("SELECT * from songs where id=%0").arg(song.id); QString qyer = QString("SELECT * from songs where id=%0").arg(song.id);
if(!qyery->exec(qyer)){ if(!qyery->exec(qyer)){
@ -230,17 +274,17 @@ bool MySql::load(const SongHeader &song,Song &result){
result.id = qyery->value(0).toInt(); result.id = qyery->value(0).toInt();
result.name = qyery->value(1).toString(); result.name = qyery->value(1).toString();
result.size = qyery->value(2).toInt(); result.size = qyery->value(2).toInt();
result.source = qyery->value(3).toByteArray(); result.url = qyery->value(3).toUrl();
return true; return true;
} }
bool MySql::updateAvailableSongs(QList<SongHeader>& list, const QString& playList, bool forEditing){ bool MySql::updateAvailableSongs(QList<SongStorage>& list, const QString& playList, bool forEditing){
QString qyer; QString qyer;
if(playList.isEmpty() || playList == ALL_SONGS_LIST || forEditing){ if(playList.isEmpty() || playList == ALL_SONGS_LIST || forEditing){
qyer = QString("SELECT id,name,size from songs"); qyer = QString("SELECT * from songs");
}else{ }else{
qyer = QString("SELECT id,name,size from songs where " qyer = QString("SELECT * from songs where "
"id in (select song from playlistsdata where " "id in (select song from playlistsdata where "
"playlist='%0')").arg(playList); "playlist='%0')").arg(playList);
} }
@ -253,11 +297,13 @@ bool MySql::updateAvailableSongs(QList<SongHeader>& list, const QString& playLis
list.clear(); list.clear();
while(qyery->next()){ while(qyery->next()){
SongHeader song; SongStorage song;
song.isSelected = !forEditing || playList == ALL_SONGS_LIST; song.isSelected = !forEditing || playList == ALL_SONGS_LIST;
song.id = qyery->value(0).toInt(); song.id = qyery->value(0).toInt();
song.name = qyery->value(1).toString(); song.name = qyery->value(1).toString();
song.size = qyery->value(2).toInt(); song.size = qyery->value(2).toInt();
song.url = qyery->value(3).toUrl();
list.push_back(song); list.push_back(song);
} }
@ -272,7 +318,7 @@ bool MySql::updateAvailableSongs(QList<SongHeader>& list, const QString& playLis
} }
while(qyery->next()){ while(qyery->next()){
for(SongHeader& item:list){ for(SongStorage& item:list){
int id = qyery->value(0).toInt(); int id = qyery->value(0).toInt();
if(item.id == id){ if(item.id == id){
item.isSelected = true; item.isSelected = true;
@ -286,15 +332,15 @@ bool MySql::updateAvailableSongs(QList<SongHeader>& list, const QString& playLis
return true; return true;
} }
bool MySql::updateAvailableSongs(QStringList& list, const QString& playList){ bool MySql::updateAvailableSongs(QMediaPlaylist& list, const QString& playList){
QList<SongHeader> tempList; QList<SongStorage> tempList;
if(!updateAvailableSongs(tempList, playList)) if(!updateAvailableSongs(tempList, playList))
return false; return false;
for(SongHeader &header : tempList){ for(SongStorage &header : tempList){
list.push_back(header.name); list.addMedia(header.toMedia());
} }
return true; return true;

View File

@ -37,26 +37,56 @@ public:
*/ */
void initDB(const QString& database = DATABASE_NAME ); void initDB(const QString& database = DATABASE_NAME );
/**
* @brief find - find song
* @param song - song header
* @param response Media Content of finded song
* @return true if song finded
*/
bool find(const SongHeader& song, QMediaContent& response);
/**
* @brief find - find song
* @param song - song header
* @param response Media Content of finded song
* @return true if song finded
*/
bool find(const QMediaContent& song, SongHeader& response);
/**
* @brief find - find song
* @param song - media Content
* @param response header of finded song
* @return true if song finded
*/
bool find(const QMediaContent& song, SongStorage &response);
/** /**
* @brief setSoundDir * @brief setSoundDir
* @param str * @param str
*/ */
void setSoundDir(const QString& str); void setSoundDir(const QString& str);
/**
* @brief findSong
* @param song
*/
bool findSong(const SongHeader &song);
/** /**
* @brief load song of database; * @brief load song of database;
* @brief song - * @brief song -
* @brief result - the resulting value; * @brief result - the resulting value;
* @return true if everything's done * @return true if everything's done
*/ */
bool load(const SongHeader &song, Song &result); bool load(const SongHeader &song, SongStorage &result);
/** /**
* @brief save media data into local database. * @brief save media data into local database.
* @param song savining media data. * @param song savining media data.
* @return id of song saved on local database. * @return id of song saved on local database.
*/ */
int save(const Song &song); int save(const Song &song, bool onlyDataBase = false);
/** /**
* @brief save media file, bud from url. * @brief save media file, bud from url.
@ -77,7 +107,7 @@ public:
* @param forEdit - flag for editing play list. If this flag = true then return all available songs with corect flag 'isSelect' * @param forEdit - flag for editing play list. If this flag = true then return all available songs with corect flag 'isSelect'
* @return true if all done * @return true if all done
*/ */
bool updateAvailableSongs(QList<SongHeader>& list, const QString &playList = "", bool forEditing = false); bool updateAvailableSongs(QList<SongStorage>& list, const QString &playList = "", bool forEditing = false);
/** /**
* @brief updateAvelableSongs will update the list of participants of songs. * @brief updateAvelableSongs will update the list of participants of songs.
@ -85,7 +115,7 @@ public:
* @param playList - play list of songs (string). * @param playList - play list of songs (string).
* @return true if all done * @return true if all done
*/ */
bool updateAvailableSongs(QStringList& list, const QString &playList = ""); bool updateAvailableSongs(QMediaPlaylist &list, const QString &playList = "");
/** /**
* @brief removeSong - remove song from local database. * @brief removeSong - remove song from local database.

View File

@ -12,24 +12,6 @@ Player::Player(const QString &bufferFile, QObject *parent, Flags flags):
bufferVolume = 0; bufferVolume = 0;
} }
bool Player::setMediaFromBytes(const QByteArray &array){
QFile f(buffer);
if(!f.open(QIODevice::WriteOnly | QIODevice::Truncate)){
return false;
}
if(array.length() != f.write(array.data(),array.length())){
f.close();
return false;
}
f.close();
setMedia(QUrl::fromLocalFile(QDir("./").absoluteFilePath(buffer)));
return true;
}
void Player::syncBegin(){ void Player::syncBegin(){
bufferVolume = volume(); bufferVolume = volume();

View File

@ -21,13 +21,6 @@ public:
Player(const QString& bufferFile, QObject *parent = Q_NULLPTR, Flags flags = Flags()); Player(const QString& bufferFile, QObject *parent = Q_NULLPTR, Flags flags = Flags());
/**
* @brief setMediaFromBytes
* @param array of song data
* @return true if all done
*/
bool setMediaFromBytes(const QByteArray& array);
/** /**
* @brief syncBegin - palyer waiting for sunced. * @brief syncBegin - palyer waiting for sunced.
*/ */

View File

@ -1,6 +1,7 @@
#include "song.h" #include "song.h"
#include <QStringList> #include <QStringList>
#include <QRegularExpression> #include <QRegularExpression>
#include <QFile>
namespace syncLib{ namespace syncLib{
@ -82,6 +83,77 @@ QDataStream& operator >> (QDataStream& stream, SongHeader& song){
} }
SongStorage::SongStorage():
SongHeader()
{
url.clear();
}
SongStorage::SongStorage(const SongHeader& from)
:SongStorage::SongStorage()
{
this->id = from.id;
this->name = from.name;
this->size = from.size;
}
SongStorage::SongStorage(const QUrl& from)
:SongStorage::SongStorage()
{
if(!from.isValid() || !from.isLocalFile()){
return;
}
this->id = -1;
if(!getName(name, from)){
name.clear();
}
this->size = QFile(from.toLocalFile()).size();
}
const QUrl& SongStorage::getSource()const{
return url;
}
bool SongStorage::isValid() const{
return SongHeader::isValid() && url.isValid();
}
SongStorage::~SongStorage(){
url.clear();
}
QMediaContent SongStorage::toMedia()const{
return QMediaContent(url);
}
bool SongStorage::toSong(Song&)const{
Song song(*((SongHeader*)this));
QFile f(url.toLocalFile());
if(!f.open(QIODevice::ReadOnly))
return false;
song.source = f.readAll();
f.close();
return song.isValid();
}
QDataStream& operator << (QDataStream& stream,const SongStorage& song){
stream << static_cast<const SongHeader&>(song);
stream << song.url;
return stream;
}
QDataStream& operator >> (QDataStream& stream, SongStorage& song){
stream >> static_cast<SongHeader&>(song);
stream >> song.url;
return stream;
}
Song::Song(): Song::Song():
SongHeader() SongHeader()
{ {

View File

@ -63,7 +63,10 @@ private:
public: public:
SongStorage(); SongStorage();
SongStorage(const SongHeader& from); SongStorage(const SongHeader& from);
SongStorage(const QUrl& url);
const QUrl& getSource()const; const QUrl& getSource()const;
bool toSong(Song &)const;
QMediaContent toMedia()const; QMediaContent toMedia()const;
bool isValid() const; bool isValid() const;
~SongStorage(); ~SongStorage();
@ -89,6 +92,8 @@ public:
friend QDataStream& operator << (QDataStream& stream, const Song& song); friend QDataStream& operator << (QDataStream& stream, const Song& song);
friend QDataStream& operator >> (QDataStream& stream, Song& song); friend QDataStream& operator >> (QDataStream& stream, Song& song);
friend class MySql; friend class MySql;
friend class SongStorage;
}; };
} }
#endif // SONG_H #endif // SONG_H

View File

@ -23,6 +23,8 @@ Sync::Sync(const QString &address, int port, const QString &datadir):
throw MediaException(); throw MediaException();
} }
playList = player->playlist();
fbroadcaster = false; fbroadcaster = false;
resyncCount = 0; resyncCount = 0;
lastSyncTime = 0; lastSyncTime = 0;
@ -41,7 +43,7 @@ MySql* Sync::getSqlApi(){
return sql; return sql;
} }
bool Sync::updateSongs(QList<SongHeader>& list, const QString& playList){ bool Sync::updateSongs(QMediaPlaylist& list, const QString& playList){
if(!sql->updateAvailableSongs(list, playList)){ if(!sql->updateAvailableSongs(list, playList)){
return false; return false;
} }
@ -59,28 +61,37 @@ const QString& Sync::getPlayListName() const{
return lastUsedPlayList; return lastUsedPlayList;
} }
bool Sync::findHeader(const Song &song){ bool Sync::play(bool fbroadcast){
fbroadcaster = fbroadcast;
if(fbroadcaster){
player->play();
sync();
}else{
player->syncBegin();
}
emit currentSongChanged();
for(int i = 0; i < playList.size(); i++){
if(playList[i] == static_cast<SongHeader>(song)){
currentSongIndex = i;
return true; return true;
} }
}
return false;
}
bool Sync::play(const SongHeader &header, bool fbroadcast){ bool Sync::play(const SongHeader &header, bool fbroadcast){
Song song; if(!header.isValid()){
return false;
}
SongStorage song;
SongHeader newheader = header; SongHeader newheader = header;
newheader.id = -1; newheader.id = -1;
if(!sql->load(newheader, song)){ if(!sql->load(newheader, song)){
return false; return false;
} }
return Sync::play(song, fbroadcast); playList->clear();
playList->addMedia(song.toMedia());
return play(fbroadcast);
} }
bool Sync::play(const Song &song, bool fbroadcast){ bool Sync::play(const Song &song, bool fbroadcast){
@ -89,27 +100,26 @@ bool Sync::play(const Song &song, bool fbroadcast){
return false; return false;
} }
if(!player->setMediaFromBytes(song.getSource())){ QMediaContent savedSong;
return false; if(!sql->find(static_cast<const SongHeader&>(song), savedSong) && sql->save(song) > -1 &&
} !sql->find((SongHeader&)song, savedSong)){
fbroadcaster = fbroadcast;
if(!findHeader(song) && sql->save(song) > -1 &&
updateSongs(playList) && !findHeader(song)){
return false; return false;
} }
if(fbroadcaster){ return play(savedSong, fbroadcast);
player->play();
sync();
}else{
player->syncBegin();
} }
emit currentSongChanged(); bool Sync::play(const QMediaContent& media, bool fbroadcast){
return true;
if(media.isNull()){
return false;
}
playList->clear();
playList->addMedia(media);
return Sync::play(fbroadcast);
} }
bool Sync::play(int id_song, bool fbroadcast){ bool Sync::play(int id_song, bool fbroadcast){
@ -120,7 +130,7 @@ bool Sync::play(int id_song, bool fbroadcast){
SongHeader header; SongHeader header;
header.id = id_song; header.id = id_song;
Song song; SongStorage song;
sql->load(header, song); sql->load(header, song);
return Sync::play(song, fbroadcast); return Sync::play(song, fbroadcast);
@ -135,22 +145,22 @@ bool Sync::play(QString url){
return Sync::play(id); return Sync::play(id);
} }
Repeat Sync::repeat()const{ QMediaPlaylist::PlaybackMode Sync::repeat()const{
return _repeat; return playList->playbackMode();
} }
void Sync::setRepeat(Repeat flag){ void Sync::setRepeat(QMediaPlaylist::PlaybackMode flag){
_repeat = flag; playList->setPlaybackMode(flag);
} }
bool Sync::pause(bool state){ bool Sync::pause(bool state){
if(!fbroadcaster){ if(!fbroadcaster){
if(playList.isEmpty()) if(playList->isEmpty())
return false; return false;
return play(playList[0]); return play();
} }
if(state){ if(state){
@ -252,18 +262,21 @@ bool Sync::createPackage(Type type, package &pac){
} }
if(type & TypePackage::t_song_h && fbroadcaster){ if(type & TypePackage::t_song_h && fbroadcaster){
if(currentSongIndex < 0) if(playList->currentIndex() < 0)
return false; return false;
pac.header = playList[currentSongIndex]; if(!sql->find(playList->currentMedia(), pac.header)){
return false;
}
} }
if(type & TypePackage::t_song && fbroadcaster){ if(type & TypePackage::t_song && fbroadcaster){
if(currentSongIndex < 0) if(playList->currentIndex() < 0)
return false; return false;
if(!sql->load(playList[currentSongIndex], pac.source)) SongStorage song;
if(!sql->load(playList->currentMedia(), song) && !song.toSong(pac.source))
return false; return false;
} }
@ -387,7 +400,7 @@ void Sync::packageRender(ETcpSocket *socket){
// if requst from client // if requst from client
if(pkg.getType() & t_play & t_sync){ if(pkg.getType() & t_play & t_sync){
if(currentSongIndex < 0){ if(playList->currentIndex() < 0){
throw SyncError(); throw SyncError();
socket->nextItem(); socket->nextItem();
continue; continue;
@ -443,28 +456,10 @@ void Sync::deepScaned(QList<ETcpSocket *> * list){
} }
void Sync::endPlay(QMediaPlayer::State state){ void Sync::endPlay(QMediaPlayer::State state){
if(state == QMediaPlayer::StoppedState){ if(state == QMediaPlayer::StoppedState && playList->currentIndex() != -1){
switch (_repeat) {
case allPlayListRandom:
next(true);
break;
case allPlayList:
next(false);
break;
case oneMusic:
play(playList[currentSongIndex]);
break;
default:
currentSongIndex = -1;
fbroadcaster = false; fbroadcaster = false;
break; break;
} }
}
} }
QString Sync::getVersion(){ QString Sync::getVersion(){
@ -488,19 +483,16 @@ unsigned int Sync::seek() const{
return player->position(); return player->position();
} }
const QList<SongHeader>* Sync::getPlayList() const{ const QMediaPlaylist* Sync::getPlayList() const{
return &playList; return playList;
} }
int Sync::getCurrentSongIndex()const{ int Sync::getCurrentSongIndex()const{
return currentSongIndex; return playList->currentIndex();
} }
const SongHeader* Sync::getCurrentSong() const{ const QMediaContent* Sync::getCurrentSong() const{
if(currentSongIndex < 0 || currentSongIndex >= playList.size()){ return &playList->currentMedia();
return nullptr;
}
return &playList[currentSongIndex];
} }
qint64 Sync::getEndPoint() const { qint64 Sync::getEndPoint() const {

View File

@ -15,8 +15,6 @@ typedef std::chrono::time_point<std::chrono::high_resolution_clock> Clock;
class Node; class Node;
enum Repeat{noRepeat, oneMusic, allPlayList, allPlayListRandom};
/** /**
* @brief The Sync class is main class of this library. * @brief The Sync class is main class of this library.
@ -28,9 +26,8 @@ class Sync : public QObject
private: private:
Node *node; Node *node;
Player *player; Player *player;
QMediaPlaylist playList; QMediaPlaylist *playList;
QString lastUsedPlayList; QString lastUsedPlayList;
int currentSongIndex;
QList<ETcpSocket*> servers; QList<ETcpSocket*> servers;
bool fbroadcaster; bool fbroadcaster;
int resyncCount; int resyncCount;
@ -39,13 +36,6 @@ private:
LocalScanner deepScaner; LocalScanner deepScaner;
MySql *sql; MySql *sql;
int port; int port;
Repeat _repeat;
/**
* @brief findHeader set current song if playList have playng song
* @return true if all done
*/
bool findHeader(const Song& song);
/** /**
* @brief rescan - search for existing servers * @brief rescan - search for existing servers
@ -67,7 +57,7 @@ private slots:
* @brief updateSongs use method update avelable songs from sql database * @brief updateSongs use method update avelable songs from sql database
* @return true if all done * @return true if all done
*/ */
bool updateSongs(QList<SongHeader> &list, const QString &playList = ""); bool updateSongs(QMediaPlaylist &list, const QString &playList = "");
/** /**
* @brief packageRender - the handler of all messages received. * @brief packageRender - the handler of all messages received.
@ -97,13 +87,13 @@ public:
* @brief repeat * @brief repeat
* @return flag of repeat * @return flag of repeat
*/ */
Repeat repeat()const; QMediaPlaylist::PlaybackMode repeat()const;
/** /**
* @brief setRepeat * @brief setRepeat
* @param flag new flag of repeat * @param flag new flag of repeat
*/ */
void setRepeat(Repeat flag); void setRepeat(QMediaPlaylist::PlaybackMode flag);
/** /**
* @brief getSqlApi * @brief getSqlApi
@ -111,6 +101,21 @@ public:
*/ */
MySql* getSqlApi(); MySql* getSqlApi();
/**
* @brief Play song in this device, if device has not supported playning media data this method throw MediaExcrption.
* @param fbroadcast - server broadcasting sound.
* @return true if all done else false.
*/
bool play(bool fbroadcast = true);
/**
* @brief Play song in this device, if device has not supported playning media data this method throw MediaExcrption.
* @param header of song
* @param fbroadcast - server broadcasting sound.
* @return true if all done else false.
*/
bool play(const QMediaContent &media, bool fbroadcast = true);
/** /**
* @brief Play song in this device, if device has not supported playning media data this method throw MediaExcrption. * @brief Play song in this device, if device has not supported playning media data this method throw MediaExcrption.
* @param header of song * @param header of song
@ -229,7 +234,7 @@ public:
* @brief getPlayList * @brief getPlayList
* @return list of available songs * @return list of available songs
*/ */
const QList<SongHeader> *getPlayList() const; const QMediaPlaylist *getPlayList() const;
/** /**
* @brief SongHeader::getCurrentSongIndex * @brief SongHeader::getCurrentSongIndex
@ -241,7 +246,7 @@ public:
* @brief getCurrentSong * @brief getCurrentSong
* @return playing song. * @return playing song.
*/ */
const SongHeader *getCurrentSong() const; const QMediaContent *getCurrentSong() const;
/** /**
* @brief getEndPoint * @brief getEndPoint