[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog libmedia/ffmpeg/MediaParserFfmp...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog libmedia/ffmpeg/MediaParserFfmp... |
Date: |
Wed, 04 Jun 2008 11:40:47 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 08/06/04 11:40:46
Modified files:
. : ChangeLog
libmedia/ffmpeg: MediaParserFfmpeg.cpp MediaParserFfmpeg.h
Log message:
* libmedia/ffmpeg/MediaParserFfmpeg.{cpp,h}: don't
miss to call av_register_all, so probing works (thanks bjacques);
LOG_ONCE for log_unimpl; don't leak ByteIO buffer;
don't leak _inputFmt and _formatCtx.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6798&r2=1.6799
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/ffmpeg/MediaParserFfmpeg.cpp?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/ffmpeg/MediaParserFfmpeg.h?cvsroot=gnash&r1=1.1&r2=1.2
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6798
retrieving revision 1.6799
diff -u -b -r1.6798 -r1.6799
--- ChangeLog 4 Jun 2008 10:06:27 -0000 1.6798
+++ ChangeLog 4 Jun 2008 11:40:46 -0000 1.6799
@@ -1,5 +1,12 @@
2008-06-04 Sandro Santilli <address@hidden>
+ * libmedia/ffmpeg/MediaParserFfmpeg.{cpp,h}: don't
+ miss to call av_register_all, so probing works (thanks bjacques);
+ LOG_ONCE for log_unimpl; don't leak ByteIO buffer;
+ don't leak _inputFmt and _formatCtx.
+
+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.
Index: libmedia/ffmpeg/MediaParserFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/libmedia/ffmpeg/MediaParserFfmpeg.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- libmedia/ffmpeg/MediaParserFfmpeg.cpp 4 Jun 2008 10:06:29 -0000
1.1
+++ libmedia/ffmpeg/MediaParserFfmpeg.cpp 4 Jun 2008 11:40:46 -0000
1.2
@@ -60,6 +60,9 @@
size_t actuallyRead = _stream->read_bytes(probe_data.buf,
probe_data.buf_size);
_stream->set_position(0);
+ if ( actuallyRead > _lastParsedPosition ) // could probably be an
assertion here (always true)
+ _lastParsedPosition = actuallyRead;
+
if (actuallyRead < 1)
{
log_error(_("Gnash could not read from movie url"));
@@ -73,14 +76,14 @@
boost::uint32_t
MediaParserFfmpeg::getBufferLength()
{
- log_unimpl("%s", __PRETTY_FUNCTION__);
+ LOG_ONCE( log_unimpl("%s", __PRETTY_FUNCTION__) );
return 0;
}
bool
MediaParserFfmpeg::nextVideoFrameTimestamp(boost::uint64_t& ts)
{
- log_unimpl("%s", __PRETTY_FUNCTION__);
+ LOG_ONCE( log_unimpl("%s", __PRETTY_FUNCTION__) );
return false;
}
@@ -88,14 +91,14 @@
MediaParserFfmpeg::nextVideoFrame()
{
std::auto_ptr<EncodedVideoFrame> ret;
- log_unimpl("%s", __PRETTY_FUNCTION__);
+ LOG_ONCE( log_unimpl("%s", __PRETTY_FUNCTION__) );
return ret;
}
bool
MediaParserFfmpeg::nextAudioFrameTimestamp(boost::uint64_t& ts)
{
- log_unimpl("%s", __PRETTY_FUNCTION__);
+ LOG_ONCE( log_unimpl("%s", __PRETTY_FUNCTION__) );
return false;
}
@@ -104,21 +107,21 @@
{
std::auto_ptr<EncodedAudioFrame> ret;
- log_unimpl("%s", __PRETTY_FUNCTION__);
+ LOG_ONCE( log_unimpl("%s", __PRETTY_FUNCTION__) );
return ret;
}
VideoInfo*
MediaParserFfmpeg::getVideoInfo()
{
- log_unimpl("%s", __PRETTY_FUNCTION__);
+ LOG_ONCE( log_unimpl("%s", __PRETTY_FUNCTION__) );
return 0;
}
AudioInfo*
MediaParserFfmpeg::getAudioInfo()
{
- log_unimpl("%s", __PRETTY_FUNCTION__);
+ LOG_ONCE( log_unimpl("%s", __PRETTY_FUNCTION__) );
return 0;
}
@@ -146,14 +149,14 @@
{
log_error("Error in av_read_frame (while seeking)");
av_seek_frame(_formatCtx, -1, 0, AVSEEK_FLAG_BACKWARD);
- av_free_packet( &Packet );
+ //av_free_packet( &Packet );
return 0; // ??
}
newtime = timebase *
(double)_formatCtx->streams[_videoIndex]->cur_dts;
}
- av_free_packet( &Packet );
+ //av_free_packet( &Packet );
av_seek_frame(_formatCtx, _videoIndex, newpos, 0);
newtime = static_cast<boost::int32_t>(newtime / 1000.0);
@@ -163,7 +166,7 @@
bool
MediaParserFfmpeg::parseNextChunk()
{
- log_unimpl("%s", __PRETTY_FUNCTION__);
+ LOG_ONCE( log_unimpl("%s", __PRETTY_FUNCTION__) );
return false;
}
@@ -182,8 +185,11 @@
_videoIndex(-1),
_videoStream(0),
_audioIndex(-1),
- _audioStream(0)
+ _audioStream(0),
+ _lastParsedPosition(0)
{
+ av_register_all(); // TODO: needs to be invoked only once ?
+
ByteIOCxt.buffer = NULL;
_inputFmt = probeStream();
@@ -196,9 +202,10 @@
// Setup the filereader/seeker mechanism. 7th argument (NULL) is the
writer function,
// which isn't needed.
+ _byteIOBuffer.reset( new unsigned char[byteIOBufferSize] );
init_put_byte(&ByteIOCxt,
- new boost::uint8_t[500000], // FIXME: happy leakage !
- 500000, // ?
+ _byteIOBuffer.get(),
+ byteIOBufferSize, // ?
0, // ?
this, // opaque pointer to pass to the callbacks
MediaParserFfmpeg::readPacketWrapper, // packet reader callback
@@ -241,20 +248,22 @@
}
}
- log_unimpl("MediaParserFfmpeg");
+ LOG_ONCE( log_unimpl("MediaParserFfmpeg") );
}
MediaParserFfmpeg::~MediaParserFfmpeg()
{
if ( _inputFmt )
{
- // TODO: how to release an AVInputFormat ?
+ // TODO: check if this is correct (should we create RIIA
classes for ffmpeg stuff?)
+ av_free(_inputFmt);
}
if ( _formatCtx )
{
- // TODO: how to release a AVFormatContext
- av_close_input_file(_formatCtx);
+ // TODO: check if this is correct (should we create RIIA
classes for ffmpeg stuff?)
+ //av_close_input_file(_formatCtx); // NOTE: this one triggers a
mismatched free/delete on _byteIOBuffer !
+ av_free(_formatCtx);
}
}
@@ -296,8 +305,8 @@
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);
+ // Instead we seek to byteIOBufferSize bytes... seems to work
fine...
+ in.set_position(byteIOBufferSize);
}
Index: libmedia/ffmpeg/MediaParserFfmpeg.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/ffmpeg/MediaParserFfmpeg.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- libmedia/ffmpeg/MediaParserFfmpeg.h 4 Jun 2008 10:06:29 -0000 1.1
+++ libmedia/ffmpeg/MediaParserFfmpeg.h 4 Jun 2008 11:40:46 -0000 1.2
@@ -35,13 +35,6 @@
}
#endif
-#ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
-extern "C" {
-#include <libavformat/avformat.h>
-}
-#endif
-
-
// Forward declaration
class tu_file;
@@ -129,9 +122,15 @@
/// ?
ByteIOContext ByteIOCxt;
+ /// Size of the ByteIO context buffer
+ static const size_t byteIOBufferSize = 500000;
+
+ boost::scoped_array<unsigned char> _byteIOBuffer;
+
/// The last parsed position, for getBytesLoaded
boost::uint64_t _lastParsedPosition;
+
};
- [Gnash-commit] gnash ChangeLog libmedia/ffmpeg/MediaParserFfmp...,
Sandro Santilli <=
- [Gnash-commit] gnash ChangeLog libmedia/ffmpeg/MediaParserFfmp..., Sandro Santilli, 2008/06/04
- [Gnash-commit] gnash ChangeLog libmedia/ffmpeg/MediaParserFfmp..., Sandro Santilli, 2008/06/04
- [Gnash-commit] gnash ChangeLog libmedia/ffmpeg/MediaParserFfmp..., Sandro Santilli, 2008/06/04
- [Gnash-commit] gnash ChangeLog libmedia/ffmpeg/MediaParserFfmp..., Markus Gothe, 2008/06/06
- [Gnash-commit] gnash ChangeLog libmedia/ffmpeg/MediaParserFfmp..., Sandro Santilli, 2008/06/16