#pragma once
#include "ofConstants.h"
#include "ofEvents.h"
#include "ofVideoBaseTypes.h"
#include "ofPixels.h"
#ifdef OF_VIDEO_CAPTURE_QTKIT
#if !defined(MAC_OS_X_VERSION_10_12) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12
#ifdef __OBJC__
@class QTKitVideoGrabber;
#endif
class ofVideoSavedEventArgs : public ofEventArgs {
public:
std::string videoPath;
ofBaseVideoGrabber* grabber;
std::string error;
};
class ofQTKitGrabber : public ofBaseVideoGrabber {
public:
ofQTKitGrabber();
~ofQTKitGrabber();
bool setup(int w, int h);
bool initGrabberWithoutPreview();
bool isFrameNew() const;
void update();
float getWidth() const;
float getHeight() const;
ofPixels& getPixels();
const ofPixels& getPixels() const;
void setVerbose(bool bTalkToMe);
std::vector <ofVideoDevice> listDevices() const;
const std::vector <std::string> & listAudioDevices() const;
const std::vector <std::string> & listVideoDevices() const;
bool initRecording();
const std::vector <std::string> & listVideoCodecs() const;
const std::vector <std::string> & listAudioCodecs() const;
void setVideoCodec(std::string videoCodecIDString);
void setAudioCodec(std::string audioCodecIDString);
void setUseAudio(bool bUseAudio);
void startRecording(std::string filePath);
void stopRecording();
bool isRecording() const;
bool isRecordingReady() const;
bool isReady() const;
bool isInitialized() const;
void close();
void setDeviceID(int videoDeviceID);
void setDeviceID(std::string videoDeviceIDString);
int getDeviceID() const;
void setVideoDeviceID(int videoDeviceID);
void setVideoDeviceID(std::string videoDeviceIDString);
int getVideoDeviceID() const;
void setAudioDeviceID(int audioDeviceID);
void setAudioDeviceID(std::string audioDeviceIDString);
int getAudioDeviceID() const;
void setDesiredFrameRate(int framerate);
bool setPixelFormat(ofPixelFormat pixelFormat);
ofPixelFormat getPixelFormat() const;
bool hasPreview() const;
void videoSettings();
ofEvent<ofVideoSavedEventArgs> videoSavedEvent;
protected:
bool confirmInit() const;
ofPixelFormat pixelFormat;
ofPixels pixels;
mutable std::vector <std::string> videoDeviceVec;
mutable std::vector <std::string> audioDeviceVec;
mutable std::vector <std::string> videoCodecsVec;
mutable std::vector <std::string> audioCodecsVec;
int videoDeviceID;
int audioDeviceID;
std::string videoCodecIDString;
std::string audioCodecIDString;
bool isInited;
bool bUseAudio;
bool bPreview;
#ifdef __OBJC__
QTKitVideoGrabber * grabber;
#else
void * grabber;
#endif
};
#endif
#endif
Comments