You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(28) |
Jul
(44) |
Aug
(27) |
Sep
(30) |
Oct
(1) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(1) |
Feb
(83) |
Mar
(79) |
Apr
(2) |
May
(1) |
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ti...@bu...> - 2006-01-23 21:00:32
|
From: till busch <ti...@bu...> To: dis...@li... Subject: loginfo.pl Content-Type: Text/Plain; charset="UTF-8" CVS commit by till: fix receiver |
From: lucijan b. <lu...@kd...> - 2005-06-12 22:17:44
|
CVS commit by luci: allow a pausing/resuming as expected ;) are we loosing an InputPipe on pause(); skip(); ? some older thingies and missing icons M +1 -1 diskothek/diskothekd/database.h 1.11 M +36 -1 diskothek/diskothekd/dplayer.cpp 1.3 [POSSIBLY UNSAFE: qDebug] M +2 -0 diskothek/diskothekd/dplayer.h 1.4 M +21 -1 diskothek/diskothekd/gstplayer.cpp 1.27 [POSSIBLY UNSAFE: qDebug] M +10 -0 diskothek/diskothekd/gstplayer.h 1.22 --- diskothek/diskothekd/database.h #1.10:1.11 @@ -33,5 +33,5 @@ struct DatabasePrivate * while(query.next()) * { - * /... + * //... * } * \endcode --- diskothek/diskothekd/dplayer.cpp #1.2:1.3 @@ -9,10 +9,15 @@ DPlayer::DPlayer(GstPlayer *parent, DSch m_player = parent; QObject::connect(m_player, SIGNAL(songChanged(const Song &)), this, SLOT(changed(const Song &))); + QObject::connect(m_player, SIGNAL(stateChanged(int)), this, SLOT(stateChanged(int))); registerNotification("skip", 0, this, SLOT(skip())); registerNotification("pause", 1, this, SLOT(pause())); - registerNotification("getCurrentSong", 2, this, SLOT(getCurrentSong(const DInvocation &))); + registerNotification("resume", 2, this, SLOT(resume())); + registerNotification("getCurrentSong", 3, this, SLOT(getCurrentSong(const DInvocation &))); registerNotification("songChanged", 10, 0); + registerNotification("paused", 11, 0); + registerNotification("playing", 12, 0); + registerNotification("stopped", 13, 0); } @@ -26,8 +31,16 @@ void DPlayer::pause() { + qDebug("DPlayer::pause()"); m_player->pause(); } void +DPlayer::resume() +{ + qDebug("DPlayer::resume()"); + m_player->resume(); +} + +void DPlayer::getCurrentSong(const DInvocation &i) { @@ -42,4 +55,26 @@ DPlayer::changed(const Song &s) Song song(s); voidCall("songChanged", song.pack()); +} + +void +DPlayer::stateChanged(int state) +{ + switch(state) + { + case GstPlayer::Paused: + voidCall("paused"); + break; + + case GstPlayer::Playing: + voidCall("playing"); + break; + + case GstPlayer::Stopped: + voidCall("stopped"); + break; + + default: + break; + } } --- diskothek/diskothekd/dplayer.h #1.3:1.4 @@ -18,7 +18,9 @@ class DPlayer : public QObject, public D void skip(); void pause(); + void resume(); void getCurrentSong(const DInvocation &i); void changed(const Song &s); + void stateChanged(int state); private: --- diskothek/diskothekd/gstplayer.cpp #1.26:1.27 @@ -102,5 +102,5 @@ bool GstPlayer::init() scale = gst_element_factory_make ("audioscale", "scale"); */ - m_gst_audiosink = gst_element_factory_make ("alsasink", "sink"); + m_gst_audiosink = gst_element_factory_make ("osssink", "sink"); gst_bin_add_many (GST_BIN (m_gst_outputThread), queue,/* conv, scale,*/ m_gst_audiosink, NULL); @@ -174,4 +174,23 @@ bool GstPlayer::pause() } } + emit stateChanged(Paused); + return true; +} + +bool GstPlayer::resume() +{ + QPtrListIterator<InputPipeline> it(m_inputs); + InputPipeline *in=0; + for(; (in=it.current()); ++it) + { + qDebug("\tplay %s", in->name()); + if(!gst_element_set_state(in->pipeline(), GST_STATE_PLAYING)) + { + qDebug("cannot set PLAYING"); + return false; + } + } + + emit stateChanged(Playing); return true; } @@ -195,4 +214,5 @@ bool GstPlayer::play(uint /*offset*/) emit(songChanged(m_inputs.getFirst()->currentSong())); + emit stateChanged(Playing); //usleep(2000000); //seek(length()-GST_SECOND*20); --- diskothek/diskothekd/gstplayer.h #1.21:1.22 @@ -33,4 +33,12 @@ Q_OBJECT public: + + enum PlayerState + { + Playing=0, + Paused, + Stopped + }; + GstPlayer(QObject *parent); ~GstPlayer(); @@ -39,4 +47,5 @@ public: bool load(const Song &next, bool start=false); bool pause(); + bool resume(); bool preloadNext(); bool skip(); @@ -78,4 +87,5 @@ public slots: signals: void songChanged(const Song &s); + void stateChanged(int state); }; |
From: lucijan b. <lu...@kd...> - 2005-06-12 22:17:44
|
CVS commit by luci: allow a pausing/resuming as expected ;) are we loosing an InputPipe on pause(); skip(); ? some older thingies and missing icons M +6 -0 diskothek/ddoc/dinvocation.cpp 1.3 M +7 -1 diskothek/ddoc/dinvocation.h 1.3 --- diskothek/ddoc/dinvocation.cpp #1.2:1.3 @@ -37,4 +37,10 @@ DInvocation::operator[] (int key) const } +DScheduler * +DInvocation::client() const +{ + return m_sender->scheduler(); +} + DInvocation::~DInvocation() { --- diskothek/ddoc/dinvocation.h #1.2:1.3 @@ -10,4 +10,5 @@ class DMethod; class DObject; class DCall; +class DScheduler; /** @@ -54,4 +55,9 @@ class DInvocation DCall *response() const; + /** + * @returns a pointer to the client \ref DScheduler + */ + DScheduler *client() const; + private: DObject *m_sender; |
From: lucijan b. <lu...@kd...> - 2005-06-12 22:17:44
|
CVS commit by luci: allow a pausing/resuming as expected ;) are we loosing an InputPipe on pause(); skip(); ? some older thingies and missing icons M +7 -0 diskothek/diskothek/diskothekbarbutton.cpp 1.5 M +1 -0 diskothek/diskothek/diskothekbarbutton.h 1.5 M +5 -1 diskothek/diskothek/mainwindow.cpp 1.14 M +38 -0 diskothek/diskothek/player.cpp 1.5 [POSSIBLY UNSAFE: qDebug] M +9 -1 diskothek/diskothek/player.h 1.4 --- diskothek/diskothek/diskothekbarbutton.cpp #1.4:1.5 @@ -25,4 +25,11 @@ DiskothekBarButton::setLabel(const QStri void +DiskothekBarButton::setPixmap(const QPixmap &p) +{ + m_icon = p; + update(); +} + +void DiskothekBarButton::acceptDrops(const QString &mime) { --- diskothek/diskothek/diskothekbarbutton.h #1.4:1.5 @@ -14,4 +14,5 @@ class DiskothekBarButton : public QWidge void setLabel(const QString &label); + void setPixmap(const QPixmap &p); void acceptDrops(const QString &mime); --- diskothek/diskothek/mainwindow.cpp #1.13:1.14 @@ -37,8 +37,9 @@ MainWindow::MainWindow(Connection *c) DiskothekBarButton *btn; DiskothekBarButton *queue; + DiskothekBarButton *pause; SearchBar *search; b->addWidget(new DiskothekBarButton(b, IconLoader::barIcon("rew"), "History")); - b->addWidget(new DiskothekBarButton(b, IconLoader::barIcon("pause"), "Pause")); + b->addWidget(pause=new DiskothekBarButton(b, IconLoader::barIcon("pause"), "Pause")); b->addWidget(btn=new DiskothekBarButton(b, IconLoader::barIcon("fwd"), "Skip")); b->addWidget(queue=new DiskothekBarButton(b, IconLoader::barIcon("queue"), "Queue")); @@ -46,8 +47,11 @@ MainWindow::MainWindow(Connection *c) b->addWidget(search=new SearchBar(b, tr("Search Song"), false)); + m_player->setPauseButton(pause); + queue->acceptDrops("application/diskothek-source"); m_queue = new QueueList(this, queue); connect(btn, SIGNAL(clicked()), m_player, SLOT(skip())); + connect(pause, SIGNAL(clicked()), m_player, SLOT(pause())); connect(queue, SIGNAL(clicked()), this, SLOT(showQueue())); --- diskothek/diskothek/player.cpp #1.4:1.5 @@ -6,4 +6,6 @@ #include "mainwindow.h" #include "connection.h" +#include "diskothekbarbutton.h" +#include "iconloader.h" #include "player.h" @@ -15,4 +17,6 @@ Player::Player(QWidget *parent) DObject *p = connection(this)->importObject(DObject::NDiskothek, "Player"); p->connect("songChanged", this, SLOT(songChanged(const DInvocation &))); + p->connect("paused", this, SLOT(paused(const DInvocation &))); + p->connect("playing", this, SLOT(playing(const DInvocation &))); DCall *current = p->call("getCurrentSong"); @@ -51,2 +55,36 @@ void Player::skip() p->call("skip"); } + +void Player::pause() +{ + qDebug("Player::pause()"); + DObject *p = connection(this)->importObject(DObject::NDiskothek, "Player"); + p->call("pause"); +} + +void Player::resume() +{ + qDebug("Player::resume()"); + DObject *p = connection(this)->importObject(DObject::NDiskothek, "Player"); + p->call("resume"); +} + +void Player::paused(const DInvocation &) +{ + m_btnPause->setPixmap(IconLoader::barIcon("play")); + m_btnPause->setLabel(tr("Continue")); + + m_btnPause->disconnect(this); + connect(m_btnPause, SIGNAL(clicked()), this, SLOT(resume())); +} + +void Player::playing(const DInvocation &) +{ + m_btnPause->setPixmap(IconLoader::barIcon("pause")); + m_btnPause->setLabel(tr("Pause")); + + m_btnPause->disconnect(this); + connect(m_btnPause, SIGNAL(clicked()), this, SLOT(pause())); +} + + --- diskothek/diskothek/player.h #1.3:1.4 @@ -6,4 +6,5 @@ class QLabel; +class DiskothekBarButton; class Player : public QWidget @@ -15,11 +16,18 @@ class Player : public QWidget ~Player(); + void setPauseButton(DiskothekBarButton *b) { m_btnPause = b; } + public slots: void skip(); + void pause(); + void resume(); protected slots: void songChanged(const DInvocation &i); + void paused(const DInvocation &i); + void playing(const DInvocation &i); private: + DiskothekBarButton *m_btnPause; QLabel *m_artist; QLabel *m_title; |
From: lucijan b. <lu...@kd...> - 2005-06-12 22:17:43
|
CVS commit by luci: allow a pausing/resuming as expected ;) are we loosing an InputPipe on pause(); skip(); ? some older thingies and missing icons A diskothek/pics/16/volume_0.png 1.1 A diskothek/pics/16/volume_1.png 1.1 A diskothek/pics/16/volume_2.png 1.1 A diskothek/pics/16/volume_full.png 1.1 |
From: lucijan b. <lu...@kd...> - 2005-06-12 22:17:41
|
CVS commit by luci: allow a pausing/resuming as expected ;) are we loosing an InputPipe on pause(); skip(); ? some older thingies and missing icons A diskothek/pics/32/play.png 1.1 |
From: lucijan b. <lu...@kd...> - 2005-05-08 19:00:32
|
CVS commit by luci: a funky volume widget... not sure if it is really according to hig ;) btw... a minimal space of at least 150 pixles from bottom is required for now A diskothek/diskothek/volumebutton.cpp 1.1 [POSSIBLY UNSAFE: qDebug] [no copyright] A diskothek/diskothek/volumebutton.h 1.1 [no copyright] A diskothek/diskothek/volumeslider.cpp 1.1 [POSSIBLY UNSAFE: qDebug] [no copyright] A diskothek/diskothek/volumeslider.h 1.1 [no copyright] M +4 -2 diskothek/diskothek/diskothek.pro 1.13 M +14 -1 diskothek/diskothek/mainwindow.cpp 1.13 M +2 -0 diskothek/diskothek/mainwindow.h 1.9 --- diskothek/diskothek/diskothek.pro #1.12:1.13 @@ -16,10 +16,12 @@ player.cpp searchbar.cpp navbar.cpp transaction.cpp \ artistlistviewitem.cpp songlist.cpp songlistview.cpp \ - queuelist.cpp songdrag.cpp view.cpp albumlistviewitem.cpp + queuelist.cpp songdrag.cpp view.cpp albumlistviewitem.cpp \ + volumebutton.cpp volumeslider.cpp HEADERS = connectiondialog.h connection.h dcore.h mainwindow.h \ diskothekbar.h diskothekbarbutton.h iconloader.h \ player.h searchbar.h navbar.h transaction.h \ artistlistviewitem.h songlist.h songlistview.h \ - queuelist.h songdrag.h view.h albumlistviewitem.h + queuelist.h songdrag.h view.h albumlistviewitem.h \ + volumebutton.h volumeslider.h FORMS = connectiondlg.ui --- diskothek/diskothek/mainwindow.cpp #1.12:1.13 @@ -18,6 +18,11 @@ #include "queuelist.h" +#include "volumebutton.h" +//#include "top25view.h" + MainWindow::MainWindow(Connection *c) { + statusBar()->addWidget(new VolumeButton(this), 0, true); + m_connection = c; @@ -84,4 +89,12 @@ MainWindow::search(const QString &s) void +MainWindow::showStatistics() +{ +/* QWidget *w = new Top25View(); + w->show(); +*/ +} + +void MainWindow::setupMenu() { @@ -100,5 +113,5 @@ MainWindow::setupMenu() QPopupMenu *tools = new QPopupMenu(); tools->insertItem(tr("Configure &filters..."), 0, 0); - tools->insertItem(tr("S&tatistics..."), 0, 0); + tools->insertItem(tr("S&tatistics..."), this, SLOT(showStatistics())); QPopupMenu *queue = new QPopupMenu(); --- diskothek/diskothek/mainwindow.h #1.8:1.9 @@ -44,4 +44,6 @@ class MainWindow : public QMainWindow void search(const QString &); + void showStatistics(); + private: Connection *m_connection; |
From: lucijan b. <lu...@kd...> - 2005-04-29 11:24:50
|
CVS commit by luci: map contentsToViewport when displaying context menu M +1 -1 diskothek/diskothek/songlistview.cpp 1.8 --- diskothek/diskothek/songlistview.cpp #1.7:1.8 @@ -296,5 +296,5 @@ SongListView::contentsMouseReleaseEvent( if(row <= m_contents.count() && ev->button() == RightButton) { - emit contextMenuRequested(viewport()->mapToGlobal(ev->pos()), row); + emit contextMenuRequested(viewport()->mapToGlobal(contentsToViewport(ev->pos())), row); } } |
From: lucijan b. <lu...@kd...> - 2005-04-28 20:40:05
|
CVS commit by luci: highlight buttons if a accepted drag is over them M +24 -2 diskothek/diskothek/diskothekbarbutton.cpp 1.4 M +1 -0 diskothek/diskothek/diskothekbarbutton.h 1.4 --- diskothek/diskothek/diskothekbarbutton.cpp #1.3:1.4 @@ -93,5 +93,13 @@ DiskothekBarButton::dragEnterEvent(QDrag ev->ignore(); else if(ev->provides(m_mime.latin1())) + { + if(!m_clicked) + { + m_clicked = true; + update(); + } + ev->accept(); + } } @@ -106,6 +114,22 @@ DiskothekBarButton::dragMoveEvent(QDragM void +DiskothekBarButton::dragLeaveEvent(QDragLeaveEvent *) +{ + if(m_clicked) + { + m_clicked = false; + update(); + } +} + +void DiskothekBarButton::dropEvent(QDropEvent *ev) { + if(m_clicked) + { + m_clicked = false; + update(); + } + if(m_mime.isNull()) { @@ -118,6 +142,4 @@ DiskothekBarButton::dropEvent(QDropEvent emit dropped(ev); } - - } --- diskothek/diskothek/diskothekbarbutton.h #1.3:1.4 @@ -24,4 +24,5 @@ class DiskothekBarButton : public QWidge virtual void dragEnterEvent(QDragEnterEvent *ev); virtual void dragMoveEvent(QDragMoveEvent *ev); + virtual void dragLeaveEvent(QDragLeaveEvent *ev); virtual void dropEvent(QDropEvent *ev); |
From: lucijan b. <lu...@kd...> - 2005-03-28 13:38:25
|
CVS commit by luci: - the artist/album drop down works - incremental search for artists / albums M +58 -11 diskothek/diskothek/navbar.cpp 1.6 M +10 -1 diskothek/diskothek/navbar.h 1.5 M +7 -0 diskothek/diskothek/searchbar.cpp 1.4 M +2 -0 diskothek/diskothek/searchbar.h 1.4 --- diskothek/diskothek/navbar.cpp #1.5:1.6 @@ -28,11 +28,12 @@ NavBar::NavBar(QWidget *parent) g->setMargin(3); - SearchBar *search = new SearchBar(this, tr("Artists")); + m_search = new SearchBar(this, tr("Artists")); + connect(m_search, SIGNAL(textChanged(const QString &)), this, SLOT(fastSearch(const QString &))); QPopupMenu *sp = new QPopupMenu(); - sp->insertItem(tr("Artists")); - sp->insertItem(tr("Albums")); + sp->insertItem(tr("Artists"), this, SLOT(showArtists())); + sp->insertItem(tr("Albums"), this, SLOT(showAlbums())); - search->addPopupMenu(sp); + m_search->addPopupMenu(sp); m_list = new QListView(this); @@ -46,11 +47,7 @@ NavBar::NavBar(QWidget *parent) connect(m_list, SIGNAL(expanded(QListViewItem *)), this, SLOT(showAlbumsFromArtist(QListViewItem *))); - DObject *al = connection(this)->importObject(DObject::NDiskothek, "ArtistList"); - DCall *c = al->call("getList"); - new Transaction(this, c, "Artist list", mainWin(this)->statusBar()); - - c->connect("recordSet", this, SLOT(artistResult(const DInvocation &))); + showArtists(); - g->addWidget(search, 0, 0); + g->addWidget(m_search, 0, 0); g->addWidget(m_list, 1 ,0); } @@ -62,4 +59,31 @@ NavBar::sizeHint() const } + +void +NavBar::showArtists() +{ + m_list->clear(); + m_search->setHint(tr("Artists")); + + DObject *al = connection(this)->importObject(DObject::NDiskothek, "ArtistList"); + DCall *c = al->call("getList"); + new Transaction(this, c, "Artist list", mainWin(this)->statusBar()); + + c->connect("recordSet", this, SLOT(artistResult(const DInvocation &))); +} + +void +NavBar::showAlbums() +{ + m_list->clear(); + m_search->setHint(tr("Albums")); + + DObject *al = connection(this)->importObject(DObject::NDiskothek, "AlbumList"); + DCall *c = al->call("getList"); + new Transaction(this, c, "album list", mainWin(this)->statusBar()); + + c->connect("recordSet", this, SLOT(albumResult(const DInvocation &))); +} + void NavBar::artistResult(const DInvocation &di) @@ -70,4 +94,10 @@ NavBar::artistResult(const DInvocation & void +NavBar::albumResult(const DInvocation &di) +{ + new AlbumListViewItem(m_list, di[1].toString(), di[0].toString()); +} + +void NavBar::artistSelected(QListViewItem *i) { @@ -143,4 +173,21 @@ NavBar::albumsFromArtistEnd(const DInvoc new ArtistListViewItem(m_cq, m_cq->id(), m_cq->artist()); m_cq = 0; +} + +void +NavBar::fastSearch(const QString &str) +{ + QListViewItem *i=0; + QString search=str.lower(); + + for(i=m_list->firstChild(); i; i=i->nextSibling()) + { + if(i->text(0).lower().startsWith(search)) + { + m_list->setCurrentItem(i); + m_list->ensureItemVisible(i); + return; + } + } } --- diskothek/diskothek/navbar.h #1.4:1.5 @@ -9,4 +9,5 @@ class QListViewItem; class MainWindow; class ArtistListViewItem; +class SearchBar; class NavBar : public QWidget @@ -21,6 +22,13 @@ class NavBar : public QWidget protected slots: - void artistResult(const DInvocation &); + void showArtists(); + void showAlbums(); + + void fastSearch(const QString &); void artistSelected(QListViewItem *a); + + void artistResult(const DInvocation &); + void albumResult(const DInvocation &); + void showAlbumsFromArtist(QListViewItem *); @@ -31,4 +39,5 @@ class NavBar : public QWidget QListView *m_list; ArtistListViewItem *m_cq; + SearchBar *m_search; }; --- diskothek/diskothek/searchbar.cpp #1.3:1.4 @@ -43,4 +43,11 @@ SearchBar::SearchBar(QWidget *parent, co void +SearchBar::setHint(const QString &hint) +{ + m_hint = hint; + m_edit->setText(hint); +} + +void SearchBar::addPopupMenu(QPopupMenu *menu) { --- diskothek/diskothek/searchbar.h #1.3:1.4 @@ -19,4 +19,6 @@ class SearchBar : public QWidget void addPopupMenu(QPopupMenu *menu); void removePopupMenu(); + + void setHint(const QString &); protected: |
From: till b. <ti...@bu...> - 2005-03-28 11:27:08
|
CVS commit by till: GstPlayer: - remove some excess debugging output (so lucijan does not get bugged about nonsense) M +3 -3 diskothek/diskothekd/gstplayer.cpp 1.26 --- diskothek/diskothekd/gstplayer.cpp #1.25:1.26 @@ -20,5 +20,5 @@ void GstPlayer::cb_underrun(GstElement *el, gpointer /*user_data*/) { - qDebug("QUEUE %s UNDERRUN!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", gst_element_get_name(el)); +// qDebug("QUEUE %s UNDERRUN!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", gst_element_get_name(el)); } @@ -332,10 +332,10 @@ InputPipeline::cb_tag(GstElement*, GstEl InputPipeline* pipe = static_cast<InputPipeline*>(ppipe); guint64 val=0LL; - GValue dest={0}; +/* GValue dest={0}; if(gst_tag_list_copy_value(&dest, taglist, GST_TAG_DURATION)) { qDebug("\tG_VALUE_TYPE_NAME: %s", G_VALUE_TYPE_NAME(&dest)); - } + }*/ if(gst_tag_list_get_uint64(taglist, GST_TAG_DURATION, &val) && val) { |
From: till b. <ti...@bu...> - 2005-03-28 11:23:21
|
CVS commit by till: GstPlayer: - slowly move to PipelineEvents instead of QTimer::singleShot (thread safety) - need more work to be really thread-safe (a mutex for m_inputs) - fix typo in Database M +1 -1 diskothek/diskothekd/database.cpp 1.21 M +100 -22 diskothek/diskothekd/gstplayer.cpp 1.25 [POSSIBLY UNSAFE: qDebug] M +66 -5 diskothek/diskothekd/gstplayer.h 1.21 --- diskothek/diskothekd/database.cpp #1.20:1.21 @@ -184,5 +184,5 @@ Database::createRandom() { //QSqlQuery drop_magic("DROP TABLE IF EXISTS magic"); - QSqlQuery create_magic("CREATE TABLE IF NOT EXTISTS magic "+magicSelect(), d->db); + QSqlQuery create_magic("CREATE TABLE IF NOT EXISTS magic "+magicSelect(), d->db); QSqlQuery magic_index("ALTER TABLE magic CHANGE titleID titleID INT NOT NULL PRIMARY KEY, add index(magic)"); } --- diskothek/diskothekd/gstplayer.cpp #1.24:1.25 @@ -10,4 +10,5 @@ void GstPlayer::cb_error(GstElement * /*gstelement*/, GstElement * /*element*/, GError *err, gchar *message, gpointer /*user_data*/) { + qDebug("output-error"); g_print(err->message); g_print("\n"); @@ -16,4 +17,12 @@ GstPlayer::cb_error(GstElement * /*gstel } +void +GstPlayer::cb_underrun(GstElement *el, gpointer /*user_data*/) +{ + qDebug("QUEUE %s UNDERRUN!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", gst_element_get_name(el)); +} + + + GstPlayer::GstPlayer(QObject *parent) :QObject(parent) @@ -84,4 +93,6 @@ bool GstPlayer::init() m_gst_outputThread = gst_thread_new ("audiobin"); queue = gst_element_factory_make ("queue", "queue0"); + g_signal_connect (queue, "underrun", G_CALLBACK(cb_underrun), NULL); + //gst_element_set(queue, "max-size-buffers", 200, NULL); gst_element_set(queue, "max-size-buffers", 200, NULL); //gst_element_set(queue, "leaky", 1, NULL); @@ -118,5 +129,5 @@ bool GstPlayer::skip() if(old) { - preloadAndPlayNext(false); + preloadAndPlayNext(true); old->fadeOutAndStop(); } @@ -259,7 +270,21 @@ InputPipeline::cb_newpad (GstElement * / qDebug("new-decoded-pad"); + caps = gst_pad_get_caps(pad); + str = gst_caps_get_structure(caps, 0); + if(!g_strrstr(gst_structure_get_name(str), "audio")) + { + qDebug("caps != audio"); + qDebug("caps = %s", gst_structure_get_name(str)); + QApplication::postEvent(pipe, new PipelineErrorEvent(pipe, PipelineErrorEvent::TypeError)); + return; + } probe = gst_probe_new(false, cb_probe, pipe); gst_pad_add_probe(pad, probe); + gst_pad_link(pad, gst_element_get_pad(pipe->audioconvert(), "sink")); + qDebug("link audioconvert -> audioscale"); + gst_pad_link(gst_element_get_pad(pipe->audioconvert(), "src"), gst_element_get_pad(pipe->audioscale(), "sink")); + qDebug("link audioscale -> volume"); + gst_pad_link(gst_element_get_pad(pipe->audioscale(), "src"), gst_element_get_pad(pipe->volume(), "sink")); qDebug("get adder pad"); pipe->m_gst_adderpad = gst_element_get_request_pad(player->m_gst_adder, "sink%d"); @@ -268,4 +293,5 @@ InputPipeline::cb_newpad (GstElement * / g_object_set(G_OBJECT(player->m_gst_adder), "disable-pad", pipe->m_gst_adderpad, NULL); /* only link audio; only link once */ + gst_pad_link(gst_element_get_pad(pipe->volume(), "src"), pipe->m_gst_adderpad); /* if(GST_PAD_IS_LINKED(pipe->m_gst_adderpad)) @@ -286,9 +312,5 @@ InputPipeline::cb_newpad (GstElement * / */ /* link'n'play */ - gst_pad_link(pad, gst_element_get_pad(pipe->audioconvert(), "sink")); - gst_pad_link(gst_element_get_pad(pipe->audioconvert(), "src"), gst_element_get_pad(pipe->audioscale(), "sink")); - gst_pad_link(gst_element_get_pad(pipe->audioscale(), "src"), gst_element_get_pad(pipe->volume(), "sink")); //gst_element_set_state(player->m_gst_adder, GST_STATE_PAUSED); - gst_pad_link(gst_element_get_pad(pipe->volume(), "src"), pipe->m_gst_adderpad); //gst_element_set_state(player->m_gst_adder, GST_STATE_PLAYING); @@ -389,8 +411,7 @@ InputPipeline::cb_probe(GstProbe *probe, if(fade->m_stop) { - g_object_set(G_OBJECT(pipe->player()->m_gst_adder), "enable-pad", pipe->player()->m_inputs.getFirst()->m_gst_adderpad, NULL); - qDebug("enable pad: %d ms", pipe->player()->m_inputs.getFirst()->m_time.restart()); + pipe->player()->m_inputs.getFirst()->enablePad(); QTimer::singleShot(1000, pipe, SLOT(stop())); - QApplication::postEvent(pipe, new PipelineEvent(pipe)); + QApplication::postEvent(pipe, new PipelineStopEvent(pipe)); } pipe->m_fadeList.removeFirst(); @@ -406,5 +427,5 @@ InputPipeline::cb_probe(GstProbe *probe, qDebug("\ttime: %lld, length: %lld", pipe->m_pos, pipe->m_length); QTimer::singleShot(0, pipe->player(), SLOT(preloadAndPlayNext())); - PipelineEvent *e = new PipelineEvent(pipe); + PipelinePreloadEvent *e = new PipelinePreloadEvent(pipe); QApplication::postEvent(pipe, e); } @@ -413,8 +434,45 @@ InputPipeline::cb_probe(GstProbe *probe, } +void +InputPipeline::cb_error(GstElement * /*gstelement*/, GstElement * /*element*/, GError *err, gchar *message, gpointer /*user_data*/) +{ + qDebug("error in InputPipeline"); + g_print(err->message); + g_print("\n"); + g_print(message); + g_print("\n"); +} +/* bool InputPipeline::event(QEvent * e) { - qDebug("InputPipeline::customEvent(QCustomEvent * e)"); - return true; + qDebug("InputPipeline::event(QEvent * e)"); + return false; +} +*/ +void InputPipeline::customEvent(QCustomEvent * e) +{ + qDebug("InputPipeline::customEvent(QCustomEvent * e=%d)", e->type()); + switch(e->type()) + { + case DEvent::PipelineError: + { + PipelineErrorEvent *pe = static_cast<PipelineErrorEvent*>(e); + qDebug("\terror %d in Pipeline %x", pe->errorType(), pe->pipeline()); + switch(pe->errorType()) + { + case PipelineErrorEvent::TypeError: + pe->pipeline()->player()->preloadAndPlayNext(true); + break; + default: + break; + } + qDebug("\tsignal to client, CLEANUP!"); + } + break; + default: + qDebug("\tunknown event"); + break; + } + return; } @@ -425,4 +483,17 @@ void InputPipeline::cb_removed_decoded_p } +void InputPipeline::enablePad() +{ + m_start=true; + if(m_gst_adderpad && GST_IS_PAD(m_gst_adderpad)) + { + g_object_set(G_OBJECT(player()->m_gst_adder), "enable-pad", m_gst_adderpad, NULL); + qDebug("enable pad: %d ms", m_time.restart()); + } + else + { + qDebug("will start immediately: %d ms", m_time.restart()); + } +} void InputPipeline::cb_unknown_type(GstElement* /*object*/, GstPad* pad, GstCaps* caps, gpointer /*user_data*/) @@ -434,4 +505,11 @@ void InputPipeline::cb_unknown_type(GstE } +void InputPipeline::cb_have_type(GstElement* object, guint arg0, GstCaps* caps, gpointer user_data) +{ + GstStructure *str; + str = gst_caps_get_structure(caps, 0); + qDebug("have-type"); + qDebug("\tpad %s, caps %s", gst_element_get_name(object), gst_structure_get_name(str)); +} void @@ -468,9 +546,8 @@ InputPipeline::cb_eos(GstElement * /*bin */ - qDebug("enable pad: %d ms", pipe->player()->m_inputs.getFirst()->m_time.restart()); - g_object_set(G_OBJECT(pipe->player()->m_gst_adder), "enable-pad", pipe->player()->m_inputs.getFirst()->m_gst_adderpad, NULL); + pipe->player()->m_inputs.getFirst()->enablePad(); } - QTimer::singleShot(5000, pipe, SLOT(eosReached())); - PipelineEvent *e = new PipelineEvent(pipe); + QTimer::singleShot(5000, pipe, SLOT(cleanup())); + PipelineEosEvent *e = new PipelineEosEvent(pipe); QApplication::postEvent(pipe, e); @@ -487,12 +564,12 @@ void InputPipeline::stop() //gst_bin_sync_children_state(GST_BIN(pipeline())); - QTimer::singleShot(1000, this, SLOT(eosReached())); - QApplication::postEvent(this, new PipelineEvent(this)); + QTimer::singleShot(1000, this, SLOT(cleanup())); + QApplication::postEvent(this, new PipelineEosEvent(this)); qDebug("InputPipeline::stop() done."); } -void InputPipeline::eosReached() +void InputPipeline::cleanup() { - qDebug("eosReached() bin: %s", name()); + qDebug("cleanup() bin: %s", name()); InputPipeline *pipe=this; @@ -556,5 +633,5 @@ void InputPipeline::eosReached() } */ - qDebug("eosReached() done."); + qDebug("cleanup() done."); player()->removeInput(this); } @@ -571,11 +648,12 @@ bool InputPipeline::load(const Song &son m_filename = song.url(); m_gst_pipeline = gst_bin_new(NULL); - g_signal_connect (m_gst_pipeline, "error", G_CALLBACK(GstPlayer::cb_error), NULL); + g_signal_connect (m_gst_pipeline, "error", G_CALLBACK(cb_error), NULL); m_gst_src = gst_element_factory_make ("filesrc", NULL); m_gst_decoder = gst_element_factory_make ("decodebin", NULL); - gst_element_set(m_gst_decoder, "threaded", true, NULL); + //gst_element_set(m_gst_decoder, "threaded", true, NULL); g_signal_connect(m_gst_decoder, "new-decoded-pad", G_CALLBACK(cb_newpad), this); g_signal_connect (m_gst_decoder, "unknown-type", G_CALLBACK(cb_unknown_type), NULL); g_signal_connect (m_gst_decoder, "removed-decoded-pad", G_CALLBACK(cb_removed_decoded_pad), NULL); +// g_signal_connect (m_gst_decoder, "have-type", G_CALLBACK(cb_have_type), NULL); m_gst_volume = gst_element_factory_make ("volume", NULL); // m_gst_volume = gst_element_factory_make ("volenv", NULL); --- diskothek/diskothekd/gstplayer.h #1.20:1.21 @@ -12,4 +12,18 @@ class InputPipeline; +class DEvent: public QCustomEvent +{ + public: + enum Type + { + PipelineError = QEvent::User, + PipelineEos, + PipelineStop, + PipelinePreload + }; + + DEvent(Type t) + :QCustomEvent(t) {}; +}; class GstPlayer : public QObject @@ -34,4 +48,5 @@ public: static void eos_cb( GstElement*, gpointer ); static void cb_error( GstElement*, GstElement*, GError*, gchar*, gpointer ); + static void cb_underrun(GstElement *el, gpointer /*user_data*/); bool seek(guint64 offset); GstClockTime length(); @@ -65,9 +80,9 @@ signals: }; -class PipelineEvent : public QCustomEvent +class PipelineEvent : public DEvent { public: - PipelineEvent(InputPipeline *p) - :QCustomEvent(65432), m_pipeline(p) {} + PipelineEvent(InputPipeline *p, Type type=PipelineError) + :DEvent(type), m_pipeline(p) {} InputPipeline *pipeline() const { return m_pipeline; } private: @@ -75,4 +90,45 @@ private: }; +class PipelineErrorEvent : public PipelineEvent +{ +public: + enum ErrorType + { + UnknownError, + LinkError, + TypeError + }; + + PipelineErrorEvent(InputPipeline *p, ErrorType t=UnknownError) + :PipelineEvent(p, PipelineError), m_type(t) {} + ErrorType errorType() const { return m_type; } +private: + ErrorType m_type; +}; + +class PipelineStopEvent : public PipelineEvent +{ +public: + PipelineStopEvent(InputPipeline *p) + :PipelineEvent(p, PipelineStop) {} +private: +}; + +class PipelineEosEvent : public PipelineEvent +{ +public: + PipelineEosEvent(InputPipeline *p) + :PipelineEvent(p, PipelineEos) {} +private: +}; + +class PipelinePreloadEvent : public PipelineEvent +{ +public: + PipelinePreloadEvent(InputPipeline *p) + :PipelineEvent(p, PipelinePreload) {} +private: +}; + class Fade { @@ -118,10 +174,11 @@ public: public slots: - void eosReached(); + void cleanup(); void fadeOutAndStop(); void stop(); protected: - virtual bool event(QEvent * e); +// virtual bool event(QEvent * e); + virtual void customEvent(QCustomEvent * e); void addFade(GstClockTime pos, double startVol, double endVol, GstClockTime length, bool stop); @@ -134,6 +191,10 @@ private: static gboolean cb_probe (GstProbe *probe, GstData **data, gpointer user_data); static void cb_tag(GstElement*, GstElement*, GstTagList* taglist, gpointer ppipe); + static void cb_error(GstElement*, GstElement*, GError*, gchar*, gpointer); + static void cb_have_type(GstElement* object, guint arg0, GstCaps* arg1, gpointer user_data); + static void env_register_cp(GstElement * volenv, double cp_time, double cp_level); + void enablePad(); GstElement *volume() { return m_gst_volume; } |
From: lucijan b. <lu...@kd...> - 2005-03-28 10:15:26
|
CVS commit by luci: - ui enhencements in client - code cleanups in client - albums by artist shown A diskothek/diskothekd/dalbumlist.cpp 1.1 [no copyright] A diskothek/diskothekd/dalbumlist.h 1.1 [no copyright] M +11 -0 diskothek/diskothekd/dartistlist.cpp 1.6 M +12 -0 diskothek/diskothekd/database.cpp 1.20 M +1 -0 diskothek/diskothekd/database.h 1.10 M +3 -2 diskothek/diskothekd/diskothekd.pro 1.17 M +3 -1 diskothek/diskothekd/nativeclient.cpp 1.13 --- diskothek/diskothekd/dartistlist.cpp #1.5:1.6 @@ -69,4 +69,15 @@ void DArtistList::albumsByArtist(const DInvocation &v) { + DCall *c = v.response(); + + c->voidCall("resultSetBegin"); + + QSqlQuery q("SELECT DISTINCT(albums.ID), albums.album_name FROM titles LEFT JOIN albums ON titles.album = albums.ID WHERE artist = " + Database::escape(v[1].toString()) + " ORDER BY album_name"); + while(q.next()) + { + c->voidCall("recordSet", QVariant(v[1]), q.value(0), q.value(1)); + } + + c->voidCall("resultSetEnd"); } --- diskothek/diskothekd/database.cpp #1.19:1.20 @@ -230,4 +230,16 @@ Database::songsByArtist(const QString &a QSqlQuery +Database::songsInAlbum(const QString &albumID) +{ + if(!d) + return QSqlQuery(); + + QString q = songBaseQuery(); + q += " WHERE titles.album = " + escape(albumID); + + return QSqlQuery(q, d->db); +} + +QSqlQuery Database::queue() { --- diskothek/diskothekd/database.h #1.9:1.10 @@ -64,4 +64,5 @@ class Database QString magicSelect(); QSqlQuery songsByArtist(const QString &artistID); + QSqlQuery songsInAlbum(const QString &albumID); QSqlQuery queue(); void remagic(const Song &s); --- diskothek/diskothekd/diskothekd.pro #1.16:1.17 @@ -12,9 +12,10 @@ dconfig.cpp gstplayer.cpp database.cpp reader.cpp \ dartistlist.cpp musichub.cpp musichubclient.cpp dmusichub.cpp \ - dplayer.cpp queue.cpp metawatcher.cpp dmeta.cpp + dplayer.cpp queue.cpp metawatcher.cpp dmeta.cpp \ + dalbumlist.cpp HEADERS = player.h server.h stream.h clientconnection.h nativeclient.h httpclient.h \ dconfig.h gstplayer.h database.h reader.h \ dartistlist.h musichub.h musichubclient.h dmusichub.h dplayer.h \ - queue.h metawatcher.h dmeta.h + queue.h metawatcher.h dmeta.h dalbumlist.h unix { --- diskothek/diskothekd/nativeclient.cpp #1.12:1.13 @@ -12,4 +12,5 @@ #include "nativeclient.h" +#include "dalbumlist.h" #include "dartistlist.h" @@ -35,6 +36,7 @@ NativeClient::NativeClient(ClientConnect */ - registerObject(new DArtistList(this, this)); registerObject(new DMusicHub(g_music_hub, this)); + registerObject(new DArtistList(this, this)); + registerObject(new DAlbumList(this, this)); registerObject(new DPlayer(g_players->first(), this, 5)); registerObject(new Queue(this, 6)); |
From: lucijan b. <lu...@kd...> - 2005-03-28 10:15:26
|
CVS commit by luci: - ui enhencements in client - code cleanups in client - albums by artist shown M +18 -0 diskothek/libdiskothek/song.cpp 1.6 M +6 -1 diskothek/libdiskothek/song.h 1.5 --- diskothek/libdiskothek/song.cpp #1.5:1.6 @@ -2,4 +2,5 @@ #include <qvaluelist.h> #include <qsqlquery.h> +#include <qdatetime.h> #include "song.h" @@ -115,4 +116,21 @@ Song::value(int field) const return QString::null; +} + +QString +Song::formatedLength() const +{ + if(!m_data) + return QString::null; + + int etime = m_data->data[Length].toInt(); + int min = etime / 60; + int secs = etime - (min * 60); + + QString sec = QString::number(secs); + if(secs < 10) + sec = QString("0%1").arg(sec); + + return QString("%1:%2 ").arg(min).arg(sec); } --- diskothek/libdiskothek/song.h #1.4:1.5 @@ -122,8 +122,13 @@ public: /** - * returns value of \a field + * @returns value of \a field */ QString value(int field) const; + /** + * @returns a human formated time string of length (e.g. 2:04) + */ + QString formatedLength() const; + /** * returns all data in a sent-ready QValueList<QVariant> |
From: lucijan b. <lu...@kd...> - 2005-03-28 10:15:26
|
CVS commit by luci: - ui enhencements in client - code cleanups in client - albums by artist shown A diskothek/diskothek/albumlistviewitem.cpp 1.1 [no copyright] A diskothek/diskothek/albumlistviewitem.h 1.1 [no copyright] A diskothek/diskothek/view.cpp 1.1 [POSSIBLY UNSAFE: qDebug] [no copyright] A diskothek/diskothek/view.h 1.1 [no copyright] M +13 -3 diskothek/diskothek/artistlistviewitem.cpp 1.2 M +12 -2 diskothek/diskothek/artistlistviewitem.h 1.2 M +12 -5 diskothek/diskothek/connectiondialog.cpp 1.6 M +1 -0 diskothek/diskothek/connectiondialog.h 1.3 M +2 -2 diskothek/diskothek/diskothek.pro 1.12 M +2 -1 diskothek/diskothek/main.cpp 1.7 M +45 -73 diskothek/diskothek/mainwindow.cpp 1.12 M +11 -9 diskothek/diskothek/mainwindow.h 1.8 M +82 -11 diskothek/diskothek/navbar.cpp 1.5 M +8 -0 diskothek/diskothek/navbar.h 1.4 M +36 -2 diskothek/diskothek/searchbar.cpp 1.3 [POSSIBLY UNSAFE: qDebug] M +4 -1 diskothek/diskothek/searchbar.h 1.3 M +18 -9 diskothek/diskothek/songlistview.cpp 1.7 M +1 -0 diskothek/diskothek/songlistview.h 1.5 |
From: lucijan b. <lu...@kd...> - 2005-03-28 10:15:26
|
CVS commit by luci: - ui enhencements in client - code cleanups in client - albums by artist shown M +1 -0 diskothek/ddoc/dobject.cpp 1.11 [POSSIBLY UNSAFE: qDebug] --- diskothek/ddoc/dobject.cpp #1.10:1.11 @@ -13,4 +13,5 @@ DObject::DObject() DObject::DObject(DScheduler *sched, int serial, DNamespace ns, const QString &name) { + qDebug("DObject::DObject(%p, %i, %i, %s)", sched, serial, ns, name.latin1()); m_serial = serial; m_namespace = ns; |
From: till b. <ti...@bu...> - 2005-03-22 15:32:33
|
CVS commit by till: GstPlayer: - continue playing, even if length was completely wrong - need a lot of clean-up now M +13 -4 diskothek/diskothekd/gstplayer.cpp 1.24 [POSSIBLY UNSAFE: qDebug] --- diskothek/diskothekd/gstplayer.cpp #1.23:1.24 @@ -440,4 +440,13 @@ InputPipeline::cb_eos(GstElement * /*bin InputPipeline* pipe = static_cast<InputPipeline*>(ppipe); qDebug("eos in %s", pipe->name()); + qDebug("\t\t%s: Time: %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT "\r", pipe->name(), GST_TIME_ARGS (pipe->m_pos), GST_TIME_ARGS (pipe->m_length)); + if(!pipe->m_eosWarningSignaled) + { + pipe->m_eosWarningSignaled=true; + qDebug("\teos PRELOAD!"); + pipe->player()->preloadAndPlayNext(true); + } + else + { /* gint64 len; @@ -458,8 +467,8 @@ InputPipeline::cb_eos(GstElement * /*bin } */ - qDebug("\t\t%s: Time: %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT "\r", pipe->name(), GST_TIME_ARGS (pipe->m_pos), GST_TIME_ARGS (pipe->m_length)); + qDebug("enable pad: %d ms", pipe->player()->m_inputs.getFirst()->m_time.restart()); g_object_set(G_OBJECT(pipe->player()->m_gst_adder), "enable-pad", pipe->player()->m_inputs.getFirst()->m_gst_adderpad, NULL); - + } QTimer::singleShot(5000, pipe, SLOT(eosReached())); PipelineEvent *e = new PipelineEvent(pipe); |
From: till b. <ti...@bu...> - 2005-03-22 15:18:15
|
CVS commit by till: GstPlayer: - get length from xing tag, if available - query for length each second, if length moving M +77 -10 diskothek/diskothekd/gstplayer.cpp 1.23 [POSSIBLY UNSAFE: qDebug] M +5 -0 diskothek/diskothekd/gstplayer.h 1.20 --- diskothek/diskothekd/gstplayer.cpp #1.22:1.23 @@ -226,4 +226,8 @@ void GstPlayer::preloadAndPlayNext(bool Song GstPlayer::currentSong() const { + if(!m_inputs.getFirst()) + { + return Song(); + } return m_inputs.getFirst()->currentSong(); } @@ -300,4 +304,25 @@ InputPipeline::cb_newpad (GstElement * / } +void +InputPipeline::cb_tag(GstElement*, GstElement*, GstTagList* taglist, gpointer ppipe) +{ + qDebug("found-tag"); + InputPipeline* pipe = static_cast<InputPipeline*>(ppipe); + guint64 val=0LL; + GValue dest={0}; + + if(gst_tag_list_copy_value(&dest, taglist, GST_TAG_DURATION)) + { + qDebug("\tG_VALUE_TYPE_NAME: %s", G_VALUE_TYPE_NAME(&dest)); + } + if(gst_tag_list_get_uint64(taglist, GST_TAG_DURATION, &val) && val) + { + qDebug("\tDURATION: %lld", val); + qDebug("\tTime: %" GST_TIME_FORMAT, GST_TIME_ARGS (val)); + pipe->m_length=val; + pipe->m_lengthStable=true; + } +} + gboolean InputPipeline::cb_probe(GstProbe *probe, GstData **data, gpointer ppipe) @@ -314,14 +339,38 @@ InputPipeline::cb_probe(GstProbe *probe, if(gst_element_query(pipe->decoder(), GST_QUERY_TOTAL, &fmt, &len)) { - qDebug("\t\tTime: %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT "\r", GST_TIME_ARGS (pipe->m_pos), GST_TIME_ARGS (len)); pipe->m_length=len; + } + } + // each second + if(pipe->m_pos > pipe->m_oldPos + GST_SECOND) + { + pipe->m_oldPos = pipe->m_pos; + GstClockTime lastLength = pipe->m_length; + if(!pipe->m_lengthStable) + { + gint64 len; + GstFormat fmt = GST_FORMAT_TIME; + if(gst_element_query(pipe->decoder(), GST_QUERY_TOTAL, &fmt, &len)) + { + pipe->m_length=len; + qDebug("\t\t%s: Time: %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT "\r", pipe->name(), GST_TIME_ARGS (pipe->m_pos), GST_TIME_ARGS (len)); + if(pipe->m_length==lastLength) + { pipe->addFade(pipe->m_length-GST_SECOND, 1.0, 0.0, GST_SECOND, true); + pipe->m_lengthStable=true; + } } } + } + /* if(pipe->m_pos < GST_SECOND/4) { + gint64 len; + GstFormat fmt = GST_FORMAT_TIME; + if(gst_element_query(pipe->decoder(), GST_QUERY_TOTAL, &fmt, &len)) + pipe->m_length=len; qDebug("\t\telapsed: %d ms", pipe->m_time.elapsed()); qDebug("\t\tTime: %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT "\r", GST_TIME_ARGS (pipe->m_pos), GST_TIME_ARGS (pipe->m_length)); - } + }*/ // FADING Fade *fade=pipe->m_fadeList.getFirst(); @@ -348,4 +397,5 @@ InputPipeline::cb_probe(GstProbe *probe, } } + if(pipe->m_pos >= pipe->m_length-GST_SECOND*5 || pipe->m_length < GST_SECOND*5) { @@ -390,5 +440,23 @@ InputPipeline::cb_eos(GstElement * /*bin InputPipeline* pipe = static_cast<InputPipeline*>(ppipe); qDebug("eos in %s", pipe->name()); - qDebug("\tTime: %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT "\r", GST_TIME_ARGS (pipe->m_pos), GST_TIME_ARGS (pipe->m_length)); +/* + gint64 len; + GstFormat fmt = GST_FORMAT_TIME; + if(gst_element_query(pipe->decoder(), GST_QUERY_POSITION, &fmt, &len)) + { + qDebug("\t\tTime: %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT "\r", GST_TIME_ARGS (pipe->m_pos), GST_TIME_ARGS (len)); + pipe->m_pos=len; + } + if(gst_element_query(pipe->decoder(), GST_QUERY_TOTAL, &fmt, &len)) + { + qDebug("\t\tTime: %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT "\r", GST_TIME_ARGS (pipe->m_pos), GST_TIME_ARGS (len)); + pipe->m_length=len; + } + else + { + qDebug("failed to GST_QUERY_TOTAL"); + } +*/ + qDebug("\t\t%s: Time: %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT "\r", pipe->name(), GST_TIME_ARGS (pipe->m_pos), GST_TIME_ARGS (pipe->m_length)); qDebug("enable pad: %d ms", pipe->player()->m_inputs.getFirst()->m_time.restart()); g_object_set(G_OBJECT(pipe->player()->m_gst_adder), "enable-pad", pipe->player()->m_inputs.getFirst()->m_gst_adderpad, NULL); @@ -489,5 +557,7 @@ bool InputPipeline::load(const Song &son m_eosWarningSignaled=false; m_length=0; + m_lengthStable=false; m_pos=0; + m_oldPos=0; m_filename = song.url(); m_gst_pipeline = gst_bin_new(NULL); @@ -505,4 +575,5 @@ bool InputPipeline::load(const Song &son gst_bin_add_many(GST_BIN(m_gst_pipeline), m_gst_src, m_gst_decoder, m_gst_audioconvert, m_gst_audioscale, m_gst_volume, NULL); gst_bin_add(GST_BIN(m_player->m_gst_pipeline), m_gst_pipeline); + g_signal_connect(m_gst_decoder, "found-tag", G_CALLBACK(cb_tag), this); g_signal_connect(m_gst_pipeline, "eos", G_CALLBACK(cb_eos), this); g_object_set(G_OBJECT(m_gst_src), "location", static_cast<const char*>(QFile::encodeName(m_filename)), NULL); @@ -515,9 +586,5 @@ bool InputPipeline::load(const Song &son */ //gst_element_set_state(m_gst_pipeline, GST_STATE_READY); -/* - if(!gst_element_set_state(m_gst_pipeline, GST_STATE_PAUSED)) - { - qDebug("cannot input queue to PAUSED"); - }*/ + qDebug("loaded %s", m_filename.latin1()); m_time.start(); --- diskothek/diskothekd/gstplayer.h #1.19:1.20 @@ -133,4 +133,6 @@ private: static void cb_state (GstElement *el, int old, int n, gpointer data); static gboolean cb_probe (GstProbe *probe, GstData **data, gpointer user_data); + static void cb_tag(GstElement*, GstElement*, GstTagList* taglist, gpointer ppipe); + static void env_register_cp(GstElement * volenv, double cp_time, double cp_level); @@ -145,5 +147,7 @@ private: GstElement *m_gst_queue; GstClockTime m_pos; + GstClockTime m_oldPos; GstClockTime m_length; + GstClockTime m_lastLength; GstClockTime m_buflen; GstPad *m_gst_adderpad; @@ -153,4 +157,5 @@ private: Song m_song; bool m_start; + bool m_lengthStable; QSortedList<Fade> m_fadeList; |
From: till b. <ti...@bu...> - 2005-03-21 18:31:50
|
CVS commit by till: GstPlayer: - try being a bit more stable M +36 -25 diskothek/diskothekd/gstplayer.cpp 1.22 [POSSIBLY UNSAFE: qDebug] M +5 -4 diskothek/diskothekd/gstplayer.h 1.19 M +1 -1 diskothek/diskothekd/main.cpp 1.25 --- diskothek/diskothekd/gstplayer.cpp #1.21:1.22 @@ -19,7 +19,11 @@ GstPlayer::GstPlayer(QObject *parent) :QObject(parent) { + m_inputs.setAutoDelete(true); } - +void GstPlayer::removeInput(InputPipeline *in) +{ + m_inputs.remove(in); +} static gboolean @@ -111,8 +115,14 @@ GstPlayer::~GstPlayer() bool GstPlayer::skip() { - InputPipeline *old = m_activeSrc; - preloadAndPlayNext(); + InputPipeline *old = m_inputs.getFirst(); + if(old) + { + preloadAndPlayNext(false); old->fadeOutAndStop(); - //g_object_set(G_OBJECT(m_gst_adder), "disable-pad", m_activeSrc->m_gst_adderpad, NULL); + } + else + { + preloadAndPlayNext(true); + } /* GstElementState state = GST_STATE_PAUSED; @@ -166,5 +176,5 @@ bool GstPlayer::play(uint /*offset*/) }*/ g_print("set PLAYING\n"); - if(!gst_element_set_state(m_activeSrc->pipeline(), GST_STATE_PLAYING)) + if(!gst_element_set_state(m_inputs.getFirst()->pipeline(), GST_STATE_PLAYING)) { qDebug("\tcannot set PLAYING"); @@ -173,5 +183,5 @@ bool GstPlayer::play(uint /*offset*/) g_print("now PLAYING\n"); - emit(songChanged(m_activeSrc->currentSong())); + emit(songChanged(m_inputs.getFirst()->currentSong())); //usleep(2000000); //seek(length()-GST_SECOND*20); @@ -191,9 +201,9 @@ bool GstPlayer::seek(guint64 offset) } -bool GstPlayer::load(const Song &s) +bool GstPlayer::load(const Song &s, bool start) { - m_activeSrc= new InputPipeline(this); - m_activeSrc->load(s); - m_inputs.append(m_activeSrc); + InputPipeline *input=new InputPipeline(this); + input->load(s, start); + m_inputs.insert(0,input); return true; } @@ -204,9 +214,9 @@ bool GstPlayer::preloadNext() } -void GstPlayer::preloadAndPlayNext() +void GstPlayer::preloadAndPlayNext(bool start) { qDebug("GstPlayer::preloadAndPlayNext()"); Song s(Database::db().nextSong()); - load(s); + load(s, start); //QTimer::singleShot(500, this, SLOT(play())); play(); @@ -216,10 +226,10 @@ void GstPlayer::preloadAndPlayNext() Song GstPlayer::currentSong() const { - return m_activeSrc->currentSong(); + return m_inputs.getFirst()->currentSong(); } GstClockTime GstPlayer::length() { - return m_activeSrc->length(); + return m_inputs.getFirst()->length(); } @@ -251,5 +261,5 @@ InputPipeline::cb_newpad (GstElement * / pipe->m_gst_adderpad = gst_element_get_request_pad(player->m_gst_adder, "sink%d"); qDebug("\tGot new adder sink pad %s", gst_pad_get_name(pipe->m_gst_adderpad)); - if(!first) + if(!pipe->m_start) g_object_set(G_OBJECT(player->m_gst_adder), "disable-pad", pipe->m_gst_adderpad, NULL); /* only link audio; only link once */ @@ -330,6 +340,6 @@ InputPipeline::cb_probe(GstProbe *probe, if(fade->m_stop) { - g_object_set(G_OBJECT(pipe->player()->m_gst_adder), "enable-pad", pipe->player()->m_activeSrc->m_gst_adderpad, NULL); - qDebug("enable pad: %d ms", pipe->player()->m_activeSrc->m_time.restart()); + g_object_set(G_OBJECT(pipe->player()->m_gst_adder), "enable-pad", pipe->player()->m_inputs.getFirst()->m_gst_adderpad, NULL); + qDebug("enable pad: %d ms", pipe->player()->m_inputs.getFirst()->m_time.restart()); QTimer::singleShot(1000, pipe, SLOT(stop())); QApplication::postEvent(pipe, new PipelineEvent(pipe)); @@ -381,6 +391,6 @@ InputPipeline::cb_eos(GstElement * /*bin qDebug("eos in %s", pipe->name()); qDebug("\tTime: %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT "\r", GST_TIME_ARGS (pipe->m_pos), GST_TIME_ARGS (pipe->m_length)); - qDebug("enable pad: %d ms", pipe->player()->m_activeSrc->m_time.restart()); - g_object_set(G_OBJECT(pipe->player()->m_gst_adder), "enable-pad", pipe->player()->m_activeSrc->m_gst_adderpad, NULL); + qDebug("enable pad: %d ms", pipe->player()->m_inputs.getFirst()->m_time.restart()); + g_object_set(G_OBJECT(pipe->player()->m_gst_adder), "enable-pad", pipe->player()->m_inputs.getFirst()->m_gst_adderpad, NULL); QTimer::singleShot(5000, pipe, SLOT(eosReached())); @@ -407,5 +417,5 @@ void InputPipeline::stop() void InputPipeline::eosReached() { - qDebug("eosReached()"); + qDebug("eosReached() bin: %s", name()); InputPipeline *pipe=this; @@ -470,9 +480,10 @@ void InputPipeline::eosReached() */ qDebug("eosReached() done."); - delete this; + player()->removeInput(this); } -bool InputPipeline::load(const Song &song) +bool InputPipeline::load(const Song &song, bool start) { + m_start = start; m_song = song; m_eosWarningSignaled=false; @@ -568,5 +579,5 @@ void InputPipeline::addFade(GstClockTime pos, double startVol, double endVol, GstClockTime length, bool stop) { - m_fadeList.inSort(new Fade(pos, startVol, endVol, length, stop)); + m_fadeList.inSort(new Fade(pos<=m_length?pos:m_pos, startVol, endVol, length, stop)); Fade *f = m_fadeList.getFirst(); if(f) --- diskothek/diskothekd/gstplayer.h #1.18:1.19 @@ -23,5 +23,5 @@ public: bool init(); bool createPipeline(); - bool load(const Song &next); + bool load(const Song &next, bool start=false); bool pause(); bool preloadNext(); @@ -51,10 +51,10 @@ protected: // GstElement *m_gst_audioscale; // GstElement *m_gst_volume; - InputPipeline *m_activeSrc; + void removeInput(InputPipeline *in); QPtrList<InputPipeline> m_inputs; public slots: - void preloadAndPlayNext(); + void preloadAndPlayNext(bool start=false); bool play(uint offset=0); // void handleInputError(); @@ -102,5 +102,5 @@ public: ~InputPipeline(); - bool load(const Song &s); + bool load(const Song &s, bool start=false); GstPlayer *player() {return m_player; } @@ -152,4 +152,5 @@ private: bool m_eosWarningSignaled; Song m_song; + bool m_start; QSortedList<Fade> m_fadeList; --- diskothek/diskothekd/main.cpp #1.24:1.25 @@ -57,5 +57,5 @@ int main(int argc, char **argv) // p->load("/home/till/archive/kvirc/openprojects/incoming/the_child_in_us.wav.ogg"); // p->load("/home/mp3.1/V.A./Hi-Fidelity_Dub_Sessions_vol.5/06-binder_and_krieglstein--wir_wissen_nicht_(shantels_bucovina_dub)-kw.mp3"); - p->preloadAndPlayNext(); + p->skip(); /* p->preloadNext(); |
From: till b. <ti...@bu...> - 2005-03-21 18:31:46
|
CVS commit by till: GstPlayer: - try being a bit more stable M +1 -1 diskothek/dkadder/dkadder.pro 1.2 --- diskothek/dkadder/dkadder.pro #1.1:1.2 @@ -10,5 +10,5 @@ TARGET=dkadder -CONFIG+=thread staticlib debug +CONFIG+=thread staticlib #CONFIG-=shared |
From: till b. <ti...@bu...> - 2005-03-21 14:48:09
|
CVS commit by till: reserve space for items, instead of resizing the list and appending to it. :-) M +1 -1 diskothek/diskothek/songlistview.cpp 1.6 --- diskothek/diskothek/songlistview.cpp #1.5:1.6 @@ -48,5 +48,5 @@ SongListView::setData(SongList *l) Songs songs=l->songs(); - m_contents.resize(songs.count()); + m_contents.reserve(songs.count()); for(Songs::Iterator it=songs.begin(); it != songs.end(); ++it) { |
From: lucijan b. <lu...@kd...> - 2005-03-21 14:26:59
|
CVS commit by luci: - sweet listview - song drag - dragging songs on queue - many more A diskothek/diskothek/songdrag.cpp 1.1 [POSSIBLY UNSAFE: qDebug] [no copyright] A diskothek/diskothek/songdrag.h 1.1 [no copyright] M +2 -2 diskothek/diskothek/diskothek.pro 1.11 M +42 -0 diskothek/diskothek/diskothekbarbutton.cpp 1.3 M +7 -0 diskothek/diskothek/diskothekbarbutton.h 1.3 M +2 -1 diskothek/diskothek/mainwindow.cpp 1.11 M +17 -0 diskothek/diskothek/queuelist.cpp 1.4 [POSSIBLY UNSAFE: qDebug] M +1 -0 diskothek/diskothek/queuelist.h 1.4 M +283 -15 diskothek/diskothek/songlistview.cpp 1.5 [POSSIBLY UNSAFE: qDebug] M +76 -4 diskothek/diskothek/songlistview.h 1.4 |
From: till b. <ti...@bu...> - 2005-03-20 22:25:39
|
CVS commit by till: add a GstElement named "dkadder" - this is the normal gst adder plugin + enable-pad and disable-pad properties improve on GstPlayer A diskothek/dkadder/.cvsignore 1.1 A diskothek/dkadder/dkadder.c 1.1 [POSSIBLY UNSAFE: printf] [LGPL (v2+)] A diskothek/dkadder/dkadder.h 1.1 [LGPL (v2+)] A diskothek/dkadder/dkadder.pro 1.1 |
From: till b. <ti...@bu...> - 2005-03-20 22:25:21
|
CVS commit by till: add a GstElement named "dkadder" - this is the normal gst adder plugin + enable-pad and disable-pad properties improve on GstPlayer M +1 -0 diskothek/diskothekd/diskothekd.pro 1.16 M +142 -65 diskothek/diskothekd/gstplayer.cpp 1.21 [POSSIBLY UNSAFE: qDebug] M +29 -8 diskothek/diskothekd/gstplayer.h 1.18 --- diskothek/diskothekd/diskothekd.pro #1.15:1.16 @@ -42,4 +42,5 @@ LIBS += -lddoc LIBS += -lqdnssd + LIBS += -Bdynamic -Wl,--unresolved-symbols=ignore-all ../dkadder/libdkadder.a } --- diskothek/diskothekd/gstplayer.cpp #1.20:1.21 @@ -1,8 +1,10 @@ -#include "database.h" -#include "gstplayer.h" #include <qfile.h> #include <qtimer.h> #include <qapplication.h> +#include "database.h" +#include "gstplayer.h" +#include "dkadder/dkadder.h" + void GstPlayer::cb_error(GstElement * /*gstelement*/, GstElement * /*element*/, GError *err, gchar *message, gpointer /*user_data*/) @@ -19,4 +21,28 @@ GstPlayer::GstPlayer(QObject *parent) } + + +static gboolean +register_elements (GstPlugin *plugin) +{ + qDebug("register elements"); + return gst_element_register (plugin, "dkadder", GST_RANK_NONE, DK_TYPE_ADDER); +} + + +static GstPluginDesc plugin_desc = { + GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "diskothek", + "Private elements of my application", + register_elements, + NULL, + "0.0.1", + "LGPL", + "diskothek", + "http://www.my-application.net/", + GST_PADDING_INIT +}; + bool GstPlayer::init() { @@ -25,4 +51,19 @@ bool GstPlayer::init() /* init GStreamer */ gst_init_check(NULL, NULL); + /* + GError *e = NULL; + GstPlugin *plug=gst_plugin_load_file("dkadder/libdkadder.so", &e); + if(plug) + { + qDebug("loaded plugin"); + }else + { + g_print(e->message); + g_print("\n"); + } +*/ + if(!gst_library_load("gstbytestream")) + qDebug("GstPlayer::init() failed to load gstbytestream"); + _gst_plugin_register_static (&plugin_desc); /* setup */ @@ -30,5 +71,9 @@ bool GstPlayer::init() g_signal_connect (m_gst_pipeline, "error", G_CALLBACK (cb_error), NULL); - m_gst_adder = gst_element_factory_make ("adder", "adder"); + m_gst_adder = gst_element_factory_make ("dkadder", "adder"); + if(!m_gst_adder) + { + qDebug("GstPlayer::init() failed to create adder"); + } /* out */ @@ -52,5 +97,8 @@ bool GstPlayer::init() /* run */ - gst_element_set_state (m_gst_outputThread, GST_STATE_PAUSED); + if(!gst_element_set_state (m_gst_outputThread, GST_STATE_PLAYING)) + { + qDebug("GstPlayer::init() canot set PLAYING"); + } return true; @@ -66,10 +114,16 @@ bool GstPlayer::skip() preloadAndPlayNext(); old->fadeOutAndStop(); + //g_object_set(G_OBJECT(m_gst_adder), "disable-pad", m_activeSrc->m_gst_adderpad, NULL); /* - if(!gst_element_set_state(old->pipeline(), GST_STATE_PAUSED)) + GstElementState state = GST_STATE_PAUSED; + if(gst_element_get_state(m_activeSrc->pipeline()) != GST_STATE_PLAYING) + state = GST_STATE_PLAYING; + if(!gst_element_set_state(m_activeSrc->pipeline(), state)) { - qDebug("\tcannot set PAUSED"); - return false; - }*/ + qDebug("cannot change state"); + } + m_activeSrc->m_time.start(); + m_activeSrc->m_length=0; + */ } @@ -194,6 +248,9 @@ InputPipeline::cb_newpad (GstElement * / gst_pad_add_probe(pad, probe); + qDebug("get adder pad"); pipe->m_gst_adderpad = gst_element_get_request_pad(player->m_gst_adder, "sink%d"); qDebug("\tGot new adder sink pad %s", gst_pad_get_name(pipe->m_gst_adderpad)); + if(!first) + g_object_set(G_OBJECT(player->m_gst_adder), "disable-pad", pipe->m_gst_adderpad, NULL); /* only link audio; only link once */ /* @@ -240,52 +297,44 @@ InputPipeline::cb_probe(GstProbe *probe, InputPipeline* pipe = static_cast<InputPipeline*>(ppipe); - //GstClockTime lastpos=pipe->m_pos; pipe->m_pos = GST_BUFFER_TIMESTAMP(*data); - //GstClockTime buflen = pipe->m_buflen; - pipe->m_buflen = GST_BUFFER_DURATION(*data); - /* - if(pipe->m_pos < lastpos) - { - qDebug("disordered probe? %lld, %lld, %lld", lastpos-pipe->m_pos, buflen, pipe->m_buflen); - }*/ -/* if(buflen != pipe->m_buflen) - { - //qDebug("\tbuffer-duration: %lld, buf-p-s:%f, pos:%lld", pipe->m_buflen, (double)GST_SECOND/pipe->m_buflen, pipe->m_pos); - }*/ if(!pipe->m_length) { - qDebug("elapsed since load: %d ms", pipe->m_time.elapsed()); gint64 len; GstFormat fmt = GST_FORMAT_TIME; if(gst_element_query(pipe->decoder(), GST_QUERY_TOTAL, &fmt, &len)) { -// qDebug("\t\tTime: %lld / %lld", pos/1000000000LL, len/1000000000LL); qDebug("\t\tTime: %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT "\r", GST_TIME_ARGS (pipe->m_pos), GST_TIME_ARGS (len)); pipe->m_length=len; + pipe->addFade(pipe->m_length-GST_SECOND, 1.0, 0.0, GST_SECOND, true); } - pipe->m_fade_start=1.0; - pipe->m_fade_step=0; - pipe->m_fade_val=pipe->m_fade_start; - pipe->m_fade_start_at=pipe->m_length-GST_SECOND*3; - //pipe->m_fade_start_at=GST_SECOND*2; } - if(pipe->m_pos >= pipe->m_fade_start_at) - { - pipe->m_fade_step++; - int fade_steps_remain = ((pipe->m_fade_start_at+GST_SECOND*pipe->m_fade_duration)-(pipe->m_pos))/pipe->m_buflen; - if(fade_steps_remain <= 1) + if(pipe->m_pos < GST_SECOND/4) { - fade_steps_remain = 1; - pipe->m_fade_start_at = pipe->m_length; + qDebug("\t\telapsed: %d ms", pipe->m_time.elapsed()); + qDebug("\t\tTime: %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT "\r", GST_TIME_ARGS (pipe->m_pos), GST_TIME_ARGS (pipe->m_length)); } - double fade_increase = ((double)pipe->m_fade_end-pipe->m_fade_val)/(fade_steps_remain); - pipe->m_fade_val += fade_increase; - double vol = 1-log10((1-(pipe->m_fade_val)) * 9 + 1); + // FADING + Fade *fade=pipe->m_fadeList.getFirst(); + if(fade && pipe->m_pos >= fade->m_pos) + { + pipe->m_buflen = GST_BUFFER_DURATION(*data); + fade->m_step++; + int fade_steps_remain = QMAX(1,((fade->m_pos+fade->m_duration)-(pipe->m_pos))/pipe->m_buflen); + double fade_increase = ((double)fade->m_endVol-fade->m_val)/(fade_steps_remain); + fade->m_val += fade_increase; + double vol = 1-log10((1-(fade->m_val)) * 9 + 1); pipe->setVolume(vol); - if(fade_steps_remain == 1 && pipe->m_stop_after_fade) + qDebug("fade f_steps_remain:%d f_inc:%f f_val:%0.2f vol:%f f-step:%d", fade_steps_remain, fade_increase, fade->m_val, vol, fade->m_step); + if(fade_steps_remain == 1) { - QTimer::singleShot(0, pipe, SLOT(stop())); + if(fade->m_stop) + { + g_object_set(G_OBJECT(pipe->player()->m_gst_adder), "enable-pad", pipe->player()->m_activeSrc->m_gst_adderpad, NULL); + qDebug("enable pad: %d ms", pipe->player()->m_activeSrc->m_time.restart()); + QTimer::singleShot(1000, pipe, SLOT(stop())); QApplication::postEvent(pipe, new PipelineEvent(pipe)); } + pipe->m_fadeList.removeFirst(); + } } if(pipe->m_pos >= pipe->m_length-GST_SECOND*5 || pipe->m_length < GST_SECOND*5) @@ -294,5 +343,5 @@ InputPipeline::cb_probe(GstProbe *probe, { pipe->m_eosWarningSignaled=true; - qDebug("\tt - 2"); + qDebug("\tt - 5 PRELOAD!"); qDebug("\ttime: %lld, length: %lld", pipe->m_pos, pipe->m_length); QTimer::singleShot(0, pipe->player(), SLOT(preloadAndPlayNext())); @@ -331,4 +380,7 @@ InputPipeline::cb_eos(GstElement * /*bin InputPipeline* pipe = static_cast<InputPipeline*>(ppipe); qDebug("eos in %s", pipe->name()); + qDebug("\tTime: %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT "\r", GST_TIME_ARGS (pipe->m_pos), GST_TIME_ARGS (pipe->m_length)); + qDebug("enable pad: %d ms", pipe->player()->m_activeSrc->m_time.restart()); + g_object_set(G_OBJECT(pipe->player()->m_gst_adder), "enable-pad", pipe->player()->m_activeSrc->m_gst_adderpad, NULL); QTimer::singleShot(5000, pipe, SLOT(eosReached())); @@ -341,12 +393,12 @@ void InputPipeline::stop() { qDebug("InputPipeline::stop()"); - /* - if(!gst_element_set_state(pipeline(), GST_STATE_NULL)) + + if(!gst_element_set_state(src(), GST_STATE_PAUSED)) { qDebug("failed to set input pipe to NULL"); } - gst_bin_sync_children_state(GST_BIN(pipeline())); - */ - QTimer::singleShot(0, this, SLOT(eosReached())); + //gst_bin_sync_children_state(GST_BIN(pipeline())); + + QTimer::singleShot(1000, this, SLOT(eosReached())); QApplication::postEvent(this, new PipelineEvent(this)); qDebug("InputPipeline::stop() done."); @@ -355,5 +407,5 @@ void InputPipeline::stop() void InputPipeline::eosReached() { - qDebug("eosReached"); + qDebug("eosReached()"); InputPipeline *pipe=this; @@ -374,9 +426,9 @@ void InputPipeline::eosReached() { qDebug("failed to set input pipe to NULL"); - }/* + } if(!gst_bin_sync_children_state(GST_BIN(pipe->pipeline()))) { qDebug("failed to sync input pipe"); - } + }/* if(gst_pad_is_linked(gst_element_get_pad(pipe->volume(), "src"))) { @@ -417,5 +469,6 @@ void InputPipeline::eosReached() } */ - qDebug("eos done."); + qDebug("eosReached() done."); + delete this; } @@ -431,4 +484,5 @@ bool InputPipeline::load(const Song &son m_gst_src = gst_element_factory_make ("filesrc", NULL); m_gst_decoder = gst_element_factory_make ("decodebin", NULL); + gst_element_set(m_gst_decoder, "threaded", true, NULL); g_signal_connect(m_gst_decoder, "new-decoded-pad", G_CALLBACK(cb_newpad), this); g_signal_connect (m_gst_decoder, "unknown-type", G_CALLBACK(cb_unknown_type), NULL); @@ -449,9 +503,10 @@ bool InputPipeline::load(const Song &son env_register_cp(m_gst_volume, 2.0, 1.0); */ - gst_element_set_state(m_gst_pipeline, GST_STATE_READY); + //gst_element_set_state(m_gst_pipeline, GST_STATE_READY); +/* if(!gst_element_set_state(m_gst_pipeline, GST_STATE_PAUSED)) { qDebug("cannot input queue to PAUSED"); - } + }*/ qDebug("loaded %s", m_filename.latin1()); m_time.start(); @@ -461,12 +516,16 @@ bool InputPipeline::load(const Song &son void InputPipeline::fadeOutAndStop() { - m_fade_start_at = m_pos; //now! - m_fade_step=0; - m_fade_val=m_fade_start; + addFade(m_pos, 1.0, 0.0, GST_SECOND*1, true); +} - m_fade_duration=1.0; - m_fade_start=1.0; - m_fade_end=0.0; - m_stop_after_fade=true; +void InputPipeline::cb_state (GstElement *el, int old, int n, gpointer data) +{ + InputPipeline *pipe = static_cast<InputPipeline*>(data); + qDebug("state-change: %d, %d", old, n); + if(n==9) + if(!gst_element_set_state(pipe->m_gst_pipeline, GST_STATE_PAUSED)) + { + qDebug("cannot input queue to PAUSED"); + } } @@ -494,12 +553,30 @@ bool InputPipeline::seek(guint64 offset) } -const char* InputPipeline::name() +const char* +InputPipeline::name() { return gst_element_get_name(m_gst_pipeline); } -Song InputPipeline::currentSong() const +Song +InputPipeline::currentSong() const { return m_song; +} + +void +InputPipeline::addFade(GstClockTime pos, double startVol, double endVol, GstClockTime length, bool stop) +{ + m_fadeList.inSort(new Fade(pos, startVol, endVol, length, stop)); + Fade *f = m_fadeList.getFirst(); + if(f) + { + qDebug("first fade is: %lld, %lld", f->m_pos, m_pos); + } +} + +Fade::Fade(GstClockTime pos, double startVol, double endVol, GstClockTime duration, bool stop) +:m_pos(pos),m_startVol(startVol),m_endVol(endVol),m_duration(duration),m_stop(stop),m_step(0),m_val(startVol) +{ } --- diskothek/diskothekd/gstplayer.h #1.17:1.18 @@ -4,4 +4,5 @@ #include <qobject.h> #include <qptrlist.h> +#include <qsortedlist.h> #include <gst/gst.h> #include <song.h> @@ -74,6 +75,26 @@ private: }; +class Fade +{ + public: + Fade(GstClockTime pos, double startVol, double endVol, GstClockTime duration, bool stop); + + GstClockTime m_pos; + double m_startVol; + double m_endVol; + GstClockTime m_duration; + bool m_stop; + + int m_step; + double m_val; + + bool operator<(const Fade& f2) { return m_pos < f2.m_pos; } + bool operator>(const Fade& f2) { return m_pos > f2.m_pos; } + bool operator==(const Fade& f2) { return m_pos == f2.m_pos; } +}; + class InputPipeline : public QObject { +friend class GstPlayer; Q_OBJECT public: @@ -103,4 +124,5 @@ public slots: protected: virtual bool event(QEvent * e); + void addFade(GstClockTime pos, double startVol, double endVol, GstClockTime length, bool stop); private: @@ -109,4 +131,5 @@ private: static void cb_newpad(GstElement *decodebin, GstPad *pad, gboolean last, gpointer pplayer); static void cb_eos (GstElement *thread, gpointer data); + static void cb_state (GstElement *el, int old, int n, gpointer data); static gboolean cb_probe (GstProbe *probe, GstData **data, gpointer user_data); static void env_register_cp(GstElement * volenv, double cp_time, double cp_level); @@ -125,15 +148,12 @@ private: GstClockTime m_buflen; GstPad *m_gst_adderpad; - QString m_filename; - int m_fade_step; - double m_fade_val; - double m_fade_start; - double m_fade_end; - double m_fade_duration; - GstClockTime m_fade_start_at; - bool m_stop_after_fade; + QString m_filename; bool m_eosWarningSignaled; Song m_song; + + QSortedList<Fade> m_fadeList; + + // debug QTime m_time; }; |
From: till b. <ti...@bu...> - 2005-03-20 22:24:42
|
CVS commit by till: add a GstElement named "dkadder" - this is the normal gst adder plugin + enable-pad and disable-pad properties improve on GstPlayer M +5 -2 diskothek/diskothek/connectiondlg.ui 1.2 --- diskothek/diskothek/connectiondlg.ui #1.1.1.1:1.2 @@ -189,8 +189,11 @@ </property> <property name="text"> - <string>&Connect</string> + <string>C&onnect</string> </property> <property name="accel"> - <string>Alt+C</string> + <string>Alt+O</string> + </property> + <property name="default"> + <bool>true</bool> </property> </widget> |