public void startTranscode() { try { transcode(); } catch (Exception e) { buttonStart.setEnabled(false); String message = (e.getMessage() != null) ? e.getMessage() : e.toString(); showMessageBox( message, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) {} }); } }
protected void getFileInfo() { try { mediaFileInfo = new MediaFileInfo(new AndroidMediaObjectFactory(getApplicationContext())); mediaFileInfo.setUri(mediaUri1); duration = mediaFileInfo.getDurationInMicroSec(); audioFormat = (AudioFormat) mediaFileInfo.getAudioFormat(); if (audioFormat == null) { showMessageBox( "Audio format info unavailable", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) {} }); } videoFormat = (VideoFormat) mediaFileInfo.getVideoFormat(); if (videoFormat == null) { showMessageBox( "Video format info unavailable", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) {} }); } else { videoWidthIn = videoFormat.getVideoFrameSize().width(); videoHeightIn = videoFormat.getVideoFrameSize().height(); } } catch (Exception e) { String message = (e.getMessage() != null) ? e.getMessage() : e.toString(); showMessageBox( message, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) {} }); } }
protected void displayVideoFrame(SurfaceHolder holder) { if (videoFormat != null) { try { ISurfaceWrapper surface = AndroidMediaObjectFactory.Converter.convert(holder.getSurface()); mediaFileInfo.setOutputSurface(surface); ByteBuffer buffer = ByteBuffer.allocate(1); mediaFileInfo.getFrameAtPosition(100, buffer); } catch (Exception e) { String message = (e.getMessage() != null) ? e.getMessage() : e.toString(); showMessageBox( message, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) {} }); } } }