mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
Renamed Media* to Video* to avoid confusion.
This commit is contained in:
+9
-9
@@ -29,9 +29,9 @@ MainWindow::MainWindow()
|
||||
{
|
||||
// Create model.
|
||||
#if QT_VERSION >= 0x050500
|
||||
QMessageLogger(__FILE__, __LINE__, 0).info() << "Video support: " << (Media::hasVideoSupport() ? "yes" : "no");
|
||||
QMessageLogger(__FILE__, __LINE__, 0).info() << "Video support: " << (Video::hasVideoSupport() ? "yes" : "no");
|
||||
#else
|
||||
QMessageLogger(__FILE__, __LINE__, 0).debug() << "Video support: " << (Media::hasVideoSupport() ? "yes" : "no");
|
||||
QMessageLogger(__FILE__, __LINE__, 0).debug() << "Video support: " << (Video::hasVideoSupport() ? "yes" : "no");
|
||||
#endif
|
||||
|
||||
mappingManager = new MappingManager;
|
||||
@@ -242,7 +242,7 @@ void MainWindow::handlePaintChanged(Paint::ptr paint) {
|
||||
uid paintId = mappingManager->getPaintId(paint);
|
||||
|
||||
if (paint->getType() == "media") {
|
||||
QSharedPointer<Media> media = qSharedPointerCast<Media>(paint);
|
||||
QSharedPointer<Video> media = qSharedPointerCast<Video>(paint);
|
||||
Q_CHECK_PTR(media);
|
||||
updatePaintItem(paintId, media->getIcon(), strippedName(media->getUri()));
|
||||
// QString fileName = QFileDialog::getOpenFileName(this,
|
||||
@@ -942,7 +942,7 @@ uid MainWindow::createMediaPaint(uid paintId, QString uri, float x, float y,
|
||||
if (isImage)
|
||||
tex = new Image(uri, paintId);
|
||||
else {
|
||||
tex = new Media(uri, live, rate, paintId);
|
||||
tex = new Video(uri, live, rate, paintId);
|
||||
}
|
||||
|
||||
// Create new image with corresponding ID.
|
||||
@@ -2277,7 +2277,7 @@ bool MainWindow::importMediaFile(const QString &fileName, bool isImage)
|
||||
uint mediaId = createMediaPaint(NULL_UID, fileName, 0, 0, isImage, live);
|
||||
|
||||
// Initialize position (center).
|
||||
QSharedPointer<Media> media = qSharedPointerCast<Media>(mappingManager->getPaintById(mediaId));
|
||||
QSharedPointer<Video> media = qSharedPointerCast<Video>(mappingManager->getPaintById(mediaId));
|
||||
Q_CHECK_PTR(media);
|
||||
|
||||
if (_isPlaying)
|
||||
@@ -2338,7 +2338,7 @@ void MainWindow::addPaintItem(uid paintId, const QIcon& icon, const QString& nam
|
||||
PaintGui::ptr paintGui;
|
||||
QString paintType = paint->getType();
|
||||
if (paintType == "media")
|
||||
paintGui = PaintGui::ptr(new MediaGui(paint));
|
||||
paintGui = PaintGui::ptr(new VideoGui(paint));
|
||||
else if (paintType == "image")
|
||||
paintGui = PaintGui::ptr(new ImageGui(paint));
|
||||
else if (paintType == "color")
|
||||
@@ -2998,7 +2998,7 @@ bool MainWindow::setTextureUri(int texture_id, const std::string &uri)
|
||||
{
|
||||
if (paint->getType() == "media")
|
||||
{
|
||||
Media *media = static_cast<Media*>(paint.data()); // FIXME: use sharedptr cast
|
||||
Video *media = static_cast<Video*>(paint.data()); // FIXME: use sharedptr cast
|
||||
videoTimer->stop();
|
||||
success = media->setUri(QString(uri.c_str()));
|
||||
videoTimer->start();
|
||||
@@ -3031,7 +3031,7 @@ bool MainWindow::setTextureRate(int texture_id, double rate)
|
||||
{
|
||||
if (paint->getType() == "media")
|
||||
{
|
||||
Media *media = static_cast<Media*>(paint.data()); // FIXME: use sharedptr cast
|
||||
Video *media = static_cast<Video*>(paint.data()); // FIXME: use sharedptr cast
|
||||
videoTimer->stop();
|
||||
media->setRate(rate);
|
||||
videoTimer->start();
|
||||
@@ -3057,7 +3057,7 @@ bool MainWindow::setTextureVolume(int texture_id, double volume)
|
||||
{
|
||||
if (paint->getType() == "media")
|
||||
{
|
||||
Media *media = static_cast<Media*>(paint.data()); // FIXME: use sharedptr cast
|
||||
Video *media = static_cast<Video*>(paint.data()); // FIXME: use sharedptr cast
|
||||
videoTimer->stop();
|
||||
media->setVolume(volume);
|
||||
videoTimer->start();
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
#include "Paint.h"
|
||||
#include "MediaImpl.h"
|
||||
#include "VideoImpl.h"
|
||||
#include <iostream>
|
||||
|
||||
UidAllocator Paint::allocator;
|
||||
@@ -41,21 +41,21 @@ bool Image::setUri(const QString &uri)
|
||||
}
|
||||
|
||||
/* Implementation of the Video class */
|
||||
Media::Media(int id) : Texture(id),
|
||||
Video::Video(int id) : Texture(id),
|
||||
uri(""),
|
||||
impl(NULL)
|
||||
{
|
||||
impl = new MediaImpl("", false);
|
||||
impl = new VideoImpl("", false);
|
||||
setRate(1);
|
||||
setVolume(1);
|
||||
}
|
||||
|
||||
Media::Media(const QString uri_, bool live, double rate, uid id):
|
||||
Video::Video(const QString uri_, bool live, double rate, uid id):
|
||||
Texture(id),
|
||||
uri(uri_),
|
||||
impl(NULL)
|
||||
{
|
||||
impl = new MediaImpl("", live);
|
||||
impl = new VideoImpl("", live);
|
||||
setRate(rate);
|
||||
setVolume(1);
|
||||
setUri(uri_);
|
||||
@@ -63,91 +63,91 @@ Media::Media(const QString uri_, bool live, double rate, uid id):
|
||||
|
||||
// vertigo
|
||||
|
||||
Media::~Media()
|
||||
Video::~Video()
|
||||
{
|
||||
delete impl;
|
||||
}
|
||||
|
||||
void Media::build()
|
||||
void Video::build()
|
||||
{
|
||||
this->impl->build();
|
||||
}
|
||||
|
||||
int Media::getWidth() const
|
||||
int Video::getWidth() const
|
||||
{
|
||||
while (!this->impl->videoIsConnected());
|
||||
return this->impl->getWidth();
|
||||
}
|
||||
|
||||
int Media::getHeight() const
|
||||
int Video::getHeight() const
|
||||
{
|
||||
while (!this->impl->videoIsConnected());
|
||||
return this->impl->getHeight();
|
||||
}
|
||||
|
||||
void Media::update() {
|
||||
void Video::update() {
|
||||
impl->update();
|
||||
}
|
||||
|
||||
void Media::play()
|
||||
void Video::play()
|
||||
{
|
||||
impl->setPlayState(true);
|
||||
}
|
||||
|
||||
void Media::pause()
|
||||
void Video::pause()
|
||||
{
|
||||
impl->setPlayState(false);
|
||||
}
|
||||
|
||||
void Media::rewind()
|
||||
void Video::rewind()
|
||||
{
|
||||
impl->resetMovie();
|
||||
}
|
||||
|
||||
void Media::lockMutex() {
|
||||
void Video::lockMutex() {
|
||||
impl->lockMutex();
|
||||
}
|
||||
|
||||
void Media::unlockMutex() {
|
||||
void Video::unlockMutex() {
|
||||
impl->unlockMutex();
|
||||
}
|
||||
|
||||
const uchar* Media::getBits()
|
||||
const uchar* Video::getBits()
|
||||
{
|
||||
return this->impl->getBits();
|
||||
}
|
||||
|
||||
bool Media::bitsHaveChanged() const
|
||||
bool Video::bitsHaveChanged() const
|
||||
{
|
||||
return this->impl->bitsHaveChanged();
|
||||
}
|
||||
|
||||
void Media::setRate(double rate)
|
||||
void Video::setRate(double rate)
|
||||
{
|
||||
impl->setRate(rate);
|
||||
}
|
||||
|
||||
double Media::getRate() const
|
||||
double Video::getRate() const
|
||||
{
|
||||
return impl->getRate();
|
||||
}
|
||||
|
||||
void Media::setVolume(double rate)
|
||||
void Video::setVolume(double rate)
|
||||
{
|
||||
impl->setVolume(rate);
|
||||
}
|
||||
|
||||
double Media::getVolume() const
|
||||
double Video::getVolume() const
|
||||
{
|
||||
return impl->getVolume();
|
||||
}
|
||||
|
||||
bool Media::hasVideoSupport()
|
||||
bool Video::hasVideoSupport()
|
||||
{
|
||||
return MediaImpl::hasVideoSupport();
|
||||
return VideoImpl::hasVideoSupport();
|
||||
}
|
||||
|
||||
bool Media::setUri(const QString &uri)
|
||||
bool Video::setUri(const QString &uri)
|
||||
{
|
||||
static QFileIconProvider provider;
|
||||
|
||||
|
||||
@@ -218,12 +218,12 @@ public:
|
||||
virtual QIcon getIcon() const { return QIcon(QPixmap::fromImage(image)); }
|
||||
};
|
||||
|
||||
class MediaImpl; // forward declaration
|
||||
class VideoImpl; // forward declaration
|
||||
|
||||
/**
|
||||
* Paint that is a Texture retrieved via a video file.
|
||||
*/
|
||||
class Media : public Texture
|
||||
class Video : public Texture
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -237,9 +237,9 @@ public:
|
||||
static const int ICON_TIMEOUT = 1000;
|
||||
|
||||
public:
|
||||
Q_INVOKABLE Media(int id=NULL_UID);
|
||||
Media(const QString uri_, bool live, double rate, uid id=NULL_UID);
|
||||
virtual ~Media();
|
||||
Q_INVOKABLE Video(int id=NULL_UID);
|
||||
Video(const QString uri_, bool live, double rate, uid id=NULL_UID);
|
||||
virtual ~Video();
|
||||
const QString getUri() const
|
||||
{
|
||||
return uri;
|
||||
@@ -299,7 +299,7 @@ protected:
|
||||
* Private implementation, so that GStreamer headers don't need
|
||||
* to be included from every file in the project.
|
||||
*/
|
||||
MediaImpl *impl;
|
||||
VideoImpl *impl;
|
||||
};
|
||||
|
||||
#endif /* PAINT_H_ */
|
||||
|
||||
+4
-4
@@ -120,14 +120,14 @@ void ImageGui::setValue(QtProperty* property, const QVariant& value) {
|
||||
PaintGui::setValue(property, value);
|
||||
}
|
||||
|
||||
MediaGui::MediaGui(Paint::ptr paint)
|
||||
VideoGui::VideoGui(Paint::ptr paint)
|
||||
: TextureGui(paint)
|
||||
{
|
||||
media = qSharedPointerCast<Media>(paint);
|
||||
media = qSharedPointerCast<Video>(paint);
|
||||
Q_CHECK_PTR(media);
|
||||
|
||||
_mediaFileItem = _variantManager->addProperty(VariantManager::filePathTypeId(),
|
||||
tr("Media file"));
|
||||
tr("Video file"));
|
||||
|
||||
_mediaFileItem->setAttribute("filter", tr("Video files (%1);;All files (*)").arg(MM::VIDEO_FILES_FILTER));
|
||||
_mediaFileItem->setValue(media->getUri());
|
||||
@@ -157,7 +157,7 @@ MediaGui::MediaGui(Paint::ptr paint)
|
||||
// _topItem->addSubProperty(_mediaReverseItem);
|
||||
}
|
||||
|
||||
void MediaGui::setValue(QtProperty* property, const QVariant& value)
|
||||
void VideoGui::setValue(QtProperty* property, const QVariant& value)
|
||||
{
|
||||
if (property == _mediaFileItem)
|
||||
{
|
||||
|
||||
+4
-4
@@ -120,18 +120,18 @@ protected:
|
||||
QtVariantProperty* _imageFileItem;
|
||||
};
|
||||
|
||||
class MediaGui : public TextureGui {
|
||||
class VideoGui : public TextureGui {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MediaGui(Paint::ptr paint);
|
||||
virtual ~MediaGui() {}
|
||||
VideoGui(Paint::ptr paint);
|
||||
virtual ~VideoGui() {}
|
||||
|
||||
public slots:
|
||||
virtual void setValue(QtProperty* property, const QVariant& value);
|
||||
|
||||
protected:
|
||||
QSharedPointer<Media> media;
|
||||
QSharedPointer<Video> media;
|
||||
QtVariantProperty* _mediaFileItem;
|
||||
QtVariantProperty* _mediaRateItem;
|
||||
QtVariantProperty* _mediaVolumeItem;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* MediaImpl.cpp
|
||||
* VideoImpl.cpp
|
||||
*
|
||||
* (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com
|
||||
* (c) 2013 Alexandre Quessy -- alexandre(@)quessy(.)net
|
||||
@@ -21,13 +21,13 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "MediaImpl.h"
|
||||
#include "VideoImpl.h"
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
// -------- private implementation of VideoImpl -------
|
||||
|
||||
bool MediaImpl::hasVideoSupport()
|
||||
bool VideoImpl::hasVideoSupport()
|
||||
{
|
||||
static bool did_print_gst_version = false;
|
||||
if (! did_print_gst_version)
|
||||
@@ -42,21 +42,21 @@ bool MediaImpl::hasVideoSupport()
|
||||
return true;
|
||||
}
|
||||
|
||||
int MediaImpl::getWidth() const
|
||||
int VideoImpl::getWidth() const
|
||||
{
|
||||
return _width;
|
||||
// Q_ASSERT(videoIsConnected());
|
||||
// return _padHandlerData.width;
|
||||
}
|
||||
|
||||
int MediaImpl::getHeight() const
|
||||
int VideoImpl::getHeight() const
|
||||
{
|
||||
return _height;
|
||||
// Q_ASSERT(videoIsConnected());
|
||||
// return _padHandlerData.height;
|
||||
}
|
||||
|
||||
const uchar* MediaImpl::getBits()
|
||||
const uchar* VideoImpl::getBits()
|
||||
{
|
||||
// Reset bits changed.
|
||||
_bitsChanged = false;
|
||||
@@ -65,23 +65,23 @@ const uchar* MediaImpl::getBits()
|
||||
return (hasBits() ? _data : NULL);
|
||||
}
|
||||
|
||||
QString MediaImpl::getUri() const
|
||||
QString VideoImpl::getUri() const
|
||||
{
|
||||
return _uri;
|
||||
}
|
||||
|
||||
bool MediaImpl::getAttached()
|
||||
bool VideoImpl::getAttached()
|
||||
{
|
||||
return _attached;
|
||||
}
|
||||
|
||||
void MediaImpl::setAttached(bool attach)
|
||||
void VideoImpl::setAttached(bool attach)
|
||||
{
|
||||
_attached = attach;
|
||||
}
|
||||
|
||||
|
||||
void MediaImpl::setRate(double rate)
|
||||
void VideoImpl::setRate(double rate)
|
||||
{
|
||||
if (rate == 0)
|
||||
{
|
||||
@@ -100,7 +100,7 @@ void MediaImpl::setRate(double rate)
|
||||
}
|
||||
}
|
||||
|
||||
void MediaImpl::setVolume(double volume)
|
||||
void VideoImpl::setVolume(double volume)
|
||||
{
|
||||
// Only update volume if needed.
|
||||
if (_volume != volume)
|
||||
@@ -112,7 +112,7 @@ void MediaImpl::setVolume(double volume)
|
||||
}
|
||||
}
|
||||
|
||||
void MediaImpl::build()
|
||||
void VideoImpl::build()
|
||||
{
|
||||
qDebug() << "Building video impl";
|
||||
if (!loadMovie(_uri))
|
||||
@@ -121,7 +121,7 @@ void MediaImpl::build()
|
||||
}
|
||||
}
|
||||
|
||||
MediaImpl::~MediaImpl()
|
||||
VideoImpl::~VideoImpl()
|
||||
{
|
||||
// Free all resources.
|
||||
freeResources();
|
||||
@@ -130,7 +130,7 @@ MediaImpl::~MediaImpl()
|
||||
delete _mutexLocker;
|
||||
}
|
||||
|
||||
bool MediaImpl::_eos() const
|
||||
bool VideoImpl::_eos() const
|
||||
{
|
||||
if (_movieReady)
|
||||
{
|
||||
@@ -156,7 +156,7 @@ bool MediaImpl::_eos() const
|
||||
return false;
|
||||
}
|
||||
|
||||
GstFlowReturn MediaImpl::gstNewSampleCallback(GstElement*, MediaImpl *p)
|
||||
GstFlowReturn VideoImpl::gstNewSampleCallback(GstElement*, VideoImpl *p)
|
||||
{
|
||||
// Make it thread-safe.
|
||||
p->lockMutex();
|
||||
@@ -204,7 +204,7 @@ GstFlowReturn MediaImpl::gstNewSampleCallback(GstElement*, MediaImpl *p)
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
MediaImpl::MediaImpl(const QString uri, bool live) :
|
||||
VideoImpl::VideoImpl(const QString uri, bool live) :
|
||||
_bus(NULL),
|
||||
_pipeline(NULL),
|
||||
_uridecodebin0(NULL),
|
||||
@@ -240,7 +240,7 @@ _uri(uri)
|
||||
_mutexLocker = new QMutexLocker(&_mutex);
|
||||
}
|
||||
|
||||
void MediaImpl::unloadMovie()
|
||||
void VideoImpl::unloadMovie()
|
||||
{
|
||||
// Reset variables.
|
||||
_terminate = false;
|
||||
@@ -254,7 +254,7 @@ void MediaImpl::unloadMovie()
|
||||
freeResources();
|
||||
}
|
||||
|
||||
void MediaImpl::freeResources()
|
||||
void VideoImpl::freeResources()
|
||||
{
|
||||
// Free resources.
|
||||
if (_bus)
|
||||
@@ -295,7 +295,7 @@ void MediaImpl::freeResources()
|
||||
_videoIsConnected = false;
|
||||
}
|
||||
|
||||
void MediaImpl::resetMovie()
|
||||
void VideoImpl::resetMovie()
|
||||
{
|
||||
// XXX: There used to be an issue that when we reached EOS (_eos() == true) we could not seek anymore.
|
||||
if (_seekEnabled)
|
||||
@@ -324,7 +324,7 @@ void MediaImpl::resetMovie()
|
||||
gboolean
|
||||
gstPollShmsrc (void *user_data)
|
||||
{
|
||||
MediaImpl *p = (MediaImpl*) user_data;
|
||||
VideoImpl *p = (VideoImpl*) user_data;
|
||||
if (g_file_test(p->getUri().toUtf8().constData(), G_FILE_TEST_EXISTS) &&
|
||||
! p->getAttached())
|
||||
{
|
||||
@@ -339,7 +339,7 @@ gstPollShmsrc (void *user_data)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MediaImpl::loadMovie(const QString& filename)
|
||||
bool VideoImpl::loadMovie(const QString& filename)
|
||||
{
|
||||
// Verify if file exists.
|
||||
const gchar* filetestpath = (const gchar*) filename.toUtf8().constData();
|
||||
@@ -583,7 +583,7 @@ bool MediaImpl::loadMovie(const QString& filename)
|
||||
gst_discoverer_stream_info_list_free(videoStreams);
|
||||
|
||||
// Connect pad signal.
|
||||
g_signal_connect (_uridecodebin0, "pad-added", G_CALLBACK (MediaImpl::gstPadAddedCallback), this);
|
||||
g_signal_connect (_uridecodebin0, "pad-added", G_CALLBACK (VideoImpl::gstPadAddedCallback), this);
|
||||
|
||||
// Set uri of decoder.
|
||||
g_object_set (_uridecodebin0, "uri", uri, NULL);
|
||||
@@ -620,7 +620,7 @@ bool MediaImpl::loadMovie(const QString& filename)
|
||||
"drop", TRUE, // ... other buffers are dropped
|
||||
"sync", TRUE,
|
||||
NULL);
|
||||
g_signal_connect (_appsink0, "new-sample", G_CALLBACK (MediaImpl::gstNewSampleCallback), this);
|
||||
g_signal_connect (_appsink0, "new-sample", G_CALLBACK (VideoImpl::gstNewSampleCallback), this);
|
||||
gst_caps_unref (videoCaps);
|
||||
|
||||
g_object_set (_audiovolume0, "mute", false, NULL);
|
||||
@@ -638,7 +638,7 @@ bool MediaImpl::loadMovie(const QString& filename)
|
||||
return true;
|
||||
}
|
||||
|
||||
void MediaImpl::update()
|
||||
void VideoImpl::update()
|
||||
{
|
||||
// Check for end-of-stream or terminate.
|
||||
if (_eos() || _terminate)
|
||||
@@ -661,7 +661,7 @@ void MediaImpl::update()
|
||||
_checkMessages();
|
||||
}
|
||||
|
||||
bool MediaImpl::setPlayState(bool play)
|
||||
bool VideoImpl::setPlayState(bool play)
|
||||
{
|
||||
if (_pipeline == NULL)
|
||||
{
|
||||
@@ -682,7 +682,7 @@ bool MediaImpl::setPlayState(bool play)
|
||||
}
|
||||
}
|
||||
|
||||
bool MediaImpl::seekTo(double position)
|
||||
bool VideoImpl::seekTo(double position)
|
||||
{
|
||||
gint64 duration;
|
||||
if (!gst_element_query_duration (_pipeline, GST_FORMAT_TIME, &duration))
|
||||
@@ -698,7 +698,7 @@ bool MediaImpl::seekTo(double position)
|
||||
return seekTo((gint64)(position*duration));
|
||||
}
|
||||
|
||||
bool MediaImpl::seekTo(gint64 positionNanoSeconds)
|
||||
bool VideoImpl::seekTo(gint64 positionNanoSeconds)
|
||||
{
|
||||
if (!_appsink0)
|
||||
return false;
|
||||
@@ -722,7 +722,7 @@ bool MediaImpl::seekTo(gint64 positionNanoSeconds)
|
||||
}
|
||||
}
|
||||
|
||||
//bool MediaImpl::_preRun()
|
||||
//bool VideoImpl::_preRun()
|
||||
//{
|
||||
// // Check for end-of-stream or terminate.
|
||||
// if (_eos() || _terminate)
|
||||
@@ -742,7 +742,7 @@ bool MediaImpl::seekTo(gint64 positionNanoSeconds)
|
||||
// return true;
|
||||
//}
|
||||
|
||||
void MediaImpl::_checkMessages()
|
||||
void VideoImpl::_checkMessages()
|
||||
{
|
||||
if (_bus != NULL)
|
||||
{
|
||||
@@ -850,18 +850,18 @@ void MediaImpl::_checkMessages()
|
||||
}
|
||||
}
|
||||
|
||||
void MediaImpl::_setMovieReady(bool ready)
|
||||
void VideoImpl::_setMovieReady(bool ready)
|
||||
{
|
||||
_movieReady = ready;
|
||||
}
|
||||
|
||||
void MediaImpl::_setFinished(bool finished)
|
||||
void VideoImpl::_setFinished(bool finished)
|
||||
{
|
||||
Q_UNUSED(finished);
|
||||
// qDebug() << "Clip " << (finished ? "finished" : "not finished");
|
||||
}
|
||||
|
||||
void MediaImpl::_updateRate()
|
||||
void VideoImpl::_updateRate()
|
||||
{
|
||||
if (_pipeline == NULL)
|
||||
{
|
||||
@@ -909,7 +909,7 @@ void MediaImpl::_updateRate()
|
||||
g_print ("Current rate: %g\n", _rate);
|
||||
}
|
||||
|
||||
void MediaImpl::_freeCurrentSample() {
|
||||
void VideoImpl::_freeCurrentSample() {
|
||||
if (_currentFrameBuffer != NULL)
|
||||
{
|
||||
gst_buffer_unmap(_currentFrameBuffer, &_mapInfo);
|
||||
@@ -928,7 +928,7 @@ void MediaImpl::_freeCurrentSample() {
|
||||
/**
|
||||
* FIXME: remove GOTO
|
||||
*/
|
||||
void MediaImpl::gstPadAddedCallback(GstElement *src, GstPad *newPad, MediaImpl* p)
|
||||
void VideoImpl::gstPadAddedCallback(GstElement *src, GstPad *newPad, VideoImpl* p)
|
||||
{
|
||||
g_print ("Received new pad '%s' from '%s':\n", GST_PAD_NAME (newPad), GST_ELEMENT_NAME (src));
|
||||
GstPad *sinkPad = NULL;
|
||||
@@ -998,17 +998,17 @@ exit:
|
||||
}
|
||||
}
|
||||
|
||||
void MediaImpl::lockMutex()
|
||||
void VideoImpl::lockMutex()
|
||||
{
|
||||
_mutexLocker->relock();
|
||||
}
|
||||
|
||||
void MediaImpl::unlockMutex()
|
||||
void VideoImpl::unlockMutex()
|
||||
{
|
||||
_mutexLocker->unlock();
|
||||
}
|
||||
|
||||
bool MediaImpl::waitForNextBits(int timeout, const uchar** bits)
|
||||
bool VideoImpl::waitForNextBits(int timeout, const uchar** bits)
|
||||
{
|
||||
QTime time;
|
||||
time.start();
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* MediaImpl.h
|
||||
* VideoImpl.h
|
||||
*
|
||||
* (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com
|
||||
* (c) 2013 Alexandre Quessy -- alexandre(@)quessy(.)net
|
||||
@@ -22,8 +22,8 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MEDIA_IMPL_H_
|
||||
#define MEDIA_IMPL_H_
|
||||
#ifndef VIDEO_IMPL_H_
|
||||
#define VIDEO_IMPL_H_
|
||||
|
||||
// GStreamer includes.
|
||||
#include <gst/gst.h>
|
||||
@@ -48,7 +48,7 @@
|
||||
* This is to prevent the GStreamer header to be included in the whole project.
|
||||
* (it just needs to be included in this file).
|
||||
*/
|
||||
class MediaImpl
|
||||
class VideoImpl
|
||||
{
|
||||
public:
|
||||
/**
|
||||
@@ -56,8 +56,8 @@ public:
|
||||
* This media player works for both video files and shared memory sockets.
|
||||
* If live is true, it's a shared memory socket.
|
||||
*/
|
||||
MediaImpl(const QString uri="", bool live=false);
|
||||
~MediaImpl();
|
||||
VideoImpl(const QString uri="", bool live=false);
|
||||
~VideoImpl();
|
||||
|
||||
// void setUri(const QString uri);
|
||||
/**
|
||||
@@ -137,7 +137,7 @@ public:
|
||||
bool seekTo(gint64 positionNanoSeconds);
|
||||
|
||||
/**
|
||||
* Tells the MediaImpl that we are actually reading from a shmsrc.
|
||||
* Tells the VideoImpl that we are actually reading from a shmsrc.
|
||||
* Called from the GStreamer callback of the shmsrc.
|
||||
*/
|
||||
void setAttached(bool attach);
|
||||
@@ -178,12 +178,12 @@ private:
|
||||
|
||||
public:
|
||||
// GStreamer callback that simply sets the #newSample# flag to point to TRUE.
|
||||
static GstFlowReturn gstNewSampleCallback(GstElement*, MediaImpl *p);
|
||||
static GstFlowReturn gstNewSampleCallback(GstElement*, VideoImpl *p);
|
||||
//static GstFlowReturn gstNewPreRollCallback (GstAppSink * appsink, gpointer user_data);
|
||||
|
||||
// GStreamer callback that plugs the audio/video pads into the proper elements when they
|
||||
// are made available by the source.
|
||||
static void gstPadAddedCallback(GstElement *src, GstPad *newPad, MediaImpl* p);
|
||||
static void gstPadAddedCallback(GstElement *src, GstPad *newPad, VideoImpl* p);
|
||||
|
||||
/// Locks mutex (default = no effect).
|
||||
void lockMutex();
|
||||
@@ -50,7 +50,7 @@ void initRegistry()
|
||||
MetaObjectRegistry& registry = MetaObjectRegistry::instance();
|
||||
|
||||
// Paints.
|
||||
registry.add<Media>();
|
||||
registry.add<Video>();
|
||||
registry.add<Image>();
|
||||
registry.add<Color>();
|
||||
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ HEADERS = \
|
||||
Mapping.h \
|
||||
MappingManager.h \
|
||||
Maths.h \
|
||||
MediaImpl.h \
|
||||
VideoImpl.h \
|
||||
Mesh.h \
|
||||
MetaObjectRegistry.h \
|
||||
OscInterface.h \
|
||||
@@ -59,7 +59,7 @@ SOURCES = \
|
||||
MapperGLCanvas.cpp \
|
||||
Mapping.cpp \
|
||||
MappingManager.cpp \
|
||||
MediaImpl.cpp \
|
||||
VideoImpl.cpp \
|
||||
Mesh.cpp \
|
||||
MetaObjectRegistry.cpp \
|
||||
OscInterface.cpp \
|
||||
|
||||
Reference in New Issue
Block a user