1 // VideoDecoder.h: Video decoding base class.
3 // Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #ifndef GNASH_VIDEODECODER_H
21 #define GNASH_VIDEODECODER_H
23 #include "GnashImage.h"
25 #include <boost/noncopyable.hpp>
27 // Forward declarations
30 class EncodedVideoFrame
;
37 /// Abstract base class for embedded video decoders.
39 /// This very simple design allows, but does not require,
40 /// the use of threads in an implementation. A user of this class push a frame
41 /// into the decoder and can subsequently pop a decoded frame. Since the pop()
42 /// call may block, it is advisable to first call peek() to see if there is a
43 /// frame ready to be popped.
45 class VideoDecoder
: public boost::noncopyable
{
48 virtual ~VideoDecoder()
52 /// Push an encoded video frame into the decoder
54 /// @param buffer the video frame to decode
56 virtual void push(const EncodedVideoFrame
& buffer
) = 0;
58 /// Pop a decoded frame from the decoder. THIS METHOD MAY BLOCK.
60 /// @return The decoded video frame, or a NULL-containing auto_ptr if an
62 virtual std::auto_ptr
<image::GnashImage
> pop() = 0;
65 /// Check whether a decoded frame is ready to be popped.
67 /// This method will never block.
69 /// @return true if there is a frame ready to be popped.
71 virtual bool peek() = 0;
73 /// Get the width in pixels of the Video
75 /// @return The width of a video frame, or 0 until this is known.
76 /// This is used ultimately for the AS Video.width property.
77 virtual int width() const = 0;
79 /// Get the height in pixels of the Video
81 /// @return The height of a video frame, or 0 until this is known.
82 /// This is used ultimately for the AS Video.height property.
83 virtual int height() const = 0;
88 } // gnash.media namespace
91 #endif // __VIDEODECODER_H__