3 * Copyright (C) 2013 Dan Dennedy <dan@dennedy.org>
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 2 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 Foundation,
17 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #include "mlt_movit_input.h"
22 using namespace movit;
24 MltInput::MltInput( mlt_image_format format )
35 void MltInput::useFlatInput(MovitPixelFormat pix_fmt, unsigned width, unsigned height)
40 ImageFormat image_format;
41 image_format.color_space = COLORSPACE_sRGB;
42 image_format.gamma_curve = GAMMA_sRGB;
43 input = new FlatInput(image_format, pix_fmt, GL_UNSIGNED_BYTE, width, height);
47 void MltInput::useYCbCrInput(const ImageFormat& image_format, const YCbCrFormat& ycbcr_format, unsigned width, unsigned height)
52 input = new YCbCrInput(image_format, ycbcr_format, width, height);
54 m_ycbcr_format = ycbcr_format;
58 void MltInput::set_pixel_data(const unsigned char* data)
62 FlatInput* flat = (FlatInput*) input;
63 flat->set_pixel_data(data);
65 YCbCrInput* ycbcr = (YCbCrInput*) input;
66 ycbcr->set_pixel_data(0, data);
67 ycbcr->set_pixel_data(1, &data[m_width * m_height]);
68 ycbcr->set_pixel_data(2, &data[m_width * m_height + (m_width / m_ycbcr_format.chroma_subsampling_x * m_height / m_ycbcr_format.chroma_subsampling_y)]);
72 void MltInput::invalidate_pixel_data()
76 FlatInput* flat = (FlatInput*) input;
77 flat->invalidate_pixel_data();
79 YCbCrInput* ycbcr = (YCbCrInput*) input;
80 ycbcr->invalidate_pixel_data();