//#define ATOM_DEBUG adm_atom::adm_atom(adm_atom *atom) { _fd=atom->_fd; _atomStart=ftell(_fd); _atomSize=read32(); _atomFCC=read32(); #ifdef ATOM_DEBUG dumpAtom(); #endif }
adm_atom::adm_atom(FILE *fd ) { _fd=fd; fseek(_fd,0,SEEK_END); _atomFCC=fourCC::get((uint8_t *)"MOVI"); _atomSize=ftell(_fd); fseek(_fd,0,SEEK_SET); _atomStart=0; #ifdef ATOM_DEBUG dumpAtom(); #endif }
adm_atom::adm_atom(FILE *fd ) { _fd=fd; fseek(_fd,0,SEEK_END); _atomFCC=fourCC::get((uint8_t *)"MOVI"); _atomSize=ftell(_fd); fseek(_fd,0,SEEK_SET); _atomStart=0; #ifdef ATOM_DEBUG dumpAtom(); #endif #ifdef _3G_LOGO printf("Starting at %x atom ",_atomStart); fourCC::printBE(_atomFCC); printf("\n"); #endif }
//#define ATOM_DEBUG adm_atom::adm_atom(adm_atom *atom) { _fd=atom->_fd; _atomStart=ftell(_fd); _atomSize=read32(); _atomFCC=read32(); // Gross hack for some (buggy ?) movie if(!_atomSize) { printf("3GP:Workaround: detected wrong sized atom!\nTrying to continue\n"); _atomStart+=4; _atomSize-=4; fseek(_fd,_atomStart,SEEK_SET); _atomSize=read32(); _atomFCC=read32(); } #ifdef ATOM_DEBUG dumpAtom(); #endif }
uint8_t adm_atom::readPayload( uint8_t *whereto, uint32_t rd) { uint32_t pos; pos=ftell(_fd); if(pos+rd>_atomSize+_atomStart) { printf("\n Going out of atom's bound!! (%ld / %ld )\n",pos+rd,_atomSize+_atomStart); dumpAtom(); exit(0); } uint32_t i; i=fread(whereto,rd,1,_fd); if(i!=1) { printf("\n oops asked %lu got %lu \n",rd,i); return 0; } return 1; }
static void dumpFile(ObjectFile::Reader* reader) { // stabs debug info if ( sDumpStabs && (reader->getDebugInfoKind() == ObjectFile::Reader::kDebugInfoStabs) ) { std::vector<ObjectFile::Reader::Stab>* stabs = reader->getStabs(); if ( stabs != NULL ) dumpStabs(stabs); } // get all atoms std::vector<ObjectFile::Atom*> atoms = reader->getAtoms(); // make copy of vector and sort (so output is canonical) std::vector<ObjectFile::Atom*> sortedAtoms(atoms); if ( sSort ) std::sort(sortedAtoms.begin(), sortedAtoms.end(), AtomSorter()); for(std::vector<ObjectFile::Atom*>::iterator it=sortedAtoms.begin(); it != sortedAtoms.end(); ++it) { if ( sNMmode ) dumpAtomLikeNM(*it); else dumpAtom(*it); } }