Update with current status
[gnash.git] / libmedia / VideoDecoder.h
blobe0e143826f62f0c3bedfd8d4657b6d7d109fcd15
1 // VideoDecoder.h: Video decoding base class.
2 //
3 // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
4 // Free Software Foundation, Inc.
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef GNASH_VIDEODECODER_H
22 #define GNASH_VIDEODECODER_H
24 #include "GnashImage.h"
26 #include <boost/noncopyable.hpp>
28 // Forward declarations
29 namespace gnash {
30 namespace media {
31 class EncodedVideoFrame;
35 namespace gnash {
36 namespace media {
38 /// Abstract base class for embedded video decoders.
40 /// This very simple design allows, but does not require,
41 /// the use of threads in an implementation. A user of this class push a frame
42 /// into the decoder and can subsequently pop a decoded frame. Since the pop()
43 /// call may block, it is advisable to first call peek() to see if there is a
44 /// frame ready to be popped.
45 ///
46 class VideoDecoder : public boost::noncopyable {
48 public:
49 virtual ~VideoDecoder()
53 /// Push an encoded video frame into the decoder
55 /// @param buffer the video frame to decode
56 ///
57 virtual void push(const EncodedVideoFrame& buffer) = 0;
59 /// Pop a decoded frame from the decoder. THIS METHOD MAY BLOCK.
61 /// @return The decoded video frame, or a NULL-containing unique_ptr if an
62 /// error occurred.
63 virtual std::unique_ptr<image::GnashImage> pop() = 0;
65 /// \brief
66 /// Check whether a decoded frame is ready to be popped.
68 /// This method will never block.
69 ///
70 /// @return true if there is a frame ready to be popped.
71 ///
72 virtual bool peek() = 0;
74 /// Get the width in pixels of the Video
76 /// @return The width of a video frame, or 0 until this is known.
77 /// This is used ultimately for the AS Video.width property.
78 virtual int width() const = 0;
80 /// Get the height in pixels of the Video
82 /// @return The height of a video frame, or 0 until this is known.
83 /// This is used ultimately for the AS Video.height property.
84 virtual int height() const = 0;
89 } // gnash.media namespace
90 } // gnash namespace
92 #endif // __VIDEODECODER_H__