oZone Server Framework
Enabling Innovation in Video Applications
AVInput Class Reference

#include <ozAVInput.h>

Inheritance diagram for AVInput:

Public Member Functions

 AVInput (const std::string &name, const std::string &source, const Options &options=gNullOptions)
 
const AVCodecContext * videoCodecContext () const
 
const AVCodecContext * audioCodecContext () const
 
const std::string & source () const
 
PixelFormat pixelFormat () const
 Return the image format of video frames supplied by this provider.
 
uint16_t width () const
 Return the width (in pixels) of video frames supplied by this provider.
 
uint16_t height () const
 Return the height (in pixels) of video frames supplied by this provider.
 
FrameRate frameRate () const
 Return the frame rate at this this provider supplies frames. May not be available or accurate.
 
AVSampleFormat sampleFormat () const
 Return the sample format of audio frames supplied by this provider.
 
uint32_t sampleRate () const
 Return the sample rate (samples/sec) of audio frames supplied by this provider.
 
uint8_t channels () const
 Return the number of audio channels in audio frames supplied by this provider.
 
uint16_t samples () const
 Return the number of samples in audio frames supplied by this provider. May not be available or accurate.
 
- Public Member Functions inherited from FeedProvider
bool hasVideo () const
 Provides video frames.
 
bool hasAudio () const
 Provides audio frames.
 
virtual bool registerConsumer (FeedConsumer &consumer, const FeedLink &link=gQueuedFeedLink)
 
virtual bool deregisterConsumer (FeedConsumer &consumer, bool reciprocate=true)
 
virtual bool hasConsumer () const
 
virtual bool hasConsumer (FeedConsumer &consumer) const
 
bool wait () const
 Indicate whether this provider is ready to supply frames.
 
bool ready () const
 
bool ended () const
 
bool error () const
 
bool frameReady (uint64_t lastFrameCount) const
 Return true if there is a new frame available that the one supplied.
 
uint64_t frameCount () const
 Return the number of frames this provider has supplied.
 
bool canPoll () const
 Indicate whether this provider can supply frames by polling.
 
void setPolling (bool poll)
 Enable the polled frame interface if supported.
 
FramePtr pollFrame () const
 Return a reference to the last generated frame. More...
 
- Public Member Functions inherited from FeedBase
const std::string & cl4ss () const
 Return the class string.
 
const char * cclass () const
 Return the class string as a c-style string.
 
const std::string & name () const
 Return the name string.
 
const char * cname () const
 Return the name string as a c-style string.
 
const std::string & identity () const
 Return the identity string.
 
const char * cidentity () const
 Return the identity string as a c-style string.
 
- Public Member Functions inherited from Thread
pid_t tid () const
 < Return the thread id
 
void start ()
 Start the thread and invoke the run method, called by invoker.
 
void stop ()
 Stop the thread, by setting the mStop flag. Thread is responsible for actually existing.
 
void join ()
 Wait for the thread to terminate.
 
bool isThread ()
 
bool running () const
 < Indicate whether the thread is running or not
 
bool stopped () const
 < Indicate whether the thread has been signalled to stop
 

Protected Member Functions

int decodePacket (AVPacket &packet, int &frameComplete)
 
int run ()
 
- Protected Member Functions inherited from AudioVideoProvider
 AudioVideoProvider (const std::string &tag, const std::string &id)
 
- Protected Member Functions inherited from VideoProvider
 VideoProvider (const std::string &tag, const std::string &id)
 
- Protected Member Functions inherited from FeedProvider
virtual void distributeFrame (const FramePtr &frame)
 Pass a frame on to all registered consumers. More...
 
void addToMap ()
 Add this provider to the static provider map.
 
void removeFromMap ()
 Remove this provider from the static provider map.
 
virtual void cleanup ()
 Tidy up relations before destruction.
 
void setReady ()
 
void setEnded ()
 
void setError ()
 
- Protected Member Functions inherited from FeedBase
void setIdentity (const std::string &cl4ss, const std::string &name)
 Identify this instance.
 
- Protected Member Functions inherited from AudioProvider
 AudioProvider (const std::string &tag, const std::string &id)
 
- Protected Member Functions inherited from Thread
 Thread (const std::string &threadLabel)
 
 Thread (const char *threadLabel="...")
 
pid_t id () const
 
void exit (long int status=0)
 

Additional Inherited Members

- Public Types inherited from FeedProvider
enum  State { PROV_ERROR =-1, PROV_WAIT, PROV_READY, PROV_ENDED }
 
- Public Types inherited from Thread
typedef void *(* ThreadFunc) (void *)
 
- Static Public Member Functions inherited from FeedProvider
static FeedProviderfind (const std::string &identity)
 Locate a provider with the given identity. More...
 
static bool videoFramesOnly (const FramePtr &, const FeedConsumer *)
 Comparator function to allow consumers to select only video frames. More...
 
static bool audioFramesOnly (const FramePtr &, const FeedConsumer *)
 Comparator function to allow consumers to select only audio frames. More...
 
static bool dataFramesOnly (const FramePtr &, const FeedConsumer *)
 Comparator function to allow consumers to select only data frames. More...
 
static bool noFrames (const FramePtr &, const FeedConsumer *)
 Comparator function that can be used to suppress frames.
 
- Static Public Member Functions inherited from FeedBase
static std::string makeIdentity (const std::string &cl4ss, const std::string &name)
 Build identity from the class and name strings.
 
- Protected Types inherited from FeedProvider
typedef std::deque< FeedConsumer * > ConsumerList
 
typedef std::map< FeedConsumer *, FeedLinkConsumerMap
 
- Static Protected Member Functions inherited from Thread
static void * mThreadFunc (void *arg)
 
- Protected Attributes inherited from FeedProvider
State mState
 Provider state.
 
uint64_t mFrameCount
 Number of frames, advisory only.
 
bool mCanPoll
 Whether consumers can request frames on demand.
 
Mutex mFrameMutex
 Protects the 'on-demand' frame.
 
FramePtr mLastFrame
 The 'on-demand' frame.
 
Mutex mConsumerMutex
 Protects the consumers.
 
ConsumerMap mConsumers
 Collection of frame consumer.
 
bool mHasVideo
 
bool mHasAudio
 
- Protected Attributes inherited from FeedBase
std::string mClass
 Identifier for the class of provider/consumer.
 
std::string mName
 Unique identifier of this provider/consumer instance.
 
- Protected Attributes inherited from Thread
pthread_t mThread
 Base pthread data.
 
std::string mThreadLabel
 Label to help identify the thread.
 
Mutex mThreadMutex
 Mutex protecting this thread from concurrent access.
 
Condition mThreadCondition
 Used to signal thread states to invoking process/thread.
 
pid_t mTid
 Thread id.
 
bool mRunning
 Flag indicating whether this thread has begun and is running.
 
bool mStop
 Flag indicating whether this thread has been signalled to stop.
 
- Static Protected Attributes inherited from FeedProvider
static const int RECONNECT_TIMEOUT = 1
 How long to wait before reconnecting to a lost source, in seconds.
 
- Static Protected Attributes inherited from FeedBase
static const int INTERFRAME_TIMEOUT = 10000
 Needs to be short enough to cope with all possible frame rates.This allows for 100fps.
 

Detailed Description

Class using ffmpeg libavcodec functions to read and decode video and audio from any supported network source.

Definition at line 16 of file ozAVInput.h.

Constructor & Destructor Documentation

AVInput::AVInput ( const std::string &  name,
const std::string &  source,
const Options options = gNullOptions 
)
Parameters
nameinstance name
sourceAV source (example "rtsp://foo", "/dev/video0", "/tmp/test.mp4" etc)
optionslist of options that you can use to configure the input with
AVOptions avOptions;
avOptions.add("realtime",true); // respects FPS if video is not live
avOptions.add("loop",true); // keeps looping video if file
nvrcam.cam = new AVInput ( name, source,avOptions );

Definition at line 7 of file ozAVInput.cpp.

Member Function Documentation

int AVInput::run ( )
protectedvirtual
Returns

Implements Thread.

Definition at line 125 of file ozAVInput.cpp.

Here is the call graph for this function:


The documentation for this class was generated from the following files: