Files
OpenSceneGraph/src/osgPlugins/avfoundation/OSXAVFoundationVideo.h
Robert Osfield eed71f647d From Stephan Huber, "* imageio: removed ReaderWriterImageIO_IOS.cpp, refactored ReaderWriterImageIO to work on OS X and IOS
* avfoundation: added support for IOS (CoreVideo-support is still in development, works only for SDK >= 6.0, set IPHONE_SDKVER in cMake accordingly)
* zeroconf: added ZeroConf-device-plugin (Mac/Win only, linux implementation missing) to advertise and discover services via ZeroConf/Bonjour, on windows you'll need the Bonjour SDK from Apple
* osgosc: modified the example to demonstrate the usage of the ZeroConf-plugin (start the example with the command-line-argument --zeroconf)
* SlideShowConstructor: enable/disable CoreVideo via a environment variable (P3D_ENABLE_CORE_VIDEO)
* RestHttp: mouse-motion-events get interpolated
* RestHttp: unhandled http-requests get sent as an user-event to the event-queue, all arguments get attached as user-values to the event
* modified some CMakeModules to work correctly when compiling for IOS
* fixed a compile-error for IOS in GraphicsWindowIOS
* some minor bugfixes"
2012-12-05 17:15:53 +00:00

119 lines
3.0 KiB
C++

//
// OSXAVFoundationVideo.h
// cefix_presentation_ios
//
// Created by Stephan Maximilian Huber on 25.07.12.
// Copyright (c) 2012 stephanmaximilianhuber.com. All rights reserved.
//
#pragma once
#include <osg/Timer>
#include "../QTKit/VideoFrameDispatcher.h"
class OSXAVFoundationVideo : public osgVideo::VideoImageStream {
public:
OSXAVFoundationVideo();
/// Destructor
~OSXAVFoundationVideo();
virtual Object* clone() const { return new OSXAVFoundationVideo(); }
virtual bool isSameKindAs(const Object* obj) const {
return dynamic_cast<const OSXAVFoundationVideo*>(obj) != NULL;
}
virtual const char* className() const { return "OSXAVFoundationVideo"; }
/// Start or continue stream.
virtual void play();
/** @return true, if a movie is playing */
bool isPlaying() const { return (getStatus() == PLAYING); }
/// sets the movierate
void setTimeMultiplier(double rate);
/// gets the movierate
double getTimeMultiplier() const;
/// Pause stream at current position.
virtual void pause();
/// stop playing
virtual void quit(bool /*waitForThreadToExit*/ = true);
/// Get total length in seconds.
virtual double getLength() const { return _videoDuration; }
/// jumps to a specific position
virtual void seek(double pos);
virtual void rewind() {
seek(0);
}
/// returns the current playing position
virtual double getCurrentTime () const;
void open(const std::string& filename);
/** @return the current volume as float */
virtual float getVolume() const;
/** sets the volume of this quicktime to v*/
virtual void setVolume(float v);
/** @return the current balance-setting (0 = neutral, -1 = left, 1 = right */
virtual float getAudioBalance();
/** sets the current balance-setting (0 = neutral, -1 = left, 1 = right */
virtual void setAudioBalance(float b);
virtual double getFrameRate () const { return _framerate; }
virtual void decodeFrame();
virtual bool valid() const { return (getStatus() != INVALID); }
virtual bool requiresUpdateCall () const { return true; }
virtual void update(osg::NodeVisitor *);
virtual void applyLoopingMode();
void setUseCoreVideo(bool b) { _useCoreVideo = b; }
bool isCoreVideoUsed() const { return _useCoreVideo; }
void lazyInitCoreVideoTextureCache(osg::State& state);
bool getCurrentCoreVideoTexture(GLenum& target, GLint& name, int& width, int& height) const;
virtual osg::Texture* createSuitableTexture();
protected:
virtual bool needsDispatching() const;
void requestNewFrame();
private:
class Data;
void clear();
float _videoDuration;
double _volume;
bool _fileOpened, _waitForFrame;
Data* _data;
bool _useCoreVideo, _dimensionsChangedCallbackNeeded;
double _framerate;
};