⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 program.cc

📁 linux下的flash的播放源代码
💻 CC
字号:
/////////////////////////////////////////////////////////////// Flash Plugin and Player// Copyright (C) 1998,1999 Olivier Debon// // 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.// /////////////////////////////////////////////////////////////////  Author : Olivier Debon  <odebon@club-internet.fr>//  #include "swf.h"#define NOTHING  0x0#define WAKEUP   0x1#define GOTO     0x2#define REFRESH  0x4#ifdef RCSIDstatic char *rcsid = "$Id: program.cc,v 1.4 1999/09/03 15:17:41 ode Exp $";#endif#define PRINT 0int debug = 0;int soundId = -1;int frameId = -1;pthread_mutex_t count_mutex = PTHREAD_MUTEX_INITIALIZER;Program::Program(FlashMovie *movie, long n){	long f;    this->movie = movie;	totalFrames = 0;	dl = new DisplayList(movie);	if (dl == NULL) return;	frames = new Frame[n];	if (frames == NULL) {		delete dl;		return;	}	nbFrames = 0;	totalFrames = n;	currentFrame = 0;	loadingFrame = 0;	movieWait = 1;	nextFrame = currentFrame;	for(f = 0; f < n; f++)	{		frames[f].controls = NULL;		frames[f].sndblock = NULL;		frames[f].label = NULL;	}	movieStatus = MoviePlay;	settings = 0;}Program::~Program(){    int i;    Control *ctrl, *ctrl1;    delete dl;    if (frames != NULL) {	    for(i=0;i<nbFrames;i++)		{			if (frames[i].label) free(frames[i].label);			if(frames[i].sndblock) free(frames[i].sndblock); 						ctrl = frames[i].controls;			while (ctrl != NULL) {			    ctrl1 = ctrl->next;		    	ctrl->next = NULL;		   		delete ctrl;			    ctrl = ctrl1;			}				    }	    delete[] frames;    }}voidProgram::validateLoadingFrame(){	nbFrames = loadingFrame;	loadingFrame++;	movieWait = 0;}Frame	*Program::getFrames(){	return frames;}longProgram::getNbFrames(){	return nbFrames;}DisplayList *Program::getDisplayList(){	return dl;}voidProgram::gotoFrame(GraphicDevice *gd, SoundMixer *sm, long frame){	long f;	dl->clearList();	for(f=0; f <= frame; f++) {		runFrame(gd, sm, f, 0);	}}void *streamplay(void *arg){	SoundStreamBlock *sblock;	StreamPlay*  sp;	sp = (StreamPlay*)arg;	int i = 0;	for(i=(sp->startFrame); i < (sp->totalFrames); i++)			{		if(sp->frames[i].sndblock)		{			sblock = sp->frames[i].sndblock;			if (sp->sm) sp->sm->playSounds(sblock);		}		pthread_mutex_lock(&count_mutex);		soundId = i;		pthread_mutex_unlock(&count_mutex);	}		pthread_mutex_lock(&count_mutex);	soundId = -1;	if(sp) delete sp;	pthread_mutex_unlock(&count_mutex);	return NULL;}longProgram::runFrame(GraphicDevice *gd, SoundMixer *sm, long f, long action){	Control		*ctrl;	Character	*character;	Matrix		*matrix;	Cxform		*cxform;	StreamPlay  *sp;				long		 status = NOTHING;	long		 update = 1;	char		*name;#if PRINT&1	if (action) printf("Prog %x (dl=%x): Frame N

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -