mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
Bugfix: video size was not properly set for many videos.
This commit is contained in:
+5
-2
@@ -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
@@ -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 {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user