2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version 2
5 * of the License, or (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software Foundation,
14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17 * All rights reserved.
20 /** \file \ingroup avi
22 * This is external code. Identify and convert different avi-files.
27 #include "avi_intern.h"
30 #include "avi_mjpeg.h"
31 #include "avi_rgb32.h"
33 void *avi_format_convert(AviMovie *movie, int stream, void *buffer, AviFormat from, AviFormat to, size_t *size)
38 if (from != AVI_FORMAT_RGB24 &&
39 to != AVI_FORMAT_RGB24)
41 return avi_format_convert(movie, stream,
42 avi_format_convert(movie, stream, buffer, from, AVI_FORMAT_RGB24, size),
43 AVI_FORMAT_RGB24, to, size);
47 case AVI_FORMAT_RGB24:
49 case AVI_FORMAT_AVI_RGB:
50 buffer = avi_converter_from_avi_rgb(movie, stream, buffer, size);
52 case AVI_FORMAT_MJPEG:
53 buffer = avi_converter_from_mjpeg(movie, stream, buffer, size);
55 case AVI_FORMAT_RGB32:
56 buffer = avi_converter_from_rgb32(movie, stream, buffer, size);
62 case AVI_FORMAT_AVI_RGB:
63 buffer = avi_converter_to_avi_rgb(movie, stream, buffer, size);
65 case AVI_FORMAT_MJPEG:
66 buffer = avi_converter_to_mjpeg(movie, stream, buffer, size);
68 case AVI_FORMAT_RGB32:
69 buffer = avi_converter_to_rgb32(movie, stream, buffer, size);
78 int avi_get_data_id(AviFormat format, int stream)
82 if (avi_get_format_type(format) == FCC("vids"))
83 sprintf(fcc, "%2.2ddc", stream);
84 else if (avi_get_format_type(format) == FCC("auds"))
85 sprintf(fcc, "%2.2ddc", stream);
92 int avi_get_format_type(AviFormat format)
95 case AVI_FORMAT_RGB24:
96 case AVI_FORMAT_RGB32:
97 case AVI_FORMAT_AVI_RGB:
98 case AVI_FORMAT_MJPEG:
105 int avi_get_format_fcc(AviFormat format)
108 case AVI_FORMAT_RGB24:
109 case AVI_FORMAT_RGB32:
110 case AVI_FORMAT_AVI_RGB:
112 case AVI_FORMAT_MJPEG:
119 int avi_get_format_compression(AviFormat format)
122 case AVI_FORMAT_RGB24:
123 case AVI_FORMAT_RGB32:
124 case AVI_FORMAT_AVI_RGB:
126 case AVI_FORMAT_MJPEG: