Debian Codegraph @

src/avframe.h

raw
1 /* dvbcut
2 Copyright (c) 2005 Sven Over <[email protected]>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19 /* $Id$ */
20
21 #ifndef _DVBCUT_AVFRAME_H
22 #define _DVBCUT_AVFRAME_H
23
24 extern "C" {
25 #include <libavcodec/avcodec.h>
26 #include <libavutil/mem.h>
27 #ifdef HAVE_LIB_SWSCALE
28 #include <libswscale/swscale.h>
29 #endif
30 }
31
32 class QImage;
33
34 /**
35 @author Sven Over
36 */
37 class avframe
38 {
39 protected:
40 AVFrame *f;
41 uint8_t *tobefreed;
42 int w,h,dw;
43 enum AVPixelFormat pix_fmt;
44 #ifdef HAVE_LIB_SWSCALE
45 struct SwsContext *img_convert_ctx;
46 #endif
47
48 public:
49 avframe();
50 avframe(AVFrame *src, AVCodecContext *ctx);
51 ~avframe();
52
53 operator AVFrame*()
54 {
55 return f;
56 }
57 AVFrame *operator->()
58 {
59 return f;
60 }
61 int getwidth() const
62 {
63 return w;
64 }
65 int getheight() const
66 {
67 return h;
68 }
69 int getdisplaywidth() const
70 {
71 return dw;
72 }
73 enum AVPixelFormat getpixfmt() const
74 {
75 return pix_fmt;
76 }
77 QImage getqimage(bool scaled=true, double viewscalefactor=1.0);
78 };
79
80 #endif