OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

osgDB::readImageFile() chooses ffmpeg over libpng


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Plugins [osgPlugins]
View previous topic :: View next topic  
Author Message
aquawicket
User


Joined: 26 Sep 2013
Posts: 20

PostPosted: Sun May 10, 2015 10:49 pm    Post subject:
osgDB::readImageFile() chooses ffmpeg over libpng
Reply with quote

OSG-3.3.7

both plugins osgdb_png and osgdb_ffmpeg loaded.
osgDB::readImageFile("image.png") chooses ffmpeg over libpng to load .png image files.

I checked ReaderWriterFFmpeg.cpp, and it does not add the .png extention.

How do I give libpng priority on .png files. Thanks Smile
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11190

PostPosted: Mon May 11, 2015 7:37 am    Post subject:
osgDB::readImageFile() chooses ffmpeg over libpng
Reply with quote

Hi Paul,

This sounds like a bug, the ffmpeg plugin should not attempt to load a
png file. What exactly happens?

As for changing the order, simple pre load the png plugin as this will
ensure it gets called first thanks to the Chain-Of-Responsibility
pattern used by it.

Robert

On 10 May 2015 at 23:49, Paul <> wrote:
Quote:
OSG-3.3.7

both plugins osgdb_png and osgdb_ffmpeg loaded.
osgDB::readImageFile("image.png") chooses ffmpeg over libpng to load .png image files.

I checked ReaderWriterFFmpeg.cpp, and it does not add the .png extention.

How do I give libpng priority on .png files. Thanks :)

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=63688#63688








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
aquawicket
User


Joined: 26 Sep 2013
Posts: 20

PostPosted: Fri Jun 05, 2015 11:49 pm    Post subject:
Reply with quote

I'm working on this today.. And I've noticed.. it's not just .png files. If I use osgdb_ffmpeg, it takes over ALL images.

I'm attempting to walk through the call stack..

Code:

starting here...
Registry.cpp - line 992
ReadImageFunctor(const std::string& filename, const Options* options):ReadFunctor(filename,options) {}


ending up here...
ReaderWriterFFmpeg.cpp - line 136
virtual ReadResult readImage(const std::string & filename, const osgDB::ReaderWriter::Options* options) const



It appears that the plugins are iterated and FFMPEG is allways selected for ReadImage()
I'm having a hard time locating where exactly the plugin is selected.

I'm currently testing here...
Code:
Registry.cpp - line 1168
// first attempt to load the file from existing ReaderWriter's
AvailableReaderWriterIterator itr(_rwList, _pluginMutex);
for(;itr.valid();++itr)
{
ReaderWriter::ReadResult rr = readFunctor.doRead(*itr);
if (readFunctor.isValid(rr)) return rr;
else results.push_back(rr);
}
Back to top
View user's profile Send private message
aquawicket
User


Joined: 26 Sep 2013
Posts: 20

PostPosted: Sat Jun 06, 2015 1:35 am    Post subject:
Reply with quote

My fix for this:

Upon inspection of ReaderWriterPNG.cpp
line - 371

Code:
virtual ReadResult readImage(const std::string& file, const osgDB::ReaderWriter::Options* options) const
{
std::string ext = osgDB::getLowerCaseFileExtension(file);
if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED;
.
.
.


if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED; seems to filter the plugin's accepted extensions.

I've altered ReaderWriterFFmpeg.cpp to include this as well..

Code:
line - 135
virtual ReadResult readImage(const std::string & filename, const osgDB::ReaderWriter::Options* options) const
{
const std::string ext = osgDB::getLowerCaseFileExtension(filename);
if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED;
.
.
.



Not sure if this is the proper fix.. but it works for me.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Plugins [osgPlugins] All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Multiple video textures using ffmpeg ... mmaurus Plugins [osgPlugins] 6 Thu Oct 05, 2017 10:02 am View latest post
No new posts Problem compiling OSG 3.4.1 osgDB 64 bit tonyor Build system [build] 0 Thu Sep 21, 2017 12:41 am View latest post
No new posts PHYSFS / VFS - How to make a custom o... Steal General 4 Mon Jul 10, 2017 1:28 pm View latest post
No new posts PHYSFS / VFS - How to make a custom o... Steal General 0 Mon Jul 10, 2017 1:18 pm View latest post
No new posts Disable FFMpeg while building OSG? jiapei100 Build system [build] 1 Fri Jan 06, 2017 11:36 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP