SWFBlock SWFSoundStream_getStreamBlock(SWFSoundStream stream) { SWFSoundStreamBlock block; if ( stream->isFinished ) return NULL; block = (SWFSoundStreamBlock) malloc(sizeof(struct SWFSoundStreamBlock_s)); SWFBlockInit((SWFBlock)block); BLOCK(block)->complete = completeSWFSoundStream; BLOCK(block)->writeBlock = writeSWFSoundStreamToMethod; BLOCK(block)->dtor = NULL; BLOCK(block)->type = SWF_SOUNDSTREAMBLOCK; block->stream = stream; block->length = 0; block->numSamples = 0; if(stream->streamSource == STREAM_MP3) fillStreamBlock_mp3(stream, block); else if(stream->streamSource == STREAM_FLV) fillStreamBlock_flv(stream, block); if(block->length == 0) { free(block); return NULL; } return (SWFBlock)block; }
SWFTabIndex newSWFTabIndex(int depth, int index) { SWFTabIndex ti = (SWFTabIndex)malloc(sizeof(struct SWFTabIndex_s)); SWFBlockInit(BLOCK(ti)); BLOCK(ti)->type = SWF_SETTABINDEX; BLOCK(ti)->writeBlock = writeSWFTabIndexToMethod; BLOCK(ti)->complete = completeSWFTabIndex; BLOCK(ti)->dtor = (destroySWFBlockMethod) destroySWFTabIndex; ti->depth = depth; ti->index = index; return ti; }
SWFPrebuilt newSWFPrebuilt() { SWFPrebuilt data = (SWFPrebuilt)malloc(sizeof(struct SWFPrebuilt_s)); SWFBlockInit((SWFBlock)data); BLOCK(data)->type = SWF_PREBUILT; BLOCK(data)->writeBlock = writeSWFPrebuiltToMethod; BLOCK(data)->complete = completeSWFPrebuilt; BLOCK(data)->dtor = (destroySWFBlockMethod) destroySWFPrebuilt; data->defines = newSWFOutput(); return data; }
SWFFileAttributes newSWFFileAttributes() { SWFFileAttributes fattrs= (SWFFileAttributes)malloc(sizeof(struct SWFFileAttributes_s)); SWFBlockInit(BLOCK(fattrs)); BLOCK(fattrs)->type = SWF_FILEATTRIBUTES; BLOCK(fattrs)->writeBlock = writeSWFFileAttributesToMethod; BLOCK(fattrs)->complete = completeSWFFileAttributes; BLOCK(fattrs)->dtor = (destroySWFBlockMethod) destroySWFFileAttributes; fattrs->hasMetadata = 0; fattrs->useNetwork = 0; fattrs->hasABC = 0; return fattrs; }
void SWFCharacterInit(SWFCharacter character) { SWFBlockInit((SWFBlock)character); character->id = 0; character->bounds = NULL; character->dependencies = NULL; character->nDependencies = 0; character->isFinished = FALSE; character->onPlace = NULL; character->onFrame = NULL; }
SWFPlaceObject2Block newSWFPlaceObject2Block(int depth) { SWFPlaceObject2Block place = (SWFPlaceObject2Block)malloc(sizeof(struct SWFPlaceObject2Block_s)); /* If malloc failed, return NULL to signify this */ if (NULL == place) return NULL; SWFBlockInit((SWFBlock)place); BLOCK(place)->type = SWF_PLACEOBJECT2; BLOCK(place)->writeBlock = writeSWFPlaceObject2BlockToStream; BLOCK(place)->complete = completeSWFPlaceObject2Block; BLOCK(place)->dtor = (destroySWFBlockMethod) destroySWFPlaceObject2Block; place->version = 2; place->out = NULL; place->name = NULL; place->move = 0; place->matrix = NULL; place->cXform = NULL; place->character = NULL; place->masklevel = -1; place->ratio = -1; place->depth = depth; place->nActions = 0; place->actionORFlags = 0; place->actionFlags = NULL; /* place->actionChars = NULL; */ place->actions = NULL; place->hasCacheFlag = 0; place->hasBlendFlag = 0; place->hasFilterFlag = 0; place->filterList = NULL; #if TRACK_ALLOCS place->gcnode = ming_gc_add_node(place, (dtorfunctype) destroySWFPlaceObject2Block); #endif return place; }
SWFBlock newSWFProtect(const char *password) { SWFProtect protect = (SWFProtect)malloc(sizeof(struct SWFProtect_s)); SWFBlockInit(BLOCK(protect)); BLOCK(protect)->type = SWF_PROTECT; BLOCK(protect)->writeBlock = writeSWFProtectToMethod; BLOCK(protect)->complete = completeSWFProtect; BLOCK(protect)->dtor = (destroySWFBlockMethod) destroySWFProtect; protect->out = newSWFOutput(); if(password != NULL) protect->Password = strdup(password); else protect->Password = NULL; return (SWFBlock)protect; }
/* * private constructor * see SWFMove[Clip]_startSound() */ SWFSoundInstance newSWFSoundInstance(SWFSound sound) { SWFSoundInstance instance = (SWFSoundInstance)malloc(sizeof(struct SWFSoundInstance_s)); SWFBlock block = (SWFBlock)instance; SWFBlockInit(block); block->type = SWF_STARTSOUND; block->writeBlock = writeSWFSoundInstanceToMethod; block->complete = completeSWFSoundInstance; /* block->dtor = destroySWFStartSoundBlock; */ instance->sound = sound; instance->inPoint = 0; instance->outPoint = 0; instance->numLoops = 0; instance->flags = 0; instance->numEnvPoints = 0; instance->envPoints = NULL; return instance; }