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"
36 FileJPEGList::FileJPEGList(Asset *asset, File *file)
37 : FileList(asset, file)
39 asset->format = FILE_JPEG_LIST;
42 FileJPEGList::~FileJPEGList()
47 char* FileJPEGList::list_title()
52 char* FileJPEGList::extension()
57 void FileJPEGList::get_parameters(BC_WindowBase *parent_window,
58 Asset *asset, BC_WindowBase* &format_window,
59 int audio_options, int video_options, EDL *edl)
63 JPEGConfigVideo *window = new JPEGConfigVideo(parent_window, asset);
64 format_window = window;
65 window->create_objects();
71 int FileJPEGList::can_copy_from(Asset *asset)
73 if(asset->format == FILE_JPEG_LIST)
79 int FileJPEGList::get_best_colormodel(int driver, int colormodel)
99 int FileJPEGList::read_frame(VFrame *frame, VFrame *data)
103 mjpeg_t *mjpeg = mjpeg_new(asset->width,
106 mjpeg_decompress(mjpeg,
108 data->get_compressed_size(),
114 frame->get_color_model(),
121 int FileJPEGList::write_frame(VFrame *frame, VFrame *data)
123 mjpeg_t *mjpeg = mjpeg_new(asset->width,
126 mjpeg_compress(mjpeg,
131 frame->get_color_model(),
133 data->allocate_compressed_data(mjpeg_output_size(mjpeg));
134 bcopy(mjpeg_output_buffer(mjpeg), frame->get_data(), mjpeg_output_size(mjpeg));
149 JPEGConfigVideo::JPEGConfigVideo(BC_WindowBase *parent_window, Asset *asset)
150 : BC_Window(_(PROGRAM_NAME ": Video Compression"),
151 parent_window->get_abs_cursor_x(),
152 parent_window->get_abs_cursor_y(),
156 this->parent_window = parent_window;
160 JPEGConfigVideo::~JPEGConfigVideo()
164 void JPEGConfigVideo::create_objects()
167 lock_window("JPEGConfigVideo::create_objects");
168 add_subwindow(new BC_Title(x, y, _("Quality:")));
169 add_subwindow(new BC_ISlider(x + 80,
181 add_subwindow(new BC_OKButton(this));
185 int JPEGConfigVideo::close_event()