Android-based 3D video sample code

Source: Internet
Author: User

Author: Mark Liu


Download Sample Code

Introduction

Vcppy + ypbfFoaM8L3A + kernel/G1w8rTxrXNvM/xyv2 + kernel + oaM8bGk + kernel + m8/m8/kernel/b7d5NbIvqO/kernel + Kernel signature + signature + y/weight/yo7u1sbe9z/weight + weight/L/weight/rQ/weight/K6zdfdz/weight + weight/J0tTKudPDtKXD/weight + yotD916rGvcPmo6y + 38 zlyKG + development/release + G7sL/release + release/release + 0aHU8cb3uvOjrM + release/release + IDEwIMProaM8L3A + release/ybXju /cgVUkgyc + 1 xNGhz + fingerprint + 0aHP7rLLtaXT0MvEuPbRoc/fingerprint + 6689K7uPbRoc/fingerprint + PGltZyBoc3BhY2U9 "10" src = "http://www.bkjia.com/uploads/allimg/140525/0123434I4-1.jpg" alt = "\">

Random Rotation

This option allows the plane of the rendered video to rotate randomly with the horizontal and vertical axes in a 3D manner. In addition, it can regularly display a red color on the screen.

Touch Rotation

In the touch rotation mode, you can move to the left and right sides to rotate the plane along the left and right sides of the vertical axis. When sliding is faster, the rotation will speed up; when the user stops sliding, the rotation will slow down.

Design

The three main components of this application include: the UI component for interactive application demonstration and the video component for video playback; render the video frame buffer and create the 3D effect OpenGL * plane in special mode.

The video playback component has two threads. The video engine thread uses the MediaCodec class. This class is available in Android JellyBean (API 16. It provides low-level Android media framework APIs, so you can control playback at the frame level. On each video frame, the graphic component can control image data and change the way the image is rendered.

In addition, the playback component can also play the audio engine thread of a video clip audio track. To synchronize the video and audio threads and match the voice of the characters, we implement the AV synchronization algorithm. Video Playback can make the time stamp consistent with the audio time stamp. It can fine-tune the playback speed so that the video frame can be controlled within 30 milliseconds.

You can add a GLSurfaceView to the graphic component to embed a custom rendering class in the class. Rendering class implements the Renderer interface to execute the OpenGL rendering algorithm. This algorithm can implement 3D Rotation on the texture plane and change the pattern to another algorithm based on user input.

In the Renderer, the rotation and coloring of Video Frames are controlled by a simple vertex and pixel shader. The rotation of the video plane is achieved by applying a series of Euclidean rotation. Frame coloring is achieved by linear mixing of the video frame content with a fixed color (red in this case) in the pixel shader.

In addition, the graphic component can be used as a video frame listener of the video engine and can be transferred to the MediaCodec object during implementation so that the rendering function can be called whenever there are available frames. The graphic component provides an option in the UI component so that you can change the playback mode.

The MediaCodec encoding/decoding process is synchronized with the video frame, and the Renderer function in the graphic component is synchronized with the graphic frame. Therefore, when accessing the frame buffer, the functions of the two components must be synchronized.

Related Links and resources:

  • Porting OpenGL * games to Android * Systems Based on Intel's Atom processor
  • Android * MediaPlayer sample code on Intel architecture
  • 3D games on Intel processor graphics cards
  • Intel Android * developer Zone

    To learn more about intel tools provided by Android Developers, visit :.

    Author Profile

    Mark Liu is a software engineer at Intel Ultra-Mobile Group and is responsible for developing a verification framework based on Android devices. He also participated in multiple Android projects of Intel's ultra-portable device division, including smartphones and tablet devices. Most of his work is related to media playback, video conferencing, and software stack performance tuning.

    Joining intel software and equipment division is based on Intel? Lingdong? The processor's device software support team is responsible for a number of different tasks, including Android sample media application development, Windows * 8 media framework system optimization, and documentation for compiling media applications.

    Chris Kirkpatrick is a software engineer at Intel's software and service division. He is responsible for providing intel graphic solution development support for the visual and interactive computing engineering design team. He has a bachelor's degree in computer science from Oregon State University.

    Category:
    • Android *
    • Developers
    • Android *
    Video3d.zip (115.71 KB) Download Now

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.