2 * pipeline.h: Ffmpeg related parts of the pipeline for the media
5 * Moonlight List (moonlight-list@lists.ximian.com)
7 * Copyright 2007 Novell, Inc. (http://www.novell.com)
9 * See the LICENSE file included with the distribution for details.
15 #ifndef __MOON_PIPELINE_FFMPEG__
16 #define __MOON_PIPELINE_FFMPEG__
22 #if HAVE_LIBAVCODEC_AVCODEC_H
23 #include <libavcodec/avcodec.h>
31 #define AUDIO_BUFFER_SIZE (AVCODEC_MAX_AUDIO_FRAME_SIZE * 2)
33 void register_ffmpeg ();
35 class FfmpegDemuxer
: public IMediaDemuxer
{
37 FfmpegDemuxer (Media
*media
, IMediaSource
*source
);
40 class FfmpegDecoder
: public IMediaDecoder
{
42 AVCodecContext
*context
;
45 guint32 frame_buffer_length
;
47 bool has_delayed_frame
;
52 virtual ~FfmpegDecoder () {}
53 virtual void DecodeFrameAsyncInternal (MediaFrame
* frame
);
54 virtual void OpenDecoderAsyncInternal ();
57 FfmpegDecoder (Media
* media
, IMediaStream
* stream
);
58 virtual void Dispose ();
59 virtual void Cleanup (MediaFrame
* frame
);
60 virtual void CleanState ();
61 virtual bool HasDelayedFrame () {return has_delayed_frame
; }
63 static PixelFormat
ToFfmpegPixFmt (MoonPixelFormat format
);
64 static MoonPixelFormat
ToMoonPixFmt (PixelFormat format
);
67 class FfmpegDecoderInfo
: public DecoderInfo
{
69 virtual bool Supports (const char* codec
);
70 virtual IMediaDecoder
* Create (Media
* media
, IMediaStream
* stream
);
71 virtual const char* GetName () { return "FfmpegDecoder"; }
74 #endif // __MOON_PIPELINE_FFMPEG__
75 #endif // INCLUDE_FFMPEG