[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51138] trunk/blender/source/blender/avi: rename avi files (endian.h is common linux include).

Campbell Barton ideasman42 at gmail.com
Sun Oct 7 08:27:32 CEST 2012


Revision: 51138
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51138
Author:   campbellbarton
Date:     2012-10-07 06:27:31 +0000 (Sun, 07 Oct 2012)
Log Message:
-----------
rename avi files (endian.h is common linux include).

Modified Paths:
--------------
    trunk/blender/source/blender/avi/AVI_avi.h
    trunk/blender/source/blender/avi/CMakeLists.txt
    trunk/blender/source/blender/avi/intern/avi.c

Added Paths:
-----------
    trunk/blender/source/blender/avi/intern/avi_codecs.c
    trunk/blender/source/blender/avi/intern/avi_endian.c
    trunk/blender/source/blender/avi/intern/avi_endian.h
    trunk/blender/source/blender/avi/intern/avi_mjpeg.c
    trunk/blender/source/blender/avi/intern/avi_mjpeg.h
    trunk/blender/source/blender/avi/intern/avi_options.c
    trunk/blender/source/blender/avi/intern/avi_rgb.c
    trunk/blender/source/blender/avi/intern/avi_rgb.h
    trunk/blender/source/blender/avi/intern/avi_rgb32.c
    trunk/blender/source/blender/avi/intern/avi_rgb32.h

Removed Paths:
-------------
    trunk/blender/source/blender/avi/intern/avirgb.c
    trunk/blender/source/blender/avi/intern/avirgb.h
    trunk/blender/source/blender/avi/intern/codecs.c
    trunk/blender/source/blender/avi/intern/endian.c
    trunk/blender/source/blender/avi/intern/endian.h
    trunk/blender/source/blender/avi/intern/mjpeg.c
    trunk/blender/source/blender/avi/intern/mjpeg.h
    trunk/blender/source/blender/avi/intern/options.c
    trunk/blender/source/blender/avi/intern/rgb32.c
    trunk/blender/source/blender/avi/intern/rgb32.h

Modified: trunk/blender/source/blender/avi/AVI_avi.h
===================================================================
--- trunk/blender/source/blender/avi/AVI_avi.h	2012-10-07 06:06:28 UTC (rev 51137)
+++ trunk/blender/source/blender/avi/AVI_avi.h	2012-10-07 06:27:31 UTC (rev 51138)
@@ -178,7 +178,7 @@
 } AviStreamRec;
 
 typedef struct _AviMovie {
-	FILE *fp; 
+	FILE *fp;
 	
 	int type;
 #define AVI_MOVIE_READ  0

Modified: trunk/blender/source/blender/avi/CMakeLists.txt
===================================================================
--- trunk/blender/source/blender/avi/CMakeLists.txt	2012-10-07 06:06:28 UTC (rev 51137)
+++ trunk/blender/source/blender/avi/CMakeLists.txt	2012-10-07 06:27:31 UTC (rev 51138)
@@ -35,19 +35,19 @@
 
 set(SRC
 	intern/avi.c
-	intern/avirgb.c
-	intern/codecs.c
-	intern/endian.c
-	intern/mjpeg.c
-	intern/options.c
-	intern/rgb32.c
+	intern/avi_rgb.c
+	intern/avi_codecs.c
+	intern/avi_endian.c
+	intern/avi_mjpeg.c
+	intern/avi_options.c
+	intern/avi_rgb32.c
 
 	AVI_avi.h
 	intern/avi_intern.h
-	intern/avirgb.h
-	intern/endian.h
-	intern/mjpeg.h
-	intern/rgb32.h
+	intern/avi_rgb.h
+	intern/avi_endian.h
+	intern/avi_mjpeg.h
+	intern/avi_rgb32.h
 )
 
 blender_add_lib(bf_avi "${SRC}" "${INC}" "${INC_SYS}")

Modified: trunk/blender/source/blender/avi/intern/avi.c
===================================================================
--- trunk/blender/source/blender/avi/intern/avi.c	2012-10-07 06:06:28 UTC (rev 51137)
+++ trunk/blender/source/blender/avi/intern/avi.c	2012-10-07 06:27:31 UTC (rev 51138)
@@ -32,7 +32,6 @@
  * This is external code.
  */
 
-
 #include <stdlib.h>
 #include <string.h>
 #include <stdarg.h>
@@ -49,7 +48,7 @@
 #include "AVI_avi.h"
 #include "avi_intern.h"
 
-#include "endian.h"
+#include "avi_endian.h"
 
 static int AVI_DEBUG = 0;
 static char DEBUG_FCC[4];

Copied: trunk/blender/source/blender/avi/intern/avi_codecs.c (from rev 51134, trunk/blender/source/blender/avi/intern/codecs.c)
===================================================================
--- trunk/blender/source/blender/avi/intern/avi_codecs.c	                        (rev 0)
+++ trunk/blender/source/blender/avi/intern/avi_codecs.c	2012-10-07 06:27:31 UTC (rev 51138)
@@ -0,0 +1,148 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/avi/intern/avi_codecs.c
+ *  \ingroup avi
+ *
+ * This is external code. Identify and convert different avi-files.
+ */
+
+
+#include "AVI_avi.h"
+#include "avi_intern.h"
+
+#include "avi_rgb.h"
+#include "avi_mjpeg.h"
+#include "avi_rgb32.h"
+
+void *avi_format_convert(AviMovie *movie, int stream, void *buffer, AviFormat from, AviFormat to, int *size)
+{
+	if (from == to)
+		return buffer;
+
+	if (from != AVI_FORMAT_RGB24 &&
+	    to != AVI_FORMAT_RGB24)
+	{
+		return avi_format_convert(movie, stream,
+		                          avi_format_convert(movie, stream, buffer, from, AVI_FORMAT_RGB24, size),
+		                          AVI_FORMAT_RGB24, to, size);
+	}
+
+	switch (to) {
+		case AVI_FORMAT_RGB24:
+			switch (from) {
+				case AVI_FORMAT_AVI_RGB:
+					buffer = avi_converter_from_avi_rgb(movie, stream, buffer, size);
+					break;
+				case AVI_FORMAT_MJPEG:
+					buffer = avi_converter_from_mjpeg(movie, stream, buffer, size);
+					break;
+				case AVI_FORMAT_RGB32:
+					buffer = avi_converter_from_rgb32(movie, stream, buffer, size);
+					break;
+				default:
+					break;
+			}
+			break;
+		case AVI_FORMAT_AVI_RGB:
+			buffer = avi_converter_to_avi_rgb(movie, stream, buffer, size);
+			break;
+		case AVI_FORMAT_MJPEG:
+			buffer = avi_converter_to_mjpeg(movie, stream, buffer, size);
+			break;
+		case AVI_FORMAT_RGB32:
+			buffer = avi_converter_to_rgb32(movie, stream, buffer, size);
+			break;
+		default:
+			break;
+	}
+
+	return buffer;
+}
+
+int avi_get_data_id(AviFormat format, int stream)
+{
+	char fcc[5];
+
+	if (avi_get_format_type(format) == FCC("vids"))
+		sprintf(fcc, "%2.2ddc", stream);
+	else if (avi_get_format_type(format) == FCC("auds"))
+		sprintf(fcc, "%2.2ddc", stream);
+	else
+		return 0;
+
+	return FCC(fcc);
+}
+
+int avi_get_format_type(AviFormat format)
+{
+	switch (format) {
+		case AVI_FORMAT_RGB24:
+		case AVI_FORMAT_RGB32:
+		case AVI_FORMAT_AVI_RGB:
+		case AVI_FORMAT_MJPEG:
+			return FCC("vids");
+			break;
+		default:
+			return 0;
+			break;
+	}
+}
+
+int avi_get_format_fcc(AviFormat format)
+{
+	switch (format) {
+		case AVI_FORMAT_RGB24:
+		case AVI_FORMAT_RGB32:
+		case AVI_FORMAT_AVI_RGB:
+			return FCC("DIB ");
+			break;
+		case AVI_FORMAT_MJPEG:
+			return FCC("MJPG");
+			break;
+		default:
+			return 0;
+			break;
+	}
+}
+
+int avi_get_format_compression(AviFormat format)
+{
+	switch (format) {
+		case AVI_FORMAT_RGB24:
+		case AVI_FORMAT_RGB32:
+		case AVI_FORMAT_AVI_RGB:
+			return 0;
+			break;
+		case AVI_FORMAT_MJPEG:
+			return FCC("MJPG");
+			break;
+		default:
+			return 0;
+			break;
+	}
+}

Copied: trunk/blender/source/blender/avi/intern/avi_endian.c (from rev 51137, trunk/blender/source/blender/avi/intern/endian.c)
===================================================================
--- trunk/blender/source/blender/avi/intern/avi_endian.c	                        (rev 0)
+++ trunk/blender/source/blender/avi/intern/avi_endian.c	2012-10-07 06:27:31 UTC (rev 51138)
@@ -0,0 +1,217 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ */
+
+/** \file blender/avi/intern/avi_endian.c
+ *  \ingroup avi
+ *
+ * This is external code. Streams bytes to output depending on the
+ * endianness of the system.
+ */
+
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "AVI_avi.h"
+#include "avi_endian.h"
+#include "avi_intern.h"
+
+#ifdef __BIG_ENDIAN__
+#include "MEM_guardedalloc.h"
+#endif
+
+#ifdef __BIG_ENDIAN__
+
+/* copied from BLI_endian_switch_inline.h */
+static void invert(int *num)
+{
+	int tval = *val;
+	*val = ((tval >> 24))             |
+	       ((tval << 8) & 0x00ff0000) |
+	       ((tval >> 8) & 0x0000ff00) |
+	       ((tval << 24));
+}
+
+static void sinvert(short int *val)
+{
+	short tval = *val;
+	*val = (tval >> 8) |
+	       (tval << 8);
+}
+
+static void Ichunk(AviChunk *chunk)
+{
+	invert(&chunk->fcc);
+	invert(&chunk->size);
+}
+#endif
+
+#ifdef __BIG_ENDIAN__
+static void Ilist(AviList *list)
+{
+	invert(&list->fcc);
+	invert(&list->size);
+	invert(&list->ids);
+}
+
+static void Imainh(AviMainHeader *mainh)
+{
+	invert(&mainh->fcc);
+	invert(&mainh->size);
+	invert(&mainh->MicroSecPerFrame);
+	invert(&mainh->MaxBytesPerSec);
+	invert(&mainh->PaddingGranularity);
+	invert(&mainh->Flags);
+	invert(&mainh->TotalFrames);
+	invert(&mainh->InitialFrames);
+	invert(&mainh->Streams);
+	invert(&mainh->SuggestedBufferSize);
+	invert(&mainh->Width);
+	invert(&mainh->Height);
+	invert(&mainh->Reserved[0]);
+	invert(&mainh->Reserved[1]);
+	invert(&mainh->Reserved[2]);
+	invert(&mainh->Reserved[3]);
+}
+
+static void Istreamh(AviStreamHeader *streamh)
+{
+	invert(&streamh->fcc);
+	invert(&streamh->size);
+	invert(&streamh->Type);
+	invert(&streamh->Handler);
+	invert(&streamh->Flags);
+	sinvert(&streamh->Priority);
+	sinvert(&streamh->Language);
+	invert(&streamh->InitialFrames);
+	invert(&streamh->Scale);
+	invert(&streamh->Rate);
+	invert(&streamh->Start);
+	invert(&streamh->Length);
+	invert(&streamh->SuggestedBufferSize);
+	invert(&streamh->Quality);
+	invert(&streamh->SampleSize);
+	sinvert(&streamh->left);
+	sinvert(&streamh->right);
+	sinvert(&streamh->top);
+	sinvert(&streamh->bottom);
+}
+
+static void Ibitmaph(AviBitmapInfoHeader *bitmaph)
+{
+	invert(&bitmaph->fcc);
+	invert(&bitmaph->size);
+	invert(&bitmaph->Size);
+	invert(&bitmaph->Width);
+	invert(&bitmaph->Height);
+	sinvert(&bitmaph->Planes);
+	sinvert(&bitmaph->BitCount);
+	invert(&bitmaph->Compression);
+	invert(&bitmaph->SizeImage);
+	invert(&bitmaph->XPelsPerMeter);
+	invert(&bitmaph->YPelsPerMeter);
+	invert(&bitmaph->ClrUsed);
+	invert(&bitmaph->ClrImportant);
+}
+
+static void Imjpegu(AviMJPEGUnknown *mjpgu)
+{
+	invert(&mjpgu->a);
+	invert(&mjpgu->b);
+	invert(&mjpgu->c);
+	invert(&mjpgu->d);
+	invert(&mjpgu->e);
+	invert(&mjpgu->f);
+	invert(&mjpgu->g);
+}
+
+static void Iindexe(AviIndexEntry *indexe)
+{
+	invert(&indexe->ChunkId);
+	invert(&indexe->Flags);
+	invert(&indexe->Offset);
+	invert(&indexe->Size);
+}
+#endif /* __BIG_ENDIAN__ */
+
+void awrite(AviMovie *movie, void *datain, int block, int size, FILE *fp, int type)
+{
+#ifdef __BIG_ENDIAN__
+	void *data;
+
+	data = MEM_mallocN(size, "avi endian");
+
+	memcpy(data, datain, size);
+
+	switch (type) {
+		case AVI_RAW:
+			fwrite(data, block, size, fp);
+			break;
+		case AVI_CHUNK:
+			Ichunk((AviChunk *) data);
+			fwrite(data, block, size, fp);
+			break;
+		case AVI_LIST:

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list