[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32596] trunk/blender/source/blender/imbuf /intern: rename anim.c -> anim_movie.c since we have an anim. c in blenkernel too, it confused debuggers in some cases.
Campbell Barton
ideasman42 at gmail.com
Tue Oct 19 13:39:37 CEST 2010
Revision: 32596
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32596
Author: campbellbarton
Date: 2010-10-19 13:39:37 +0200 (Tue, 19 Oct 2010)
Log Message:
-----------
rename anim.c -> anim_movie.c since we have an anim.c in blenkernel too, it confused debuggers in some cases.
Added Paths:
-----------
trunk/blender/source/blender/imbuf/intern/anim_movie.c
Removed Paths:
-------------
trunk/blender/source/blender/imbuf/intern/anim.c
Deleted: trunk/blender/source/blender/imbuf/intern/anim.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/anim.c 2010-10-19 11:15:08 UTC (rev 32595)
+++ trunk/blender/source/blender/imbuf/intern/anim.c 2010-10-19 11:39:37 UTC (rev 32596)
@@ -1,1189 +0,0 @@
-/**
- * anim.c
- *
- * $Id$
- *
- * ***** 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 *****
- */
-
-#ifdef _WIN32
-#define INC_OLE2
-#include <windows.h>
-#include <windowsx.h>
-#include <mmsystem.h>
-#include <memory.h>
-#include <commdlg.h>
-
-#ifndef FREE_WINDOWS
-#include <vfw.h>
-#endif
-
-#undef AVIIF_KEYFRAME // redefined in AVI_avi.h
-#undef AVIIF_LIST // redefined in AVI_avi.h
-
-#define FIXCC(fcc) if (fcc == 0) fcc = mmioFOURCC('N', 'o', 'n', 'e'); \
- if (fcc == BI_RLE8) fcc = mmioFOURCC('R', 'l', 'e', '8');
-#endif
-
-#include <sys/types.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <stdio.h>
-#ifndef _WIN32
-#include <dirent.h>
-#else
-#include <io.h>
-#endif
-
-#include "BLI_blenlib.h" /* BLI_remlink BLI_filesize BLI_addtail
- BLI_countlist BLI_stringdec */
-#include "MEM_guardedalloc.h"
-
-#include "DNA_userdef_types.h"
-#include "BKE_utildefines.h"
-#include "BKE_global.h"
-#include "BKE_depsgraph.h"
-
-#include "imbuf.h"
-
-#include "AVI_avi.h"
-
-#ifdef WITH_QUICKTIME
-#if defined(_WIN32) || defined(__APPLE__)
-#include "quicktime_import.h"
-#endif /* _WIN32 || __APPLE__ */
-#endif /* WITH_QUICKTIME */
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "IMB_allocimbuf.h"
-#include "IMB_anim.h"
-
-#ifdef WITH_FFMPEG
-#include <libavformat/avformat.h>
-#include <libavcodec/avcodec.h>
-#include <libavutil/rational.h>
-#include <libswscale/swscale.h>
-
-#if LIBAVFORMAT_VERSION_INT < (49 << 16)
-#define FFMPEG_OLD_FRAME_RATE 1
-#else
-#define FFMPEG_CODEC_IS_POINTER 1
-#endif
-
-#if (LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 29) && \
- (LIBSWSCALE_VERSION_MAJOR >= 0) && (LIBSWSCALE_VERSION_MINOR >= 10)
-#define FFMPEG_SWSCALE_COLOR_SPACE_SUPPORT
-#endif
-
-#endif //WITH_FFMPEG
-
-#ifdef WITH_REDCODE
-#ifdef _WIN32 /* on windows we use the ones in extern instead */
-#include "libredcode/format.h"
-#include "libredcode/codec.h"
-#else
-#include "libredcode/format.h"
-#include "libredcode/codec.h"
-#endif
-#endif
-
-/****/
-
-#ifdef __sgi
-
-#include <dmedia/moviefile.h>
-
-static void movie_printerror(char * str) {
- const char * errstr = mvGetErrorStr(mvGetErrno());
-
- if (str) {
- if (errstr) printf("%s: %s\n", str, errstr);
- else printf("%s: returned error\n", str);
- } else printf("%s\n", errstr);
-}
-
-static int startmovie(struct anim * anim) {
- if (anim == 0) return(-1);
-
- if ( mvOpenFile (anim->name, O_BINARY|O_RDONLY, &anim->movie ) != DM_SUCCESS ) {
- printf("Can't open movie: %s\n", anim->name);
- return(-1);
- }
- if ( mvFindTrackByMedium (anim->movie, DM_IMAGE, &anim->track) != DM_SUCCESS ) {
- printf("No image track in movie: %s\n", anim->name);
- mvClose(anim->movie);
- return(-1);
- }
-
- anim->duration = mvGetTrackLength (anim->track);
- anim->params = mvGetParams( anim->track );
-
- anim->x = dmParamsGetInt( anim->params, DM_IMAGE_WIDTH);
- anim->y = dmParamsGetInt( anim->params, DM_IMAGE_HEIGHT);
- anim->interlacing = dmParamsGetEnum (anim->params, DM_IMAGE_INTERLACING);
- anim->orientation = dmParamsGetEnum (anim->params, DM_IMAGE_ORIENTATION);
- anim->framesize = dmImageFrameSize(anim->params);
-
- anim->curposition = 0;
- anim->preseek = 0;
-
- /*printf("x:%d y:%d size:%d interl:%d dur:%d\n", anim->x, anim->y, anim->framesize, anim->interlacing, anim->duration);*/
- return (0);
-}
-
-static ImBuf * movie_fetchibuf(struct anim * anim, int position) {
- ImBuf * ibuf;
-/* extern rectcpy(); */
- int size;
- unsigned int *rect1, *rect2;
-
- if (anim == 0) return (0);
-
- ibuf = IMB_allocImBuf(anim->x, anim->y, 24, IB_rect);
-
- if ( mvReadFrames(anim->track, position, 1, ibuf->x * ibuf->y *
- sizeof(int), ibuf->rect ) != DM_SUCCESS ) {
- movie_printerror("mvReadFrames");
- IMB_freeImBuf(ibuf);
- return(0);
- }
-
-/*
- if (anim->interlacing == DM_IMAGE_INTERLACED_EVEN) {
- rect1 = ibuf->rect + (ibuf->x * ibuf->y) - 1;
- rect2 = rect1 - ibuf->x;
-
- for (size = ibuf->x * (ibuf->y - 1); size > 0; size--){
- *rect1-- = *rect2--;
- }
- }
-*/
-
- if (anim->interlacing == DM_IMAGE_INTERLACED_EVEN)
- {
- rect1 = ibuf->rect;
- rect2 = rect1 + ibuf->x;
-
- for (size = ibuf->x * (ibuf->y - 1); size > 0; size--){
- *rect1++ = *rect2++;
- }
- }
- /*if (anim->orientation == DM_TOP_TO_BOTTOM) IMB_flipy(ibuf);*/
-
-
- return(ibuf);
-}
-
-static void free_anim_movie(struct anim * anim) {
- if (anim == NULL) return;
-
- if (anim->movie) {
- mvClose(anim->movie);
- anim->movie = NULL;
- }
- anim->duration = 0;
-}
-
-int ismovie(char *name) {
- return (mvIsMovieFile(name) == DM_TRUE);
-}
-
-#else
-
-int ismovie(char *UNUSED(name)) {
- return 0;
-}
-
- /* never called, just keep the linker happy */
-static int startmovie(struct anim *UNUSED(anim)) { return 1; }
-static ImBuf * movie_fetchibuf(struct anim *UNUSED(anim), int UNUSED(position)) { return NULL; }
-static void free_anim_movie(struct anim *UNUSED(anim)) { ; }
-
-#endif
-
-#if defined(_WIN32)
-# define PATHSEPERATOR '\\'
-#else
-# define PATHSEPERATOR '/'
-#endif
-
-static int an_stringdec(const char *string, char* head, char *tail, unsigned short *numlen) {
- unsigned short len,nume,nums=0;
- short i,found=FALSE;
-
- len=strlen(string);
- nume = len;
-
- for(i=len-1;i>=0;i--){
- if (string[i]==PATHSEPERATOR) break;
- if (isdigit(string[i])) {
- if (found){
- nums=i;
- } else{
- nume=i;
- nums=i;
- found=TRUE;
- }
- } else{
- if (found) break;
- }
- }
- if (found){
- strcpy(tail ,&string[nume+1]);
- strcpy(head, string);
- head[nums]= '\0';
- *numlen=nume-nums+1;
- return ((int)atoi(&(string[nums])));
- }
- tail[0]= '\0';
- strcpy(head, string);
- *numlen=0;
- return TRUE;
-}
-
-
-static void an_stringenc(char *string, const char *head, const char *tail, unsigned short numlen, int pic) {
- BLI_stringenc(string, head, tail, numlen, pic);
-}
-
-static void free_anim_avi (struct anim *anim) {
-#if defined(_WIN32) && !defined(FREE_WINDOWS)
- int i;
-#endif
-
- if (anim == NULL) return;
- if (anim->avi == NULL) return;
-
- AVI_close (anim->avi);
- MEM_freeN (anim->avi);
- anim->avi = NULL;
-
-#if defined(_WIN32) && !defined(FREE_WINDOWS)
-
- if (anim->pgf) {
- AVIStreamGetFrameClose(anim->pgf);
- anim->pgf = NULL;
- }
-
- for (i = 0; i < anim->avistreams; i++){
- AVIStreamRelease(anim->pavi[i]);
- }
- anim->avistreams = 0;
-
- if (anim->pfileopen) {
- AVIFileRelease(anim->pfile);
- anim->pfileopen = 0;
- AVIFileExit();
- }
-#endif
-
- anim->duration = 0;
-}
-
-void IMB_free_anim_ibuf(struct anim * anim) {
- if (anim == NULL) return;
-
- if (anim->ibuf1) IMB_freeImBuf(anim->ibuf1);
- if (anim->ibuf2) IMB_freeImBuf(anim->ibuf2);
-
- anim->ibuf1 = anim->ibuf2 = NULL;
-}
-
-#ifdef WITH_FFMPEG
-static void free_anim_ffmpeg(struct anim * anim);
-#endif
-#ifdef WITH_REDCODE
-static void free_anim_redcode(struct anim * anim);
-#endif
-
-void IMB_free_anim(struct anim * anim) {
- if (anim == NULL) {
- printf("free anim, anim == NULL\n");
- return;
- }
-
- IMB_free_anim_ibuf(anim);
- free_anim_movie(anim);
- free_anim_avi(anim);
-
-#ifdef WITH_QUICKTIME
- free_anim_quicktime(anim);
-#endif
-#ifdef WITH_FFMPEG
- free_anim_ffmpeg(anim);
-#endif
-#ifdef WITH_REDCODE
- free_anim_redcode(anim);
-#endif
-
- MEM_freeN(anim);
-}
-
-void IMB_close_anim(struct anim * anim) {
- if (anim == 0) return;
-
- IMB_free_anim(anim);
-}
-
-
-struct anim * IMB_open_anim( const char * name, int ib_flags) {
- struct anim * anim;
-
- anim = (struct anim*)MEM_callocN(sizeof(struct anim), "anim struct");
- if (anim != NULL) {
- strcpy(anim->name, name); /* fixme: possible buffer overflow here? */
- anim->ib_flags = ib_flags;
- }
- return(anim);
-}
-
-
-static int startavi (struct anim *anim) {
-
- AviError avierror;
-#if defined(_WIN32) && !defined(FREE_WINDOWS)
- HRESULT hr;
- int i, firstvideo = -1;
- BYTE abFormat[1024];
- LONG l;
- LPBITMAPINFOHEADER lpbi;
- AVISTREAMINFO avis;
-#endif
-
- anim->avi = MEM_callocN (sizeof(AviMovie),"animavi");
-
- if (anim->avi == NULL) {
- printf("Can't open avi: %s\n", anim->name);
- return -1;
- }
-
- avierror = AVI_open_movie (anim->name, anim->avi);
-
-#if defined(_WIN32) && !defined(FREE_WINDOWS)
- if (avierror == AVI_ERROR_COMPRESSION) {
- AVIFileInit();
- hr = AVIFileOpen(&anim->pfile, anim->name, OF_READ, 0L);
- if (hr == 0) {
- anim->pfileopen = 1;
- for (i = 0; i < MAXNUMSTREAMS; i++) {
- if (AVIFileGetStream(anim->pfile, &anim->pavi[i], 0L, i) != AVIERR_OK) {
- break;
- }
-
- AVIStreamInfo(anim->pavi[i], &avis, sizeof(avis));
- if ((avis.fccType == streamtypeVIDEO) && (firstvideo == -1)) {
- anim->pgf = AVIStreamGetFrameOpen(anim->pavi[i], NULL);
- if (anim->pgf) {
- firstvideo = i;
-
- // get stream length
- anim->avi->header->TotalFrames = AVIStreamLength(anim->pavi[i]);
-
- // get information about images inside the stream
- l = sizeof(abFormat);
- AVIStreamReadFormat(anim->pavi[i], 0, &abFormat, &l);
- lpbi = (LPBITMAPINFOHEADER)abFormat;
- anim->avi->header->Height = lpbi->biHeight;
- anim->avi->header->Width = lpbi->biWidth;
- } else {
- FIXCC(avis.fccHandler);
- FIXCC(avis.fccType);
- printf("Can't find AVI decoder for type : %4.4hs/%4.4hs\n",
- (LPSTR)&avis.fccType,
- (LPSTR)&avis.fccHandler);
- }
- }
- }
-
- // register number of opened avistreams
- anim->avistreams = i;
-
- //
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list