CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/10/19 13:50:25
Modified files: . : ChangeLog libmedia : VideoDecoder.h libmedia/sdl : VideoDecoderFfmpeg.h server/parser : video_stream_def.cpp Log message: * libmedia/VideoDecoder.h: add getPaddingBytes. * libmedia/sdl/VideoDecoderFfmpeg.h: implement getPaddingBytes using the ffmpeg define. * server/parser/video_stream_def.cpp: use getPaddingBytes to find out how much to pad. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4647&r2=1.4648 http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/VideoDecoder.h?cvsroot=gnash&r1=1.5&r2=1.6 http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/sdl/VideoDecoderFfmpeg.h?cvsroot=gnash&r1=1.5&r2=1.6 http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/video_stream_def.cpp?cvsroot=gnash&r1=1.22&r2=1.23 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4647 retrieving revision 1.4648 diff -u -b -r1.4647 -r1.4648 --- ChangeLog 19 Oct 2007 12:28:24 -0000 1.4647 +++ ChangeLog 19 Oct 2007 13:50:24 -0000 1.4648 @@ -1,3 +1,11 @@ +2007-10-19 Sandro Santilli <[EMAIL PROTECTED]> + + * libmedia/VideoDecoder.h: add getPaddingBytes. + * libmedia/sdl/VideoDecoderFfmpeg.h: implement getPaddingBytes + using the ffmpeg define. + * server/parser/video_stream_def.cpp: use getPaddingBytes + to find out how much to pad. + 2007-10-19 Udo Giacomozzi <[EMAIL PROTECTED]> * gui/fb.cpp, gui/fbsup.h: Preliminary support for keyboard input; Index: libmedia/VideoDecoder.h =================================================================== RCS file: /sources/gnash/gnash/libmedia/VideoDecoder.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- libmedia/VideoDecoder.h 18 Oct 2007 15:56:54 -0000 1.5 +++ libmedia/VideoDecoder.h 19 Oct 2007 13:50:25 -0000 1.6 @@ -16,7 +16,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// $Id: VideoDecoder.h,v 1.5 2007/10/18 15:56:54 tgc Exp $ +// $Id: VideoDecoder.h,v 1.6 2007/10/19 13:50:25 strk Exp $ #ifndef __VIDEODECODER_H__ #define __VIDEODECODER_H__ @@ -35,6 +35,12 @@ // virtual classes need a virtual destructor ! virtual ~VideoDecoder() {} + /// Return the number of bytes input frame data is expected + /// to be padded with zeroes. Make sure to provide such + /// padding to avoid illegal reads. + /// + virtual unsigned getPaddingBytes() const { return 8; } + /// Sets up the decoder. // /// @param info Index: libmedia/sdl/VideoDecoderFfmpeg.h =================================================================== RCS file: /sources/gnash/gnash/libmedia/sdl/VideoDecoderFfmpeg.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- libmedia/sdl/VideoDecoderFfmpeg.h 18 Oct 2007 15:56:55 -0000 1.5 +++ libmedia/sdl/VideoDecoderFfmpeg.h 19 Oct 2007 13:50:25 -0000 1.6 @@ -16,7 +16,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// $Id: VideoDecoderFfmpeg.h,v 1.5 2007/10/18 15:56:55 tgc Exp $ +// $Id: VideoDecoderFfmpeg.h,v 1.6 2007/10/19 13:50:25 strk Exp $ #ifndef __VIDEODECODERFFMPEG_H__ #define __VIDEODECODERFFMPEG_H__ @@ -42,6 +42,8 @@ VideoDecoderFfmpeg(); ~VideoDecoderFfmpeg(); + virtual unsigned getPaddingBytes() const { return FF_INPUT_BUFFER_PADDING_SIZE; } + bool setup(VideoInfo* info); bool setup( Index: server/parser/video_stream_def.cpp =================================================================== RCS file: /sources/gnash/gnash/server/parser/video_stream_def.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -b -r1.22 -r1.23 --- server/parser/video_stream_def.cpp 19 Oct 2007 12:17:28 -0000 1.22 +++ server/parser/video_stream_def.cpp 19 Oct 2007 13:50:25 -0000 1.23 @@ -16,7 +16,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -// $Id: video_stream_def.cpp,v 1.22 2007/10/19 12:17:28 strk Exp $ +// $Id: video_stream_def.cpp,v 1.23 2007/10/19 13:50:25 strk Exp $ #include "video_stream_def.h" #include "video_stream_instance.h" @@ -102,7 +102,7 @@ // bigger than the data to avoid libavcodec (ffmpeg) making // illegal reads. Also, we must ensure first 23 bits to be // zeroed out. We'll zero out all padding. - unsigned int padding = FF_INPUT_BUFFER_PADDING_SIZE; + unsigned int padding = _decoder->getPaddingBytes(); unsigned int dataSize = in->get_tag_end_position() - in->get_position(); unsigned int totSize = dataSize+padding; @@ -111,7 +111,7 @@ { data[i] = in->read_u8(); } - memset(&data[dataSize], 0, padding); // padd with zeroes + if ( padding ) memset(&data[dataSize], 0, padding); // pad with zeroes if needed // TODO: should we pass dataSize instead of totSize to decodeToImage ? std::auto_ptr<image::image_base> img ( _decoder->decodeToImage(data.get(), totSize) ); _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit