Skip to content

Commit

Permalink
Allowing pausing the pipeline from the controller
Browse files Browse the repository at this point in the history
  • Loading branch information
calvaris committed Mar 29, 2012
1 parent cc38946 commit 1a1f9cf
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ void Controller::stopPipeline()
ResourceManager::instance()->releaseResources();
}

void Controller::pausePipeline()
{
m_pipeline->pause();
setPipelineReady(false);
}

void Controller::setupEffects()
{
EffectManager::setup(this);
Expand Down
1 change: 1 addition & 0 deletions src/controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class Controller : public QDeclarativeItem
public slots:
void startPipeline();
void stopPipeline();
void pausePipeline();
void startRecording();
void stopRecording();
void shutterClicked();
Expand Down
8 changes: 8 additions & 0 deletions src/pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ void Pipeline::stop()
gst_element_set_state(camerabin, GST_STATE_NULL);
}

void Pipeline::pause()
{
gst_element_set_state(camerabin, GST_STATE_PAUSED);
}

void Pipeline::prepare()
{
gst_element_set_state(camerabin, GST_STATE_READY);
Expand Down Expand Up @@ -391,6 +396,9 @@ void Pipeline::handleBusMessage(GstMessage *message)
if (GST_ELEMENT(GST_MESSAGE_SRC(message)) == camerabin) {
GstState oldstate, newstate, pending;
gst_message_parse_state_changed(message, &oldstate, &newstate, &pending);
qDebug() << Q_FUNC_INFO << gst_element_state_get_name(oldstate)
<< "->" << gst_element_state_get_name(newstate) << "=>"
<< gst_element_state_get_name(pending);
if (newstate==GST_STATE_PLAYING) {
QMetaObject::invokeMethod(this, "pipelinePlaying", Qt::QueuedConnection);
}
Expand Down
1 change: 1 addition & 0 deletions src/pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class Pipeline : public QObject
void setDevice(const ControllerSettings::Device value);
void start();
void stop();
void pause();
void prepare();
void startRecording();
void stopRecording();
Expand Down

0 comments on commit 1a1f9cf

Please sign in to comment.