Blender  V2.93
avi_codecs.c
Go to the documentation of this file.
1 /*
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.
6  *
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.
11  *
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.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
26 #include "AVI_avi.h"
27 #include "avi_intern.h"
28 
29 #include "avi_mjpeg.h"
30 #include "avi_rgb.h"
31 #include "avi_rgb32.h"
32 
34  AviMovie *movie, int stream, void *buffer, AviFormat from, AviFormat to, size_t *size)
35 {
36  if (from == to) {
37  return buffer;
38  }
39 
40  if (from != AVI_FORMAT_RGB24 && to != AVI_FORMAT_RGB24) {
41  return avi_format_convert(
42  movie,
43  stream,
46  to,
47  size);
48  }
49 
50  switch (to) {
51  case AVI_FORMAT_RGB24:
52  switch (from) {
53  case AVI_FORMAT_AVI_RGB:
54  buffer = avi_converter_from_avi_rgb(movie, stream, buffer, size);
55  break;
56  case AVI_FORMAT_MJPEG:
57  buffer = avi_converter_from_mjpeg(movie, stream, buffer, size);
58  break;
59  case AVI_FORMAT_RGB32:
60  buffer = avi_converter_from_rgb32(movie, stream, buffer, size);
61  break;
62  default:
63  break;
64  }
65  break;
66  case AVI_FORMAT_AVI_RGB:
67  buffer = avi_converter_to_avi_rgb(movie, stream, buffer, size);
68  break;
69  case AVI_FORMAT_MJPEG:
70  buffer = avi_converter_to_mjpeg(movie, stream, buffer, size);
71  break;
72  case AVI_FORMAT_RGB32:
73  buffer = avi_converter_to_rgb32(movie, stream, buffer, size);
74  break;
75  default:
76  break;
77  }
78 
79  return buffer;
80 }
81 
83 {
84  char fcc[5];
85 
86  if (avi_get_format_type(format) == FCC("vids")) {
87  sprintf(fcc, "%2.2ddc", stream);
88  }
89  else if (avi_get_format_type(format) == FCC("auds")) {
90  sprintf(fcc, "%2.2ddc", stream);
91  }
92  else {
93  return 0;
94  }
95 
96  return FCC(fcc);
97 }
98 
100 {
101  switch (format) {
102  case AVI_FORMAT_RGB24:
103  case AVI_FORMAT_RGB32:
104  case AVI_FORMAT_AVI_RGB:
105  case AVI_FORMAT_MJPEG:
106  return FCC("vids");
107  default:
108  return 0;
109  }
110 }
111 
113 {
114  switch (format) {
115  case AVI_FORMAT_RGB24:
116  case AVI_FORMAT_RGB32:
117  case AVI_FORMAT_AVI_RGB:
118  return FCC("DIB ");
119  case AVI_FORMAT_MJPEG:
120  return FCC("MJPG");
121  default:
122  return 0;
123  }
124 }
125 
127 {
128  switch (format) {
129  case AVI_FORMAT_RGB24:
130  case AVI_FORMAT_RGB32:
131  case AVI_FORMAT_AVI_RGB:
132  return 0;
133  case AVI_FORMAT_MJPEG:
134  return FCC("MJPG");
135  default:
136  return 0;
137  }
138 }
#define FCC(ch4)
Definition: AVI_avi.h:231
AviFormat
Definition: AVI_avi.h:160
@ AVI_FORMAT_RGB24
Definition: AVI_avi.h:162
@ AVI_FORMAT_RGB32
Definition: AVI_avi.h:164
@ AVI_FORMAT_AVI_RGB
Definition: AVI_avi.h:166
@ AVI_FORMAT_MJPEG
Definition: AVI_avi.h:168
int avi_get_format_type(AviFormat format)
Definition: avi_codecs.c:99
int avi_get_format_compression(AviFormat format)
Definition: avi_codecs.c:126
int avi_get_data_id(AviFormat format, int stream)
Definition: avi_codecs.c:82
void * avi_format_convert(AviMovie *movie, int stream, void *buffer, AviFormat from, AviFormat to, size_t *size)
Definition: avi_codecs.c:33
int avi_get_format_fcc(AviFormat format)
Definition: avi_codecs.c:112
void * avi_converter_to_mjpeg(AviMovie *movie, int stream, unsigned char *buffer, size_t *size)
Definition: avi_mjpeg.c:426
void * avi_converter_from_mjpeg(AviMovie *movie, int stream, unsigned char *buffer, const size_t *size)
Definition: avi_mjpeg.c:386
void * avi_converter_to_rgb32(AviMovie *movie, int stream, unsigned char *buffer, size_t *size)
Definition: avi_rgb32.c:65
void * avi_converter_from_rgb32(AviMovie *movie, int stream, unsigned char *buffer, size_t *size)
Definition: avi_rgb32.c:36
void * avi_converter_to_avi_rgb(AviMovie *movie, int stream, unsigned char *buffer, size_t *size)
Definition: avi_rgb.c:129
void * avi_converter_from_avi_rgb(AviMovie *movie, int stream, unsigned char *buffer, const size_t *size)
Definition: avi_rgb.c:40
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
StackEntry * from
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer
format
Definition: logImageCore.h:47