private declaration of VideoImpl

This commit is contained in:
Alexandre Quessy
2014-03-06 15:19:06 -05:00
parent 93b55cb61a
commit 16ce2a449f
5 changed files with 157 additions and 19 deletions
+11 -18
View File
@@ -19,7 +19,7 @@
*/
#include "Paint.h"
#include <gst/gst.h>
#include "VideoImpl.h"
#include <iostream>
UidAllocator Paint::allocator;
@@ -42,51 +42,44 @@ Paint::~Paint()
allocator.free(_id);
}
/* Implementation of the Video class */
Video::Video(const QString uri_, uid id=NULL_UID):
Texture(id),
uri(uri_)
uri(uri_),
impl_(new VideoImpl)
{
this->impl_->setUri(uri);
}
Video::~Video()
{
delete impl_;
}
void Video::build()
{
this->impl_->build();
}
int Video::getWidth() const
{
// TODO
return 0;
return this->impl_->getWidth();
}
int Video::getHeight() const
{
// TODO
return 0;
return this->impl_->getHeight();
}
const uchar* Video::getBits() const
{
// TODO
return 0;
return this->impl_->getBits();
}
bool Video::hasVideoSupport()
{
static bool did_print_gst_version = false;
if (! did_print_gst_version)
{
std::cout << "Using GStreamer version " <<
GST_VERSION_MAJOR << "." <<
GST_VERSION_MINOR << "." <<
GST_VERSION_MICRO << std::endl;
did_print_gst_version = true;
}
return true;
return VideoImpl::hasVideoSupport();
}
+8
View File
@@ -161,6 +161,8 @@ public:
virtual const uchar* getBits() const { return image.bits(); }
};
class VideoImpl; // forware declaration
/**
* Paint that is a Texture retrieved via a video file.
*/
@@ -187,6 +189,12 @@ public:
* Checks whether or not video is supported on this platform.
*/
static bool hasVideoSupport();
private:
/**
* Private implementation, so that GStreamer headers don't need
* to be included from every file in the project.
*/
VideoImpl * impl_; // PIMPL opaque pointer
};
#endif /* PAINT_H_ */
+81
View File
@@ -0,0 +1,81 @@
/*
* VideoImpl.cpp
*
* (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com
* (c) 2013 Alexandre Quessy -- alexandre(@)quessy(.)net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 "VideoImpl.h"
#include <iostream>
// -------- private implementation of VideoImpl -------
bool VideoImpl::hasVideoSupport()
{
static bool did_print_gst_version = false;
if (! did_print_gst_version)
{
std::cout << "Using GStreamer version " <<
GST_VERSION_MAJOR << "." <<
GST_VERSION_MINOR << "." <<
GST_VERSION_MICRO << std::endl;
did_print_gst_version = true;
}
// TODO: actually check if we have it
return true;
}
int VideoImpl::getWidth() const
{
// TODO
std::cout << "TODO" << std::endl;
return 0;
}
int VideoImpl::getHeight() const
{
// TODO
std::cout << "TODO" << std::endl;
return 0;
}
const uchar* VideoImpl::getBits() const
{
// TODO
std::cout << "TODO" << std::endl;
return 0;
}
void VideoImpl::build()
{
std::cout << "TODO" << std::endl;
}
VideoImpl::VideoImpl()
{
std::cout << "TODO" << std::endl;
}
VideoImpl::~VideoImpl()
{
std::cout << "TODO" << std::endl;
}
void VideoImpl::setUri(QString uri)
{
this->uri_ = uri;
std::cout << "TODO" << std::endl;
}
+54
View File
@@ -0,0 +1,54 @@
/*
* Paint.h
*
* (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com
* (c) 2013 Alexandre Quessy -- alexandre(@)quessy(.)net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VIDEO_IMPL_H_
#define VIDEO_IMPL_H_
#include <gst/gst.h>
#include <QtGlobal>
#include <QtOpenGL>
#if __APPLE__
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif
#include <tr1/memory>
/**
* Private declaration of the video player.
* This is done this way so that GStreamer header don't need to be
* included in the whole project. (just in this file)
*/
class VideoImpl
{
public:
VideoImpl();
~VideoImpl();
void setUri(const QString uri);
static bool hasVideoSupport();
void build();
int getWidth() const;
int getHeight() const;
const uchar* getBits() const;
private:
QString uri_;
};
#endif /* ifndef */
+3 -1
View File
@@ -22,7 +22,8 @@ HEADERS = \
SourceGLCanvas.h \
UidAllocator.h \
Util.h \
unused.h
unused.h \
VideoImpl.h
SOURCES = \
# Controller.cpp \
@@ -42,6 +43,7 @@ SOURCES = \
SourceGLCanvas.cpp \
UidAllocator.cpp \
Util.cpp \
VideoImpl.cpp \
main.cpp
RESOURCES = mapmap.qrc