Bugfix: video size was not properly set for many videos.

This commit is contained in:
Tats
2014-09-16 20:54:40 -04:00
parent 6adad6ac77
commit 4246c5a3b4
3 changed files with 15 additions and 3 deletions
+5 -2
View File
@@ -44,12 +44,12 @@ bool MediaImpl::hasVideoSupport()
int MediaImpl::getWidth() const
{
return _width;
return _padHandlerData.width;
}
int MediaImpl::getHeight() const
{
return _height;
return _padHandlerData.height;
}
const uchar* MediaImpl::getBits() const
@@ -665,6 +665,9 @@ void MediaImpl::gstPadAddedCallback(GstElement *src, GstPad *newPad, MediaImpl::
else if (g_str_has_prefix (newPadType, "video/x-raw"))
{
sinkPad = gst_element_get_static_pad (data->videoToConnect, "sink");
gst_structure_get_int(newPadStruct, "width", &data->width);
gst_structure_get_int(newPadStruct, "height", &data->height);
isAudio = false;
}
else
+6 -1
View File
@@ -55,6 +55,8 @@ public:
int getHeight() const;
const uchar* getBits() const;
bool isReady() const { return _padHandlerData.isConnected(); }
/// Returns true if the image has changed.
bool runVideo();
// void runAudio();
@@ -90,10 +92,13 @@ public:
GstElement* videoSink;
bool audioIsConnected;
bool videoIsConnected;
int width;
int height;
GstPadHandlerData() :
audioToConnect(NULL), videoToConnect(NULL), videoSink(NULL),
audioIsConnected(false), videoIsConnected(false)
audioIsConnected(false), videoIsConnected(false),
width(-1), height(-1)
{}
bool isConnected() const {
+4
View File
@@ -73,11 +73,15 @@ void Media::build()
int Media::getWidth() const
{
// Wait for impl to be ready.
while (!this->impl_->isReady());
return this->impl_->getWidth();
}
int Media::getHeight() const
{
// Wait for impl to be ready.
while (!this->impl_->isReady());
return this->impl_->getHeight();
}