static __GLinterface *glWinCreateContext(__GLimports *imports, __GLcontextModes *mode, __GLinterface *shareGC) { __GLcontext *result; GLWIN_DEBUG_MSG("glWinCreateContext\n"); result = (__GLcontext *)calloc(1, sizeof(__GLcontext)); if (!result) return NULL; result->interface.imports = *imports; result->interface.exports = glWinExports; if (makeFormat(mode, &result->pfd)) { ErrorF("makeFormat failed\n"); free(result); return NULL; } if (glWinDebugSettings.dumpPFD) pfdOut(&result->pfd); GLWIN_DEBUG_MSG("glWinCreateContext done\n"); return (__GLinterface *)result; }
void DashPlayer::Decoder::configure(const sp<MetaData> &meta) { CHECK(mCodec == NULL); const char *mime; CHECK(meta->findCString(kKeyMIMEType, &mime)); ALOGV("@@@@:: Decoder::configure :: mime is --- %s ---",mime); sp<AMessage> notifyMsg = new AMessage(kWhatCodecNotify, id()); sp<AMessage> format = makeFormat(meta); if (mNativeWindow != NULL) { format->setObject("native-window", mNativeWindow); } // Current video decoders do not return from OMX_FillThisBuffer // quickly, violating the OpenMAX specs, until that is remedied // we need to invest in an extra looper to free the main event // queue. bool isVideo = !strncasecmp(mime, "video/", 6); if(!isVideo) { const char *mime; CHECK(meta->findCString(kKeyMIMEType, &mime)); } ALOGV("@@@@:: DashCodec created "); mCodec = new DashCodec; bool needDedicatedLooper = false; if (isVideo){ needDedicatedLooper = true; if(mCodecLooper == NULL) { ALOGV("@@@@:: Creating Looper for %s",(isVideo?"Video":"Audio")); mCodecLooper = new ALooper; mCodecLooper->setName("DashPlayerDecoder"); mCodecLooper->start(false, false, ANDROID_PRIORITY_AUDIO); } } (needDedicatedLooper ? mCodecLooper : looper())->registerHandler(mCodec); mCodec->setNotificationMessage(notifyMsg); mCodec->initiateSetup(format); }
// ------------------------------------- // Applies the new pattern and returns an error if the pattern // is not correct. void MessageFormat::applyPattern(const UnicodeString& pattern, UParseError& parseError, UErrorCode& ec) { if(U_FAILURE(ec)) { return; } // The pattern is broken up into segments. Each time a subformat // is encountered, 4 segments are recorded. For example, consider // the pattern: // "There {0,choice,0.0#are no files|1.0#is one file|1.0<are {0, number} files} on disk {1}." // The first set of segments is: // segments[0] = "There " // segments[1] = "0" // segments[2] = "choice" // segments[3] = "0.0#are no files|1.0#is one file|1.0<are {0, number} files" // During parsing, the plain text is accumulated into segments[0]. // Segments 1..3 are used to parse each subpattern. Each time a // subpattern is parsed, it creates a format object that is stored // in the subformats array, together with an offset and argument // number. The offset into the plain text stored in // segments[0]. // Quotes in segment 0 are handled normally. They are removed. // Quotes may not occur in segments 1 or 2. // Quotes in segment 3 are parsed and _copied_. This makes // subformat patterns work, e.g., {1,number,'#'.##} passes // the pattern "'#'.##" to DecimalFormat. UnicodeString segments[4]; int32_t part = 0; // segment we are in, 0..3 // Record the highest argument number in the pattern. (In the // subpattern {3,number} the argument number is 3.) int32_t formatNumber = 0; UBool inQuote = FALSE; int32_t braceStack = 0; // Clear error struct parseError.offset = -1; parseError.preContext[0] = parseError.postContext[0] = (UChar)0; int32_t patLen = pattern.length(); int32_t i; for (i=0; i<subformatCount; ++i) { delete subformats[i].format; } subformatCount = 0; argTypeCount = 0; for (i=0; i<patLen; ++i) { UChar ch = pattern[i]; if (part == 0) { // In segment 0, recognize and remove quotes if (ch == SINGLE_QUOTE) { if (i+1 < patLen && pattern[i+1] == SINGLE_QUOTE) { segments[0] += ch; ++i; } else { inQuote = !inQuote; } } else if (ch == LEFT_CURLY_BRACE && !inQuote) { // The only way we get from segment 0 to 1 is via an // unquoted '{'. part = 1; } else { segments[0] += ch; } } else if (inQuote) { // In segments 1..3, recognize quoted matter, and copy it // into the segment, together with the quotes. This takes // care of '' as well. segments[part] += ch; if (ch == SINGLE_QUOTE) { inQuote = FALSE; } } else { // We have an unquoted character in segment 1..3 switch (ch) { case COMMA: // Commas bump us to the next segment, except for segment 3, // which can contain commas. See example above. if (part < 3) part += 1; else segments[3] += ch; break; case LEFT_CURLY_BRACE: // Handle '{' within segment 3. The initial '{' // before segment 1 is handled above. if (part != 3) { ec = U_PATTERN_SYNTAX_ERROR; goto SYNTAX_ERROR; } ++braceStack; segments[part] += ch; break; case RIGHT_CURLY_BRACE: if (braceStack == 0) { makeFormat(formatNumber, segments, parseError,ec); if (U_FAILURE(ec)){ goto SYNTAX_ERROR; } formatNumber++; segments[1].remove(); segments[2].remove(); segments[3].remove(); part = 0; } else { --braceStack; segments[part] += ch; } break; case SINGLE_QUOTE: inQuote = TRUE; // fall through (copy quote chars in segments 1..3) default: segments[part] += ch; break; } } } if (braceStack != 0 || part != 0) { // Unmatched braces in the pattern ec = U_UNMATCHED_BRACES; goto SYNTAX_ERROR; } fPattern = segments[0]; return; SYNTAX_ERROR: syntaxError(pattern, i, parseError); for (i=0; i<subformatCount; ++i) { delete subformats[i].format; } argTypeCount = subformatCount = 0; }