[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r9615: Some abstractions and class c
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r9615: Some abstractions and class clean-ups to make implementing transparent |
Date: |
Mon, 18 Aug 2008 20:32:16 +0200 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9615
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Mon 2008-08-18 20:32:16 +0200
message:
Some abstractions and class clean-ups to make implementing transparent
video possible.
Fix gstreamer again, which subclasses ImageBase (this seems unnecessary,
but it needs an immediate fix).
modified:
libbase/image.h
libcore/asobj/NetStreamFfmpeg.cpp
libcore/asobj/NetStreamFfmpeg.h
libcore/parser/video_stream_def.cpp
libcore/parser/video_stream_def.h
libmedia/VideoDecoder.h
libmedia/ffmpeg/VideoDecoderFfmpeg.cpp
libmedia/ffmpeg/VideoDecoderFfmpeg.h
libmedia/gst/VideoDecoderGst.cpp
libmedia/gst/VideoDecoderGst.h
------------------------------------------------------------
revno: 9609.1.14
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Mon 2008-08-18 20:01:10 +0200
message:
Use ImageBase for video frames too. This will allow transparent video
when it is implemented.
Use legal header names.
Make ImageBase::data() virtual again, as Gst subclasses it.
Handle VP6 with alpha instead of returning CODEC_ID_UNKNOWN. Catch
CODEC_ID_UNKNOWN with an assertion. This is better than the segfault
that otherwise happens, but still not very good.
modified:
libbase/image.h
libcore/asobj/NetStreamFfmpeg.cpp
libcore/asobj/NetStreamFfmpeg.h
libcore/parser/video_stream_def.cpp
libcore/parser/video_stream_def.h
libmedia/VideoDecoder.h
libmedia/ffmpeg/VideoDecoderFfmpeg.cpp
libmedia/ffmpeg/VideoDecoderFfmpeg.h
libmedia/gst/VideoDecoderGst.cpp
libmedia/gst/VideoDecoderGst.h
=== modified file 'libbase/image.h'
--- a/libbase/image.h 2008-08-18 11:28:00 +0000
+++ b/libbase/image.h 2008-08-18 18:01:10 +0000
@@ -118,7 +118,7 @@
void clear(const boost::uint8_t byteValue = 0);
/// Return a pointer to the underlying data
- boost::uint8_t* data() { return _data.get(); }
+ virtual boost::uint8_t* data() { return _data.get(); }
/// Return a pointer to first byte of given line
DSOEXPORT boost::uint8_t* scanline(size_t y);
=== modified file 'libcore/asobj/NetStreamFfmpeg.cpp'
--- a/libcore/asobj/NetStreamFfmpeg.cpp 2008-08-18 08:37:50 +0000
+++ b/libcore/asobj/NetStreamFfmpeg.cpp 2008-08-18 18:01:10 +0000
@@ -326,12 +326,12 @@
return true;
}
-std::auto_ptr<image::ImageRGB>
+std::auto_ptr<image::ImageBase>
NetStreamFfmpeg::getDecodedVideoFrame(boost::uint32_t ts)
{
assert(_videoDecoder.get()); // caller should check this
- std::auto_ptr<image::ImageRGB> video;
+ std::auto_ptr<image::ImageBase> video;
assert(m_parser.get());
if ( ! m_parser.get() )
@@ -409,10 +409,10 @@
return video;
}
-std::auto_ptr<image::ImageRGB>
+std::auto_ptr<image::ImageBase>
NetStreamFfmpeg::decodeNextVideoFrame()
{
- std::auto_ptr<image::ImageRGB> video;
+ std::auto_ptr<image::ImageBase> video;
if ( ! m_parser.get() )
{
@@ -859,7 +859,7 @@
#endif // GNASH_DEBUG_DECODING
// Get next decoded video frame from parser, will have the lowest
timestamp
- std::auto_ptr<image::ImageRGB> video = getDecodedVideoFrame(curPos);
+ std::auto_ptr<image::ImageBase> video = getDecodedVideoFrame(curPos);
// to be decoded or we're out of data
if (!video.get())
=== modified file 'libcore/asobj/NetStreamFfmpeg.h'
--- a/libcore/asobj/NetStreamFfmpeg.h 2008-08-18 08:37:50 +0000
+++ b/libcore/asobj/NetStreamFfmpeg.h 2008-08-18 18:01:10 +0000
@@ -186,7 +186,7 @@
//
/// @return 0 on EOF or error, a decoded video otherwise
///
- std::auto_ptr<image::ImageRGB> decodeNextVideoFrame();
+ std::auto_ptr<image::ImageBase> decodeNextVideoFrame();
/// Decode next audio frame fetching it MediaParser cursor
//
@@ -209,7 +209,7 @@
/// 3. next element in cursor has timestamp > tx
/// 4. there was an error decoding
///
- std::auto_ptr<image::ImageRGB> getDecodedVideoFrame(boost::uint32_t ts);
+ std::auto_ptr<image::ImageBase> getDecodedVideoFrame(boost::uint32_t
ts);
// Used to calculate a decimal value from a ffmpeg fraction
inline double as_double(AVRational time)
=== modified file 'libcore/parser/video_stream_def.cpp'
--- a/libcore/parser/video_stream_def.cpp 2008-08-10 17:08:19 +0000
+++ b/libcore/parser/video_stream_def.cpp 2008-08-18 18:01:10 +0000
@@ -106,7 +106,9 @@
if (bytesRead < dataLength)
{
- throw ParserException(_("Tag boundary reported past end of stream!"));
+ throw ParserException(_("Could not read enough bytes when parsing "
+ "VideoFrame tag. Perhaps we reached the "
+ "end of the stream!"));
}
memset(buffer + bytesRead, 0, 8);
=== modified file 'libcore/parser/video_stream_def.h'
--- a/libcore/parser/video_stream_def.h 2008-08-10 14:57:21 +0000
+++ b/libcore/parser/video_stream_def.h 2008-08-18 18:01:10 +0000
@@ -168,6 +168,7 @@
/// 2: H.263
/// 3: screen video (Flash 7+ only)
/// 4: VP6
+ /// 5: VP6 video with alpha
///
media::videoCodecType m_codec_id;
=== modified file 'libmedia/VideoDecoder.h'
--- a/libmedia/VideoDecoder.h 2008-08-18 08:37:50 +0000
+++ b/libmedia/VideoDecoder.h 2008-08-18 18:01:10 +0000
@@ -17,8 +17,8 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#ifndef __VIDEODECODER_H__
-#define __VIDEODECODER_H__
+#ifndef GNASH_VIDEODECODER_H
+#define GNASH_VIDEODECODER_H
#include "image.h"
@@ -59,7 +59,7 @@
//
/// @return The decoded video frame, or a NULL-containing auto_ptr if an
/// error occurred.
- virtual std::auto_ptr<image::ImageRGB> pop() = 0;
+ virtual std::auto_ptr<image::ImageBase> pop() = 0;
/// \brief
/// Check whether a decoded frame is ready to be popped.
=== modified file 'libmedia/ffmpeg/VideoDecoderFfmpeg.cpp'
--- a/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp 2008-08-18 08:37:50 +0000
+++ b/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp 2008-08-18 18:01:10 +0000
@@ -48,7 +48,7 @@
_videoCodec(NULL),
_videoCodecCtx(NULL)
{
- enum CodecID codec_id = FlashToFfmpegCodec(format);
+ enum CodecID codec_id = flashToFfmpegCodec(format);
init(codec_id, width, height);
}
@@ -59,9 +59,15 @@
_videoCodecCtx(NULL)
{
enum CodecID codec_id = CODEC_ID_NONE;
- if ( info.type == FLASH ) codec_id =
FlashToFfmpegCodec(static_cast<videoCodecType>(info.codec));
+ if ( info.type == FLASH )
+ {
+ codec_id = flashToFfmpegCodec(static_cast<videoCodecType>(info.codec));
+ }
else codec_id = static_cast<enum CodecID>(info.codec);
+ // This would cause nasty segfaults.
+ assert(codec_id != CODEC_ID_NONE);
+
boost::uint8_t* extradata=0;
int extradataSize=0;
if ( info.extra.get() )
@@ -176,10 +182,10 @@
return picture;
}
-std::auto_ptr<image::ImageRGB>
+std::auto_ptr<image::ImageBase>
VideoDecoderFfmpeg::decode(const boost::uint8_t* input, boost::uint32_t
input_size)
{
- std::auto_ptr<image::ImageRGB> ret;
+ std::auto_ptr<image::ImageBase> ret;
AVFrame* frame = avcodec_alloc_frame();
if ( ! frame ) {
@@ -215,10 +221,10 @@
}
-std::auto_ptr<image::ImageRGB>
+std::auto_ptr<image::ImageBase>
VideoDecoderFfmpeg::pop()
{
- std::auto_ptr<image::ImageRGB> ret;
+ std::auto_ptr<image::ImageBase> ret;
for (std::vector<const EncodedVideoFrame*>::iterator it =
_video_frames.begin(), end = _video_frames.end(); it != end; ++it) {
@@ -238,23 +244,25 @@
/* public static */
enum CodecID
-VideoDecoderFfmpeg::FlashToFfmpegCodec(videoCodecType format)
+VideoDecoderFfmpeg::flashToFfmpegCodec(videoCodecType format)
{
- // Find the decoder and init the parser
- switch(format) {
- case VIDEO_CODEC_H263:
- return CODEC_ID_FLV1; // why not CODEC_ID_H263I ?
+ // Find the decoder and init the parser
+ switch(format) {
+ case VIDEO_CODEC_H263:
+ return CODEC_ID_FLV1; // why not CODEC_ID_H263I ?
#ifdef FFMPEG_VP6
- case VIDEO_CODEC_VP6:
- return CODEC_ID_VP6F;
+ case VIDEO_CODEC_VP6:
+ return CODEC_ID_VP6F;
+ case VIDEO_CODEC_VP6A:
+ return CODEC_ID_VP6A;
#endif
- case VIDEO_CODEC_SCREENVIDEO:
- return CODEC_ID_FLASHSV;
- default:
- log_error(_("Unsupported video codec %d"),
+ case VIDEO_CODEC_SCREENVIDEO:
+ return CODEC_ID_FLASHSV;
+ default:
+ log_error(_("Unsupported video codec %d"),
static_cast<int>(format));
- return CODEC_ID_NONE;
- }
+ return CODEC_ID_NONE;
+ }
}
=== modified file 'libmedia/ffmpeg/VideoDecoderFfmpeg.h'
--- a/libmedia/ffmpeg/VideoDecoderFfmpeg.h 2008-08-18 08:37:50 +0000
+++ b/libmedia/ffmpeg/VideoDecoderFfmpeg.h 2008-08-18 18:01:10 +0000
@@ -57,7 +57,7 @@
void push(const EncodedVideoFrame& buffer);
- std::auto_ptr<image::ImageRGB> pop();
+ std::auto_ptr<image::ImageBase> pop();
bool peek();
@@ -77,15 +77,15 @@
//
/// @return CODEC_ID_NONE for unsupported flash codecs
///
- DSOEXPORT static enum CodecID FlashToFfmpegCodec(videoCodecType format);
+ DSOEXPORT static enum CodecID flashToFfmpegCodec(videoCodecType format);
private:
void init(enum CodecID format, int width, int height, boost::uint8_t*
extradata=0, int extradataSize=0);
- std::auto_ptr<image::ImageRGB> decode(const boost::uint8_t* input,
boost::uint32_t input_size);
+ std::auto_ptr<image::ImageBase> decode(const boost::uint8_t* input,
boost::uint32_t input_size);
- std::auto_ptr<image::ImageRGB> decode(const EncodedVideoFrame* vf)
+ std::auto_ptr<image::ImageBase> decode(const EncodedVideoFrame* vf)
{
return decode(vf->data(), vf->dataSize());
}
=== modified file 'libmedia/gst/VideoDecoderGst.cpp'
--- a/libmedia/gst/VideoDecoderGst.cpp 2008-08-18 08:37:50 +0000
+++ b/libmedia/gst/VideoDecoderGst.cpp 2008-08-18 18:01:10 +0000
@@ -146,11 +146,11 @@
}
-std::auto_ptr<image::ImageRGB>
+std::auto_ptr<image::ImageBase>
VideoDecoderGst::pop()
{
if (!_pipeline) {
- return std::auto_ptr<image::ImageRGB>();
+ return std::auto_ptr<image::ImageBase>();
}
checkMessages();
@@ -158,7 +158,7 @@
GstBuffer* buffer = gst_app_sink_pull_buffer_timed (GST_APP_SINK(_appsink));
if (!buffer) {
- return std::auto_ptr<image::ImageRGB>();
+ return std::auto_ptr<image::ImageBase>();
}
GstCaps* caps = gst_buffer_get_caps(buffer);
@@ -174,7 +174,7 @@
gst_caps_unref(caps);
- std::auto_ptr<image::ImageRGB> ret(new gnashGstBuffer(buffer, width,
height));
+ std::auto_ptr<image::ImageBase> ret(new gnashGstBuffer(buffer, width,
height));
return ret;
}
=== modified file 'libmedia/gst/VideoDecoderGst.h'
--- a/libmedia/gst/VideoDecoderGst.h 2008-08-18 08:37:50 +0000
+++ b/libmedia/gst/VideoDecoderGst.h 2008-08-18 18:01:10 +0000
@@ -17,8 +17,8 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#ifndef __VIDEODECODERGST_H__
-#define __VIDEODECODERGST_H__
+#ifndef GNASH_VIDEODECODERGST_H
+#define GNASH_VIDEODECODERGST_H
#ifdef HAVE_CONFIG_H
@@ -74,7 +74,7 @@
void push(const EncodedVideoFrame& buffer);
- std::auto_ptr<image::ImageRGB> pop();
+ std::auto_ptr<image::ImageBase> pop();
bool peek();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r9615: Some abstractions and class clean-ups to make implementing transparent,
Benjamin Wolsey <=