video_scaler.h 1.72 KB
Newer Older
1
/*
Sébastien Blin's avatar
Sébastien Blin committed
2
 *  Copyright (C) 2011-2019 Savoir-faire Linux Inc.
Guillaume Roguez's avatar
Guillaume Roguez committed
3 4
 *
 *  Author: Guillaume Roguez <Guillaume.Roguez@savoirfairelinux.com>
5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
19 20
 */

21 22
#ifndef __VIDEO_SCALER_H__
#define __VIDEO_SCALER_H__
23 24 25 26 27

#include "video_base.h"
#include "noncopyable.h"


28
struct SwsContext;
29

Adrien Béraud's avatar
Adrien Béraud committed
30
namespace jami { namespace video {
31 32 33 34 35 36

class VideoScaler {
public:
    VideoScaler();
    ~VideoScaler();
    void reset();
37 38
    void scale(const VideoFrame &input, VideoFrame &output);
    void scale_with_aspect(const VideoFrame &input, VideoFrame &output);
39
    void scale_and_pad(const VideoFrame &input, VideoFrame &output,
40
                       unsigned xoff, unsigned yoff,
41 42
                       unsigned dest_width, unsigned dest_height,
                       bool keep_aspect);
43
    std::unique_ptr<VideoFrame> convertFormat(const VideoFrame& input, AVPixelFormat pix);
44 45 46 47 48

private:
    NON_COPYABLE(VideoScaler);
    SwsContext *ctx_;
    int mode_;
49
    uint8_t *tmp_data_[4]; // used by scale_and_pad
50 51
};

Adrien Béraud's avatar
Adrien Béraud committed
52
}} // namespace jami::video
53

54
#endif // __VIDEO_SCALER_H__