mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
Replaced images by videos + implemented hack on update() / runVideo() to quickly test gstreamer (works!)
This commit is contained in:
+4
-1
@@ -1087,7 +1087,7 @@ void MainWindow::addMappingItem(uint mappingId)
|
||||
// Add mapper.
|
||||
// XXX hardcoded for textures
|
||||
std::tr1::shared_ptr<TextureMapping> textureMapping;
|
||||
if (paintType == "image")
|
||||
if (paintType == "image" || paintType == "video")
|
||||
{
|
||||
textureMapping = std::tr1::static_pointer_cast<TextureMapping>(mapping);
|
||||
Q_CHECK_PTR(textureMapping);
|
||||
@@ -1160,6 +1160,9 @@ void MainWindow::addMappingItem(uint mappingId)
|
||||
item->setSizeHint(QSize(item->sizeHint().width(), MainWindow::SHAPE_LIST_ITEM_HEIGHT));
|
||||
mappingList->insertItem(0, item);
|
||||
mappingList->setCurrentItem(item);
|
||||
|
||||
// Build mapping!
|
||||
mapping->build();
|
||||
}
|
||||
|
||||
void MainWindow::clearWindow()
|
||||
|
||||
@@ -302,6 +302,7 @@ void TextureMapper::draw(QPainter* painter)
|
||||
Q_ASSERT( outputShape->nVertices() == outputShape->nVertices());
|
||||
|
||||
// Project source texture and sent it to destination.
|
||||
texture->update();
|
||||
|
||||
glEnable (GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, texture->getTextureId());
|
||||
|
||||
@@ -75,6 +75,10 @@ int Video::getHeight() const
|
||||
return this->impl_->getHeight();
|
||||
}
|
||||
|
||||
void Video::update() {
|
||||
impl_->runVideo();
|
||||
}
|
||||
|
||||
const uchar* Video::getBits() const
|
||||
{
|
||||
return this->impl_->getBits();
|
||||
|
||||
@@ -64,6 +64,9 @@ public:
|
||||
|
||||
virtual void build() {}
|
||||
|
||||
/// This method should be called at each call of draw().
|
||||
virtual void update() {}
|
||||
|
||||
void setName(const QString& name) { _name = name; }
|
||||
QString getName() const { return _name; }
|
||||
uid getId() const { return _id; }
|
||||
@@ -178,6 +181,7 @@ public:
|
||||
return uri;
|
||||
}
|
||||
virtual void build();
|
||||
virtual void update();
|
||||
virtual QString getType() const
|
||||
{
|
||||
return "video";
|
||||
|
||||
+6
-3
@@ -54,6 +54,7 @@ const uchar* VideoImpl::getBits() const
|
||||
|
||||
void VideoImpl::build()
|
||||
{
|
||||
qDebug() << "Building video impl" << endl;
|
||||
if (!loadMovie(_uri))
|
||||
{
|
||||
qDebug() << "Cannot load movie " << _currentMovie << "." << endl;
|
||||
@@ -69,6 +70,8 @@ VideoImpl::~VideoImpl()
|
||||
|
||||
bool VideoImpl::_videoPull()
|
||||
{
|
||||
qDebug() << "video pull" << endl;
|
||||
|
||||
GstBuffer *buffer;
|
||||
|
||||
// Retrieve the buffer.
|
||||
@@ -85,8 +88,8 @@ bool VideoImpl::_videoPull()
|
||||
GstCaps* caps = GST_BUFFER_CAPS(buffer);
|
||||
GstStructure *capsStruct = gst_caps_get_structure (caps, 0);
|
||||
|
||||
int width = 320;
|
||||
int height = 240;
|
||||
int width = 640;
|
||||
int height = 480;
|
||||
int bpp = 24;
|
||||
int depth = 24;
|
||||
|
||||
@@ -170,7 +173,7 @@ _videoConvert(NULL),
|
||||
_videoColorSpace(NULL),
|
||||
_audioSink(NULL),
|
||||
_videoSink(NULL),
|
||||
_width(720),
|
||||
_width(640),
|
||||
_height(480),
|
||||
_data(NULL),
|
||||
//_audioBufferAdapter(NULL),
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ public:
|
||||
{}
|
||||
|
||||
bool isConnected() const {
|
||||
return (audioIsConnected && videoIsConnected);
|
||||
return (/*audioIsConnected && */videoIsConnected);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user