gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog libmedia/Makefile.am libmedia/M...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog libmedia/Makefile.am libmedia/M...
Date: Wed, 04 Jun 2008 10:06:29 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/06/04 10:06:29

Modified files:
        .              : ChangeLog 
        libmedia       : Makefile.am MediaHandler.cpp MediaHandler.h 
                         MediaParser.h 
        libmedia/ffmpeg: MediaHandlerFfmpeg.cpp 
Added files:
        libmedia/ffmpeg: MediaParserFfmpeg.cpp MediaParserFfmpeg.h 

Log message:
        * libmedia/MediaHandler.{cpp,h}: add protected isFLV
          method, for use by subclasses to figure if FLVParser
          would be enough for input.
        * libmedia/MediaParser.h: comment out unneeded interfaces
          (dont' seem to fit in the design, were left over from
           tgc draft)
        * libmedia/Makefile.am, libmedia/ffmpeg/MediaParserFfmpeg.{cpp,h}:
          Stub non-FLV ffmpeg-based media parser (still not working).
        * libmedia/ffmpeg/MediaHandlerFfmpeg.cpp: for non-FLV input, try
          to create an FFMPEG-based MediaParser.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6797&r2=1.6798
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/Makefile.am?cvsroot=gnash&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/MediaHandler.cpp?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/MediaHandler.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/MediaParser.h?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/ffmpeg/MediaHandlerFfmpeg.cpp?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/ffmpeg/MediaParserFfmpeg.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/ffmpeg/MediaParserFfmpeg.h?cvsroot=gnash&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6797
retrieving revision 1.6798
diff -u -b -r1.6797 -r1.6798
--- ChangeLog   4 Jun 2008 07:59:11 -0000       1.6797
+++ ChangeLog   4 Jun 2008 10:06:27 -0000       1.6798
@@ -1,3 +1,16 @@
+2008-06-04 Sandro Santilli <address@hidden>
+
+       * libmedia/MediaHandler.{cpp,h}: add protected isFLV
+         method, for use by subclasses to figure if FLVParser
+         would be enough for input.
+       * libmedia/MediaParser.h: comment out unneeded interfaces
+         (dont' seem to fit in the design, were left over from
+          tgc draft)
+       * libmedia/Makefile.am, libmedia/ffmpeg/MediaParserFfmpeg.{cpp,h}:
+         Stub non-FLV ffmpeg-based media parser (still not working).
+       * libmedia/ffmpeg/MediaHandlerFfmpeg.cpp: for non-FLV input, try
+         to create an FFMPEG-based MediaParser.
+
 2008-06-04 Benjamin Wolsey <address@hidden>
 
        * server/swf/tag_loaders.cpp: no need to log_unimpl with metadata

Index: libmedia/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/libmedia/Makefile.am,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- libmedia/Makefile.am        3 Jun 2008 14:48:53 -0000       1.23
+++ libmedia/Makefile.am        4 Jun 2008 10:06:28 -0000       1.24
@@ -134,6 +134,7 @@
 if USE_FFMPEG_ENGINE
    libgnashmedia_la_SOURCES += \
                ffmpeg/MediaHandlerFfmpeg.cpp \
+               ffmpeg/MediaParserFfmpeg.cpp \
                ffmpeg/AudioDecoderFfmpeg.cpp \
                ffmpeg/VideoDecoderFfmpeg.cpp \
                ffmpeg/sound_handler_sdl.cpp \
@@ -141,6 +142,7 @@
 
    noinst_HEADERS += \
                ffmpeg/MediaHandlerFfmpeg.h \
+               ffmpeg/MediaParserFfmpeg.h \
                ffmpeg/AudioDecoderFfmpeg.h \
                ffmpeg/VideoDecoderFfmpeg.h \
                ffmpeg/sound_handler_sdl.h \

Index: libmedia/MediaHandler.cpp
===================================================================
RCS file: /sources/gnash/gnash/libmedia/MediaHandler.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- libmedia/MediaHandler.cpp   3 Jun 2008 14:48:53 -0000       1.1
+++ libmedia/MediaHandler.cpp   4 Jun 2008 10:06:28 -0000       1.2
@@ -28,28 +28,36 @@
 
 std::auto_ptr<MediaHandler> MediaHandler::_handler;
 
-std::auto_ptr<MediaParser>
-MediaHandler::createMediaParser(std::auto_ptr<tu_file> stream)
+/* public static */
+bool
+MediaHandler::isFLV(tu_file& stream)
 {
-       std::auto_ptr<MediaParser> parser;
-
        char head[4] = {0, 0, 0, 0};
-       size_t actuallyRead = stream->read_bytes(head, 3);
-       stream->set_position(0);
+       stream.set_position(0);
+       size_t actuallyRead = stream.read_bytes(head, 3);
+       stream.set_position(0);
 
        if (actuallyRead < 3)
        {
-               log_error(_("MediaHandler::createMediaParser: Could not read 3 
bytes from input stream"));
-               return parser;
+               log_error(_("MediaHandler::isFLV: Could not read 3 bytes from 
input stream"));
+               return false;
        }
 
-       if (std::string(head) != "FLV")
+       if (std::string(head) != "FLV") return false;
+       return true;
+}
+
+std::auto_ptr<MediaParser>
+MediaHandler::createMediaParser(std::auto_ptr<tu_file> stream)
+{
+       std::auto_ptr<MediaParser> parser;
+
+       if ( ! isFLV(*stream) )
        {
                log_error(_("MediaHandler::createMediaParser: only FLV input is 
supported by this MediaHandler"));
                return parser;
        }
        
-
        parser.reset( new FLVParser(stream) );
        assert(! stream.get() ); // TODO: when ownership will be transferred...
 

Index: libmedia/MediaHandler.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/MediaHandler.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libmedia/MediaHandler.h     3 Jun 2008 16:11:44 -0000       1.2
+++ libmedia/MediaHandler.h     4 Jun 2008 10:06:28 -0000       1.3
@@ -98,6 +98,9 @@
 
 protected:
 
+       /// Return true if input stream is an FLV
+       bool isFLV(tu_file& stream);
+
        MediaHandler() {}
 
 private:

Index: libmedia/MediaParser.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/MediaParser.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- libmedia/MediaParser.h      3 Jun 2008 14:48:53 -0000       1.17
+++ libmedia/MediaParser.h      4 Jun 2008 10:06:29 -0000       1.18
@@ -289,12 +289,6 @@
        ///
        bool isAudioNellymoser() { return _isAudioNellymoser; }
 
-       /// Setup the parser
-       //
-       /// @return whether we'll be able to parse the file.
-       ///
-       virtual bool setupParser() { return false; }
-
        /// Returns a VideoInfo class about the videostream
        //
        /// @return a VideoInfo class about the videostream,
@@ -324,23 +318,23 @@
        //
        /// @return the diff between the current and last frame
        ///
-       virtual boost::uint32_t audioFrameDelay() { return 0; }
+       //virtual boost::uint32_t audioFrameDelay() { return 0; }
 
        /// Returns the framedelay from the last to the current
        /// videoframe in milliseconds. 
        //
        /// @return the diff between the current and last frame
        ///
-       virtual boost::uint32_t videoFrameDelay() { return 0; }
+       //virtual boost::uint32_t videoFrameDelay() { return 0; }
 
        /// Returns the framerate of the video
        //
        /// @return the framerate of the video
        ///
-       virtual boost::uint16_t videoFrameRate() { return 0; }
+       //virtual boost::uint16_t videoFrameRate() { return 0; }
 
        /// Returns the last parsed position in the file in bytes
-       virtual boost::uint32_t getLastParsedPos() { return 0; }
+       //virtual boost::uint32_t getLastParsedPos() { return 0; }
 
        /// Parse next input chunk
        //

Index: libmedia/ffmpeg/MediaHandlerFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/libmedia/ffmpeg/MediaHandlerFfmpeg.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- libmedia/ffmpeg/MediaHandlerFfmpeg.cpp      3 Jun 2008 16:11:44 -0000       
1.2
+++ libmedia/ffmpeg/MediaHandlerFfmpeg.cpp      4 Jun 2008 10:06:29 -0000       
1.3
@@ -19,8 +19,11 @@
 
 
 #include "MediaHandlerFfmpeg.h"
+#include "MediaParserFfmpeg.h"
 #include "VideoDecoderFfmpeg.h"
 #include "AudioDecoderFfmpeg.h"
+#include "GnashException.h"
+#include "FLVParser.h"
 
 #include "tu_file.h" // for visibility of destructor
 #include "MediaParser.h" // for visibility of destructor
@@ -31,8 +34,26 @@
 std::auto_ptr<MediaParser>
 MediaHandlerFfmpeg::createMediaParser(std::auto_ptr<tu_file> stream)
 {
-       // TODO: support more then just FLV...
-       return MediaHandler::createMediaParser(stream);
+       std::auto_ptr<MediaParser> parser;
+
+       if ( isFLV(*stream) )
+       {
+               parser.reset( new FLVParser(stream) );
+       }
+       else
+       {
+               try
+               {
+                       parser.reset(new MediaParserFfmpeg(stream));
+               }
+               catch (GnashException& ex)
+               {
+                       log_error("Could not create FFMPEG based media parser 
for input stream: %s", ex.what());
+                       assert(!parser.get());
+               }
+       }
+
+       return parser;
 }
 
 std::auto_ptr<VideoDecoder>

Index: libmedia/ffmpeg/MediaParserFfmpeg.cpp
===================================================================
RCS file: libmedia/ffmpeg/MediaParserFfmpeg.cpp
diff -N libmedia/ffmpeg/MediaParserFfmpeg.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ libmedia/ffmpeg/MediaParserFfmpeg.cpp       4 Jun 2008 10:06:29 -0000       
1.1
@@ -0,0 +1,312 @@
+// MediaParserFfmpeg.cpp: FFMPG media parsers, for Gnash
+//
+//   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+
+#include "MediaParserFfmpeg.h"
+#include "GnashException.h"
+#include "log.h"
+
+using namespace std;
+
+//#define PADDING_BYTES 64
+//#define READ_CHUNKS 64
+
+namespace gnash {
+namespace media {
+
+
+int
+MediaParserFfmpeg::readPacketWrapper(void* opaque, boost::uint8_t* buf, int 
buf_size)
+{
+       MediaParserFfmpeg* p = static_cast<MediaParserFfmpeg*>(opaque);
+       return p->readPacket(buf, buf_size);
+}
+
+offset_t
+MediaParserFfmpeg::seekMediaWrapper(void *opaque, offset_t offset, int whence)
+{
+       MediaParserFfmpeg* p = static_cast<MediaParserFfmpeg*>(opaque);
+       return p->seekMedia(offset, whence);
+}
+
+AVInputFormat*
+MediaParserFfmpeg::probeStream()
+{
+       boost::scoped_array<boost::uint8_t> buffer(new boost::uint8_t[2048]);
+
+       // Probe the file to detect the format
+       AVProbeData probe_data;
+       probe_data.filename = "";
+       probe_data.buf = buffer.get();
+       probe_data.buf_size = 2048;
+
+       assert(_stream->get_position() == 0);
+       size_t actuallyRead = _stream->read_bytes(probe_data.buf, 
probe_data.buf_size);
+       _stream->set_position(0);
+
+       if (actuallyRead < 1)
+       {
+               log_error(_("Gnash could not read from movie url"));
+               return NULL;
+       }
+
+       probe_data.buf_size = actuallyRead; // right ?
+       return av_probe_input_format(&probe_data, 1);
+}
+
+boost::uint32_t
+MediaParserFfmpeg::getBufferLength()
+{
+       log_unimpl("%s", __PRETTY_FUNCTION__);
+       return 0;
+}
+
+bool
+MediaParserFfmpeg::nextVideoFrameTimestamp(boost::uint64_t& ts)
+{
+       log_unimpl("%s", __PRETTY_FUNCTION__);
+       return false;
+}
+
+std::auto_ptr<EncodedVideoFrame>
+MediaParserFfmpeg::nextVideoFrame()
+{
+       std::auto_ptr<EncodedVideoFrame> ret;
+       log_unimpl("%s", __PRETTY_FUNCTION__);
+       return ret;
+}
+
+bool
+MediaParserFfmpeg::nextAudioFrameTimestamp(boost::uint64_t& ts)
+{
+       log_unimpl("%s", __PRETTY_FUNCTION__);
+       return false;
+}
+
+std::auto_ptr<EncodedAudioFrame>
+MediaParserFfmpeg::nextAudioFrame()
+{
+       std::auto_ptr<EncodedAudioFrame> ret;
+
+       log_unimpl("%s", __PRETTY_FUNCTION__);
+       return ret;
+}
+
+VideoInfo*
+MediaParserFfmpeg::getVideoInfo()
+{
+       log_unimpl("%s", __PRETTY_FUNCTION__);
+       return 0;
+}
+
+AudioInfo*
+MediaParserFfmpeg::getAudioInfo()
+{
+       log_unimpl("%s", __PRETTY_FUNCTION__);
+       return 0;
+}
+
+boost::uint32_t
+MediaParserFfmpeg::seek(boost::uint32_t pos)
+{
+       log_debug("MediaParserFfmpeg::seek(%d) TESTING", pos);
+
+       AVStream* videostream = _formatCtx->streams[_videoIndex];
+       double timebase = static_cast<double>(videostream->time_base.num / 
videostream->time_base.den);
+       long newpos = static_cast<long>(pos / timebase);
+               
+       if (av_seek_frame(_formatCtx, _videoIndex, newpos, 0) < 0)
+       {
+               log_error(_("%s: seeking failed"), __FUNCTION__);
+               return 0;
+       }
+
+       AVPacket Packet;
+       av_init_packet(&Packet);
+       double newtime = 0;
+       while (newtime == 0)
+       {
+               if (av_read_frame(_formatCtx, &Packet) < 0) 
+               {
+                       log_error("Error in av_read_frame (while seeking)");
+                       av_seek_frame(_formatCtx, -1, 0, AVSEEK_FLAG_BACKWARD);
+                       av_free_packet( &Packet );
+                       return 0; // ??
+               }
+
+               newtime = timebase * 
(double)_formatCtx->streams[_videoIndex]->cur_dts;
+       }
+
+       av_free_packet( &Packet );
+       av_seek_frame(_formatCtx, _videoIndex, newpos, 0);
+
+       newtime = static_cast<boost::int32_t>(newtime / 1000.0);
+       return newtime;
+}
+
+bool
+MediaParserFfmpeg::parseNextChunk()
+{
+       log_unimpl("%s", __PRETTY_FUNCTION__);
+       return false;
+}
+
+boost::uint64_t
+MediaParserFfmpeg::getBytesLoaded() const
+{
+       //log_unimpl("%s", __PRETTY_FUNCTION__);
+       return _stream->get_position();
+}
+
+MediaParserFfmpeg::MediaParserFfmpeg(std::auto_ptr<tu_file> stream)
+       :
+       MediaParser(stream),
+       _inputFmt(0),
+       _formatCtx(0),
+       _videoIndex(-1),
+       _videoStream(0),
+       _audioIndex(-1),
+       _audioStream(0)
+{
+       ByteIOCxt.buffer = NULL;
+
+       _inputFmt = probeStream();
+       if ( ! _inputFmt )
+       {
+               throw GnashException("MediaParserFfmpeg couldn't figure out 
input format");
+       }
+
+       _formatCtx = av_alloc_format_context();
+
+       // Setup the filereader/seeker mechanism. 7th argument (NULL) is the 
writer function,
+       // which isn't needed.
+       init_put_byte(&ByteIOCxt,
+               new boost::uint8_t[500000], // FIXME: happy leakage !
+               500000, // ?
+               0, // ?
+               this, // opaque pointer to pass to the callbacks
+               MediaParserFfmpeg::readPacketWrapper, // packet reader callback
+               NULL, // writer callback
+               MediaParserFfmpeg::seekMediaWrapper // seeker callback
+               );
+
+       ByteIOCxt.is_streamed = 1;
+
+       // Open the stream. the 4th argument is the filename, which we ignore.
+       if(av_open_input_stream(&_formatCtx, &ByteIOCxt, "", _inputFmt, NULL) < 
0)
+       {
+               throw GnashException("MediaParserFfmpeg couldn't open input 
stream");
+       }
+
+       // Find audio and video stream
+       for (unsigned int i = 0; i < (unsigned)_formatCtx->nb_streams; i++)
+       {
+               AVCodecContext* enc = _formatCtx->streams[i]->codec; 
+
+               switch (enc->codec_type)
+               {
+                       case CODEC_TYPE_AUDIO:
+                               if (_audioIndex < 0)
+                               {
+                                       _audioIndex = i;
+                                       _audioStream = _formatCtx->streams[i];
+                               }
+                               break;
+
+                       case CODEC_TYPE_VIDEO:
+                               if (_videoIndex < 0)
+                               {
+                                       _videoIndex = i;
+                                       _videoStream = _formatCtx->streams[i];
+                               }
+                               break;
+                       default:
+                               break;
+               }
+       }
+
+       log_unimpl("MediaParserFfmpeg");
+}
+
+MediaParserFfmpeg::~MediaParserFfmpeg()
+{
+       if ( _inputFmt )
+       {
+               // TODO: how to release an AVInputFormat ?
+       }
+
+       if ( _formatCtx )
+       {
+               // TODO: how to release a AVFormatContext 
+               av_close_input_file(_formatCtx);
+       }
+}
+
+int 
+MediaParserFfmpeg::readPacket(boost::uint8_t* buf, int buf_size)
+{
+
+       assert( _stream.get() );
+       tu_file& in = *_stream;
+
+       size_t ret = in.read_bytes(static_cast<void*>(buf), buf_size);
+
+       // Update _lastParsedPosition
+       boost::uint64_t curPos = in.get_position();
+       if ( curPos > _lastParsedPosition ) _lastParsedPosition = curPos;
+
+       return ret;
+
+}
+
+offset_t 
+MediaParserFfmpeg::seekMedia(offset_t offset, int whence)
+{
+
+       assert(_stream.get());
+       tu_file& in = *(_stream);
+
+       // Offset is absolute new position in the file
+       if (whence == SEEK_SET)
+       {       
+               in.set_position(offset);
+               // New position is offset + old position
+       }
+       else if (whence == SEEK_CUR)
+       {
+               in.set_position(in.get_position() + offset);
+               // New position is offset + end of file
+       }
+       else if (whence == SEEK_END)
+       {
+               // This is (most likely) a streamed file, so we can't seek to 
the end!
+               // Instead we seek to 50.000 bytes... seems to work fine...
+               in.set_position(50000);
+
+       }
+
+       return in.get_position(); 
+}
+
+
+} // end of gnash::media namespace
+} // end of gnash namespace
+
+#undef PADDING_BYTES
+#undef READ_CHUNKS 

Index: libmedia/ffmpeg/MediaParserFfmpeg.h
===================================================================
RCS file: libmedia/ffmpeg/MediaParserFfmpeg.h
diff -N libmedia/ffmpeg/MediaParserFfmpeg.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ libmedia/ffmpeg/MediaParserFfmpeg.h 4 Jun 2008 10:06:29 -0000       1.1
@@ -0,0 +1,141 @@
+// MediaParserFfmpeg.h: FFMPG media parsers, for Gnash
+// 
+//   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+#ifndef __MEDIAPARSER_FFMPEG_H__
+#define __MEDIAPARSER_FFMPEG_H__
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include "MediaParser.h" // for inheritance
+
+#include <boost/scoped_array.hpp>
+#include <memory>
+
+#ifdef HAVE_FFMPEG_AVFORMAT_H
+extern "C" {
+#include <ffmpeg/avformat.h>
+}
+#endif
+
+#ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
+extern "C" {
+#include <libavformat/avformat.h>
+}
+#endif
+
+
+// Forward declaration
+class tu_file;
+
+namespace gnash {
+namespace media {
+
+/// FFMPEG based MediaParser
+///
+class MediaParserFfmpeg: public MediaParser
+{
+public:
+
+       /// Construct a ffmpeg-based media parser for given stream
+       //
+       /// Can throw a GnashException if input format couldn't be detected
+       ///
+       MediaParserFfmpeg(std::auto_ptr<tu_file> stream);
+
+       ~MediaParserFfmpeg();
+
+       // See dox in MediaParser.h
+       virtual boost::uint32_t getBufferLength();
+
+       // See dox in MediaParser.h
+       virtual bool nextVideoFrameTimestamp(boost::uint64_t& ts);
+
+       // See dox in MediaParser.h
+       virtual std::auto_ptr<EncodedVideoFrame> nextVideoFrame();
+
+       // See dox in MediaParser.h
+       virtual bool nextAudioFrameTimestamp(boost::uint64_t& ts);
+
+       // See dox in MediaParser.h
+       virtual std::auto_ptr<EncodedAudioFrame> nextAudioFrame();
+
+       // See dox in MediaParser.h
+       virtual VideoInfo* getVideoInfo();
+
+       // See dox in MediaParser.h
+       virtual AudioInfo* getAudioInfo();
+
+       // See dox in MediaParser.h
+       virtual boost::uint32_t seek(boost::uint32_t);
+
+       // See dox in MediaParser.h
+       virtual bool parseNextChunk();
+
+       // See dox in MediaParser.h
+       virtual boost::uint64_t getBytesLoaded() const;
+
+private:
+
+       /// Input chunk reader, to be called by ffmpeg parser
+       int readPacket(boost::uint8_t* buf, int buf_size);
+
+       /// ffmpeg callback function
+       static int readPacketWrapper(void* opaque, boost::uint8_t* buf, int 
buf_size);
+
+       /// Input stream seeker, to be called by ffmpeg parser
+       offset_t seekMedia(offset_t offset, int whence);
+
+       /// ffmpeg callback function
+       static offset_t seekMediaWrapper(void *opaque, offset_t offset, int 
whence);
+
+       /// Read some of the input to figure an AVInputFormat
+       AVInputFormat* probeStream();
+
+       AVInputFormat* _inputFmt;
+
+       /// the format (mp3, avi, etc.)
+       AVFormatContext *_formatCtx;
+
+       /// Index of the video stream in input
+       int _videoIndex;
+
+       /// Video input stream
+       AVStream* _videoStream;
+
+       /// Index of the audio stream in input
+       int _audioIndex;
+
+       // audio
+       AVStream* _audioStream;
+
+       /// ?
+       ByteIOContext ByteIOCxt;
+
+       /// The last parsed position, for getBytesLoaded
+       boost::uint64_t _lastParsedPosition;
+
+};
+
+
+} // gnash.media namespace 
+} // namespace gnash
+
+#endif // __MEDIAPARSER_FFMPEG_H__




reply via email to

[Prev in Thread] Current Thread [Next in Thread]