/*----------------------------------------------------------------- GEM - Graphics Environment for Multimedia Load an digital video (like AVI, Mpeg, Quicktime) into a pix block (Linux) Copyright (c) 1997-1999 Mark Danks. mark@danks.org Copyright (c) Günther Geiger. geiger@epy.co.at Copyright (c) 2001-2011 IOhannes m zmölnig. forum::für::umläute. IEM. zmoelnig@iem.at For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution. -----------------------------------------------------------------*/ #ifndef _INCLUDE_GEMPLUGIN__FILMFFMPEG_FILMFFMPEG_H_ #define _INCLUDE_GEMPLUGIN__FILMFFMPEG_FILMFFMPEG_H_ #include "plugins/film.h" #include "Gem/Image.h" # ifdef __cplusplus extern "C" { # endif #include #include #include #include # ifdef __cplusplus } # endif /*----------------------------------------------------------------- ------------------------------------------------------------------- CLASS filmFFMPEG Loads in a film KEYWORDS pix DESCRIPTION -----------------------------------------------------------------*/ namespace gem { namespace plugins { class GEM_EXPORT filmFFMPEG : public film { public: ////////// // Constructor filmFFMPEG(void); ////////// // open a movie up virtual bool open(const std::string&filename, const gem::Properties&); virtual void close(void); ////////// // get the next frame virtual pixBlock* getFrame(void); ////////// // set the next frame to read; virtual errCode changeImage(int imgNum, int trackNum = -1); virtual bool enumProperties(gem::Properties&readprops, gem::Properties&writeprops); virtual void getProperties(gem::Properties&props); virtual void setProperties(gem::Properties&props); virtual bool isThreadable(void); virtual int64_t frameToPts(int frame) const; virtual int decode_packet(AVPacket *m_packet, AVCodecContext *m_codecContext, AVFrame *m_avframe); //----------------------------------- pixBlock m_image; unsigned int m_wantedFormat; // format requested by the user double m_fps; // the frame-rate int m_fps_num, m_fps_denum; int m_width,m_height; unsigned int m_numFrames, m_numTracks; int m_avframeBytes; uint8_t *m_avframeBuffer; int ret, video_stream; enum AVPixelFormat src_pix_fmt, dst_pix_fmt; struct SwsContext *sws_ctx; AVFormatContext *m_formatContext; AVStream *m_in_stream; AVCodecParameters *m_codecParam; AVCodec *m_codec; AVCodecContext *m_codecContext; AVFrame *m_avframe; AVPacket *m_packet; AVFrame *m_finalFrame; unsigned char *m_rawdata; int how_many_packets_to_process,response; }; }; }; #endif // for header file