When Android plays video, there is no change between stereo and mono, and the solution _android

Source: Internet
Author: User
Some customers use a third-party video player, there is stereo and mono switch between, found no effect after switching
The reason is because in the HAL layer default does not handle the upper stereo turn mono command, so there will be no effect,

you can add related processing as follows:
1 Modification AudioMTKHardware.cpp
Add: Static String8 Keysetstereo2monomode = String8 ("Enablestereooutput");

2. Modify status_t audiomtkhardware::setparameters (const STRING8 &keyvaluepairs)
In Exit_setparameters:
Add Before:
Copy Code code as follows:

if (Param.getint (keysetstereo2monomode, value) = = No_error) {
ALOGD ("Setparameters ():%s value=%d", keyvaluepairs.string (), value);
((audiomtkstreammanager*) Maudiomtkstreammanager)->forcesterer2mono (value);
}


3. Modify AudioMTKStreamManager.h
Add Public method Definition:
Copy Code code as follows:

status_t Forcesterer2mono (bool flag);
status_t Audiomtkstreammanager::forcesterer2mono (BOOL flag)
{
Force all stream to standby
ALOGD ("Forcesterer2mono =%d", flag);
if (Mstreamoutvector.size ()) {
for (size_t i = 0; i < mstreamoutvector.size (); i++) {
Audiomtkstreamout *ptempout = (Audiomtkstreamout *) mstreamoutvector.valueat (i);
Ptempout->setstereotomonoflagforce (flag);
}
}
return no_error;
}

4. Modify AudioMTKStreamOut.h
T add definition:
Copy Code code as follows:

status_t Setstereotomonoflagforce (BOOL flag);
status_t Audiomtkstreamout::setstereotomonoflagforce (BOOL flag)
{
Alogd ("Setstereotomonoflagforce =%d") Flag);
Msterotomono = flag;
return no_error;
}
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.