On Mon, Aug 09, 2010 at 05:43:45PM +0100, Robert Osfield wrote: > Hi David, > > What does creation time refer to? > > Robert.
In this case mp4 has a file creation time and a file modification time (and the same times per stream). The file creation time is supposed to be the time the file is first recorded, and modification time is if it is edited later. In our case we needed to synchronize the playback of multiple video streams with other data and finding out the time each video started recording was the most logical way to keep the rest of the playback in sync. Thanks for merging those, looks like I'll have some more improvements to the ffmpeg plugin later. Would you prefer one patch in the future as opposed to one patch per bug? > On Mon, Jul 26, 2010 at 5:25 PM, David Fries <[email protected]> wrote: > > Add a way to retrieve the creation time for MPEG-4 files. > > > > --- > > ?include/osg/ImageStream ? ? ? ? ? ? ? ? ? ? | ? ?2 +- > > ?src/osgPlugins/ffmpeg/FFmpegDecoder.hpp ? ? | ? ?8 ++++++++ > > ?src/osgPlugins/ffmpeg/FFmpegImageStream.cpp | ? ?5 +++++ > > ?src/osgPlugins/ffmpeg/FFmpegImageStream.hpp | ? ?1 + > > ?4 files changed, 15 insertions(+), 1 deletions(-) > > > > diff --git a/include/osg/ImageStream b/include/osg/ImageStream > > index 2749cd2..4b4a6d5 100644 > > --- a/include/osg/ImageStream > > +++ b/include/osg/ImageStream > > @@ -76,7 +76,7 @@ class OSG_EXPORT ImageStream : public Image > > > > ? ? ? ? LoopingMode getLoopingMode() const { return _loopingMode; } > > > > - > > + ? ? ? ?virtual double getCreationTime() const { return HUGE_VAL; } > > ? ? ? ? virtual double getLength() const { return 0.0; } > > ? ? ? ? virtual double getFrameRate() const { return 0.0; } > > > > diff --git a/src/osgPlugins/ffmpeg/FFmpegDecoder.hpp > > b/src/osgPlugins/ffmpeg/FFmpegDecoder.hpp > > index 6176dcc..a783f01 100644 > > --- a/src/osgPlugins/ffmpeg/FFmpegDecoder.hpp > > +++ b/src/osgPlugins/ffmpeg/FFmpegDecoder.hpp > > @@ -26,6 +26,8 @@ class FormatContextPtr > > > > ? ? ? ? T* get() { return _ptr; } > > > > + ? ? ? ?operator bool() const { return _ptr != 0; } > > + > > ? ? ? ? T * operator-> () const // never throws > > ? ? ? ? { > > ? ? ? ? ? ? return _ptr; > > @@ -74,6 +76,7 @@ public: > > ? ? void loop(bool loop); > > ? ? bool loop() const; > > > > + ? ?double creation_time() const; > > ? ? double duration() const; > > ? ? double reference(); > > > > @@ -144,6 +147,11 @@ inline bool FFmpegDecoder::loop() const > > ? ? return m_loop; > > ?} > > > > +inline double FFmpegDecoder::creation_time() const > > +{ > > + ? if(m_format_context) return m_format_context->timestamp; > > + ? else return HUGE_VAL; > > +} > > > > ?inline double FFmpegDecoder::duration() const > > ?{ > > diff --git a/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp > > b/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp > > index e14fbd9..bd25ef8 100644 > > --- a/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp > > +++ b/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp > > @@ -162,6 +162,11 @@ float FFmpegImageStream::getVolume() const > > ? ? return m_decoder->audio_decoder().getVolume(); > > ?} > > > > +double FFmpegImageStream::getCreationTime() const > > +{ > > + ? ?return m_decoder->creation_time(); > > +} > > + > > ?double FFmpegImageStream::getLength() const > > ?{ > > ? ? return m_decoder->duration(); > > diff --git a/src/osgPlugins/ffmpeg/FFmpegImageStream.hpp > > b/src/osgPlugins/ffmpeg/FFmpegImageStream.hpp > > index 033a892..4395a58 100644 > > --- a/src/osgPlugins/ffmpeg/FFmpegImageStream.hpp > > +++ b/src/osgPlugins/ffmpeg/FFmpegImageStream.hpp > > @@ -36,6 +36,7 @@ namespace osgFFmpeg > > ? ? ? ? virtual void setVolume(float volume); > > ? ? ? ? virtual float getVolume() const; > > > > + ? ? ? ?virtual double getCreationTime() const; > > ? ? ? ? virtual double getLength() const; > > ? ? ? ? virtual double getReferenceTime () const; > > ? ? ? ? virtual double getFrameRate() const; > > -- > > 1.7.0 > > > > > > _______________________________________________ > > osg-submissions mailing list > > [email protected] > > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org > > > > > _______________________________________________ > osg-submissions mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org -- David Fries <[email protected]> http://fries.net/~david/ (PGP encryption key available) _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
