Replaced images by videos + implemented hack on update() / runVideo() to quickly test gstreamer (works!)

This commit is contained in:
Tats
2014-04-26 00:07:25 +01:00
parent ed3f476d6b
commit ada827de41
6 changed files with 20 additions and 5 deletions
+4 -1
View File
@@ -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()
+1
View File
@@ -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());
+4
View File
@@ -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();
+4
View File
@@ -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
View File
@@ -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
View File
@@ -93,7 +93,7 @@ public:
{}
bool isConnected() const {
return (audioIsConnected && videoIsConnected);
return (/*audioIsConnected && */videoIsConnected);
}
};