Android mediarecorder framework (2)

Source: Internet
Author: User

Here is a setupvideiencoder. It seems that the video encoding should be set with different parameters based on different encoding types. This method code directly intercepts some code:

Let's take a look at the key sentence. Here we have created omxcodec and assigned the created encoder to mediasource. mediasource here can be seen as an encapsulation of omxcodec, in this way, the preparation of the encoder is ready:

Return to the startmpeg4recording () method. We can see that metadata is created after the decoder is prepared, and setupmpeg4metadata is called to store media information in metadata, finally, we call the start method of mediawriter to start encoding:

This is the parameter that the setupmpeg4metadata method uses to store media information:

Next, let's take a look at the implementation of mediawriter's start method. meidawriter is just a description file. We call the mpeg4writer's start method to implement this header file. Here we intercept the code we are interested in, here, a thread is enabled and the starttracks method is called:

The implementation in the starttracks method creates an iterator to continuously call the start method:

Here it is the track class. Let's look at the track class, which is the internal class of mpeg4writer:


Next, let's take a look at the implementation of START in the track class. Here we intercept the code we are interested in. The original code called mediasource. we mentioned earlier that mediasource is the encapsulation of omxcodec, now we know that we used to prepare the encoder. Here we start to call the encoder to start encoding, that is, we start from mediarecorder. java calls the start method and omxcodec. CPP start method:


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.