code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
private void applyFontToToolbar(final Toolbar view) {
final CharSequence previousTitle = view.getTitle();
final CharSequence previousSubtitle = view.getSubtitle();
// The toolbar inflates both the title and the subtitle views lazily but luckily they do it
// synchronously when you set a ... | java |
public static Typeface load(final AssetManager assetManager, final String filePath) {
synchronized (sCachedFonts) {
try {
if (!sCachedFonts.containsKey(filePath)) {
final Typeface typeface = Typeface.createFromAsset(assetManager, filePath);
sCa... | java |
public static CalligraphyTypefaceSpan getSpan(final Typeface typeface) {
if (typeface == null) return null;
synchronized (sCachedSpans) {
if (!sCachedSpans.containsKey(typeface)) {
final CalligraphyTypefaceSpan span = new CalligraphyTypefaceSpan(typeface);
sCa... | java |
public static String getScript(String path) {
StringBuilder sb = new StringBuilder();
InputStream stream = ScriptUtil.class.getClassLoader().getResourceAsStream(path);
try (BufferedReader br = new BufferedReader(new InputStreamReader(stream))){
String str;
while ((str =... | java |
private Object getConnection() {
Object connection ;
if (type == RedisToolsConstant.SINGLE){
RedisConnection redisConnection = jedisConnectionFactory.getConnection();
connection = redisConnection.getNativeConnection();
}else {
RedisClusterConnection clusterCon... | java |
public boolean tryLock(String key, String request) {
//get connection
Object connection = getConnection();
String result ;
if (connection instanceof Jedis){
result = ((Jedis) connection).set(lockPrefix + key, request, SET_IF_NOT_EXIST, SET_WITH_EXPIRE_TIME, 10 * TIME);
... | java |
public void error(final String msg)
{
errors++;
if (!suppressOutput)
{
out.println("ERROR: " + msg);
}
if (stopOnError)
{
throw new IllegalArgumentException(msg);
}
} | java |
public void warning(final String msg)
{
warnings++;
if (!suppressOutput)
{
out.println("WARNING: " + msg);
}
if (warningsFatal && stopOnError)
{
throw new IllegalArgumentException(msg);
}
} | java |
public static String formatByteOrderEncoding(final ByteOrder byteOrder, final PrimitiveType primitiveType)
{
switch (primitiveType.size())
{
case 2:
return "SBE_" + byteOrder + "_ENCODE_16";
case 4:
return "SBE_" + byteOrder + "_ENCODE_32";
... | java |
public static String formatPropertyName(final String value)
{
String formattedValue = toUpperFirstChar(value);
if (ValidationUtil.isGolangKeyword(formattedValue))
{
final String keywordAppendToken = System.getProperty(SbeTool.KEYWORD_APPEND_TOKEN);
if (null == keywor... | java |
public static PrimitiveValue parse(
final String value, final int length, final String characterEncoding)
{
if (value.length() > length)
{
throw new IllegalStateException("value.length=" + value.length() + " greater than length=" + length);
}
byte[] bytes = value... | java |
public byte[] byteArrayValue(final PrimitiveType type)
{
if (representation == Representation.BYTE_ARRAY)
{
return byteArrayValue;
}
else if (representation == Representation.LONG && size == 1 && type == PrimitiveType.CHAR)
{
byteArrayValueForLong[0] =... | java |
public static void append(final StringBuilder builder, final String indent, final String line)
{
builder.append(indent).append(line).append('\n');
} | java |
public static String generateTypeJavadoc(final String indent, final Token typeToken)
{
final String description = typeToken.description();
if (null == description || description.isEmpty())
{
return "";
}
return
indent + "/**\n" +
indent + ... | java |
public static String generateOptionEncodeJavadoc(final String indent, final Token optionToken)
{
final String description = optionToken.description();
if (null == description || description.isEmpty())
{
return "";
}
return
indent + "/**\n" +
... | java |
public static String generateFlyweightPropertyJavadoc(
final String indent, final Token propertyToken, final String typeName)
{
final String description = propertyToken.description();
if (null == description || description.isEmpty())
{
return "";
}
return... | java |
public static Map<Long, Message> findMessages(
final Document document, final XPath xPath, final Map<String, Type> typeByNameMap) throws Exception
{
final Map<Long, Message> messageByIdMap = new HashMap<>();
final ObjectHashSet<String> distinctNames = new ObjectHashSet<>();
forEach(... | java |
public static void handleError(final Node node, final String msg)
{
final ErrorHandler handler = (ErrorHandler)node.getOwnerDocument().getUserData(ERROR_HANDLER_KEY);
if (handler == null)
{
throw new IllegalStateException("ERROR: " + formatLocationInfo(node) + msg);
}
... | java |
public static void handleWarning(final Node node, final String msg)
{
final ErrorHandler handler = (ErrorHandler)node.getOwnerDocument().getUserData(ERROR_HANDLER_KEY);
if (handler == null)
{
throw new IllegalStateException("WARNING: " + formatLocationInfo(node) + msg);
... | java |
public static String getAttributeValue(final Node elementNode, final String attrName)
{
final Node attrNode = elementNode.getAttributes().getNamedItemNS(null, attrName);
if (attrNode == null || "".equals(attrNode.getNodeValue()))
{
throw new IllegalStateException(
... | java |
public static String getAttributeValue(final Node elementNode, final String attrName, final String defValue)
{
final Node attrNode = elementNode.getAttributes().getNamedItemNS(null, attrName);
if (attrNode == null)
{
return defValue;
}
return attrNode.getNodeVal... | java |
public static void checkForValidName(final Node node, final String name)
{
if (!ValidationUtil.isSbeCppName(name))
{
handleWarning(node, "name is not valid for C++: " + name);
}
if (!ValidationUtil.isSbeJavaName(name))
{
handleWarning(node, "name is n... | java |
private int generateFieldEncodeDecode(
final List<Token> tokens,
final char varName,
final int currentOffset,
final StringBuilder encode,
final StringBuilder decode,
final StringBuilder rc,
final StringBuilder init)
{
final Token signalToken = tokens.g... | java |
private void generateGroupProperties(
final StringBuilder sb,
final List<Token> tokens,
final String prefix)
{
for (int i = 0, size = tokens.size(); i < size; i++)
{
final Token token = tokens.get(i);
if (token.signal() == Signal.BEGIN_GROUP)
... | java |
private void generateExtensibilityMethods(
final StringBuilder sb,
final String typeName,
final Token token)
{
sb.append(String.format(
"\nfunc (*%1$s) SbeBlockLength() (blockLength uint) {\n" +
"\treturn %2$s\n" +
"}\n" +
"\nfunc (*%1$... | java |
public static String formatScopedName(final CharSequence[] scope, final String value)
{
return String.join("_", scope).toLowerCase() + "_" + formatName(value);
} | java |
public static void main(final String[] args) throws Exception
{
if (args.length == 0)
{
System.err.format("Usage: %s <filenames>...%n", SbeTool.class.getName());
System.exit(-1);
}
for (final String fileName : args)
{
final Ir ir;
... | java |
public static void validateAgainstSchema(final String sbeSchemaFilename, final String xsdFilename)
throws Exception
{
final ParserOptions.Builder optionsBuilder = ParserOptions.builder()
.xsdFilename(System.getProperty(VALIDATION_XSD))
.xIncludeAware(Boolean.parseBoolean(Syst... | java |
public static void generate(final Ir ir, final String outputDirName, final String targetLanguage)
throws Exception
{
final TargetCodeGenerator targetCodeGenerator = TargetCodeGeneratorLoader.get(targetLanguage);
final CodeGenerator codeGenerator = targetCodeGenerator.newInstance(ir, outputDi... | java |
public void makeDataFieldCompositeType()
{
final EncodedDataType edt = (EncodedDataType)containedTypeByNameMap.get("varData");
if (edt != null)
{
edt.variableLength(true);
}
} | java |
public void checkForWellFormedGroupSizeEncoding(final Node node)
{
final EncodedDataType blockLengthType = (EncodedDataType)containedTypeByNameMap.get("blockLength");
final EncodedDataType numInGroupType = (EncodedDataType)containedTypeByNameMap.get("numInGroup");
if (blockLengthType == nul... | java |
public void checkForWellFormedVariableLengthDataEncoding(final Node node)
{
final EncodedDataType lengthType = (EncodedDataType)containedTypeByNameMap.get("length");
if (lengthType == null)
{
XmlSchemaParser.handleError(node, "composite for variable length data encoding must hav... | java |
public void checkForWellFormedMessageHeader(final Node node)
{
final boolean shouldGenerateInterfaces = Boolean.getBoolean(JAVA_GENERATE_INTERFACES);
final EncodedDataType blockLengthType = (EncodedDataType)containedTypeByNameMap.get("blockLength");
final EncodedDataType templateIdType = (E... | java |
public void checkForValidOffsets(final Node node)
{
int offset = 0;
for (final Type edt : containedTypeByNameMap.values())
{
final int offsetAttribute = edt.offsetAttribute();
if (-1 != offsetAttribute)
{
if (offsetAttribute < offset)
... | java |
public static Token findFirst(final String name, final List<Token> tokens, final int index)
{
for (int i = index, size = tokens.size(); i < size; i++)
{
final Token token = tokens.get(i);
if (token.name().equals(name))
{
return token;
}... | java |
public int getTemplateId(final DirectBuffer buffer, final int bufferOffset)
{
return Types.getInt(buffer, bufferOffset + templateIdOffset, templateIdType, templateIdByteOrder);
} | java |
public int getSchemaId(final DirectBuffer buffer, final int bufferOffset)
{
return Types.getInt(buffer, bufferOffset + schemaIdOffset, schemaIdType, schemaIdByteOrder);
} | java |
public int getSchemaVersion(final DirectBuffer buffer, final int bufferOffset)
{
return Types.getInt(buffer, bufferOffset + schemaVersionOffset, schemaVersionType, schemaVersionByteOrder);
} | java |
public int getBlockLength(final DirectBuffer buffer, final int bufferOffset)
{
return Types.getInt(buffer, bufferOffset + blockLengthOffset, blockLengthType, blockLengthByteOrder);
} | java |
public static void initialize(AlbumConfig albumConfig) {
if (sAlbumConfig == null) sAlbumConfig = albumConfig;
else Log.w("Album", new IllegalStateException("Illegal operation, only allowed to configure once."));
} | java |
public static AlbumConfig getAlbumConfig() {
if (sAlbumConfig == null) {
sAlbumConfig = AlbumConfig.newBuilder(null).build();
}
return sAlbumConfig;
} | java |
public static Camera<ImageCameraWrapper, VideoCameraWrapper> camera(android.support.v4.app.Fragment fragment) {
return new AlbumCamera(fragment.getContext());
} | java |
public static Choice<ImageMultipleWrapper, ImageSingleWrapper> image(android.support.v4.app.Fragment fragment) {
return new ImageChoice(fragment.getContext());
} | java |
public static Choice<VideoMultipleWrapper, VideoSingleWrapper> video(android.support.v4.app.Fragment fragment) {
return new VideoChoice(fragment.getContext());
} | java |
public static Choice<AlbumMultipleWrapper, AlbumSingleWrapper> album(android.support.v4.app.Fragment fragment) {
return new AlbumChoice(fragment.getContext());
} | java |
@WorkerThread
public ArrayList<AlbumFolder> getAllVideo() {
Map<String, AlbumFolder> albumFolderMap = new HashMap<>();
AlbumFolder allFileFolder = new AlbumFolder();
allFileFolder.setChecked(true);
allFileFolder.setName(mContext.getString(R.string.album_all_videos));
scanVid... | java |
public void setupViews(Widget widget) {
if (widget.getUiStyle() == Widget.STYLE_LIGHT) {
int color = ContextCompat.getColor(getContext(), R.color.albumLoadingDark);
mProgressBar.setColorFilter(color);
} else {
mProgressBar.setColorFilter(widget.getToolBarColor());
... | java |
public Returner currentPosition(@IntRange(from = 0, to = Integer.MAX_VALUE) int currentPosition) {
this.mCurrentPosition = currentPosition;
return (Returner) this;
} | java |
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public static void invasionStatusBar(Window window) {
View decorView = window.getDecorView();
decorView.setSystemUiVisibility(decorView.getSystemUiVisibility()
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FL... | java |
public static boolean setStatusBarDarkFont(Window window, boolean darkFont) {
if (setMIUIStatusBarFont(window, darkFont)) {
setDefaultStatusBarFont(window, darkFont);
return true;
} else if (setMeizuStatusBarFont(window, darkFont)) {
setDefaultStatusBarFont(window, da... | java |
private static void setImageViewScaleTypeMatrix(ImageView imageView) {
/**
* PhotoView sets its own ScaleType to Matrix, then diverts all calls
* setScaleType to this.setScaleType automatically.
*/
if (null != imageView && !(imageView instanceof IPhotoView)) {
if (... | java |
private void updateBaseMatrix(Drawable d) {
ImageView imageView = getImageView();
if (null == imageView || null == d) {
return;
}
final float viewWidth = getImageViewWidth(imageView);
final float viewHeight = getImageViewHeight(imageView);
final int drawableW... | java |
public static Widget getDefaultWidget(Context context) {
return Widget.newDarkBuilder(context)
.statusBarColor(ContextCompat.getColor(context, R.color.albumColorPrimaryDark))
.toolBarColor(ContextCompat.getColor(context, R.color.albumColorPrimary))
.navigationBarC... | java |
private int createView() {
switch (mWidget.getUiStyle()) {
case Widget.STYLE_DARK: {
return R.layout.album_activity_album_dark;
}
case Widget.STYLE_LIGHT: {
return R.layout.album_activity_album_light;
}
default: {
... | java |
private void showFolderAlbumFiles(int position) {
this.mCurrentFolder = position;
AlbumFolder albumFolder = mAlbumFolders.get(position);
mView.bindAlbumFolder(albumFolder);
} | java |
private void showLoadingDialog() {
if (mLoadingDialog == null) {
mLoadingDialog = new LoadingDialog(this);
mLoadingDialog.setupViews(mWidget);
}
if (!mLoadingDialog.isShowing()) {
mLoadingDialog.show();
}
} | java |
public VideoMultipleWrapper selectCount(@IntRange(from = 1, to = Integer.MAX_VALUE) int count) {
this.mLimitCount = count;
return this;
} | java |
protected void requestPermission(String[] permissions, int code) {
if (Build.VERSION.SDK_INT >= 23) {
List<String> deniedPermissions = getDeniedPermissions(this, permissions);
if (deniedPermissions.isEmpty()) {
onPermissionGranted(code);
} else {
... | java |
@WorkerThread
@Nullable
public String createThumbnailForImage(String imagePath) {
if (TextUtils.isEmpty(imagePath)) return null;
File inFile = new File(imagePath);
if (!inFile.exists()) return null;
File thumbnailFile = randomPath(imagePath);
if (thumbnailFile.exists())... | java |
@WorkerThread
@Nullable
public String createThumbnailForVideo(String videoPath) {
if (TextUtils.isEmpty(videoPath)) return null;
File thumbnailFile = randomPath(videoPath);
if (thumbnailFile.exists()) return thumbnailFile.getAbsolutePath();
try {
MediaMetadataRetrie... | java |
@Nullable
public static Bitmap readImageFromPath(String imagePath, int width, int height) {
File imageFile = new File(imagePath);
if (imageFile.exists()) {
try {
BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(imageFile));
Bit... | java |
@NonNull
public static File getAlbumRootPath(Context context) {
if (sdCardIsAvailable()) {
return new File(Environment.getExternalStorageDirectory(), CACHE_DIRECTORY);
} else {
return new File(context.getFilesDir(), CACHE_DIRECTORY);
}
} | java |
public static boolean sdCardIsAvailable() {
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
return Environment.getExternalStorageDirectory().canWrite();
} else
return false;
} | java |
@NonNull
private static String randomMediaPath(File bucket, String extension) {
if (bucket.exists() && bucket.isFile()) bucket.delete();
if (!bucket.exists()) bucket.mkdirs();
String outFilePath = AlbumUtils.getNowDateTime("yyyyMMdd_HHmmssSSS") + "_" + getMD5ForString(UUID.randomUUID().toStr... | java |
public static String getMimeType(String url) {
String extension = getExtension(url);
if (!MimeTypeMap.getSingleton().hasExtension(extension)) return "";
String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
return TextUtils.isEmpty(mimeType) ? "" : mimeType;
... | java |
public static String getExtension(String url) {
url = TextUtils.isEmpty(url) ? "" : url.toLowerCase();
String extension = MimeTypeMap.getFileExtensionFromUrl(url);
return TextUtils.isEmpty(extension) ? "" : extension;
} | java |
@NonNull
public static String convertDuration(@IntRange(from = 1) long duration) {
duration /= 1000;
int hour = (int) (duration / 3600);
int minute = (int) ((duration - hour * 3600) / 60);
int second = (int) (duration - hour * 3600 - minute * 60);
String hourValue = "";
... | java |
public static String getMD5ForString(String content) {
StringBuilder md5Buffer = new StringBuilder();
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
byte[] tempBytes = digest.digest(content.getBytes());
int digital;
for (int i = 0; i < temp... | java |
@Override
public void stopRecording() {
super.stopRecording();
mSentBroadcastLiveEvent = false;
if (mStream != null) {
if (VERBOSE) Log.i(TAG, "Stopping Stream");
mKickflip.stopStream(mStream, new KickflipCallback() {
@Override
public v... | java |
private void queueOrSubmitUpload(String key, File file) {
if (mReadyToBroadcast) {
submitUpload(key, file);
} else {
if (VERBOSE) Log.i(TAG, "queueing " + key + " until S3 Credentials available");
queueUpload(key, file);
}
} | java |
private void queueUpload(String key, File file) {
if (mUploadQueue == null)
mUploadQueue = new ArrayDeque<>();
mUploadQueue.add(new Pair<>(key, file));
} | java |
private void submitQueuedUploadsToS3() {
if (mUploadQueue == null) return;
for (Pair<String, File> pair : mUploadQueue) {
submitUpload(pair.first, pair.second);
}
} | java |
public void applyFilter(int filter) {
Filters.checkFilterArgument(filter);
mDisplayRenderer.changeFilterMode(filter);
synchronized (mReadyForFrameFence) {
mNewFilter = filter;
}
} | java |
public void handleCameraPreviewTouchEvent(MotionEvent ev) {
if (mFullScreen != null) mFullScreen.handleTouchEvent(ev);
if (mDisplayRenderer != null) mDisplayRenderer.handleTouchEvent(ev);
} | java |
public void startRecording() {
if (mState != STATE.INITIALIZED) {
Log.e(TAG, "startRecording called in invalid state. Ignoring");
return;
}
synchronized (mReadyForFrameFence) {
mFrameNum = 0;
mRecording = true;
mState = STATE.RECORDING;... | java |
@Override
public void onFrameAvailable(SurfaceTexture surfaceTexture) {
// Pass SurfaceTexture to Encoding thread via Handler
// Then Encode and display frame
mHandler.sendMessage(mHandler.obtainMessage(MSG_FRAME_AVAILABLE, surfaceTexture));
} | java |
private void prepareEncoder(EGLContext sharedContext, int width, int height, int bitRate,
Muxer muxer) throws IOException {
mVideoEncoder = new VideoEncoderCore(width, height, bitRate, muxer);
if (mEglCore == null) {
// This is the first prepare called for thi... | java |
private void releaseEglResources() {
mReadyForFrames = false;
if (mInputWindowSurface != null) {
mInputWindowSurface.release();
mInputWindowSurface = null;
}
if (mFullScreen != null) {
mFullScreen.release();
mFullScreen = null;
}
... | java |
private void releaseCamera() {
if (mDisplayView != null)
releaseDisplayView();
if (mCamera != null) {
if (VERBOSE) Log.d(TAG, "releasing camera");
mCamera.stopPreview();
mCamera.release();
mCamera = null;
}
} | java |
private void configureDisplayView() {
if (mDisplayView instanceof GLCameraEncoderView)
((GLCameraEncoderView) mDisplayView).setCameraEncoder(this);
else if (mDisplayView instanceof GLCameraView)
((GLCameraView) mDisplayView).setCamera(mCamera);
} | java |
private void releaseDisplayView() {
if (mDisplayView instanceof GLCameraEncoderView) {
((GLCameraEncoderView) mDisplayView).releaseCamera();
} else if (mDisplayView instanceof GLCameraView)
((GLCameraView) mDisplayView).releaseCamera();
} | java |
public static int createProgram(String vertexSource, String fragmentSource) {
int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource);
if (vertexShader == 0) {
return 0;
}
int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource);
if (pixelS... | java |
public static int loadShader(int shaderType, String source) {
int shader = GLES20.glCreateShader(shaderType);
checkGlError("glCreateShader type=" + shaderType);
GLES20.glShaderSource(shader, source);
GLES20.glCompileShader(shader);
int[] compiled = new int[1];
GLES20.glGe... | java |
public static void checkGlError(String op) {
int error = GLES20.glGetError();
if (error != GLES20.GL_NO_ERROR) {
String msg = op + ": glError 0x" + Integer.toHexString(error);
Log.e(TAG, msg);
throw new RuntimeException(msg);
}
} | java |
public static FloatBuffer createFloatBuffer(float[] coords) {
// Allocate a direct ByteBuffer, using 4 bytes per float, and copy coords into it.
ByteBuffer bb = ByteBuffer.allocateDirect(coords.length * SIZEOF_FLOAT);
bb.order(ByteOrder.nativeOrder());
FloatBuffer fb = bb.asFloatBuffer()... | java |
public static void logVersionInfo() {
Log.i(TAG, "vendor : " + GLES20.glGetString(GLES20.GL_VENDOR));
Log.i(TAG, "renderer: " + GLES20.glGetString(GLES20.GL_RENDERER));
Log.i(TAG, "version : " + GLES20.glGetString(GLES20.GL_VERSION));
if (false) {
int[] values = new int[1];... | java |
private EGLConfig getConfig(int flags, int version) {
int renderableType = EGL14.EGL_OPENGL_ES2_BIT;
if (version >= 3) {
renderableType |= EGLExt.EGL_OPENGL_ES3_BIT_KHR;
}
// The actual surface is generally RGBA or RGBX, so situationally omitting alpha
// doesn't rea... | java |
public void release() {
if (mEGLDisplay != EGL14.EGL_NO_DISPLAY) {
// Android is unusual in that it uses a reference-counted EGLDisplay. So for
// every eglInitialize() we need an eglTerminate().
EGL14.eglMakeCurrent(mEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, E... | java |
public EGLSurface createOffscreenSurface(int width, int height) {
int[] surfaceAttribs = {
EGL14.EGL_WIDTH, width,
EGL14.EGL_HEIGHT, height,
EGL14.EGL_NONE
};
EGLSurface eglSurface = EGL14.eglCreatePbufferSurface(mEGLDisplay, mEGLConfig,
... | java |
public void makeCurrent(EGLSurface eglSurface) {
if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {
// called makeCurrent() before create?
Log.d(TAG, "NOTE: makeCurrent w/o display");
}
if (!EGL14.eglMakeCurrent(mEGLDisplay, eglSurface, eglSurface, mEGLContext)) {
thr... | java |
public void makeCurrent(EGLSurface drawSurface, EGLSurface readSurface) {
if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {
// called makeCurrent() before create?
Log.d(TAG, "NOTE: makeCurrent w/o display");
}
if (!EGL14.eglMakeCurrent(mEGLDisplay, drawSurface, readSurface, mEGL... | java |
public void makeNothingCurrent() {
if (!EGL14.eglMakeCurrent(mEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE,
EGL14.EGL_NO_CONTEXT)) {
throw new RuntimeException("eglMakeCurrent failed");
}
} | java |
public boolean isCurrent(EGLSurface eglSurface) {
return mEGLContext.equals(EGL14.eglGetCurrentContext()) &&
eglSurface.equals(EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW));
} | java |
public int querySurface(EGLSurface eglSurface, int what) {
int[] value = new int[1];
EGL14.eglQuerySurface(mEGLDisplay, eglSurface, what, value, 0);
return value[0];
} | java |
public static void logCurrent(String msg) {
EGLDisplay display;
EGLContext context;
EGLSurface surface;
display = EGL14.eglGetCurrentDisplay();
context = EGL14.eglGetCurrentContext();
surface = EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW);
Log.i(TAG, "Current EGL (... | java |
private void checkEglError(String msg) {
int error;
if ((error = EGL14.eglGetError()) != EGL14.EGL_SUCCESS) {
throw new RuntimeException(msg + ": EGL error: 0x" + Integer.toHexString(error));
}
} | java |
private long getJitterFreePTS(long bufferPts, long bufferSamplesNum) {
long correctedPts = 0;
long bufferDuration = (1000000 * bufferSamplesNum) / (mEncoderCore.mSampleRate);
bufferPts -= bufferDuration; // accounts for the delay of acquiring the audio buffer
if (totalSamplesNum == 0) {
... | java |
public void adjustForVerticalVideo(SCREEN_ROTATION orientation, boolean scaleToFit) {
synchronized (mDrawLock) {
mCorrectVerticalVideo = true;
mScaleToFit = scaleToFit;
requestedOrientation = orientation;
Matrix.setIdentityM(IDENTITY_MATRIX, 0);
switch... | java |
public void drawFrame(int textureId, float[] texMatrix) {
// Use the identity matrix for MVP so our 2x2 FULL_RECTANGLE covers the viewport.
synchronized (mDrawLock) {
if (mCorrectVerticalVideo && !mScaleToFit && (requestedOrientation == SCREEN_ROTATION.VERTICAL || requestedOrientation == SCR... | java |
public void stopBroadcasting() {
if (mBroadcaster.isRecording()) {
mBroadcaster.stopRecording();
mBroadcaster.release();
} else {
Log.e(TAG, "stopBroadcasting called but mBroadcaster not broadcasting");
}
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.