How to add a preview size to the camera on the MTK platform

Source: Internet
Author: User

1, first check which sensor is used in the project, take OV2659 as an example
OV2659 is a 2M camera, Sensor spit out the data resolution can reach 1600*1200, it is sure to support the resolution of 1280*720.
How to configure it to be able to record 720P video, this still takes a lot of effort.
ALPS. ICS2. Tdd. Mp. V1.2_td_20121019\mediatek\custom\common\hal\imgsensor\ov2659_yuv\cfg_ftbl_ov2659_yuv.h
Check if there is a setup preview_size_1280_720 in this file, and if not, add

   //  Preview Size
    config_feature_si (fid_preview_size, 
        By_default (preview_size_320_240),  
         preview_size_176_144, preview_size_320_240, 
         preview_size_352_288, preview_size_640_480, 
        Preview_ size_720_480, preview_size_1280_720
   )
 
2, check if there is a mtkprofile created, specifically below this Action
/trunk/alps in the MediaProfiles.cpp file. ICS2. Tdd. Mp. V1.2_td_20121019/frameworks/base/media/libmedia/mediaprofiles.cpp
See/*static*/MediaProfiles:: camcorderprofile*
Mediaprofiles::createmtkcamcorderprofile (camcorder_quality quality, Camcorder_mode CamMode, camera_id CamId) function

Setting for VIDEO Profiles
Switch (Quality)
{
Case Camcorder_quality_mtk_low:
Case Camcorder_quality_mtk_night_low:
Case Camcorder_quality_mtk_time_lapse_low:
Case Camcorder_quality_mtk_time_lapse_night_low:
Videocodec = new Mediaprofiles::videocodec (video_encoder_mpeg_4_sp, 12500*1000/cammode, 1280x720, 720, 30/CamMode);
......

Add Profiles to it.

3, still operating in the MediaProfiles.cpp file
/*static*/void
Mediaprofiles::createdefaultcamcorderprofiles (mediaprofiles *profiles) The function also needs to add the corresponding profiles

Front fine camcorder profiles.
Mediaprofiles::camcorderprofile *frontfineprofile =
Createmtkcamcorderprofile (Camcorder_quality_mtk_fine, Camcorder_day_mode, Front_camera);
Mediaprofiles::camcorderprofile *frontfinespecificprofile =
Createmtkcamcorderprofile (Camcorder_quality_mtk_fine, Camcorder_day_mode, Front_camera);
Profiles->mcamcorderprofiles.add (Frontfineprofile);
Profiles->mcamcorderprofiles.add (Frontfinespecificprofile);


Front Night fine camcorder profiles.
Mediaprofiles::camcorderprofile *frontnightfineprofile =
Createmtkcamcorderprofile (Camcorder_quality_mtk_night_fine, Camcorder_night_mode, FRONT_CAMERA);
Mediaprofiles::camcorderprofile *frontnightfinespecificprofile =
Createmtkcamcorderprofile (Camcorder_quality_mtk_night_fine, Camcorder_night_mode, FRONT_CAMERA);
Profiles->mcamcorderprofiles.add (Frontnightfineprofile);
Profiles->mcamcorderprofiles.add (Frontnightfinespecificprofile);

Add front fine camcorder profiles and front night fine camcorder profiles respectively

4, the app layer in the Getmtksupportedvideoquality function of the Camerasettings.java can be used to output their respective resolutions to support the video.

Private Arraylist<string> getmtksupportedvideoquality () {
Arraylist<string> supported = new arraylist<string> ();
Check for supported quality
if (Camcorderprofile.hasprofile (Mcameraid, camcorderprofile.quality_480p)) {
Supported.add (integer.tostring (camcorderprofile.quality_480p));
}
if (Camcorderprofile.hasprofile (Mcameraid, camcorderprofile.quality_1080p)) {
Supported.add (integer.tostring (camcorderprofile.quality_1080p));
}

if (Camcorderprofile.hasprofile (Mcameraid, Camcorderprofile.quality_mtk_low)) {
Supported.add (integer.tostring (Camcorderprofile.quality_mtk_low));
}
if (Camcorderprofile.hasprofile (Mcameraid, Camcorderprofile.quality_mtk_medium)) {
Supported.add (integer.tostring (Camcorderprofile.quality_mtk_medium));
}
if (Camcorderprofile.hasprofile (Mcameraid, Camcorderprofile.quality_mtk_high)) {
Supported.add (integer.tostring (Camcorderprofile.quality_mtk_high));
}

for (int i = 0; i < supported.size (); i++)
LOG.E (TAG, "--------------getmtksupportedvideoquality----------i=" +supported.get (i));
return supported;
}

Finished directly compiled./mk-t mm Framework/base/av/media/libmedia, you will get a libmedia.so library file, push to the mobile System/lib directory

Reboot!


The previewsizes can be added to the Videocamera.java Startpreview function by the following log output.

list<size> sizes1 = mparameters.getsupportedpreviewsizes ();
for (int i = 0; i < sizes1.size (); i++) {
LOG.D (TAG, "supportedpreviewsizes:" + sizes1.get (i). Width + "x" + sizes1.get (i). height);
}


General Camcorderprofile.quality_mtk_low for 176X144
Camcorderprofile.quality_mtk_medium to 480X320
Camcorderprofile.quality_mtk_high to 640x480
Camcorderprofile.quality_mtk_fine to 1280x720

The corresponding enum values are 8,9,10,11, respectively.

Transferred from: http://blog.csdn.net/fulinwsuafcie/article/details/8351537

How to add a preview size to the camera on the MTK platform

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.