Codec --- 1 of stagefright

Source: Internet
Author: User

After multimedia files are parsed, you need to find the appropriate codec according to mime. 2.3 of the system has two methods: SoftwareCodec and omx node codec. The latter can be optimized with special hardware, the former seems to be relatively standard soft decoding.
Below is the code
Omxcodec. cpp
Omxcodec: create
Vector <String8> matchingCodecs; ------ all the codec sets of a mime
FindMatchingCodecs (
Mime, createEncoder, matchComponentName, flags, & matchingCodecs );
If (matchingCodecs. isEmpty ()){
Return NULL;
}
Sp <OMXCodecObserver> observer = new OMXCodecObserver;
IOMX: node_id node = 0;
Const char * componentName;
For (size_t I = 0; I <matchingCodecs. size (); ++ I) {-------- traverse all the codec in it. Generally, the node of omx is first followed by soft decoding.
ComponentName = matchingCodecs [I]. string ();
Sp <MediaSource> softwareCodec = createEncoder?
InstantiateSoftwareEncoder (componentName, source, meta ):
InstantiateSoftwareCodec (componentName, source );
If (softwareCodec! = NULL ){
LOGV ("Successfully allocated software codec '% S'", componentName );
Return softwareCodec; ----------------- soft decoding-return codec
}
LOGV ("Attempting to allocate OMX node '% S'", componentName );
Uint32_t quirks = getComponentQuirks (componentName, createEncoder );
If (! CreateEncoder
& (Quirks & kOutputBuffersAreUnreadable)
& (Flags & kClientNeedsFramebuffer )){
If (strncmp (componentName, "OMX. SEC.", 8 )){
// For OMX. SEC. * decoders we can enable a special mode that
// Gives the client access to the framebuffer contents.
LOGW ("Component '% s' does not give the client access"
"The framebuffer contents. Skipping .",
ComponentName );
Continue;
}
}
Status_t err = omx-> allocateNode (componentName, observer, & node );
If (err = OK ){
LOGV ("Successfully allocated OMX node '% S'", componentName );
Sp <OMXCodec> codec = new OMXCodec (
Omx, node, quirks,
CreateEncoder, mime, componentName,
Source); ------------------------ generate an omxcodec, which needs to be further studied later
Observer-> setCodec (codec );
Err = codec-> configureCodec (meta, flags );
If (err = OK ){
Return codec;
}
LOGV ("Failed to configure codec '% S'", componentName );
}
}

From shcalm's column

Related Article

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.