[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog libmedia/ffmpeg/MediaHandlerFfm...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog libmedia/ffmpeg/MediaHandlerFfm... |
Date: |
Thu, 05 Jun 2008 07:19:03 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 08/06/05 07:19:03
Modified files:
. : ChangeLog
libmedia/ffmpeg: MediaHandlerFfmpeg.cpp VideoDecoderFfmpeg.cpp
VideoDecoderFfmpeg.h
Log message:
* libmedia/ffmpeg/MediaHandlerFfmpeg.cpp: construct VideoDecoder
by VideoInfo (to support non-FLASH codecs).
* libmedia/ffmpeg/VideoDecoderFfmpeg.{cpp,h}: add constructor
taking a VideoInfo&.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6824&r2=1.6825
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/ffmpeg/MediaHandlerFfmpeg.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/libmedia/ffmpeg/VideoDecoderFfmpeg.h?cvsroot=gnash&r1=1.11&r2=1.12
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6824
retrieving revision 1.6825
diff -u -b -r1.6824 -r1.6825
--- ChangeLog 5 Jun 2008 03:26:30 -0000 1.6824
+++ ChangeLog 5 Jun 2008 07:19:01 -0000 1.6825
@@ -1,3 +1,10 @@
+2008-06-05 Sandro Santilli <address@hidden>
+
+ * libmedia/ffmpeg/MediaHandlerFfmpeg.cpp: construct VideoDecoder
+ by VideoInfo (to support non-FLASH codecs).
+ * libmedia/ffmpeg/VideoDecoderFfmpeg.{cpp,h}: add constructor
+ taking a VideoInfo&.
+
2008-06-05 Zou Lunkai <address@hidden>
* server/matrix.{h,cpp}: code refactory, use integer math for swf
matrix,
Index: libmedia/ffmpeg/MediaHandlerFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/libmedia/ffmpeg/MediaHandlerFfmpeg.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- libmedia/ffmpeg/MediaHandlerFfmpeg.cpp 4 Jun 2008 10:06:29 -0000
1.3
+++ libmedia/ffmpeg/MediaHandlerFfmpeg.cpp 5 Jun 2008 07:19:02 -0000
1.4
@@ -59,15 +59,7 @@
std::auto_ptr<VideoDecoder>
MediaHandlerFfmpeg::createVideoDecoder(VideoInfo& info)
{
- if ( info.type != FLASH )
- {
- log_error("Non-flash video encoding not supported yet by FFMPEG
VideoDecoder");
- return std::auto_ptr<VideoDecoder>(0);
- }
- videoCodecType format = static_cast<videoCodecType>(info.codec);
- int width = info.width;
- int height = info.height;
- std::auto_ptr<VideoDecoder> ret( new VideoDecoderFfmpeg(format, width,
height) );
+ std::auto_ptr<VideoDecoder> ret( new VideoDecoderFfmpeg(info) );
return ret;
}
Index: libmedia/ffmpeg/VideoDecoderFfmpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- libmedia/ffmpeg/VideoDecoderFfmpeg.cpp 4 Jun 2008 20:12:33 -0000
1.11
+++ libmedia/ffmpeg/VideoDecoderFfmpeg.cpp 5 Jun 2008 07:19:02 -0000
1.12
@@ -42,37 +42,36 @@
namespace gnash {
namespace media {
-VideoDecoderFfmpeg::VideoDecoderFfmpeg(videoCodecType format, int width,int
height)
+VideoDecoderFfmpeg::VideoDecoderFfmpeg(videoCodecType format, int width, int
height)
:
_videoCodec(NULL),
_videoCodecCtx(NULL)
{
+ enum CodecID codec_id = FlashToFfmpegCodec(format);
+
+ init(codec_id, width, height);
+}
+
+VideoDecoderFfmpeg::VideoDecoderFfmpeg(VideoInfo& info)
+ :
+ _videoCodec(NULL),
+ _videoCodecCtx(NULL)
+{
+ enum CodecID codec_id = CODEC_ID_NONE;
+ if ( info.type == FLASH ) codec_id =
FlashToFfmpegCodec(static_cast<videoCodecType>(info.codec));
+ else codec_id = static_cast<enum CodecID>(info.codec);
+
+ init(codec_id, info.width, info.height);
+}
+
+void
+VideoDecoderFfmpeg::init(enum CodecID codecId, int width, int height)
+{
// Init the avdecoder-decoder
avcodec_init();
avcodec_register_all();// change this to only register need codec?
- enum CodecID codec_id;
-
- // Find the decoder and init the parser
- switch(format) {
- case VIDEO_CODEC_H263:
- codec_id = CODEC_ID_FLV1;
- break;
-#ifdef FFMPEG_VP6
- case VIDEO_CODEC_VP6:
- codec_id = CODEC_ID_VP6F;
- break;
-#endif
- case VIDEO_CODEC_SCREENVIDEO:
- codec_id = CODEC_ID_FLASHSV;
- break;
- default:
- log_error(_("Unsupported video codec %d"),
- static_cast<int>(format));
- return;
- }
-
- _videoCodec = avcodec_find_decoder(static_cast<CodecID>(codec_id)); // WTF?
+ _videoCodec = avcodec_find_decoder(codecId);
if (!_videoCodec) {
log_error(_("libavcodec can't decode the current video format"));
@@ -97,7 +96,6 @@
assert(_videoCodecCtx->width > 0);
assert(_videoCodecCtx->height > 0);
- return;
}
VideoDecoderFfmpeg::~VideoDecoderFfmpeg()
@@ -221,5 +219,27 @@
return (!_video_frames.empty());
}
+/* public static */
+enum CodecID
+VideoDecoderFfmpeg::FlashToFfmpegCodec(videoCodecType format)
+{
+ // Find the decoder and init the parser
+ switch(format) {
+ case VIDEO_CODEC_H263:
+ return CODEC_ID_FLV1;
+#ifdef FFMPEG_VP6
+ case VIDEO_CODEC_VP6:
+ return CODEC_ID_VP6F;
+#endif
+ case VIDEO_CODEC_SCREENVIDEO:
+ return CODEC_ID_FLASHSV;
+ default:
+ log_error(_("Unsupported video codec %d"),
+ static_cast<int>(format));
+ return CODEC_ID_NONE;
+ }
+}
+
+
} // gnash.media namespace
} // gnash namespace
Index: libmedia/ffmpeg/VideoDecoderFfmpeg.h
===================================================================
RCS file: /sources/gnash/gnash/libmedia/ffmpeg/VideoDecoderFfmpeg.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- libmedia/ffmpeg/VideoDecoderFfmpeg.h 3 Jun 2008 12:39:54 -0000
1.11
+++ libmedia/ffmpeg/VideoDecoderFfmpeg.h 5 Jun 2008 07:19:02 -0000
1.12
@@ -48,7 +48,11 @@
class VideoDecoderFfmpeg : public VideoDecoder {
public:
+
DSOEXPORT VideoDecoderFfmpeg(videoCodecType format, int width, int height);
+
+ DSOEXPORT VideoDecoderFfmpeg(VideoInfo& info);
+
DSOEXPORT ~VideoDecoderFfmpeg();
void push(const EncodedVideoFrame& buffer);
@@ -69,15 +73,22 @@
/// If conversion fails, AVPicture::data[0] will be NULL.
DSOEXPORT static AVPicture convertRGB24(AVCodecContext* srcCtx, const
AVFrame& srcFrame);
+ /// Convert FLASH codec id to FFMPEG codec id
+ //
+ /// @return CODEC_ID_NONE for unsupported flash codecs
+ ///
+ DSOEXPORT static enum CodecID FlashToFfmpegCodec(videoCodecType format);
+
private:
+ void init(enum CodecID format, int width, int height);
+
std::auto_ptr<image::rgb> decode(const boost::uint8_t* input,
boost::uint32_t input_size);
std::auto_ptr<image::rgb> decode(const EncodedVideoFrame* vf)
{
return decode(vf->data(), vf->dataSize());
}
-private:
AVCodec* _videoCodec;
AVCodecContext* _videoCodecCtx;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog libmedia/ffmpeg/MediaHandlerFfm...,
Sandro Santilli <=