Blender  V2.59
IMB_anim.h
Go to the documentation of this file.
00001 /*
00002  * allocimbuf.h
00003  *
00004  * $Id: IMB_anim.h 36815 2011-05-22 04:25:31Z campbellbarton $
00005  *
00006  * ***** BEGIN GPL LICENSE BLOCK *****
00007  *
00008  * This program is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License
00010  * as published by the Free Software Foundation; either version 2
00011  * of the License, or (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software Foundation,
00020  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00021  *
00022  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00023  * All rights reserved.
00024  *
00025  * The Original Code is: all of this file.
00026  *
00027  * Contributor(s): none yet.
00028  *
00029  * ***** END GPL LICENSE BLOCK *****
00030  */
00031 
00037 #ifndef IMB_ANIM_H
00038 #define IMB_ANIM_H
00039 
00040 #ifdef _WIN32
00041 #define INC_OLE2
00042 #include <windows.h>
00043 #include <windowsx.h>
00044 #include <mmsystem.h>
00045 #include <memory.h>
00046 #include <commdlg.h>
00047 
00048 #ifndef FREE_WINDOWS
00049 #include <vfw.h>
00050 #endif
00051 
00052 #undef AVIIF_KEYFRAME // redefined in AVI_avi.h
00053 #undef AVIIF_LIST // redefined in AVI_avi.h
00054 
00055 #define FIXCC(fcc)  if (fcc == 0)       fcc = mmioFOURCC('N', 'o', 'n', 'e'); \
00056                 if (fcc == BI_RLE8) fcc = mmioFOURCC('R', 'l', 'e', '8');
00057 #endif
00058 
00059 #include <sys/types.h>
00060 #include <ctype.h>
00061 #include <stdlib.h>
00062 #include <stdio.h>
00063 #ifndef _WIN32
00064 #include <dirent.h>
00065 #else
00066 #include <io.h>
00067 #endif
00068 
00069 #include "BLI_blenlib.h" /* BLI_remlink BLI_filesize BLI_addtail
00070                                                         BLI_countlist BLI_stringdec */
00071 
00072 #include "imbuf.h"
00073 
00074 #include "AVI_avi.h"
00075 
00076 #ifdef WITH_QUICKTIME
00077 #if defined(_WIN32) || defined(__APPLE__)
00078 #include "quicktime_import.h"
00079 #endif /* _WIN32 || __APPLE__ */
00080 #endif /* WITH_QUICKTIME */
00081 
00082 #ifdef WITH_FFMPEG
00083 #include <libavformat/avformat.h>
00084 #include <libavcodec/avcodec.h>
00085 #include <libswscale/swscale.h>
00086 #endif
00087 
00088 #ifdef WITH_REDCODE
00089 #ifdef _WIN32 /* on windows we use the one in extern instead */
00090 #include "libredcode/format.h"
00091 #else
00092 #include "libredcode/format.h"
00093 #endif
00094 #endif
00095 
00096 #include "IMB_imbuf_types.h"
00097 #include "IMB_imbuf.h"
00098 
00099 #include "IMB_allocimbuf.h"
00100 
00101 
00102 
00103 /* actually hard coded endianness */
00104 #define GET_BIG_LONG(x) (((uchar *) (x))[0] << 24 | ((uchar *) (x))[1] << 16 | ((uchar *) (x))[2] << 8 | ((uchar *) (x))[3])
00105 #define GET_LITTLE_LONG(x) (((uchar *) (x))[3] << 24 | ((uchar *) (x))[2] << 16 | ((uchar *) (x))[1] << 8 | ((uchar *) (x))[0])
00106 #define SWAP_L(x) (((x << 24) & 0xff000000) | ((x << 8) & 0xff0000) | ((x >> 8) & 0xff00) | ((x >> 24) & 0xff))
00107 #define SWAP_S(x) (((x << 8) & 0xff00) | ((x >> 8) & 0xff))
00108 
00109 /* more endianness... should move to a separate file... */
00110 #if defined(__sgi) || defined (__sparc) || defined (__sparc__) || defined (__PPC__) || defined (__ppc__) || defined (__hppa__) || defined (__BIG_ENDIAN__)
00111 #define GET_ID GET_BIG_LONG
00112 #define LITTLE_LONG SWAP_LONG
00113 #else
00114 #define GET_ID GET_LITTLE_LONG
00115 #define LITTLE_LONG ENDIAN_NOP
00116 #endif
00117 
00118 /* anim.curtype, runtime only */
00119 #define ANIM_NONE               0
00120 #define ANIM_SEQUENCE   (1 << 0)
00121 #define ANIM_MOVIE              (1 << 4)
00122 #define ANIM_AVI                (1 << 6)
00123 #define ANIM_QTIME              (1 << 7)
00124 #define ANIM_FFMPEG     (1 << 8)
00125 #define ANIM_REDCODE    (1 << 9)
00126 
00127 #define MAXNUMSTREAMS           50
00128 
00129 struct _AviMovie;
00130 
00131 struct anim {
00132         int ib_flags;
00133         int curtype;
00134         int curposition;        /* index  0 = 1e,  1 = 2e, enz. */
00135         int duration;
00136         int x, y;
00137         
00138                 /* voor op nummer */
00139         char name[256];
00140                 /* voor sequence */
00141         char first[256];
00142         
00143                 /* movie */
00144         void *movie;
00145         void *track;
00146         void *params;
00147         int orientation; 
00148         size_t framesize;
00149         int interlacing;
00150         int preseek;
00151         
00152                 /* data */
00153         struct ImBuf * ibuf1, * ibuf2;
00154         
00155                 /* avi */
00156         struct _AviMovie *avi;
00157 
00158 #if defined(_WIN32) && !defined(FREE_WINDOWS)
00159                 /* windows avi */
00160         int avistreams;
00161         int firstvideo;
00162         int pfileopen;
00163         PAVIFILE        pfile;
00164         PAVISTREAM  pavi[MAXNUMSTREAMS];        // the current streams
00165         PGETFRAME         pgf;
00166 #endif
00167 
00168 #ifdef WITH_QUICKTIME
00169                 /* quicktime */
00170         struct _QuicktimeMovie *qtime;
00171 #endif /* WITH_QUICKTIME */
00172 
00173 #ifdef WITH_FFMPEG
00174         AVFormatContext *pFormatCtx;
00175         AVCodecContext *pCodecCtx;
00176         AVCodec *pCodec;
00177         AVFrame *pFrame;
00178         AVFrame *pFrameRGB;
00179         AVFrame *pFrameDeinterlaced;
00180         struct SwsContext *img_convert_ctx;
00181         int videoStream;
00182 #endif
00183 
00184 #ifdef WITH_REDCODE
00185         struct redcode_handle * redcodeCtx;
00186 #endif
00187 };
00188 
00189 #endif
00190