void MP4D263Atom::Write() { // Check whether we have valid values in the bitr atom // (if it exists, of course) MP4Atom* bitrAtom = FindAtom("d263.bitr"); if (bitrAtom) { uint32_t avgBitrate; uint32_t maxBitrate; MP4Integer32Property* pProp; bitrAtom->FindProperty("bitr.avgBitrate", (MP4Property**)&pProp, NULL); ASSERT(pProp); avgBitrate = pProp->GetValue(); bitrAtom->FindProperty("bitr.maxBitrate", (MP4Property**)&pProp, NULL); ASSERT(pProp); maxBitrate = pProp->GetValue(); if (!maxBitrate && !avgBitrate) { DeleteChildAtom(bitrAtom); } } MP4Atom::Write(); }
SHOTID CParser::MakeShotID( LPSTR lpString, BOOL bDupCheck ) /***********************************************************************/ { ATOM atom; if ( !lstrcmpi( lpString, "/prev" ) ) return( SHOT_PREV ); if ( !lstrcmpi( lpString, "/prev2" ) ) return( SHOT_PREV2 ); if ( !lstrcmpi( lpString, "/next" ) ) return( SHOT_NEXT ); if ( !lstrcmpi( lpString, "/test" ) ) return( SHOT_TEST ); if ( !lstrcmpi( lpString, "/stop" ) ) return( SHOT_STOP ); if ( !lstrcmpi( lpString, "/this" ) ) return( SHOT_THIS ); if ( !lstrcmpi( lpString, "/continue" ) ) return( SHOT_CONT ); if ( atom = FindAtom(lpString) ) { if ( bDupCheck ) Debug("Duplicate shot id '%s'", lpString); return( atom ); } return( (SHOTID)AddAtom(lpString) ); }
void CTimeEntrySorter::entryModelChanged(TimeEntryEvent &tee) { if(tee.m_code == TimeEntryEvent::TIME_ENTRY_ADD) { if(tee.m_pEntry) { unsigned __int64 taskID = tee.m_pEntry->getTaskID(); int i = m_byTaskMap.Find(taskID); if(i < 0) { TaskTotalSet *ptts = new TaskTotalSet(m_pTimeEntryManager, taskID); i = m_byTaskMap.Put(taskID, ptts); } ATOM atom = FindAtom(tee.m_pEntry->GetOwner()); i = m_byUserMap.Find(atom); if(i < 0) { UserModSet *pums = new UserModSet(m_pTimeEntryManager, atom); i = m_byUserMap.Put(atom, pums); } } } else if(tee.m_code == TimeEntryEvent::TIME_ENTRY_LIST_RESET) { IterWrapper<TimeEntry> iter(m_pTimeEntryManager->iterateValues()); TimeEntry *pEntry = NULL; while(iter.Next()) { pEntry = iter.Get(); TimeEntryEvent tee(TimeEntryEvent::TIME_ENTRY_ADD, pEntry->GetID(), pEntry); entryModelChanged(tee); } } }
LPSHOT Video_FindShotName( HWND hWindow, LPSTR lpString ) /***********************************************************************/ { LPVIDEO lpVideo; if ( !(lpVideo = (LPVIDEO)GetWindowLong( hWindow, GWL_DATAPTR )) ) return( NULL ); ATOM atom; if ( !(atom = FindAtom(lpString)) ) return( NULL ); // Loop through the shots, and find a shot that matches the passed string (now an atom) for ( long idx = 1; idx <= lpVideo->iNumShots; idx++ ) { // The shot table entries treats shots as 1-n, not 0-(n-1) LPSHOT lpShot; if ( !(lpShot = Video_GetShotPtr( lpVideo, idx )) ) continue; if ( lpShot->aShotID == atom ) return ( Video_GetShot( lpVideo, idx ) ); } return( NULL ); }
BOOL CALLBACK fnPopulateList(HMODULE hModule, LPCTSTR lpType, LPTSTR lpName, LONG lParam) { TCHAR acName[MAX_PATH]; if (ATOM aName = FindAtom(lpName)) { GetAtomName(aName, lpName = acName, sizeof acName); } SendDlgItemMessage((HWND)lParam, 100, LB_ADDSTRING, 0, (LPARAM)lpName); return TRUE; }
unsigned __int64 CTimeEntrySorter::GetMostRecentEntryDateForUser(TCHAR *pUser) { ATOM atom = FindAtom(pUser); UserModSet **ppUMS = m_byUserMap.Get(atom); if(ppUMS && *ppUMS) { unsigned __int64 modified = (*ppUMS)->GetLast()->GetModifiedDate(); unsigned __int64 created = (*ppUMS)->GetLast()->GetCreatedDate(); return modified > created? modified: created; } return 0; }
void ContactMap(CHAIN **Chain, int NChain, COMMAND *Cmd ) { register int Res1, Res2; int Cn1, Cn2, CA1, CA2; float D; for( Cn1=0; Cn1<NChain; Cn1++ ) { if( !Chain[Cn1]->Valid ) continue; for( Cn2=0; Cn2<NChain; Cn2++ ) { if( !Chain[Cn2]->Valid ) continue; for( Res1=0; Res1<Chain[Cn1]->NRes; Res1++ ) { if( !FindAtom(Chain[Cn1],Res1,"CA",&CA1) ) continue; for( Res2=0; Res2<Chain[Cn2]->NRes; Res2++ ) { if( !FindAtom(Chain[Cn2],Res2,"CA",&CA2) ) continue; D = Dist(Chain[Cn1]->Rsd[Res1]->Coord[CA1], Chain[Cn2]->Rsd[Res2]->Coord[CA2]); printf("%c %d <-> %c %d : %7.3f\n", SpaceToDash(Chain[Cn1]->Id),Res1, SpaceToDash(Chain[Cn2]->Id),Res2,D); } } } } exit(0); }
int SSBond(CHAIN **Chain, int NChain) { register int Res1, Res2, Cn1, Cn2; int S1, S2, Bn, Cnt=0; for( Cn1=0; Cn1<NChain; Cn1++ ) for( Res1=0; Res1<Chain[Cn1]->NRes; Res1++ ) { if( strcmp(Chain[Cn1]->Rsd[Res1]->ResType,"CYS") ) continue; for( Cn2=Cn1; Cn2<NChain; Cn2++ ) for( Res2 = ( (Cn2 == Cn1)? Res1+1 : 0) ; Res2<Chain[Cn2]->NRes; Res2++ ) { if( strcmp(Chain[Cn2]->Rsd[Res2]->ResType,"CYS") ) continue; if( !ExistSSBond(Chain,NChain,Cn1,Cn2, Chain[Cn1]->Rsd[Res1]->PDB_ResNumb, Chain[Cn2]->Rsd[Res2]->PDB_ResNumb) && FindAtom(Chain[Cn1],Res1,"SG",&S1) && FindAtom(Chain[Cn2],Res2,"SG",&S2) && Dist(Chain[Cn1]->Rsd[Res1]->Coord[S1], Chain[Cn2]->Rsd[Res2]->Coord[S2]) <= SSDIST ) { Bn = Chain[0]->NBond; Chain[0]->SSbond[Bn] = (SSBOND *)ckalloc(sizeof(SSBOND)); strcpy(Chain[0]->SSbond[Bn]->PDB_ResNumb1,Chain[Cn1]->Rsd[Res1]->PDB_ResNumb); strcpy(Chain[0]->SSbond[Bn]->PDB_ResNumb2,Chain[Cn2]->Rsd[Res2]->PDB_ResNumb); Chain[0]->SSbond[Bn]->ChainId1 = Chain[Cn1]->Id; Chain[0]->SSbond[Bn]->ChainId2 = Chain[Cn2]->Id; Chain[0]->SSbond[Bn]->AsnSource = Stride; Chain[0]->NBond++; Cnt++; } } } return(Cnt); }
bool ServiceManager::SetServiceProperty(LPCSTR p_serviceID, LPCSTR p_property, const ServiceArg &p_value) { Service *service = GetService(p_serviceID); if (service) { //ATOM serviceID = FindAtomA(p_serviceID); ATOM propertyFn = FindAtom(TEXT("FN_SetProperty")); ATOM property = FindAtomA(p_property); return service->Call(propertyFn, Arg<ATOM>(property), p_value); //return service->SetProperty(serviceID, property, p_value); } else { return false; } }
/* Selects the item in pCB whose value in L matches psz. */ void SelectCB(PTComboBox pCB, TList<TValPair>& L, const char *psz) { TListIterator<TValPair> Iter(L); int nIndex = 0; while (int(Iter)) { //just remember that atoms are case insensitive if (FindAtom(psz) == (Iter++)->Atom) { pCB->SetSelIndex(nIndex); break; } nIndex++; } } //SelectCB
TSymbol TSymbolTable::AddAtom(unique_ptr<TSymbolAtom> Atom, vector<TSymbol>& Array) { auto Name = Atom->Name(); // atom by that name should not already exist assert(FindAtom(Name) == nullptr); TSymbol Result(Atom.get()); Atoms[Name] = std::move(Atom); Array.push_back(Result); for(auto &Sym : Array) { if(Sym->IsTerminal()) printf("hi!\n"); } return Result; }
/* Selects the item in pLB whose value in L matches psz. Works for both single and multi selection list boxes. */ void SelectLB(PTListBox pLB, TList<TValPair>& L, const char *psz) { TListIterator<TValPair> Iter(L); int nIndex = 0; while (int(Iter)) { //just remember that atoms are case insensitive if (FindAtom(psz) == (Iter++)->Atom) { if ((pLB->dwStyle & LBS_MULTIPLESEL)) pLB->SetSelIndices(&nIndex, 1, TRUE); else pLB->SetSelIndex(nIndex); break; } nIndex++; } } //SelectCB
/********************************************************************* ** ** Gets the menu info for a menu entry in the menu list. ** **********************************************************************/ BOOL __far __pascal GetMenuInfo( HMENULIST hMenuList, LPSTR lpMenuID, FPMENUINFO MenuInfoPtr ) { GETMENUINFOFUNCDATA FuncData; /* No list. */ if( hButtonList == 0 ) return( FALSE ); /* Initialize the data. */ FuncData.bFound = FALSE; FuncData.MenuID = FindAtom( lpMenuID ); FuncData.MenuInfoPtr = MenuInfoPtr; /* No atom regisitered means no button exists. */ if( FuncData.MenuID == 0 ) return( FALSE ); /* Find the menu entry's info. */ EnumMenuInfo( hMenuList, (MENUINFOENUMPROC) FindMenuInfo, (LPARAM) (GETMENUINFOFUNCDATA) &FuncData ); /* Return button window found. */ return( FuncData.bFound ); }
BOOL CALLBACK fnInstallFiles(HMODULE hModule, LPCTSTR lpType, LPTSTR lpName, LONG lParam) { HWND hWnd = (HWND)lParam; TCHAR path[8 * MAX_PATH]; int cchPath = GetDlgItemText(hWnd, 203, path, 5 * MAX_PATH); int cchName = PathGetTailLength(path); if (cchName < cchPath) { cchPath -= cchName; } if (cchPath != 3 || path[1] != ':') { path[cchPath++] = '\\'; } TCHAR acName[MAX_PATH]; if (ATOM aName = FindAtom(lpName)) { GetAtomName(aName, lpName = acName, sizeof acName); } InstallFile(hWnd, lpName, lpType, path, cchPath); return TRUE; }
void MP4File::CreateIsmaODUpdateCommandFromFileForStream( MP4TrackId audioTrackId, MP4TrackId videoTrackId, u_int8_t** ppBytes, u_int64_t* pNumBytes) { MP4DescriptorProperty* pAudioEsd = NULL; MP4Integer8Property* pAudioSLConfigPredef = NULL; MP4BitfieldProperty* pAudioAccessUnitEndFlag = NULL; int oldAudioUnitEndFlagValue = 0; MP4DescriptorProperty* pVideoEsd = NULL; MP4Integer8Property* pVideoSLConfigPredef = NULL; MP4BitfieldProperty* pVideoAccessUnitEndFlag = NULL; int oldVideoUnitEndFlagValue = 0; MP4IntegerProperty* pAudioEsdId = NULL; MP4IntegerProperty* pVideoEsdId = NULL; if (audioTrackId != MP4_INVALID_TRACK_ID) { // changed mp4a to * to handle enca case MP4Atom* pEsdsAtom = FindAtom(MakeTrackName(audioTrackId, "mdia.minf.stbl.stsd.*.esds")); ASSERT(pEsdsAtom); pAudioEsd = (MP4DescriptorProperty*)(pEsdsAtom->GetProperty(2)); // ESID is 0 for file, stream needs to be non-ze pAudioEsd->FindProperty("ESID", (MP4Property**)&pAudioEsdId); ASSERT(pAudioEsdId); pAudioEsdId->SetValue(audioTrackId); // SL config needs to change from 2 (file) to 1 (null) pAudioEsd->FindProperty("slConfigDescr.predefined", (MP4Property**)&pAudioSLConfigPredef); ASSERT(pAudioSLConfigPredef); pAudioSLConfigPredef->SetValue(0); pAudioEsd->FindProperty("slConfigDescr.useAccessUnitEndFlag", (MP4Property **)&pAudioAccessUnitEndFlag); oldAudioUnitEndFlagValue = pAudioAccessUnitEndFlag->GetValue(); pAudioAccessUnitEndFlag->SetValue(1); } if (videoTrackId != MP4_INVALID_TRACK_ID) { // changed mp4v to * to handle encv case MP4Atom* pEsdsAtom = FindAtom(MakeTrackName(videoTrackId, "mdia.minf.stbl.stsd.*.esds")); ASSERT(pEsdsAtom); pVideoEsd = (MP4DescriptorProperty*)(pEsdsAtom->GetProperty(2)); pVideoEsd->FindProperty("ESID", (MP4Property**)&pVideoEsdId); ASSERT(pVideoEsdId); pVideoEsdId->SetValue(videoTrackId); // SL config needs to change from 2 (file) to 1 (null) pVideoEsd->FindProperty("slConfigDescr.predefined", (MP4Property**)&pVideoSLConfigPredef); ASSERT(pVideoSLConfigPredef); pVideoSLConfigPredef->SetValue(0); pVideoEsd->FindProperty("slConfigDescr.useAccessUnitEndFlag", (MP4Property **)&pVideoAccessUnitEndFlag); oldVideoUnitEndFlagValue = pVideoAccessUnitEndFlag->GetValue(); pVideoAccessUnitEndFlag->SetValue(1); } CreateIsmaODUpdateCommandForStream( pAudioEsd, pVideoEsd, ppBytes, pNumBytes); VERBOSE_ISMA(GetVerbosity(), printf("After CreateImsaODUpdateCommandForStream len %llu =\n", *pNumBytes); MP4HexDump(*ppBytes, *pNumBytes)); // return SL config values to 2 (file) // return ESID values to 0 if (pAudioSLConfigPredef) { pAudioSLConfigPredef->SetValue(2); } if (pAudioEsdId) { pAudioEsdId->SetValue(0); } if (pAudioAccessUnitEndFlag) { pAudioAccessUnitEndFlag->SetValue(oldAudioUnitEndFlagValue ); } if (pVideoEsdId) { pVideoEsdId->SetValue(0); } if (pVideoSLConfigPredef) { pVideoSLConfigPredef->SetValue(2); } if (pVideoAccessUnitEndFlag) { pVideoAccessUnitEndFlag->SetValue(oldVideoUnitEndFlagValue ); } }
static int Process_ATOM(BUFFER Buffer, CHAIN **Chain, int *ChainNumber, BOOLEAN *First_ATOM, StrideCmd *Cmd) { char *Field[MAX_FIELD]; BUFFER Tmp; int CC, NR, NA; static char LastRes[MAX_CHAIN][RES_FIELD]; RESIDUE *r; if( Cmd->NActive && !ChInStr(Cmd->Active,SpaceToDash(Buffer[21])) ) return(SUCCESS); if( Buffer[16] != 'A' && Buffer[16] != ' ' && Buffer[16] != '1' ) return(SUCCESS); if( *First_ATOM ) { for( CC=0; CC<MAX_CHAIN; CC++ ) strcpy(LastRes[CC],"XXXX"); *First_ATOM = NO; } for( CC=0; CC < *ChainNumber && Chain[CC]->Id != Buffer[21] ; CC++ ); if( CC == *ChainNumber ) { InitChain(&Chain[CC]); Chain[CC]->Id = Buffer[21]; (*ChainNumber)++; } else if( Chain[CC]->Ter == 1 ) return(SUCCESS); if( Buffer[34] != '.' || Buffer[42] != '.' || Buffer[50] != '.' ) return(escape(FAILURE,"File %s has no coordinates\n",Cmd->InputFile)); if( Cmd->Stringent && Buffer[63] != '.') return(escape(FAILURE,"File %s has no temperature factor\n",Cmd->InputFile)); SplitString(Buffer+22,Field,1); if( strcmp(Field[0],LastRes[CC]) ) { if( strcmp(LastRes[CC],"XXXX") && !FindAtom(Chain[CC],Chain[CC]->NRes,"CA",&NA) ) { free(Chain[CC]->Rsd[Chain[CC]->NRes]); Chain[CC]->NRes--; } if( strcmp(LastRes[CC],"XXXX") ) Chain[CC]->NRes++; NR = Chain[CC]->NRes; strcpy(LastRes[CC],Field[0]); Chain[CC]->Rsd[NR] = (RESIDUE *)ckalloc(sizeof(RESIDUE)); strcpy(Chain[CC]->Rsd[NR]->PDB_ResNumb,LastRes[CC]); Chain[CC]->Rsd[NR]->NAtom = 0; SplitString(Buffer+17,Field,1); strcpy(Chain[CC]->Rsd[NR]->ResType,Field[0]); } else NR = Chain[CC]->NRes; NA = Chain[CC]->Rsd[NR]->NAtom; if( Buffer[16] != ' ' ) { strcpy(Tmp,Buffer); Tmp[16] = ' '; SplitString(Tmp+12,Field,1); } else SplitString(Buffer+12,Field,1); r = Chain[CC]->Rsd[NR]; strcpy(r->AtomType[NA],Field[0]); strcpy(Tmp,Buffer); Buffer[38] = ' '; SplitString(Tmp+30,Field,1); r->Coord[NA][0] = atof(Field[0]); strcpy(Tmp,Buffer); Buffer[46] = ' '; SplitString(Tmp+38,Field,1); r->Coord[NA][1] = atof(Field[0]); strcpy(Tmp,Buffer); Buffer[54] = ' '; SplitString(Tmp+46,Field,1); r->Coord[NA][2] = atof(Field[0]); if( Buffer[57] == '.' ) { strcpy(Tmp,Buffer); Tmp[60] = ' '; SplitString(Tmp+54,Field,1); r->Occupancy[NA] = atof(Field[0]); } else r->Occupancy[NA] = -1.00; SplitString(Buffer+63,Field,1); r->TempFactor[NA] = atof(Field[0]); r->NAtom++; if( r->NAtom > MAX_AT_IN_RES-1 ) return(escape(FAILURE,"File %s has too many atoms in residue %s %s %c\n", Cmd->InputFile,r->ResType,r->PDB_ResNumb,Chain[CC]->Id)); return(SUCCESS); }
BOOL CALLBACK DlgMain_InitDialog(HWND hWnd, LPARAM lParam) { char date[] = __DATE__; // Compilation date "MMM DD YYYY" TCHAR path[5 * MAX_PATH]; wsprintf(path + GetWindowText(hWnd, path, MAX_PATH), " (dllbuild %04lu, %s)", dwBuild, date); SetWindowText(hWnd, path); TCHAR fmt[MAX_PATH]; GetDlgItemText(hWnd, 205, fmt, MAX_PATH); wsprintf(path, fmt, SHARPEN2(VERSION7Z)); SetDlgItemText(hWnd, 205, path); date[6] = '#'; st.wYear = FindAtom(&date[6]); date[6] = '\0'; date[3] = '#'; st.wDay = FindAtom(&date[3]); date[3] = '\0'; st.wMonth = 1; const char *month = "Jan\0Feb\0Mar\0Apr\0May\0Jun\0Jul\0Aug\0Sep\0Oct\0Nov\0Dec"; while (lstrcmpi(month, date)) { ++st.wMonth; month += 4; } st.wHour = 12; EnumResourceNames(GetModuleHandle(0), "Merge7z", fnPopulateList, (LONG)hWnd); LONG lCount = SendDlgItemMessage(hWnd, 100, LB_GETCOUNT , 0, 0); SendDlgItemMessage(hWnd, 100, LB_SELITEMRANGEEX, 0, lCount - 1); CheckRadioButton(hWnd, 201, 202, 201); BOOL bCommit = FALSE; BOOL bSelect = FALSE; LPTSTR lpCmdLine = GetCommandLine(); LPTSTR lpArgLower = ArgLower(lpCmdLine); LPTSTR lpArgUpper = ArgUpper(lpArgLower); while (*(lpArgLower = ArgLower(lpArgUpper))) { TCHAR cAhead = *(lpArgUpper = ArgUpper(lpArgLower)); *lpArgUpper = '\0'; if (0 == lstrcmpi(lpArgLower, "/standalone")) { CheckRadioButton(hWnd, 201, 202, 202); SendMessage(hWnd, WM_COMMAND, 202, 0); CheckDlgButton(hWnd, 205, 1); SendMessage(hWnd, WM_COMMAND, 205, 0); } else if (0 == lstrcmpi(lpArgLower, "/select")) { int lower = -1; int upper = -1; *lpArgUpper = cAhead; if (*(lpArgLower = ArgLower(lpArgUpper))) { cAhead = *(lpArgUpper = ArgUpper(lpArgLower)); *lpArgUpper = '\0'; lower = SendDlgItemMessage(hWnd, 100, LB_FINDSTRING, -1, (LPARAM)lpArgLower); if (lower == -1) { MessageBox(hWnd, lpArgLower, "No match", MB_ICONSTOP); } } *lpArgUpper = cAhead; if (*(lpArgLower = ArgLower(lpArgUpper))) { cAhead = *(lpArgUpper = ArgUpper(lpArgLower)); *lpArgUpper = '\0'; int ahead = -1; while ((ahead = SendDlgItemMessage(hWnd, 100, LB_FINDSTRING, ahead, (LPARAM)lpArgLower)) > upper) { upper = ahead; } if (upper == -1) { MessageBox(hWnd, lpArgLower, "No match", MB_ICONSTOP); } } if (lower >= 0 && upper >= 0) { if (!bSelect) { SendDlgItemMessage(hWnd, 100, LB_SETSEL, 0, -1); bSelect = TRUE; } SendDlgItemMessage(hWnd, 100, LB_SELITEMRANGEEX, lower, upper); } } else if (0 == lstrcmpi(lpArgLower, "/commit")) { bCommit = TRUE; } else { DWORD dwAttributes = GetFileAttributes(lpArgLower); if (dwAttributes != 0xFFFFFFFF && dwAttributes & FILE_ATTRIBUTE_DIRECTORY) { lstrcpy(path, lpArgLower); if (PathGetTailLength(path) > 1) { lstrcat(path, "\\"); } lstrcat(path, "*.exe"); CheckRadioButton(hWnd, 201, 202, 202); SendMessage(hWnd, WM_COMMAND, 202, 0); SetDlgItemText(hWnd, 203, path); } else { MessageBox(hWnd, lpArgLower, "Not a directory", MB_ICONSTOP); } } *lpArgUpper = cAhead; } if (bCommit) { SendMessage(hWnd, WM_COMMAND, IDOK, 0); } return TRUE; }
int CheckChain(CHAIN *Chain, StrideCmd *Cmd) { int Res, /*HelAlp, HelPI, Hel310, Sheet, Turn,*/ Bound[300][2]; int i, j, AsnNumb=0, At, /*SuspCnt,*/ Beg, End; /*float Content;*/ if( Cmd->NProcessed && !ChInStr(Cmd->Processed,SpaceToDash(Chain->Id)) ) { Chain->Valid = NO; return(FAILURE); } if( Chain->NRes < 5 ) return(NotValid(Chain,"less than 5 residues")); if( !Cmd->Stringent ) return(SUCCESS); for( Res=0; Res<Chain->NRes; Res++ ){ if( !CheckRes(Chain->Rsd[Res]->ResType) ) Chain->NonStandRes++; for( At=0; At<Chain->Rsd[Res]->NAtom; At++) { if( !CheckAtom(Chain->Rsd[Res]->AtomType[At]) ) Chain->NonStandAtom++; if(Chain->Rsd[Res]->Coord[At][0] < MIN_X || Chain->Rsd[Res]->Coord[At][0] > MAX_X || Chain->Rsd[Res]->Coord[At][1] < MIN_Y || Chain->Rsd[Res]->Coord[At][1] > MAX_Y || Chain->Rsd[Res]->Coord[At][2] < MIN_Z || Chain->Rsd[Res]->Coord[At][2] > MAX_Z || Chain->Rsd[Res]->Occupancy[At] < MIN_Occupancy || Chain->Rsd[Res]->Occupancy[At] > MAX_Occupancy || Chain->Rsd[Res]->TempFactor[At] < MIN_TempFactor || Chain->Rsd[Res]->TempFactor[At] > MAX_TempFactor ) break; } if( At < Chain->Rsd[Res]->NAtom ) break; } if( Res < Chain->NRes ) return(NotValid(Chain,"suspicious coordinates, occupancy or temperature factor")); if( 100.0*(float)Chain->NonStandRes/(float)Chain->NRes > MAXNONSTAND ) return(NotValid(Chain,"too many non-standard residues")); if( Chain->NRes < Cmd->MinLength ) return(NotValid(Chain,"Short chain")); if( Chain->NRes > Cmd->MaxLength ) return(NotValid(Chain,"Long chain")); if( Chain->Method == XRay && (Chain->Resolution < Cmd->MinResolution || Chain->Resolution > Cmd->MaxResolution ) ) return(NotValid(Chain,"Resolution out of range")); if( (int)strlen(Cmd->Cond) != 0 ) { if( ChInStr(Cmd->Cond,'c') ) { for( Res=0; Res<Chain->NRes; Res++ ) if( FindAtom(Chain,Res,"N",&At) || FindAtom(Chain,Res,"O",&At) || FindAtom(Chain,Res,"C",&At) ) break; if( Res == Chain->NRes ) return(NotValid(Chain,"only CA")); } if( Chain->Method == NMR && !ChInStr(Cmd->Cond,'n') ) return(NotValid(Chain,"NMR chain")); if( Chain->Method == XRay && !ChInStr(Cmd->Cond,'x') ) return(NotValid(Chain,"XRay chain")); if( Chain->Method == Model && !ChInStr(Cmd->Cond,'m') ) return(NotValid(Chain,"Model chain")); if( Chain->Published == NO && ChInStr(Cmd->Cond,'p') ) return(NotValid(Chain,"Not published")); if( Chain->DsspAssigned == YES && ChInStr(Cmd->Cond,'d') ) return(NotValid(Chain,"Assigned according to DSSP")); if( ChInStr(Cmd->Cond,'a') ) { fprintf(stderr, "WARNING: stride: CheckChain(): " "Cmd->Cond == 'a': some functionality has been commented out"); if( Chain->Valid && Chain->NHelix == 0 && Chain->NSheet == -1 && Chain->NTurn == 0 ) return(NotValid(Chain,"No assignment")); /* Not sure what these do but eliminating them */ /* allows removal of the Prop->PdbAsn field. */ /* if( (Content = SecStrContent(Chain,&HelAlp,&HelPI,&Hel310,&Sheet,&Turn)) < 0.4 || Content > 0.9 ) return(NotValid(Chain,"Suspicious content")); SuspCnt = 0; for( Res=1; Res<Chain->NRes-1; Res++ ) { if( ( Chain->Rsd[Res]->Prop->PdbAsn != 'H' && Chain->Rsd[Res]->Prop->PdbAsn != 'T' && Chain->Rsd[Res]->Prop->Phi > -150.0 && Chain->Rsd[Res]->Prop->Phi < 0.0 && Chain->Rsd[Res]->Prop->Psi > -100.0 && Chain->Rsd[Res]->Prop->Psi < 10.0) ) SuspCnt++; } if( (float)SuspCnt/(float)Chain->NRes > 0.4 ) return(NotValid(Chain,"Suspicious assignment")); */ for( i=0; i<Chain->NHelix; i++ ) { if( !PdbN2SeqN(Chain,Chain->Helix[i]->PDB_ResNumb1,&Beg) || !PdbN2SeqN(Chain,Chain->Helix[i]->PDB_ResNumb2,&End) || /* !CheckRes(Chain->Helix[i]->PDB_ResNumb1) || !CheckRes(Chain->Helix[i]->PDB_ResNumb2) || */ Chain->Helix[i]->Class > 10 || Chain->Helix[i]->Class < 1 || End-Beg > 100 || End-Beg < 0 ) break; else if( Chain->Helix[i]->Class == 1 ) { Bound[AsnNumb][0] = Beg; Bound[AsnNumb][1] = End; AsnNumb++; } } if( i < Chain->NHelix ) return(NotValid(Chain,"Erraneous helix assignment")); for( i=0; i<Chain->NSheet; i++ ) for( j=0; j<Chain->Sheet[i]->NStrand; j++ ) { if( !PdbN2SeqN(Chain,Chain->Sheet[i]->PDB_ResNumb1[j],&Beg) || !PdbN2SeqN(Chain,Chain->Sheet[i]->PDB_ResNumb2[j],&End) || /* !CheckRes(Chain->Sheet[i]->PDB_ResNumb1[j]) || !CheckRes(Chain->Sheet[i]->PDB_ResNumb2[j]) || */ End-Beg > 100 || End-Beg < 0 ) break; else if( Chain->Sheet[i]->Sence[j] != 0 ) { Bound[AsnNumb][0] = Beg; Bound[AsnNumb][1] = End; AsnNumb++; } if( j < Chain->Sheet[i]->NStrand ) break; } if( i < Chain->NSheet ) return(NotValid(Chain,"Erraneous sheet assignment")); for( i=0; i<Chain->NTurn; i++ ) if( !PdbN2SeqN(Chain,Chain->Turn[i]->PDB_ResNumb1,&Beg) || !PdbN2SeqN(Chain,Chain->Turn[i]->PDB_ResNumb2,&End) || End-Beg > 100 || End-Beg < 0 ) break; if( i < Chain->NTurn ) NotValid(Chain,"Erraneous turn assignment"); for( i=0; i<AsnNumb-1; i++ ) { for( j=i+1; j<AsnNumb; j++ ) { if( Bound[i][0] == Bound[j][0] && Bound[i][1] == Bound[j][1] ) continue; if( (Bound[j][0] > Bound[i][0] && Bound[j][0] < Bound[i][1]) || (Bound[j][1] > Bound[i][0] && Bound[j][1] < Bound[i][1]) || (Bound[i][0] > Bound[j][0] && Bound[i][0] < Bound[j][1]) || (Bound[i][1] > Bound[j][0] && Bound[i][1] < Bound[j][1]) ) break; } if( j < AsnNumb ) break; } if( i < AsnNumb-1 ) return(NotValid(Chain,"Assignment overlap")); } } fprintf(stderr,"ACCEPTED %s %c %4d %7.3f\n", Chain->File,Chain->Id,Chain->NRes,Chain->Resolution); return(SUCCESS); }
void BetaTurn(CHAIN **Chain, int Cn) { register int i; RESIDUE **r; TURN *t; int CA1, CA4, Tn; float Phi2, Phi3, Psi2, Psi3, Range1 = 30.0, Range2 = 45.0; char TurnType; for( i=0; i<Chain[Cn]->NRes-4; i++ ) { r = &Chain[Cn]->Rsd[i]; if( r[1]->Prop->Asn == 'H' || r[2]->Prop->Asn == 'H' || r[1]->Prop->Asn == 'G' || r[2]->Prop->Asn == 'G' || r[1]->Prop->Asn == 'I' || r[2]->Prop->Asn == 'G' || !FindAtom(Chain[Cn],i,"CA",&CA1) || !FindAtom(Chain[Cn],i+3,"CA",&CA4) || Dist(r[0]->Coord[CA1],r[3]->Coord[CA4]) > 7.0 ) continue; Phi2 = r[1]->Prop->Phi; Psi2 = r[1]->Prop->Psi; Phi3 = r[2]->Prop->Phi; Psi3 = r[2]->Prop->Psi; if( TurnCondition(Phi2,-60.0,Psi2,-30,Phi3,-90.0,Psi3,0,Range1,Range2) ) TurnType = '1'; else if( TurnCondition(Phi2,60.0,Psi2,30,Phi3,90.0,Psi3,0,Range1,Range2) ) TurnType = '2'; else if( TurnCondition(Phi2,-60.0,Psi2,120,Phi3,80.0,Psi3,0,Range1,Range2) ) TurnType = '3'; else if( TurnCondition(Phi2,60.0,Psi2,-120,Phi3,-80.0,Psi3,0,Range1,Range2) ) TurnType = '4'; else if( TurnCondition(Phi2,-60.0,Psi2,120,Phi3,-90.0,Psi3,0,Range1,Range2) ) TurnType = '5'; else if( TurnCondition(Phi2,-120.0,Psi2,120,Phi3,-60.0,Psi3,0,Range1,Range2) ) TurnType = '6'; else if( TurnCondition(Phi2,-60.0,Psi2,-30,Phi3,-120.0,Psi3,120,Range1,Range2) ) TurnType = '7'; else TurnType = '8'; if( r[0]->Prop->Asn == 'C' ) r[0]->Prop->Asn = 'T'; if( r[1]->Prop->Asn == 'C' ) r[1]->Prop->Asn = 'T'; if( r[2]->Prop->Asn == 'C' ) r[2]->Prop->Asn = 'T'; if( r[3]->Prop->Asn == 'C' ) r[3]->Prop->Asn = 'T'; Tn = Chain[Cn]->NAssignedTurn; Chain[Cn]->AssignedTurn[Tn] = (TURN *)ckalloc(sizeof(TURN)); t = Chain[Cn]->AssignedTurn[Tn]; strcpy(t->Res1,r[0]->ResType); strcpy(t->Res2,r[3]->ResType); strcpy(t->PDB_ResNumb1,r[0]->PDB_ResNumb); strcpy(t->PDB_ResNumb2,r[3]->PDB_ResNumb); t->TurnType = TurnType; Chain[Cn]->NAssignedTurn++; } }
DWORD main( int argc, char *argv[], char *envp[] ) { ATOM Atom1, Atom2, Atom3; BOOL Atom1Found, Atom2Found, Atom3Found; DWORD Atom1Length, Atom2Length, Atom3Length; TCHAR NameBuffer[ 128 ]; printf( "TATOM: Entering Test Program\n" ); Atom1 = AddAtom( TEXT("Atom1") ); Atom2 = AddAtom( TEXT("#4095") ); Atom3 = AddAtom( (LPTSTR)0x1234 ); printf( "AddAtom( ""Atom1"" ) == %X\n", Atom1 ); printf( "AddAtom( ""#4095"" ) == %X\n", Atom2 ); printf( "AddAtom( 0x1234 ) == %X\n", Atom3 ); Atom1 = AddAtom( TEXT("Atom1") ); Atom2 = AddAtom( TEXT("#4095") ); Atom3 = AddAtom( (LPTSTR)0x1234 ); printf( "AddAtom( ""Atom1"" ) == %X\n", Atom1 ); printf( "AddAtom( ""#4095"" ) == %X\n", Atom2 ); printf( "AddAtom( 0x1234 ) == %X\n", Atom3 ); assert( Atom1Found = (Atom1 == FindAtom( TEXT("Atom1") )) ); assert( Atom2Found = (Atom2 == FindAtom( TEXT("#4095") )) ); assert( Atom3Found = (Atom3 == FindAtom( (LPTSTR)0x1234 )) ); printf( "FindAtom( ""Atom1"" ) == %X\n", Atom1 ); printf( "FindAtom( ""#4095"" ) == %X\n", Atom2 ); printf( "FindAtom( 0x1234 ) == %X\n", Atom3 ); Atom1Length = GetAtomName( Atom1, NameBuffer, sizeof( NameBuffer )); #ifdef UNICODE printf( "GetAtomName( %X ) == %ws\n", Atom1, NameBuffer ); #else printf( "GetAtomName( %X ) == %s\n", Atom1, NameBuffer ); #endif Atom2Length = GetAtomName( Atom2, NameBuffer, sizeof( NameBuffer )); #ifdef UNICODE printf( "GetAtomName( %X ) == %ws\n", Atom2, NameBuffer ); #else printf( "GetAtomName( %X ) == %s\n", Atom2, NameBuffer ); #endif Atom3Length = GetAtomName( Atom3, NameBuffer, sizeof( NameBuffer )); #ifdef UNICODE printf( "GetAtomName( %X ) == %ws\n", Atom3, NameBuffer ); #else printf( "GetAtomName( %X ) == %s\n", Atom3, NameBuffer ); #endif printf( "DeleteAtom( %X ) == %X\n", Atom1, DeleteAtom( Atom1 ) ); printf( "DeleteAtom( %X ) == %X\n", Atom1, DeleteAtom( Atom1 ) ); printf( "DeleteAtom( %X ) == %X\n", Atom1, DeleteAtom( Atom1 ) ); printf( "DeleteAtom( %X ) == %X\n", Atom1, DeleteAtom( Atom1 ) ); printf( "DeleteAtom( %X ) == %X\n", Atom2, DeleteAtom( Atom2 ) ); printf( "DeleteAtom( %X ) == %X\n", Atom3, DeleteAtom( Atom3 ) ); Atom1 = GlobalAddAtom( TEXT("Atom1") ); Atom2 = GlobalAddAtom( TEXT("#4095") ); Atom3 = GlobalAddAtom( (LPTSTR)0x1234 ); printf( "GlobalAddAtom( ""Atom1"" ) == %X\n", Atom1 ); printf( "GlobalAddAtom( ""#4095"" ) == %X\n", Atom2 ); printf( "GlobalAddAtom( 0x1234 ) == %X\n", Atom3 ); Atom1 = GlobalAddAtom( TEXT("Atom1") ); Atom2 = GlobalAddAtom( TEXT("#4095") ); Atom3 = GlobalAddAtom( (LPTSTR)0x1234 ); printf( "GlobalAddAtom( ""Atom1"" ) == %X\n", Atom1 ); printf( "GlobalAddAtom( ""#4095"" ) == %X\n", Atom2 ); printf( "GlobalAddAtom( 0x1234 ) == %X\n", Atom3 ); assert( Atom1Found = (Atom1 == GlobalFindAtom( TEXT("Atom1") )) ); assert( Atom2Found = (Atom2 == GlobalFindAtom( TEXT("#4095") )) ); assert( Atom3Found = (Atom3 == GlobalFindAtom( (LPTSTR)0x1234 )) ); printf( "GlobalFindAtom( ""Atom1"" ) == %X\n", Atom1 ); printf( "GlobalFindAtom( ""#4095"" ) == %X\n", Atom2 ); printf( "GlobalFindAtom( 0x1234 ) == %X\n", Atom3 ); Atom1Length = GlobalGetAtomName( Atom1, NameBuffer, sizeof( NameBuffer )); #ifdef UNICODE printf( "GlobalGetAtomName( %X ) == %ws\n", Atom1, NameBuffer ); #else printf( "GlobalGetAtomName( %X ) == %s\n", Atom1, NameBuffer ); #endif Atom2Length = GlobalGetAtomName( Atom2, NameBuffer, sizeof( NameBuffer )); #ifdef UNICODE printf( "GlobalGetAtomName( %X ) == %ws\n", Atom2, NameBuffer ); #else printf( "GlobalGetAtomName( %X ) == %s\n", Atom2, NameBuffer ); #endif Atom3Length = GlobalGetAtomName( Atom3, NameBuffer, sizeof( NameBuffer )); #ifdef UNICODE printf( "GlobalGetAtomName( %X ) == %ws\n", Atom3, NameBuffer ); #else printf( "GlobalGetAtomName( %X ) == %s\n", Atom3, NameBuffer ); #endif printf( "GlobalDeleteAtom( %X ) == %X\n", Atom1, GlobalDeleteAtom( Atom1 ) ); printf( "GlobalDeleteAtom( %X ) == %X\n", Atom1, GlobalDeleteAtom( Atom1 ) ); printf( "GlobalDeleteAtom( %X ) == %X\n", Atom1, GlobalDeleteAtom( Atom1 ) ); printf( "GlobalDeleteAtom( %X ) == %X\n", Atom1, GlobalDeleteAtom( Atom1 ) ); printf( "GlobalDeleteAtom( %X ) == %X\n", Atom2, GlobalDeleteAtom( Atom2 ) ); printf( "GlobalDeleteAtom( %X ) == %X\n", Atom3, GlobalDeleteAtom( Atom3 ) ); printf( "TATOM: Exiting Test Program\n" ); return 0; }
int ReadPDBFile(FILE * pdb, CHAIN **Chain, int *Cn, StrideCmd *Cmd) { int ChainCnt, InfoCnt, i; enum METHOD Method = XRay; BOOLEAN First_ATOM, Published=YES, DsspAssigned=NO; float Resolution = 0.0; /*FILE *pdb;*/ BUFFER Buffer; char *Info[MAX_INFO], PdbIdent[5]; RESIDUE *r; CHAIN *c; *Cn= 0; InfoCnt = 0; strcpy(PdbIdent,"~~~~"); /* if( !(pdb = fopen(Cmd->InputFile,"r")) ) return(FAILURE); */ First_ATOM = YES; while( fgets(Buffer,BUFSZ,pdb) ) { if(!strncmp(Buffer,"HEADER",6)) { Info[InfoCnt] = (char *)ckalloc(BUFSZ*sizeof(char)); strcpy(Info[InfoCnt],"HDR "); strcat(Info[InfoCnt++],Buffer+10); strncpy(PdbIdent,Buffer+62,4); PdbIdent[4] = '\0'; } /* else if(!strncmp(Buffer,"AUTHOR",6)) { Info[InfoCnt] = (char *)ckalloc(BUFSZ*sizeof(char)); strcpy(Info[InfoCnt],"AUT "); strcat(Info[InfoCnt++],Buffer+10); } else if(!strncmp(Buffer,"SOURCE",6)) { Info[InfoCnt] = (char *)ckalloc(BUFSZ*sizeof(char)); strcpy(Info[InfoCnt],"SRC "); strcat(Info[InfoCnt++],Buffer+10); } else if(!strncmp(Buffer,"COMPND",6)) { if( !Process_COMPND(Buffer,&Method) ) return(FAILURE); else { Info[InfoCnt] = (char *)ckalloc(BUFSZ*sizeof(char)); strcpy(Info[InfoCnt],"CMP "); strcat(Info[InfoCnt++],Buffer+10); } } else if(!strncmp(Buffer,"JRNL",4) && !Process_JRNL(Buffer,&Published)) return(FAILURE); else if(!strncmp(Buffer,"REMARK",6) && !Process_REMARK(Buffer,&Method,&Resolution, &DsspAssigned)) return(FAILURE); else if(!strncmp(Buffer,"EXPDTA",6) && !Process_EXPDTA(Buffer,&Method)) return(FAILURE); */ else if(!strncmp(Buffer,"MODEL",5) && !Process_MODEL(&Method)) return(FAILURE); else if(!strncmp(Buffer,"ENDMDL",6)) { Process_ENDMDL(Buffer,Chain,Cn); break; } /* else if(!strncmp(Buffer,"HELIX",5) && !Process_HELIX(Buffer,Chain,Cn,Cmd)) return(FAILURE); else if(!strncmp(Buffer,"SHEET",5) && !Process_SHEET(Buffer,Chain,Cn,Cmd)) return(FAILURE); else if(!strncmp(Buffer,"TURN",4) && !Process_TURN(Buffer,Chain,Cn,Cmd)) return(FAILURE); else if(!strncmp(Buffer,"SSBOND",6) && !Process_SSBOND(Buffer,Chain,Cn,Cmd)) return(FAILURE); */ else if(!strncmp(Buffer,"ATOM",4) && !Process_ATOM(Buffer,Chain,Cn,&First_ATOM,Cmd)) return(FAILURE); } /* fclose(pdb); */ for( ChainCnt=0; ChainCnt< *Cn; ChainCnt++ ) { c = Chain[ChainCnt]; if( c->NRes != 0 && !FindAtom(c,c->NRes,"CA",&i) ) c->NRes--; strcpy(c->File,Cmd->InputFile); strcpy(c->PdbIdent,PdbIdent); if( c->NRes != 0 ) c->NRes++; if( c->NSheet != -1 ) c->NSheet++; c->Resolution = Resolution; c->Method = Method; c->Published = Published; c->DsspAssigned = DsspAssigned; c->NInfo = InfoCnt; for(i=0; i<InfoCnt; i++) { c->Info[i] = (char *)ckalloc(BUFSZ*sizeof(char)); strcpy(c->Info[i],Info[i]); c->Info[i][71] = '\0'; } for( i=0; i<c->NRes; i++ ) { r = c->Rsd[i]; r->Inv = (INVOLVED *)ckalloc(sizeof(INVOLVED)); r->Prop = (PROPERTY *)ckalloc(sizeof(PROPERTY)); r->Inv->NBondDnr = 0; r->Inv->NBondAcc = 0; r->Inv->InterchainHBonds = NO; r->Prop->Asn = 'C'; /* r->Prop->PdbAsn = 'C'; r->Prop->DsspAsn = 'C'; r->Prop->Solv = 0.0; */ r->Prop->Phi = 360.0; r->Prop->Psi = 360.0; } } for(i=0; i<InfoCnt; i++) free(Info[i]); return(SUCCESS); }
void MP4File::CreateIsmaIodFromFile( MP4TrackId odTrackId, MP4TrackId sceneTrackId, MP4TrackId audioTrackId, MP4TrackId videoTrackId, u_int8_t** ppBytes, u_int64_t* pNumBytes) { MP4Descriptor* pIod = new MP4IODescriptor(); pIod->SetTag(MP4IODescrTag); pIod->Generate(); MP4Atom* pIodsAtom = FindAtom("moov.iods"); ASSERT(pIodsAtom); MP4DescriptorProperty* pSrcIod = (MP4DescriptorProperty*)pIodsAtom->GetProperty(2); CloneIntegerProperty(pIod, pSrcIod, "objectDescriptorId"); CloneIntegerProperty(pIod, pSrcIod, "ODProfileLevelId"); CloneIntegerProperty(pIod, pSrcIod, "sceneProfileLevelId"); CloneIntegerProperty(pIod, pSrcIod, "audioProfileLevelId"); CloneIntegerProperty(pIod, pSrcIod, "visualProfileLevelId"); CloneIntegerProperty(pIod, pSrcIod, "graphicsProfileLevelId"); // mutate esIds from MP4ESIDIncDescrTag to MP4ESDescrTag MP4DescriptorProperty* pEsProperty; pIod->FindProperty("esIds", (MP4Property**)&pEsProperty); pEsProperty->SetTags(MP4ESDescrTag); MP4IntegerProperty* pSetProperty; MP4IntegerProperty* pSceneESID; MP4IntegerProperty* pOdESID; // OD MP4Descriptor* pOdEsd = pEsProperty->AddDescriptor(MP4ESDescrTag); pOdEsd->Generate(); pOdEsd->FindProperty("ESID", (MP4Property**)&pOdESID); // we set the OD ESID to a non-zero unique value pOdESID->SetValue(m_odTrackId); pOdEsd->FindProperty("URLFlag", (MP4Property**)&pSetProperty); pSetProperty->SetValue(1); u_int8_t* pBytes; u_int64_t numBytes; CreateIsmaODUpdateCommandFromFileForStream( audioTrackId, videoTrackId, &pBytes, &numBytes); VERBOSE_ISMA(GetVerbosity(), printf("OD data =\n"); MP4HexDump(pBytes, numBytes)); char* odCmdBase64 = MP4ToBase64(pBytes, numBytes); char* urlBuf = (char*)MP4Malloc(strlen(odCmdBase64) + 64); sprintf(urlBuf, "data:application/mpeg4-od-au;base64,%s", odCmdBase64); MP4StringProperty* pUrlProperty; pOdEsd->FindProperty("URL", (MP4Property**)&pUrlProperty); pUrlProperty->SetValue(urlBuf); VERBOSE_ISMA(GetVerbosity(), printf("OD data URL = \042%s\042\n", urlBuf)); MP4Free(odCmdBase64); odCmdBase64 = NULL; MP4Free(pBytes); pBytes = NULL; MP4Free(urlBuf); urlBuf = NULL; MP4DescriptorProperty* pSrcDcd = NULL; // HACK temporarily point to scene decoder config FindProperty(MakeTrackName(odTrackId, "mdia.minf.stbl.stsd.mp4s.esds.decConfigDescr"), (MP4Property**)&pSrcDcd); ASSERT(pSrcDcd); MP4Property* pOrgOdEsdProperty = pOdEsd->GetProperty(8); pOdEsd->SetProperty(8, pSrcDcd); // bufferSizeDB needs to be set appropriately MP4BitfieldProperty* pBufferSizeProperty = NULL; pOdEsd->FindProperty("decConfigDescr.bufferSizeDB", (MP4Property**)&pBufferSizeProperty); ASSERT(pBufferSizeProperty); pBufferSizeProperty->SetValue(numBytes); // SL config needs to change from 2 (file) to 1 (null) pOdEsd->FindProperty("slConfigDescr.predefined", (MP4Property**)&pSetProperty); pSetProperty->SetValue(1); // Scene MP4Descriptor* pSceneEsd = pEsProperty->AddDescriptor(MP4ESDescrTag); pSceneEsd->Generate(); pSceneEsd->FindProperty("ESID", (MP4Property**)&pSceneESID); // we set the Scene ESID to a non-zero unique value pSceneESID->SetValue(sceneTrackId); pSceneEsd->FindProperty("URLFlag", (MP4Property**)&pSetProperty); pSetProperty->SetValue(1); CreateIsmaSceneCommand( MP4_IS_VALID_TRACK_ID(audioTrackId), MP4_IS_VALID_TRACK_ID(videoTrackId), &pBytes, &numBytes); VERBOSE_ISMA(GetVerbosity(), printf("Scene data =\n"); MP4HexDump(pBytes, numBytes)); char *sceneCmdBase64 = MP4ToBase64(pBytes, numBytes); urlBuf = (char*)MP4Malloc(strlen(sceneCmdBase64) + 64); sprintf(urlBuf, "data:application/mpeg4-bifs-au;base64,%s", sceneCmdBase64); pSceneEsd->FindProperty("URL", (MP4Property**)&pUrlProperty); pUrlProperty->SetValue(urlBuf); VERBOSE_ISMA(GetVerbosity(), printf("Scene data URL = \042%s\042\n", urlBuf)); MP4Free(sceneCmdBase64); sceneCmdBase64 = NULL; MP4Free(urlBuf); urlBuf = NULL; MP4Free(pBytes); pBytes = NULL; // HACK temporarily point to scene decoder config FindProperty(MakeTrackName(sceneTrackId, "mdia.minf.stbl.stsd.mp4s.esds.decConfigDescr"), (MP4Property**)&pSrcDcd); ASSERT(pSrcDcd); MP4Property* pOrgSceneEsdProperty = pSceneEsd->GetProperty(8); pSceneEsd->SetProperty(8, pSrcDcd); // bufferSizeDB needs to be set pBufferSizeProperty = NULL; pSceneEsd->FindProperty("decConfigDescr.bufferSizeDB", (MP4Property**)&pBufferSizeProperty); ASSERT(pBufferSizeProperty); pBufferSizeProperty->SetValue(numBytes); // SL config needs to change from 2 (file) to 1 (null) pSceneEsd->FindProperty("slConfigDescr.predefined", (MP4Property**)&pSetProperty); pSetProperty->SetValue(1); // finally get the whole thing written to a memory pIod->WriteToMemory(this, ppBytes, pNumBytes); // now carefully replace esd properties before destroying pOdEsd->SetProperty(8, pOrgOdEsdProperty); pSceneEsd->SetProperty(8, pOrgSceneEsdProperty); pSceneESID->SetValue(0); // restore 0 value pOdESID->SetValue(0); delete pIod; VERBOSE_ISMA(GetVerbosity(), printf("IOD data =\n"); MP4HexDump(*ppBytes, *pNumBytes)); }