CFrameSeqVideoControllerComp.h
Go to the documentation of this file.
1 #ifndef iqtmm_CFrameSeqVideoControllerComp_included
2 #define iqtmm_CFrameSeqVideoControllerComp_included
3 
4 
5 // Qt includes
6 #include <QtCore/QObject>
7 #include <QtCore/QTimer>
8 #include <QtCore/QFileInfoList>
9 
10 // ACF includes
11 #include "ifile/IFilePersistence.h"
13 #include "icomp/CComponentBase.h"
15 
16 // ACF-Solutions includes
18 #include "imm/IVideoController.h"
19 
20 
21 namespace iqtmm
22 {
23 
24 
29  public QObject,
30  public iproc::TSyncProcessorCompBase<icam::IBitmapAcquisition>,
31  virtual public imm::IVideoController,
33 {
34  Q_OBJECT
35 
36 public:
38 
39  I_BEGIN_COMPONENT(CFrameSeqVideoControllerComp);
40  I_REGISTER_INTERFACE(istd::IChangeable);
41  I_REGISTER_INTERFACE(imm::IMediaController);
42  I_REGISTER_INTERFACE(imm::IVideoInfo);
43  I_REGISTER_INTERFACE(imm::IVideoController);
44  I_ASSIGN(m_framesPerSecondAttrPtr, "FramesPerSecond", "Default number of frames per second if this info is unavailable from video", true, 25.0);
45  I_ASSIGN(m_frameLoaderCompPtr, "FrameLoader", "Loader for the single frame", true, "FrameLoader");
46  I_ASSIGN(m_frameDataCompPtr, "FrameData", "Frame instance will be loaded with loader", true, "FrameData");
47  I_END_COMPONENT;
48 
50 
51  // reimplemented (icam::IBitmapAcquisition)
52  virtual istd::CIndex2d GetBitmapSize(const iprm::IParamsSet* paramsPtr) const;
53 
54  // reimplemented (iproc::IProcessor)
55  virtual int DoProcessing(
56  const iprm::IParamsSet* paramsPtr,
57  const istd::IPolymorphic* inputPtr,
58  istd::IChangeable* outputPtr,
59  ibase::IProgressManager* progressManagerPtr = NULL);
60 
61  // reimplemented (imm::IMediaController)
62  virtual QString GetOpenedMediumUrl() const;
63  virtual bool OpenMediumUrl(const QString& url, bool autoPlay = true);
64  virtual void CloseMedium();
65  virtual bool IsPlaying() const;
66  virtual bool SetPlaying(bool state = true);
67  virtual double GetMediumLength() const;
68  virtual double GetCurrentPosition() const;
69  virtual bool SetCurrentPosition(double position);
70  virtual int GetSupportedFeatures() const;
71 
72  // reimplemented (imm::IVideoInfo)
73  virtual int GetFramesCount() const;
74  virtual double GetFrameIntervall() const;
75  virtual istd::CIndex2d GetFrameSize() const;
76  virtual double GetPixelAspectRatio() const;
77 
78  // reimplemented (imm::IVideoController)
79  virtual int GetCurrentFrame() const;
80  virtual bool SetCurrentFrame(int frameIndex);
81 
82  // reimplemented (ifile::IFileTypeInfo)
83  virtual bool GetFileExtensions(QStringList& result, int flags = -1, bool doAppend = false) const;
84  virtual QString GetTypeDescription(const QString* extensionPtr = NULL) const;
85 
86 protected:
87  bool LoadCurrentFrame();
88 
89 private:
90  I_ATTR(QString, m_defaultSequenceDirectoryAttrPtr);
91  I_ATTR(double, m_framesPerSecondAttrPtr);
92  I_REF(ifile::IFilePersistence, m_frameLoaderCompPtr);
93  I_REF(istd::IChangeable, m_frameDataCompPtr);
94 
95  int m_currentFrameIndex;
96 
97  QString m_mediumUrl;
98 
99  QFileInfoList m_fileList;
100  bool m_isPlaying;
101 
102  bool m_isFrameLoaded;
103 };
104 
105 
106 } // namespace iqtmm
107 
108 
109 #endif // !iqtmm_CFrameSeqVideoControllerComp_included
110 
virtual int DoProcessing(const iprm::IParamsSet *paramsPtr, const istd::IPolymorphic *inputPtr, istd::IChangeable *outputPtr, ibase::IProgressManager *progressManagerPtr=NULL)
Do synchronized processing.
Simple definition macro for a synchronous processor.
Component to play some image (frame) sequence from a directory.
virtual double GetPixelAspectRatio() const
Get frame aspect ratio.
virtual int GetFramesCount() const
Return length of video in seconds.
virtual bool SetPlaying(bool state=true)
Play or pause current media.
virtual istd::CIndex2d GetFrameSize() const
Return size in pixels of single frame.
virtual bool SetCurrentPosition(double position)
Skip to some position of media stream.
virtual QString GetTypeDescription(const QString *extensionPtr=NULL) const
iproc::TSyncProcessorCompBase< icam::IBitmapAcquisition > BaseClass
virtual bool OpenMediumUrl(const QString &url, bool autoPlay=true)
Open some media file.
virtual double GetMediumLength() const
Return length of opened media.
virtual istd::CIndex2d GetBitmapSize(const iprm::IParamsSet *paramsPtr) const
Get size of acquired bitmap for specified parameters.
virtual double GetFrameIntervall() const
Return time difference between frames.
virtual double GetCurrentPosition() const
Get current position.
virtual void CloseMedium()
Close this media player.
virtual int GetSupportedFeatures() const
Get info about features, that are supported by this media controller.
virtual int GetCurrentFrame() const
Get index of current frame.
virtual bool GetFileExtensions(QStringList &result, int flags=-1, bool doAppend=false) const
virtual bool IsPlaying() const
Return true, if media is currntly playing.
virtual bool SetCurrentFrame(int frameIndex)
Set index of current frame.
virtual QString GetOpenedMediumUrl() const
Get URL of the medium object.

© 2007-2011 Witold Gantzke and Kirill Lepskiy