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 20 /** \file 21 * \ingroup imbuf 22 */ 23 24 #pragma once 25 26 #ifdef _WIN32 27 # define INC_OLE2 28 # include <commdlg.h> 29 # include <memory.h> 30 # include <mmsystem.h> 31 # include <vfw.h> 32 # include <windows.h> 33 # include <windowsx.h> 34 35 # undef AVIIF_KEYFRAME /* redefined in AVI_avi.h */ 36 # undef AVIIF_LIST /* redefined in AVI_avi.h */ 37 #endif /* _WIN32 */ 38 39 #include <ctype.h> 40 #include <stdio.h> 41 #include <stdlib.h> 42 #include <sys/types.h> 43 44 #ifdef _WIN32 45 # include <io.h> 46 #else 47 # include <dirent.h> 48 #endif 49 50 #include "imbuf.h" 51 52 #ifdef WITH_AVI 53 # include "AVI_avi.h" 54 #endif 55 56 #include "IMB_imbuf.h" 57 #include "IMB_imbuf_types.h" 58 59 #include "IMB_allocimbuf.h" 60 61 #ifdef WITH_FFMPEG 62 # include <libavcodec/avcodec.h> 63 # include <libavformat/avformat.h> 64 # include <libswscale/swscale.h> 65 #endif 66 67 /* more endianness... should move to a separate file... */ 68 #ifdef __BIG_ENDIAN__ 69 # define LITTLE_LONG SWAP_LONG 70 #else 71 # define LITTLE_LONG ENDIAN_NOP 72 #endif 73 74 /* anim.curtype, runtime only */ 75 #define ANIM_NONE 0 76 #define ANIM_SEQUENCE (1 << 0) 77 #define ANIM_MOVIE (1 << 4) 78 #define ANIM_AVI (1 << 6) 79 #define ANIM_FFMPEG (1 << 8) 80 81 #define MAXNUMSTREAMS 50 82 83 struct IDProperty; 84 struct _AviMovie; 85 struct anim_index; 86 87 struct anim { 88 int ib_flags; 89 int curtype; 90 int curposition; /* index 0 = 1e, 1 = 2e, enz. */ 91 int duration_in_frames; 92 int frs_sec; 93 double frs_sec_base; 94 int x, y; 95 96 /* for number */ 97 char name[1024]; 98 /* for sequence */ 99 char first[1024]; 100 101 /* movie */ 102 void *movie; 103 void *track; 104 void *params; 105 int orientation; 106 size_t framesize; 107 int interlacing; 108 int preseek; 109 int streamindex; 110 111 /* avi */ 112 struct _AviMovie *avi; 113 114 #if defined(_WIN32) 115 /* windows avi */ 116 int avistreams; 117 int firstvideo; 118 int pfileopen; 119 PAVIFILE pfile; 120 PAVISTREAM pavi[MAXNUMSTREAMS]; /* the current streams */ 121 PGETFRAME pgf; 122 #endif 123 124 #ifdef WITH_FFMPEG 125 AVFormatContext *pFormatCtx; 126 AVCodecContext *pCodecCtx; 127 AVCodec *pCodec; 128 AVFrame *pFrame; 129 int pFrameComplete; 130 AVFrame *pFrameRGB; 131 AVFrame *pFrameDeinterlaced; 132 struct SwsContext *img_convert_ctx; 133 int videoStream; 134 135 struct ImBuf *last_frame; 136 int64_t last_pts; 137 int64_t next_pts; 138 AVPacket next_packet; 139 #endif 140 141 char index_dir[768]; 142 143 int proxies_tried; 144 int indices_tried; 145 146 struct anim *proxy_anim[IMB_PROXY_MAX_SLOT]; 147 struct anim_index *curr_idx[IMB_TC_MAX_SLOT]; 148 149 char colorspace[64]; 150 char suffix[64]; /* MAX_NAME - multiview */ 151 152 struct IDProperty *metadata; 153 }; 154