Amlogic s905は、ブートビデオアニメーションを動的に変更します

Amlogic s905は、ブートビデオアニメーションを動的に変更します

プラットホーム

Amlogic s905 + Android 7.1

要求する

ビデオをブートアニメーションとして使用し、ブートビデオアニメーションを変更するためのインターフェイスを提供します。

解決

  1. ビデオブートアニメーション機能をオンにします。
//设置属性:
service.bootvideo=1 
  1. サービス登録:
    | -device / amlogic / common / products / tv / init.amlogic.rc
service bootvideo /system/bin/bootplayer /system/etc/bootvideo
    class main
    user root
    group system
    disabled
    oneshot
  1. ビデオブートアニメーションプログラム:
    変更方法は比較的簡単です。つまり、ビデオを再生する前に/ data / bootvideoを読み取ります。このファイルが存在しない場合、再生のデフォルトは/ system / etc / bootvideo
    | -vendor / amlogic / frameworks /です。 av / LibPlayer / bootplayer / bootplayer.c
int main(int argc, char *argv[])
{
    
    
    play_control_t *pCtrl = NULL;
    int pid;
    int pos = 0;
    int speed = 0;
    int tmpneedexit = 0;
    int ret = -1;
    int fd_di_bypass_all = -1;
    media_info_t minfo;
    int osd_is_blank = 0;
    char tmpcommand[TMP_COMMAND_MAX];
    char newframestring[30] = {
    
    0};
    char newstring0[30] = {
    
    0};
    int new_frame_count = 0;
    EMU_STEP tmpstep = EMU_STEP_MENU;
    osd1_clear = 0;
    char *di_bypass_all_path = "/sys/module/di/parameters/bypass_all";
    pCtrl = (play_control_t*)malloc(sizeof(play_control_t));
    memset(pCtrl, 0, sizeof(play_control_t));
    memset(&minfo, 0, sizeof(media_info_t));
    if (argc < 2) {
    
    
        ALOGD("usage:player file\n");
        return -1;
    }
    //amsysfs_set_sysfs_str(di_bypass_all_path, "1");
    set_video_axis();

    player_init();
    //streamsource_init();

    player_register_update_callback(&pCtrl->callback_fn, &update_player_info, 1000);
    ALOGD("player callback register....\n");

    //尝试读取/data/bootvideo, 若不存在则使用默认传进视频文件地址.
	char* videoPath = "/data/bootvideo";
	FILE* fp = fopen(videoPath, "r");
	if(fp){
    
    
		pCtrl->file_name = strdup(videoPath);
	}else{
    
    
		pCtrl->file_name = strdup(argv[1]);
	}

	ALOGD("player pCtrl->file_name=%s", pCtrl->file_name);
	//...
	}
  1. SELinuxの問題を解決するには、bootplayerのファイル読み取り権限を開きます。
    | -system / sepolicy / domain.te
neverallow {
  domain
  -system_server
  -system_app
  -init
  -shell
  -bootanim
  -bootanimcp
  -bootvideo
  -installd # for relabelfrom and unlink, check for this in explicit neverallow
} system_data_file:file no_w_file_perms;

| -device / amlogic / common / sepolicy / bootvideo.te

# 增加代码
allow bootvideo system_data_file:file{read getattr open write};

結論

使用する場合は、サービスまたはアプリケーションを介してビデオファイルを/ data / bootvideoに配置するだけで済みます。通常のAPP権限の場合、システムはファイルコピーサービスを適切に追加し、指定したファイルを/ dataにコピーして、割り当てることができます。および関連する権限。

おすすめ

転載: blog.csdn.net/ansondroider/article/details/103028415