Blender V2.61 - r43446

IMB_anim.h

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