root/OpenSceneGraph/trunk/include/osgGA/EventHandler @ 13890

Revision 13890, 2.3 kB (checked in by robert, 2 days ago)

From Javier Taibo,
"I have found a "bug" in the new audio decoding code (actually I think the bug is in ffmpeg, but anyway it should be wise to protect the OSG plug-in about it). I am attaching a security check in FFmpegDecoderAudio.cpp.

If anybody is curious about the problem, it happens sometimes when decoding an AAC audio stream. It eventually includes a PCE block inside the AAC audio frame and then ffmpeg audio decoding function signals a "new_frame" with 1024 samples, but a null pointer instead of the audio data. It can be easily detected because in these cases number of channels is 0. Maybe this is the intended behaviour for ffmpeg, but I find it quite weird.
"

" It seems that libav does not have a channels attribute in AVFrame structure. This new version should do."

Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSGGA_EVENTHANDLER
15#define OSGGA_EVENTHANDLER 1
16
17#include <vector>
18
19#include <osg/NodeCallback>
20#include <osg/Drawable>
21#include <osg/ApplicationUsage>
22
23#include <osgGA/Export>
24#include <osgGA/GUIEventAdapter>
25#include <osgGA/GUIActionAdapter>
26
27
28namespace osgGA{
29
30/**
31EventHandler is base class for adding handling of events, either as node event callback, drawable event callback or an event handler attached directly to the view(er)
32*/
33
34class OSGGA_EXPORT EventHandler : public osg::NodeCallback, public osg::Drawable::EventCallback
35{
36public:
37
38        EventHandler() {}
39        EventHandler(const EventHandler& eh,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
40            osg::NodeCallback(eh, copyop),
41            osg::Drawable::EventCallback(eh, copyop) {}
42
43        META_Object(osgGA, EventHandler);
44
45        /** Event traversal node callback method. There is no need to override this method in subclasses of EventHandler as this implementation calls handle(..) for you. */
46        virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
47
48        /** Event traversal drawable callback method. There is no need to override this method in subclasses of EventHandler as this implementation calls handle(..) for you. */
49        virtual void event(osg::NodeVisitor* nv, osg::Drawable* drawable);
50
51        /** Handle event. Override the handle(..) method in your event handlers to respond to events. */
52        virtual bool handle(osgGA::Event* event, osg::Object* object, osg::NodeVisitor* nv);
53
54        /** Get the user interface usage of this event handler, i.e. keyboard and mouse bindings.*/
55        virtual void getUsage(osg::ApplicationUsage&) const {}
56
57protected:
58
59};
60
61}
62
63#endif
Note: See TracBrowser for help on using the browser.