2 * qpsnr (C) 2010 E. Oriani, ema <AT> fastwebnet <DOT> it
4 * This file is part of qpsnr.
6 * qpsnr 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.
11 * qpsnr 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 qpsnr. If not, see <http://www.gnu.org/licenses/>.
23 // libavcodec is a C library without C++ guards...
25 #include <libavcodec/avcodec.h>
26 #include <libavformat/avformat.h>
27 #include <libswscale/swscale.h>
37 scr_size(const int& _x = 0, const int& _y = 0) : x(_x), y(_y) {
40 inline friend bool operator==(const scr_size& lhs, const scr_size& rhs) {
41 return lhs.x==rhs.x && lhs.y==rhs.y;
50 AVFormatContext *pFormatCtx;
51 AVCodecContext *pCodecCtx;
54 struct SwsContext *img_convert_ctx;
57 qvideo(const char* file, int _out_width = -1, int _out_height = -1);
58 scr_size get_size(void) const;
59 int get_fps_k(void) const;
60 bool get_frame(std::vector<unsigned char>& out, int *_frnum = 0);
61 void save_frame(const unsigned char *buf, const char* __fname = 0);