I just added a field version_ to read it at the beginning and added extra code to check it and read the extra field if needed and read the good filename"
been removed in the most recent versions of libavcodec/ffmpeg. You're
already using avcodec_open2() elsewhere, but one appears to have been
missed. The change is trivial:
[skynet](0) $ svn diff
Index: src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp
===================================================================
--- src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp (revision 13355)
+++ src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp (working copy)
@@ -109,7 +109,7 @@
// m_context->flags |= CODEC_FLAG_TRUNCATED;
// Open codec
- if (avcodec_open(m_context, p_codec) < 0)
+ if (avcodec_open2(m_context, p_codec, NULL) < 0)
throw std::runtime_error("avcodec_open() failed");
}
[skynet](0) $
I've applied similar changes this year to many other packages, including
cheese, blender, linphone, ad nauseam. It's been tested by verifying that
with my patch, OSG builds against the newest libavcodec and ffmpeg, whereas
otherwise it does not.
The modified src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp is attached. It
originates in svn trunk revision 13355. Thanks!"
// A custom class
namespace CustomDomain {
class MyGroup : public osg::Group
{
public:
META_Node( CustomDomain, MyGroup );
void setMyName( const std::string& n );
const std::string& getMyName() const;
void setMyID( int id );
int getMyID() const;
...
};
}
// The serialization wrapper using a custom domain name
REGISTER_CUSTOM_OBJECT_WRAPPER( MyDomain,
CustomDomain_MyGroup,
new CustomDomain::MyGroup,
CustomDomain::MyGroup,
"osg::Object osg::Node osg::Group CustomDomain::MyGroup" )
{
ADD_STRING_SERIALIZER( MyName, std::string() );
{
UPDATE_TO_VERSION_SCOPED( 1 ); // Updated for a new domain version
ADD_INT_SERIALIZER( MyID, 0 );
}
}
Save the class instance as follows:
osgDB::writeNodeFile( *myGroup, "serializer_test.osgt", new osgDB::Options("CustomDomains=MyDomain:1") );
The output file will include the domain version definition and all the class data, and can be read back. We can also force setting the domain version by the CustomDomains option while reading the saved files. If we save the class instance without any options, MyID will be ignored because the default domain version is 0.
This may help third-party libraries like osgEarth to maintain their own serializers without regarding to the OSG soversion changes.
Another feature added is a more robust binary format, which in fact adds a size-offset at each block's beginning. When there are problems or unsupported data types while reading, we can now directly jump to the block end indicated by the offset value. So a .osgb file will automatically ignore bad data and read remains as normal (at present it will fail at all). This feature will not break the backward compatibility, and can be disabled by setting "RobustBinaryFormat=false" while writing out.
Hope these changes can work smoothly with present and future community projects. Maybe we should also consider have an osgserializer example to test and demonstrate all things we can do now."
a few modifications to these files:
- applications/present3D/Cluster.cpp
- src/osgDB/FileUtils.cpp
The changes are needed to fix a few platform specific things such as the
absence of stat64, int/socklen_t differences, etc... and are in the same
line as Linux, Apple and FreeBSD specific checks.
I have attached the modified files; the original patches to 3.0.1 are
also visible here if you find it more convenient:
http://dl.wolfpond.org/dports/graphics.osg/dragonfly/patch-applications_present3D_Cluster.cpphttp://dl.wolfpond.org/dports/graphics.osg/dragonfly/patch-src_osgDB_FileUtils.cpp
With these changes, osg 3.0.1 is able to be built and packaged on DragonFly
whereas it previously failed to compile."
This is because Qt auto repeats keyboard events, so multiple calls are made to GLWidget::keyPressEvent and GLWidget::keyReleaseEvent by Qt, and subsequently translated to OSG events.
The way to solve this is ignoring key released auto repeated events (see http://qt-project.org/doc/qt-4.8/qkeyevent.html#isAutoRepeat), so multiple KEYDOWN events are fired, but only one KEYUP.
I attach a modified osgQt/GraphicsWindowQt.cpp with this change."