4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
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 2 of the License, or
9 * (at your option) any later version.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "filejpeglist.h"
27 #include "mwindow.inc"
28 #include "jpegwrapper.h"
29 #include "quicktime.h"
37 FileJPEGList::FileJPEGList(Asset *asset, File *file)
38 : FileList(asset, file)
40 asset->format = FILE_JPEG_LIST;
43 FileJPEGList::~FileJPEGList()
48 char* FileJPEGList::list_title()
53 char* FileJPEGList::extension()
58 void FileJPEGList::get_parameters(BC_WindowBase *parent_window,
60 BC_WindowBase* &format_window,
66 JPEGConfigVideo *window = new JPEGConfigVideo(parent_window, asset);
67 format_window = window;
68 window->create_objects();
74 int FileJPEGList::can_copy_from(Asset *asset)
76 if(asset->format == FILE_JPEG_LIST)
79 if(asset->format == FILE_MOV && match4(asset->vcodec, QUICKTIME_JPEG))
85 int FileJPEGList::get_best_colormodel(int driver, int colormodel)
105 int FileJPEGList::read_frame(VFrame *frame, VFrame *data)
109 mjpeg_t *mjpeg = mjpeg_new(asset->width,
112 mjpeg_decompress(mjpeg,
114 data->get_compressed_size(),
120 frame->get_color_model(),
127 int FileJPEGList::write_frame(VFrame *frame, VFrame *data)
129 mjpeg_t *mjpeg = mjpeg_new(asset->width,
132 mjpeg_compress(mjpeg,
137 frame->get_color_model(),
139 data->allocate_compressed_data(mjpeg_output_size(mjpeg));
140 bcopy(mjpeg_output_buffer(mjpeg), frame->get_data(), mjpeg_output_size(mjpeg));
155 JPEGConfigVideo::JPEGConfigVideo(BC_WindowBase *parent_window, Asset *asset)
156 : BC_Window(_(PROGRAM_NAME ": Video Compression"),
157 parent_window->get_abs_cursor_x(),
158 parent_window->get_abs_cursor_y(),
162 this->parent_window = parent_window;
166 JPEGConfigVideo::~JPEGConfigVideo()
170 int JPEGConfigVideo::create_objects()
173 lock_window("JPEGConfigVideo::create_objects");
174 add_subwindow(new BC_Title(x, y, _("Quality:")));
175 add_subwindow(new BC_ISlider(x + 80,
187 add_subwindow(new BC_OKButton(this));
192 int JPEGConfigVideo::close_event()