data_frame = data_frame.set_index(‘Name‘)报错:KeyError: ‘Name‘

1.问题

想要去掉index列用行名称作为第一列,第一列名称为'Name',如下图:

输入:data_frame = data_frame.set_index('Name'),报错:KeyError: 'Name'。

2.原因

输入:data_frame.columns[0]查看第一列列名称。显示:

也就是说,列名称不是'Name',而是后面多了许多空格的'Name           

 '

3.解决方法

方法(1):将data_frame = data_frame.set_index('Name')改为data_frame = data_frame.set_index(data_frame.columns[0])。

方法(2):修改列名称,删除Name后面多余的空格,即:

data_frame = data_frame.rename(columns={data_frame.columns[0]: data_frame.columns[0].strip()})

data_frame = data_frame.set_index('Name')

4.最后,成功去除index列:

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Version 1.7 ----------- - ADD: Delphi/CBuilder 10.2 Tokyo now supported. - ADD: Delphi/CBuilder 10.1 Berlin now supported. - ADD: Delphi/CBuilder 10 Seattle now supported. - ADD: Delphi/CBuilder XE8 now supported. - ADD: Delphi/CBuilder XE7 now supported. - ADD: Delphi/CBuilder XE6 now supported. - ADD: Delphi/CBuilder XE5 now supported. - ADD: Delphi/CBuilder XE4 now supported. - ADD: Delphi/CBuilder XE3 now supported. - ADD: Delphi/CBuilder XE2 now supported. - ADD: Delphi/CBuilder XE now supported. - ADD: Delphi/CBuilder 2010 now supported. - ADD: Delphi/CBuilder 2009 now supported. - ADD: New demo project FlexCADImport. - FIX: The height of the TFlexRegularPolygon object incorrectly changes with its rotation. - FIX: Added division by zero protect in method TFlexControl.MovePathSegment. - FIX: The background beyond docuemnt wasn't filled when TFlexPanel.DocClipping=True. - FIX: In "Windows ClearType" font rendering mode (OS Windows mode) the "garbage" pixels can appear from the right and from the bottom sides of the painted rectangle of the TFlexText object. - FIX: The result rectangle incorrectly calculated in the TFlexText.GetRefreshRect method. - FIX: Added FPaintCache.rcPaint cleanup in the TFlexPanel.WMPaint method. Now it is possible to define is the drawing take place via WMPaint or via the PaintTo direct call (if rcPaint contain non-empty rectangle then WMPaint in progress). - FIX: The TFlexPanel.FPaintCache field moved in the protected class section. Added rcPaint field in FPaintCache that represents drawing rectangle. - ADD: In the text prcise mode (TFlexText.Precise=True) takes into account the rotation angle (TFlexText.Angle). - FIX: Removed FG_NEWTEXTROTATE directive (the TFlexText Precise mode should be used instead). - FIX: The TFlexRegularPolygon object clones incorrectly drawed in case when TFlexRegularPolygon have alternative brush (gradient, texture). - ADD: Add TFlexPanel.InvalidateControl virtual method which calls from TFle
全志R16平台的tinav2.0系统下调通HM1375 2017/8/24 14:04 开发板:SC3817R OS:tina V2.0 1、最新的驱动程序请直接联系HiMax原厂/代理商! R:\wyb\thl_r16_tinav2.0_hm1375\lichee\linux-3.4\drivers\media\video\sunxi-vfe\device\hm1375.c 2、 R:\wyb\thl_r16_tinav2.0_hm1375\lichee\linux-3.4\drivers\media\video\sunxi-vfe\device\Makefile EXTRA_LDFLAGS += --strip-debug ifneq ($(strip $(CONFIG_ARCH_SUN8IW8)),) obj-$(CONFIG_OV2710_MIPI)+= ov2710_mipi.o obj-$(CONFIG_OV4689)+= ov4689.o obj-$(CONFIG_OV4689_60FPS)+= ov4689_60fps.o obj-$(CONFIG_AR0330_MIPI)+= ar0330_mipi.o obj-$(CONFIG_OV4689_SDV)+= ov4689_sdv.o obj-$(CONFIG_GC1004_MIPI)+= gc1004_mipi.o obj-$(CONFIG_H22_MIPI)+= h22_mipi.o obj-$(CONFIG_NT99231_MIPI)+= nt99231_mipi.o else obj-m+= hm1375.o #obj-m+= ov5640.o #obj-m+= ov2640.o #obj-m+= ov7736.o #obj-m+= s5k4ec.o #obj-m+= s5k4ec_mipi.o #obj-m+= gc2035.o #obj-m+= gt2005.o #obj-m+= gc0307.o #obj-m+= gc0308.o #obj-m+= gc0328.o #obj-m+= gc0328c.o #obj-m+= gc0329.o #obj-m+= gc0311.o #obj-m+= hi253.o #obj-m+= sp2518.o #obj-m+= sp2519.o #obj-m+= sp0718.o #obj-m+= sp0838.o #obj-m+= ov16825.o #obj-m+= ov5650.o #obj-m+= ov5647.o #obj-m+= ov5647_mipi.o #obj-m+= t8et5.o #obj-m+= s5k4e1.o #obj-m+= s5k4e1_mipi.o #obj-m+= sp2518.o #obj-m+= sp0718.o #obj-m+= gc5004.o #obj-m+= gc5004_mipi.o #obj-m+= ov5648.o #obj-m+= ar0330.o #obj-m+= ov5648.o #obj-m+= sp5408.o #obj-m+= ov12830.o #obj-m+= ov8825.o #obj-m+= ov8850.o #obj-m+= gc2155.o #obj-m+= gc2145.o #obj-m+= gc2145d.o #obj-m+= ov8858.o #obj-m+= ov13850.o #obj-m+= imx214.o #obj-m+= ov8858_4lane.o #obj-m+= sp5409.o #obj-m+= s5k5e2yx.o #obj-m+= ov2710_mipi.o #obj-m+= siv121d.o #obj-m+= ov2710_mipi.o #obj-m+= bg0703.o #obj-m+= gc1014_mipi.o #obj-m+= imx219.o #obj-m+= imx224.o #obj-m+= imx322.o #obj-m+= ov8858_r2a_4lane.o #obj-m+= ov8865_4lane.o #obj-m+= ps1210.o #obj-m+= imx291.o endif 3、让tinav2.0启动之后不让摄像头camera休眠: R:\wyb\thl_r16_tinav2.0_hm1375\lichee\linux-3.4\drivers\media\video\sunxi-vfe\vfe.c static void probe_work_handle(struct work_struct *work) { struct vfe_dev *dev= container_of(work, struct vfe_dev, probe_work.work); int ret = 0; int input_num; int device_valid_count = 0; struct video_device *vfd; char vfe_name[16] = {0}; mutex_lock(&probe_hdl_lock); vfe_print("probe_work_handle start!\n"); vfe_dbg(0,"v4l2_device_register\n"); #ifdef USE_SPECIFIC_CCI vfe_clk_open(dev); #endif /* v4l2 device register */ ret = v4l2_device_register(&dev->pdev->dev, &dev->v4l2_dev); if (ret) { vfe_err("Error registering v4l2 device\n"); goto probe_hdl_free_dev; } dev_set_drvdata(&dev->pdev->dev, (dev)); vfe_dbg(0,"v4l2 subdev register\n"); /* v4l2 subdev register */ dev->is_same_module = 0; for(input_num=0; input_num<dev->dev_qty; input_num++) { vfe_print("v4l2 subdev register input_num = %d\n",input_num); if(!strcmp(dev->ccm_cfg[input_num]->ccm,"")) { vfe_err("Sensor name is NULL!\n"); goto snesor_register_end; } if(dev->is_same_module) { dev->ccm_cfg[input_num]->sd = dev->ccm_cfg[input_num-1]->sd; vfe_dbg(0,"num = %d , sd_0 = %p,sd_1 = %p\n",input_num,dev->ccm_cfg[input_num]->sd,dev->ccm_cfg[input_num-1]->sd); goto snesor_register_end; } if((dev->dev_qty > 1) && (input_num+1<dev->dev_qty)) { if((!strcmp(dev->ccm_cfg[input_num]->ccm,dev->ccm_cfg[input_num+1]->ccm))) dev->is_same_module = 1; } if(dev->vip_define_sensor_list == 1) { if(dev->ccm_cfg[input_num]->sensor_cfg_ini->power_settings_enable == 1) { cpy_ccm_power_settings(dev->ccm_cfg[input_num]); } } #ifdef _REGULATOR_CHANGE_ #else if(vfe_device_regulator_get(dev->ccm_cfg[input_num])) { vfe_err("vfe_device_regulator_get error at input_num = %d\n",input_num); goto snesor_register_end; } #endif vfe_print("vfe sensor detect start! input_num = %d\n",input_num); dev->input = input_num; if(vfe_sensor_register_check(dev,&dev->v4l2_dev,dev->ccm_cfg[input_num],&dev->dev_sensor[input_num],input_num) == NULL) { vfe_err("vfe sensor register check error at input_num = %d\n",input_num); dev->device_valid_flag[input_num] = 0; //goto snesor_register_end; } else{ dev->device_valid_flag[input_num] = 1; device_valid_count ++; } if(dev->ccm_cfg[input_num]->is_isp_used && dev->ccm_cfg[input_num]->is_bayer_raw) { if(read_ini_info(dev,input_num, "/system/etc/hawkview/")) { vfe_warn("read ini info fail\n"); } } if(dev->ccm_cfg[input_num]->act_used == 1) { dev->dev_act[input_num].addr = (unsigned short)(dev->ccm_cfg[input_num]->act_slave>>1); strcpy(dev->dev_act[input_num].type,dev->ccm_cfg[input_num]->act_name); if(vfe_actuator_subdev_register(dev,dev->ccm_cfg[input_num], &dev->dev_act[input_num]) != 0) ;//goto probe_hdl_free_dev; } snesor_register_end: vfe_dbg(0,"dev->ccm_cfg[%d] = %p\n",input_num,dev->ccm_cfg[input_num]); vfe_dbg(0,"dev->ccm_cfg[%d]->sd = %p\n",input_num,dev->ccm_cfg[input_num]->sd); vfe_dbg(0,"dev->ccm_cfg[%d]->power.iovdd = %p\n",input_num,dev->ccm_cfg[input_num]->power.iovdd); vfe_dbg(0,"dev->ccm_cfg[%d]->power.avdd = %p\n",input_num,dev->ccm_cfg[input_num]->power.avdd); vfe_dbg(0,"dev->ccm_cfg[%d]->power.dvdd = %p\n",input_num,dev->ccm_cfg[input_num]->power.dvdd); vfe_dbg(0,"dev->ccm_cfg[%d]->power.afvdd = %p\n",input_num,dev->ccm_cfg[input_num]->power.afvdd); } dev->input = -1; /*video device register */ ret = -ENOMEM; vfd = video_device_alloc(); if (!vfd) { goto probe_hdl_unreg_dev; } *vfd = vfe_template[dev->id]; vfd->v4l2_dev = &dev->v4l2_dev; sprintf(vfe_name,"vfe-%d",dev->id); dev_set_name(&vfd->dev, vfe_name); if (0 != device_valid_count) { ret = video_register_device(vfd, VFL_TYPE_GRABBER, dev->id); if (ret < 0) { goto probe_hdl_rel_vdev; } } video_set_drvdata(vfd, dev); /*add device list*/ /* Now that everything is fine, let's add it to device list */ list_add_tail(&dev->devlist, &devlist); dev->vfd = vfd; vfe_print("V4L2 device registered as %s\n",video_device_node_name(vfd)); /*initial video buffer queue*/ videobuf_queue_dma_contig_init(&dev->vb_vidq, &vfe_video_qops, NULL, &dev->slock, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE,//default format, can be changed by s_fmt sizeof(struct vfe_buffer), dev,NULL); ret = sysfs_create_group(&dev->pdev->dev.kobj, &vfe_attribute_group); #ifdef CONFIG_ES dev->early_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB + 1; dev->early_suspend.suspend = vfe_early_suspend; dev->early_suspend.resume = vfe_late_resume; // [hawkview_err]xxxxcan't open /dev/video0(Resource temporarily unavailable) // 2016/10/25 14:33 wenyuanbo cloase suspend. // register_early_suspend(&dev->early_suspend); vfe_print("register_early_suspend @ probe handle!\n"); #endif #ifdef USE_SPECIFIC_CCI vfe_clk_close(dev); #endif vfe_print("probe_work_handle end!\n"); mutex_unlock(&probe_hdl_lock); return ; probe_hdl_rel_vdev: video_device_release(vfd); vfe_print("video_device_release @ probe_hdl!\n"); probe_hdl_unreg_dev: vfe_print("v4l2_device_unregister @ probe_hdl!\n"); v4l2_device_unregister(&dev->v4l2_dev); probe_hdl_free_dev: vfe_print("vfe_resource_release @ probe_hdl!\n"); #ifdef USE_SPECIFIC_CCI csi_cci_exit_helper(dev->cci_sel); vfe_clk_close(dev); #endif //vfe_resource_release(dev); vfe_err("Failed to install at probe handle\n"); mutex_unlock(&probe_hdl_lock); return ; } 4、 R:\wyb\thl_r16_tinav2.0_hm1375\package\allwinner\cameratest\src\common\hawkview.c int fetch_sub_cmd(const char* buf,int buf_len,char** cmd,int* cmd_num,int lenght) { int i = 0,j = 0,n = 0; while(buf[i] != '#'){ //the sub cmd end by '#' while(buf[i] != 'x' && buf[i] != ':' && buf[i] != '#') { if((i+1) > buf_len) return 0; 修改为: if(i++ > buf_len) return 0; *((char*)cmd + n*lenght + j++) = buf[i++]; if(j > lenght) { hv_err("sub cmd over long\n"); *cmd_num = n + 1; return -1; } } *((char*)cmd + n*lenght + j++) = '\0'; n++; j = 0; if(buf[i] != '#'){ i++; } if(n > *cmd_num){ hv_err("the max cmd num is %d\n",*cmd_num); return -1; } } *cmd_num = n; return 0; } R:\wyb\thl_r16_tinav2.0_hm1375\package\allwinner\cameratest\src\common\video.c static int capture_frame(void* capture,int (*set_disp_addr)(int,int,unsigned int*),pthread_mutex_t* mutex) { capture_handle* cap = (capture_handle*)capture; int ret; int i; struct v4l2_buffer buf; enum v4l2_buf_type type; fd_set fds; struct timeval tv; pthread_mutex_lock(mutex); //used for cammand and status debug if (old_vi_cmd != cap->cmd){ hv_dbg("capture frame command %d --> %d\n",old_vi_cmd,cap->cmd); old_vi_cmd = (int)cap->cmd; } if(old_status != cap->status){ hv_dbg("capture frame status %d --> %d\n",old_status,cap->status); old_status = cap->status; } if(cap->status == OFF && cap->cmd == START_STREAMMING){ hv_dbg("capture start streaming\n"); type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (ioctl(videofh, VIDIOC_STREAMON, &type) == -1) { hv_err("VIDIOC_STREAMON error! %s\n",strerror(errno)); goto quit; } cap->status = ON; cap->cmd = COMMAND_UNUSED; pthread_mutex_unlock(mutex); return 0; } if(cap->status == ON && cap->cmd == STOP_STREAMMING){ hv_dbg("capture stop streaming\n"); type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if(-1 == ioctl(videofh, VIDIOC_STREAMOFF, &type)){ hv_err("VIDIOC_STREAMOFF error! %s\n",strerror(errno)); goto quit; } cap->status = OFF; cap->cmd = COMMAND_UNUSED; capture_quit(capture); pthread_mutex_unlock(mutex); return 2; } if(cap->status == OFF) { pthread_mutex_unlock(mutex); return 0; } FD_ZERO(&fds); FD_SET(videofh, &fds); tv.tv_sec = 2; tv.tv_usec = 0; pthread_mutex_unlock(mutex); ret = select(videofh + 1, &fds, NULL, NULL, &tv); pthread_mutex_lock(mutex); //hv_dbg("select video ret: %d\n",ret); if (ret == -1) { if (errno == EINTR) { return 0; } hv_err("select error\n"); goto stream_off; } else if (ret == 0) { hv_err("select timeout\n"); pthread_mutex_unlock(mutex); return 0; } memset(&buf, 0, sizeof(struct v4l2_buffer)); buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.memory = V4L2_MEMORY_MMAP; ret = ioctl(videofh, VIDIOC_DQBUF, &buf); if (ret == -1) { hv_err("VIDIOC_DQBUF failed!\n"); goto stream_off; } float framerate; framerate = get_framerate((long long)(buf.timestamp.tv_sec),(long long)(buf.timestamp.tv_usec)); if(framerate > 1.0){ cap->cap_fps = framerate; //hv_dbg("framerate: %0.2ffps\n",cap->cap_fps); } //sync capture info perp x second #define M_SECOND 200 if(is_x_msec(M_SECOND,(long long)(buf.timestamp.tv_sec),(long long)(buf.timestamp.tv_usec))){ getExifInfo(&(cap->frame.exif)); set_cap_info((void*)cap); 修改为: // set_cap_info((void*)cap); } if(cap->cmd == STOP_SAVE_FRAME && cap->save_status == ON) cap->save_status = OFF; //save frame , the frame will be get by PC Tool to preview on PC screen //frame format: /dev/frame_x (x:0~21) if(cap->cmd == SAVE_FRAME || cap->save_status == ON ) { if(cap->cmd == SAVE_FRAME){ cap->save_status = ON; cap->cmd = COMMAND_UNUSED; } ret = do_save_frame(capture,buf.index); } //take yuv image,it will save the target frame exif info in the same time //image name: xxxx (set by usered through command) //exif info name: xxxx.exif if(cap->cmd == SAVE_IMAGE ) { ret = 0;//getExifInfo(&(cap->picture.exif)); //get target frame exif info successfully then save the target image //if get the exif info fail,it will try next frame if(ret == 0){ buffers[buf.index].phy_addr = buf.m.offset - 0x20000000; hv_dbg("index: %d buffers[buf.index].start = %p\n",buf.index,buffers[buf.index].start); //do_save_image(capture,buf.index); do_save_sub_image(capture,buf.index); cap->cmd = COMMAND_UNUSED; } } //get display addr int w,h; unsigned int addr; get_disp_addr(capture, buf.m.offset,&addr,&w,&h); // set disp buffer if (set_disp_addr){ set_disp_addr(w,h,&addr); } ret = ioctl(videofh, VIDIOC_QBUF, &buf); if (ret == -1) { hv_err("VIDIOC_DQBUF failed!\n"); goto stream_off; } pthread_mutex_unlock(mutex); return 0; stream_off: hv_err("err stream off\n"); ioctl(videofh, VIDIOC_STREAMOFF, &type); quit: capture_quit(capture); pthread_mutex_unlock(mutex); return -1; } R:\wyb\thl_r16_tinav2.0_hm1375\package\allwinner\cameratest\src\common\video_helper.c int set_cap_info(void* capture) { char info[500]; char exif[500]; char file_path[20]; capture_handle* cap = (capture_handle*)capture; memset(info,0,sizeof(info)); strcpy(file_path,"dev/info"); 修改为: //strcpy(file_path, "dev/info"); sprintf(file_path, "%s/%s.info", PATH, cap->picture.path_name); //sync string: sensor_type:save_status:framrate:capture_w:capture_h,sub_w,sub_h# sprintf(info, \ "sensor_type = %s\n" \ "status = %d\n" \ "framerate = %0.2f\n" \ "subchanel_width = %d\n" \ "subchanel_height = %d\n" \ "rotation = %d\n\n", \ (cap->sensor_type == 1)?"raw":"yuv", \ cap->save_status, \ cap->cap_fps, \ cap->sub_w, \ cap->sub_h, \ cap->sub_rot); make_exif_info(exif,"none",&(cap->frame.exif),cap->cap_w,cap->cap_h); strcat(info,exif); //hv_dbg("info str:\n%s\n",info); return write_file(file_path,info,sizeof(info)); } int do_save_sub_image(void* capture,int buf_index) { int ret; char image_name[30]; capture_handle* cap = (capture_handle*)capture; memset(image_name,0,sizeof(image_name)); sprintf(image_name,"%s/%s", PATH,cap->picture.path_name); hv_dbg("image_name: %s\n",image_name); (建议增加这里) set_cap_info(capture); set_exif_info(capture); hv_dbg("--------set_exif_info end\n"); void* vir_sub_start = NULL; unsigned int phy_sub_start = 0; int w,h; if(cap->sensor_type == V4L2_SENSOR_TYPE_RAW){ vir_sub_start = (unsigned int)(buffers[buf_index].start) + ALIGN_4K(ALIGN_16B(cap->cap_w) * cap->cap_h * 3 >> 1); phy_sub_start = buffers[buf_index].phy_addr + ALIGN_4K(ALIGN_16B(cap->cap_w) * cap->cap_h * 3 >> 1); w = cap->sub_w; h = cap->sub_h; } else { vir_sub_start = buffers[buf_index].start; phy_sub_start = buffers[buf_index].phy_addr; w = cap->cap_w; h = cap->cap_h; } #ifdef ANDROID_ENV ret = save_jpeg_frame(image_name,phy_sub_start,w,h); //sprintf(image_name,"/data/camera/yuv%s", cap->picture.path_name); //ret = save_jpeg_frame_by_viraddr(image_name,(void*)vir_sub_start,cap->sub_w,cap->sub_h); #else sprintf(image_name,"%s/yuv%s", PATH,cap->picture.path_name); ret = save_frame_to_file(image_name, \ (void*)(vir_sub_start), \ w,h,cap->cap_fmt, \ 1); #endif if(ret == -1) hv_err("save image failed!\n"); return 0; } 5、可选增加fpscamera: R:\wyb\thl_r16_tinav2.0_hm1375\package\allwinner\fpscamera 6、 define KernelPackage/sunxi-vfe SUBMENU:=$(VIDEO_MENU) TITLE:=sunxi-vfe support FILES:=$(LINUX_DIR)/drivers/media/video/videobuf-core.ko FILES+=$(LINUX_DIR)/drivers/media/video/videobuf-dma-contig.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/csi_cci/cci.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/vfe_os.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/vfe_subdev.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/device/gc0308.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/vfe_v4l2.ko AUTOLOAD:=$(call AutoLoad,90,videobuf-core videobuf-dma-contig cci vfe_os vfe_subdev gc0308 vfe_v4l2) endef 修改为: define KernelPackage/sunxi-vfe SUBMENU:=$(VIDEO_MENU) TITLE:=sunxi-vfe support FILES:=$(LINUX_DIR)/drivers/media/video/videobuf-core.ko FILES+=$(LINUX_DIR)/drivers/media/video/videobuf-dma-contig.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/csi_cci/cci.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/vfe_os.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/vfe_subdev.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/device/hm1375.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/vfe_v4l2.ko AUTOLOAD:=$(call AutoLoad,90,videobuf-core videobuf-dma-contig cci vfe_os vfe_subdev hm1375 vfe_v4l2) endef 7、 R:\wyb\thl_r16_tinav2.0_hm1375\target\allwinner\astar-parrot\configs\sys_config.fex ;---------------------------------------------------------------------------------- ;dcdc1_vol ---set dcdc1 voltage,mV,1600-3400,100mV/step ;dcdc2_vol ---set dcdc2 voltage,mV,600-1540,20mV/step ;dcdc3_vol ---set dcdc3 voltage,mV,600-1860,20mV/step ;dcdc4_vol ---set dcdc4 voltage,mV,600-1540,20mV/step ;dcdc5_vol ---set dcdc5 voltage,mV,1000-2550,50mV/step ;aldo2_vol ---set aldo2 voltage,mV,700-3300,100mV/step ;aldo3_vol ---set aldo3 voltage,mV,700-3300,100mV/step ;---------------------------------------------------------------------------------- [power_sply] dcdc1_vol = 3000 dcdc2_vol = 1100 dcdc3_vol = 1200 dcdc4_vol = 0 dcdc5_vol = 1500 aldo2_vol = 2500 aldo3_vol = 3000 dldo3_vol = 2800 ;gpio0_vol = 2800 ldoio0_vol = 2800 [twi2] twi_used = 1 twi_scl = port:PE12<3><default><default><default> twi_sda = port:PE13<3><default><default><default> ;-------------------------------------------------------------------------------- ;vip (video input port) configuration ;vip_used: 0:disable 1:enable ;vip_mode: 0:sample one interface to one buffer 1:sample two interface to one buffer ;vip_dev_qty: The quantity of devices linked to capture bus ; ;vip_define_sensor_list: If you want use sensor detect function, please set vip_define_sensor_list = 1, and ; verify that file /system/etc/hawkview/sensor_list_cfg.ini is properly configured! ; ;vip_dev(x)_pos: sensor position, "rear" or "front", if vip_define_sensor_list = 1,vip_dev(x)_pos must be configured! ; ;vip_dev(x)_isp_used 0:not use isp 1:use isp ;vip_dev(x)_fmt: 0:yuv 1:bayer raw rgb ;vip_dev(x)_stby_mode: 0:not shut down power at standby 1:shut down power at standby ;vip_dev(x)_vflip: flip in vertical direction 0:disable 1:enable ;vip_dev(x)_hflip: flip in horizontal direction 0:disable 1:enable ;vip_dev(x)_iovdd: camera module io power handle string, pmu power supply ;vip_dev(x)_iovdd_vol: camera module io power voltage, pmu power supply ;vip_dev(x)_avdd: camera module analog power handle string, pmu power supply ;vip_dev(x)_avdd_vol: camera module analog power voltage, pmu power supply ;vip_dev(x)_dvdd: camera module core power handle string, pmu power supply ;vip_dev(x)_dvdd_vol: camera module core power voltage, pmu power supply ;vip_dev(x)_afvdd: camera module vcm power handle string, pmu power supply ;vip_dev(x)_afvdd_vol: camera module vcm power voltage, pmu power supply ;x indicates the index of the devices which are linked to the same capture bus ;fill voltage in uV, e.g. iovdd = 2.8V, vip_devx_iovdd_vol = 2800000 ;fill handle string as below: ;axp22_eldo3 ;axp22_dldo4 ;axp22_eldo2 ;fill handle string "" when not using any pmu power supply ;-------------------------------------------------------------------------------- [csi0] vip_used = 1 vip_mode = 0 vip_dev_qty = 1 vip_define_sensor_list = 0 vip_csi_pck = port:PE00<2><default><default><default> vip_csi_mck = port:PE01<2><default><default><default> vip_csi_hsync = port:PE02<2><default><default><default> vip_csi_vsync = port:PE03<2><default><default><default> vip_csi_d0 = port:PE04<2><default><default><default> vip_csi_d1 = port:PE05<2><default><default><default> vip_csi_d2 = port:PE06<2><default><default><default> vip_csi_d3 = port:PE07<2><default><default><default> vip_csi_d4 = port:PE08<2><default><default><default> vip_csi_d5 = port:PE09<2><default><default><default> vip_csi_d6 = port:PE10<2><default><default><default> vip_csi_d7 = port:PE11<2><default><default><default> ;vip_csi_sck = port:PE12<2><default><default><default> ;vip_csi_sda = port:PE13<2><default><default><default> vip_dev0_mname = "hm1375" vip_dev0_pos = "rear" vip_dev0_lane = 1 vip_dev0_twi_id = 2 vip_dev0_twi_addr = 0x48 vip_dev0_isp_used = 0 vip_dev0_fmt = 0 (调试的时候推荐选0,给摄像头时钟供电,方便测量电压:) vip_dev0_stby_mode = 0 vip_dev0_vflip = 0 vip_dev0_hflip = 0 vip_dev0_iovdd = "" vip_dev0_iovdd_vol = 2800000 vip_dev0_avdd = "axp22_ldoio0" vip_dev0_avdd_vol = 2800000 vip_dev0_dvdd = "" vip_dev0_dvdd_vol = 1800000 vip_dev0_afvdd = "" vip_dev0_afvdd_vol = 2800000 vip_dev0_power_en = vip_dev0_reset = port:PE14<1><default><default><0> vip_dev0_pwdn = port:PE15<1><default><default><1> vip_dev0_flash_en = vip_dev0_flash_mode = vip_dev0_af_pwdn = 8、可选: rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ make menuconfig 内核的修改保存在这里: R:\wyb\thl_r16_tinav2.0_hm1375\target\allwinner\astar-parrot\config-3.4 rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ make menuconfig 系统的修改保存在这里: R:\wyb\thl_r16_tinav2.0_hm1375\target\allwinner\astar-parrot\defconfig 9、为了调试方便,可选修改: R:\wyb\thl_r16_tinav2.0_hm1375\target\allwinner\generic\configs\env.cfg bootdelay=3 #default bootcmd, will change at runtime according to key press bootcmd=run setargs_nand boot_normal#default nand boot #kernel command arguments console=ttyS0,115200 nor_root=/dev/mtdblock4 nand_root=/dev/nandd mmc_root=/dev/mmcblk0p7 init=/sbin/init loglevel=8 #set kernel cmdline if boot.img or recovery.img has no cmdline we will use this setargs_nor=setenv bootargs console=${console} root=${nor_root} rootwait init=${init} ion_cma_list="8m,32m,64m,128m,256m"loglevel=${loglevel} partitions=${partitions} setargs_nand=setenv bootargs console=${console} root=${nand_root} rootwait init=${init} ion_cma_list="8m,32m,64m,128m,256m" loglevel=${loglevel} partitions=${partitions} setargs_mmc=setenv bootargs console=${console} root=${mmc_root} rootwait init=${init} ion_cma_list="8m,32m,64m,128m,256m" loglevel=${loglevel} partitions=${partitions} #nand command syntax: sunxi_flash read address partition_name read_bytes #0x40007800 = 0x40008000(kernel entry) - 0x800(boot.img header 2k) boot_normal=fatload sunxi_flash boot 43800000 uImage;bootm 43800000 boot_recovery=fatload sunxi_flash extend 43800000 uImage;bootm 43800000 boot_fastboot=fastboot #recovery key recovery_key_value_max=0x13 recovery_key_value_min=0x10 #fastboot key fastboot_key_value_max=0x8 fastboot_key_value_min=0x2 10、先编译一遍tianv2.0的系统,然后增加sunxi-vfe support支持: rootroot@rootroot-E400:~$ cd wyb/thl_r16_tinav2.0_hm1375/ rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ 7za x thl_r16_tinav2.0_hm1375等待最终验证_20170824_1141.7z -r -o./ rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ source build/envsetup.sh including target/allwinner/octopus-dev/vendorsetup.sh including target/allwinner/astar-parrot/vendorsetup.sh including target/allwinner/astar-evb/vendorsetup.sh including target/allwinner/generic/vendorsetup.sh including target/allwinner/tulip-d1/vendorsetup.sh including target/allwinner/astar-spk/vendorsetup.sh rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ lunch You're building on Linux Lunch menu... pick a combo: 1. octopus_dev-tina 2. octopus_dev-dragonboard 3. astar_parrot-tina 4. astar_parrot-dragonboard 5. astar_evb-tina 6. tulip_d1-tina 7. tulip_d1-dragonboard 8. astar_spk-tina 9. astar_spk-dragonboard Which would you like?3 ============================================ PLATFORM_VERSION_CODENAME=Neptune PLATFORM_VERSION=2.0.0 TARGET_PRODUCT=astar_parrot TARGET_BUILD_VARIANT=tina TARGET_BUILD_TYPE=release TARGET_BUILD_APPS= TARGET_ARCH=arm TARGET_ARCH_VARIANT=armv7-a-neon TARGET_CPU_VARIANT=cortex-a7 TARGET_2ND_ARCH= TARGET_2ND_ARCH_VARIANT= TARGET_2ND_CPU_VARIANT= HOST_ARCH=x86_64 HOST_OS=linux HOST_OS_EXTRA=Linux-3.13.0-24-generic-x86_64-with-Ubuntu-14.04-trusty HOST_BUILD_TYPE=release BUILD_ID=57513AA3 OUT_DIR= ============================================ rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ make -j8 rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ pack -d rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ make menuconfig Allwinner ---> < > fpscamera................................. fpscamera just test the camera 修改为: <*> fpscamera................................. fpscamera just test the camera Kernel modules ---> Video Support ---> < > kmod-sunxi-vfe......................................... sunxi-vfe support 修改为: <*> kmod-sunxi-vfe......................................... sunxi-vfe support rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ make -j12 rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ pack -d 11、加载hm1375的驱动的时候查看I2C是否是通的: R:\wyb\thl_r16_tinav2.0_hm1375\lichee\linux-3.4\drivers\media\video\sunxi-vfe\device\hm1375.c static int sensor_detect(struct v4l2_subdev *sd) { int ret; unsigned char rdval; printk("****wyb %s:%d/%s()! verify HM1375\n", __FILE__, __LINE__, __func__); LOG_ERR_RET(sensor_read(sd, 0x0001, &rdval)) ret = sensor_read(sd, 0x0001,&rdval); printk("****wyb %s:%d/%s()! reg:0x0001=value:0xx right=0x03/0x13\n", __FILE__, __LINE__, __func__, rdval); if (ret < 0) { vfe_dev_err("sensor_read err at sensor_detect!\n"); return ret; } if((rdval != 0x03) && (rdval != 0x13)) { vfe_dev_err("read high val: %d\n", rdval); return -ENODEV; } LOG_ERR_RET(sensor_read(sd, 0x0002, &rdval)) printk("****wyb %s:%d/%s()! reg:0x0002=value:0xx right=0x75\n", __FILE__, __LINE__, __func__, rdval); if(rdval != 0x75) { vfe_dev_err("read low val: %d\n", rdval); return -ENODEV; } printk("HM1375 sensor_detect OK\r\n"); return 0; } (奇怪的时候HM1375的0x0001号寄存器,第一次读是0x03,以后都是0x13,好神奇!) [ 16.030894] ****wyb drivers/media/video/sunxi-vfe/device/hm1375.c:2891/sensor_detect()! verify HM1375 [ 16.042100] ****wyb drivers/media/video/sunxi-vfe/device/hm1375.c:2895/sensor_detect()! reg:0x0001=value:0x03 right=0x03/0x13 [ 16.055259] ****wyb drivers/media/video/sunxi-vfe/device/hm1375.c:2909/sensor_detect()! reg:0x0002=value:0x75 right=0x75 [ 16.067560] HM1375 sensor_detect OK [ 47.398156] ****wyb drivers/media/video/sunxi-vfe/device/hm1375.c:2891/sensor_detect()! verify HM1375 [ 47.409351] ****wyb drivers/media/video/sunxi-vfe/device/hm1375.c:2895/sensor_detect()! reg:0x0001=value:0x13 right=0x03/0x13 [ 47.422492] ****wyb drivers/media/video/sunxi-vfe/device/hm1375.c:2909/sensor_detect()! reg:0x0002=value:0x75 right=0x75 [ 47.434769] HM1375 sensor_detect OK [ 88.217828] ****wyb drivers/media/video/sunxi-vfe/device/hm1375.c:2891/sensor_detect()! verify HM1375 [ 88.228920] ****wyb drivers/media/video/sunxi-vfe/device/hm1375.c:2895/sensor_detect()! reg:0x0001=value:0x13 right=0x03/0x13 [ 88.242056] ****wyb drivers/media/video/sunxi-vfe/device/hm1375.c:2909/sensor_detect()! reg:0x0002=value:0x75 right=0x75 [ 88.254325] HM1375 sensor_detect OK
r40_tinav2.1_最终验证通过_使用CB-S来验证OV5640有横条纹fpscamera+SPI2.0成功_20171114_1443没有外层目录.7z 开发板:CB-S 1、(可选修改/调试技巧:) 除了ov5640.c之外,其它的驱动都不编译,节省编译时间! W:\ov5640_spi20_r40t\lichee\linux-3.10\drivers\media\platform\sunxi-vfe\device\Makefile obj-m += ov5640.o #obj-m += ov2640.o #obj-m += ov7736.o #obj-m += s5k4ec.o #obj-m += s5k4ec_mipi.o #obj-m += gc2035.o #obj-m += gt2005.o #obj-m += gc0307.o #obj-m += gc0308.o #obj-m += gc0328.o #obj-m += gc0328c.o #obj-m += gc2145.o #obj-m += gc0329.o #obj-m += gc0311.o #obj-m += hi253.o #obj-m += sp2518.o #obj-m += sp2519.o #obj-m += sp0718.o #obj-m += sp0838.o #obj-m += ov16825.o #obj-m += ov5650.o #obj-m += ov5647.o #obj-m += ov5647_mipi.o #obj-m += t8et5.o #obj-m += s5k4e1.o #obj-m += s5k4e1_mipi.o #obj-m += sp2518.o #obj-m += sp0718.o #obj-m += gc5004.o #obj-m += gc5004_mipi.o #obj-m += ov5648.o #obj-m += ar0330.o #obj-m += ov5648.o #obj-m += sp5408.o #obj-m += ov12830.o #obj-m += ov8825.o #obj-m += ov8850.o #obj-m += gc2155.o #obj-m += ov8858.o #obj-m += ov13850.o #obj-m += imx214.o #obj-m += ov8858_4lane.o #obj-m += sp5409.o #obj-m += s5k5e2yx.o #obj-m += ov2710_mipi.o #obj-m += ov2686.o (这里是看ov5640的驱动的probe执行是否正确?设备ID是否读取成功!) W:\ov5640_spi20_r40t\lichee\linux-3.10\drivers\media\platform\sunxi-vfe\device\ov5640.c static int sensor_detect(struct v4l2_subdev *sd) { data_type rdval; printk("****wyb %s:%d/%s()! \n", __FILE__, __LINE__, __func__); LOG_ERR_RET(sensor_read(sd, 0x300a, &rdval;)) printk("****wyb %s:%d/%s()! 0x300a rdval=0xx\n", __FILE__, __LINE__, __func__, rdval); if(rdval != 0x56) return -ENODEV; LOG_ERR_RET(sensor_read(sd, 0x300b, &rdval;)) printk("****wyb %s:%d/%s()! 0x300b rdval=0xx\n", __FILE__, __LINE__, __func__, rdval); if(rdval != 0x40) return -ENODEV; return 0; } (在全志R16平台改过这个文件,让摄像头不要休眠,但是全志R40平台的tina v2.1系统下不需要修改!) W:\ov5640_spi20_r40t\lichee\linux-3.10\drivers\media\platform\sunxi-vfe\vfe.c 2、(可
2017/8/24 14:04 R:\wyb\thl_r16_tinav2.0_hm1375\lichee\linux-3.4\drivers\media\video\sunxi-vfe\device\hm1375.c 2¡¢ R:\wyb\thl_r16_tinav2.0_hm1375\lichee\linux-3.4\drivers\media\video\sunxi-vfe\device\Makefile EXTRA_LDFLAGS += --strip-debug ifneq ($(strip $(CONFIG_ARCH_SUN8IW8)),) obj-$(CONFIG_OV2710_MIPI)+= ov2710_mipi.o obj-$(CONFIG_OV4689)+= ov4689.o obj-$(CONFIG_OV4689_60FPS)+= ov4689_60fps.o obj-$(CONFIG_AR0330_MIPI)+= ar0330_mipi.o obj-$(CONFIG_OV4689_SDV)+= ov4689_sdv.o obj-$(CONFIG_GC1004_MIPI)+= gc1004_mipi.o obj-$(CONFIG_H22_MIPI)+= h22_mipi.o obj-$(CONFIG_NT99231_MIPI)+= nt99231_mipi.o else obj-m+= hm1375.o #obj-m+= ov5640.o #obj-m+= ov2640.o #obj-m+= ov7736.o #obj-m+= s5k4ec.o #obj-m+= s5k4ec_mipi.o #obj-m+= gc2035.o #obj-m+= gt2005.o #obj-m+= gc0307.o #obj-m+= gc0308.o #obj-m+= gc0328.o #obj-m+= gc0328c.o #obj-m+= gc0329.o #obj-m+= gc0311.o #obj-m+= hi253.o #obj-m+= sp2518.o #obj-m+= sp2519.o #obj-m+= sp0718.o #obj-m+= sp0838.o #obj-m+= ov16825.o #obj-m+= ov5650.o #obj-m+= ov5647.o #obj-m+= ov5647_mipi.o #obj-m+= t8et5.o #obj-m+= s5k4e1.o #obj-m+= s5k4e1_mipi.o #obj-m+= sp2518.o #obj-m+= sp0718.o #obj-m+= gc5004.o #obj-m+= gc5004_mipi.o #obj-m+= ov5648.o #obj-m+= ar0330.o #obj-m+= ov5648.o #obj-m+= sp5408.o #obj-m+= ov12830.o #obj-m+= ov8825.o #obj-m+= ov8850.o #obj-m+= gc2155.o #obj-m+= gc2145.o #obj-m+= gc2145d.o #obj-m+= ov8858.o #obj-m+= ov13850.o #obj-m+= imx214.o #obj-m+= ov8858_4lane.o #obj-m+= sp5409.o #obj-m+= s5k5e2yx.o #obj-m+= ov2710_mipi.o #obj-m+= siv121d.o #obj-m+= ov2710_mipi.o #obj-m+= bg0703.o #obj-m+= gc1014_mipi.o #obj-m+= imx219.o #obj-m+= imx224.o #obj-m+= imx322.o #obj-m+= ov8858_r2a_4lane.o #obj-m+= ov8865_4lane.o #obj-m+= ps1210.o #obj-m+= imx291.o endif 3¡¢ÈÃtinav2.0Æô¶¯Ö®ºó²»ÈÃÉãÏñÍ·cameraÐÝÃߣº R:\wyb\thl_r16_tinav2.0_hm1375\lichee\linux-3.4\drivers\media\video\sunxi-vfe\vfe.c static void probe_work_handle(struct work_struct *work) { struct vfe_dev *dev= container_of(work, struct vfe_dev, probe_work.work); int ret = 0; int input_num; int device_valid_count = 0; struct video_device *vfd; char vfe_name[16] = {0}; mutex_lock(&probe_hdl_lock); vfe_print("probe_work_handle start!\n"); vfe_dbg(0,"v4l2_device_register\n"); #ifdef USE_SPECIFIC_CCI vfe_clk_open(dev); #endif /* v4l2 device register */ ret = v4l2_device_register(&dev->pdev->dev, &dev->v4l2_dev); if (ret) { vfe_err("Error registering v4l2 device\n"); goto probe_hdl_free_dev; } dev_set_drvdata(&dev->pdev->dev, (dev)); vfe_dbg(0,"v4l2 subdev register\n"); /* v4l2 subdev register */ dev->is_same_module = 0; for(input_num=0; input_num<dev->dev_qty; input_num++) { vfe_print("v4l2 subdev register input_num = %d\n",input_num); if(!strcmp(dev->ccm_cfg[input_num]->ccm,"")) { vfe_err("Sensor name is NULL!\n"); goto snesor_register_end; } if(dev->is_same_module) { dev->ccm_cfg[input_num]->sd = dev->ccm_cfg[input_num-1]->sd; vfe_dbg(0,"num = %d , sd_0 = %p,sd_1 = %p\n",input_num,dev->ccm_cfg[input_num]->sd,dev->ccm_cfg[input_num-1]->sd); goto snesor_register_end; } if((dev->dev_qty > 1) && (input_num+1<dev->dev_qty)) { if((!strcmp(dev->ccm_cfg[input_num]->ccm,dev->ccm_cfg[input_num+1]->ccm))) dev->is_same_module = 1; } if(dev->vip_define_sensor_list == 1) { if(dev->ccm_cfg[input_num]->sensor_cfg_ini->power_settings_enable == 1) { cpy_ccm_power_settings(dev->ccm_cfg[input_num]); } } #ifdef _REGULATOR_CHANGE_ #else if(vfe_device_regulator_get(dev->ccm_cfg[input_num])) { vfe_err("vfe_device_regulator_get error at input_num = %d\n",input_num); goto snesor_register_end; } #endif vfe_print("vfe sensor detect start! input_num = %d\n",input_num); dev->input = input_num; if(vfe_sensor_register_check(dev,&dev->v4l2_dev,dev->ccm_cfg[input_num],&dev->dev_sensor[input_num],input_num) == NULL) { vfe_err("vfe sensor register check error at input_num = %d\n",input_num); dev->device_valid_flag[input_num] = 0; //goto snesor_register_end; } else{ dev->device_valid_flag[input_num] = 1; device_valid_count ++; } if(dev->ccm_cfg[input_num]->is_isp_used && dev->ccm_cfg[input_num]->is_bayer_raw) { if(read_ini_info(dev,input_num, "/system/etc/hawkview/")) { vfe_warn("read ini info fail\n"); } } if(dev->ccm_cfg[input_num]->act_used == 1) { dev->dev_act[input_num].addr = (unsigned short)(dev->ccm_cfg[input_num]->act_slave>>1); strcpy(dev->dev_act[input_num].type,dev->ccm_cfg[input_num]->act_name); if(vfe_actuator_subdev_register(dev,dev->ccm_cfg[input_num], &dev->dev_act[input_num]) != 0) ;//goto probe_hdl_free_dev; } snesor_register_end: vfe_dbg(0,"dev->ccm_cfg[%d] = %p\n",input_num,dev->ccm_cfg[input_num]); vfe_dbg(0,"dev->ccm_cfg[%d]->sd = %p\n",input_num,dev->ccm_cfg[input_num]->sd); vfe_dbg(0,"dev->ccm_cfg[%d]->power.iovdd = %p\n",input_num,dev->ccm_cfg[input_num]->power.iovdd); vfe_dbg(0,"dev->ccm_cfg[%d]->power.avdd = %p\n",input_num,dev->ccm_cfg[input_num]->power.avdd); vfe_dbg(0,"dev->ccm_cfg[%d]->power.dvdd = %p\n",input_num,dev->ccm_cfg[input_num]->power.dvdd); vfe_dbg(0,"dev->ccm_cfg[%d]->power.afvdd = %p\n",input_num,dev->ccm_cfg[input_num]->power.afvdd); } dev->input = -1; /*video device register */ ret = -ENOMEM; vfd = video_device_alloc(); if (!vfd) { goto probe_hdl_unreg_dev; } *vfd = vfe_template[dev->id]; vfd->v4l2_dev = &dev->v4l2_dev; sprintf(vfe_name,"vfe-%d",dev->id); dev_set_name(&vfd->dev, vfe_name); if (0 != device_valid_count) { ret = video_register_device(vfd, VFL_TYPE_GRABBER, dev->id); if (ret < 0) { goto probe_hdl_rel_vdev; } } video_set_drvdata(vfd, dev); /*add device list*/ /* Now that everything is fine, let's add it to device list */ list_add_tail(&dev->devlist, &devlist); dev->vfd = vfd; vfe_print("V4L2 device registered as %s\n",video_device_node_name(vfd)); /*initial video buffer queue*/ videobuf_queue_dma_contig_init(&dev->vb_vidq, &vfe_video_qops, NULL, &dev->slock, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE,//default format, can be changed by s_fmt sizeof(struct vfe_buffer), dev,NULL); ret = sysfs_create_group(&dev->pdev->dev.kobj, &vfe_attribute_group); #ifdef CONFIG_ES dev->early_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB + 1; dev->early_suspend.suspend = vfe_early_suspend; dev->early_suspend.resume = vfe_late_resume; // [hawkview_err]xxxxcan't open /dev/video0(Resource temporarily unavailable) // 2016/10/25 14:33 wenyuanbo cloase suspend. // register_early_suspend(&dev->early_suspend); vfe_print("register_early_suspend @ probe handle!\n"); #endif #ifdef USE_SPECIFIC_CCI vfe_clk_close(dev); #endif vfe_print("probe_work_handle end!\n"); mutex_unlock(&probe_hdl_lock); return ; probe_hdl_rel_vdev: video_device_release(vfd); vfe_print("video_device_release @ probe_hdl!\n"); probe_hdl_unreg_dev: vfe_print("v4l2_device_unregister @ probe_hdl!\n"); v4l2_device_unregister(&dev->v4l2_dev); probe_hdl_free_dev: vfe_print("vfe_resource_release @ probe_hdl!\n"); #ifdef USE_SPECIFIC_CCI csi_cci_exit_helper(dev->cci_sel); vfe_clk_close(dev); #endif //vfe_resource_release(dev); vfe_err("Failed to install at probe handle\n"); mutex_unlock(&probe_hdl_lock); return ; } 4¡¢ R:\wyb\thl_r16_tinav2.0_hm1375\package\allwinner\cameratest\src\common\hawkview.c int fetch_sub_cmd(const char* buf,int buf_len,char** cmd,int* cmd_num,int lenght) { int i = 0,j = 0,n = 0; while(buf[i] != '#'){ //the sub cmd end by '#' while(buf[i] != 'x' && buf[i] != ':' && buf[i] != '#') { if((i+1) > buf_len) return 0; ÐÞ¸ÄΪ£º if(i++ > buf_len) return 0; *((char*)cmd + n*lenght + j++) = buf[i++]; if(j > lenght) { hv_err("sub cmd over long\n"); *cmd_num = n + 1; return -1; } } *((char*)cmd + n*lenght + j++) = '\0'; n++; j = 0; if(buf[i] != '#'){ i++; } if(n > *cmd_num){ hv_err("the max cmd num is %d\n",*cmd_num); return -1; } } *cmd_num = n; return 0; } R:\wyb\thl_r16_tinav2.0_hm1375\package\allwinner\cameratest\src\common\video.c static int capture_frame(void* capture,int (*set_disp_addr)(int,int,unsigned int*),pthread_mutex_t* mutex) { capture_handle* cap = (capture_handle*)capture; int ret; int i; struct v4l2_buffer buf; enum v4l2_buf_type type; fd_set fds; struct timeval tv; pthread_mutex_lock(mutex); //used for cammand and status debug if (old_vi_cmd != cap->cmd){ hv_dbg("capture frame command %d --> %d\n",old_vi_cmd,cap->cmd); old_vi_cmd = (int)cap->cmd; } if(old_status != cap->status){ hv_dbg("capture frame status %d --> %d\n",old_status,cap->status); old_status = cap->status; } if(cap->status == OFF && cap->cmd == START_STREAMMING){ hv_dbg("capture start streaming\n"); type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (ioctl(videofh, VIDIOC_STREAMON, &type) == -1) { hv_err("VIDIOC_STREAMON error! %s\n",strerror(errno)); goto quit; } cap->status = ON; cap->cmd = COMMAND_UNUSED; pthread_mutex_unlock(mutex); return 0; } if(cap->status == ON && cap->cmd == STOP_STREAMMING){ hv_dbg("capture stop streaming\n"); type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if(-1 == ioctl(videofh, VIDIOC_STREAMOFF, &type)){ hv_err("VIDIOC_STREAMOFF error! %s\n",strerror(errno)); goto quit; } cap->status = OFF; cap->cmd = COMMAND_UNUSED; capture_quit(capture); pthread_mutex_unlock(mutex); return 2; } if(cap->status == OFF) { pthread_mutex_unlock(mutex); return 0; } FD_ZERO(&fds); FD_SET(videofh, &fds); tv.tv_sec = 2; tv.tv_usec = 0; pthread_mutex_unlock(mutex); ret = select(videofh + 1, &fds, NULL, NULL, &tv); pthread_mutex_lock(mutex); //hv_dbg("select video ret: %d\n",ret); if (ret == -1) { if (errno == EINTR) { return 0; } hv_err("select error\n"); goto stream_off; } else if (ret == 0) { hv_err("select timeout\n"); pthread_mutex_unlock(mutex); return 0; } memset(&buf, 0, sizeof(struct v4l2_buffer)); buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.memory = V4L2_MEMORY_MMAP; ret = ioctl(videofh, VIDIOC_DQBUF, &buf); if (ret == -1) { hv_err("VIDIOC_DQBUF failed!\n"); goto stream_off; } float framerate; framerate = get_framerate((long long)(buf.timestamp.tv_sec),(long long)(buf.timestamp.tv_usec)); if(framerate > 1.0){ cap->cap_fps = framerate; //hv_dbg("framerate: %0.2ffps\n",cap->cap_fps); } //sync capture info perp x second #define M_SECOND 200 if(is_x_msec(M_SECOND,(long long)(buf.timestamp.tv_sec),(long long)(buf.timestamp.tv_usec))){ getExifInfo(&(cap->frame.exif)); set_cap_info((void*)cap); ÐÞ¸ÄΪ£º // set_cap_info((void*)cap); } if(cap->cmd == STOP_SAVE_FRAME && cap->save_status == ON) cap->save_status = OFF; //save frame , the frame will be get by PC Tool to preview on PC screen //frame format: /dev/frame_x (x:0~21) if(cap->cmd == SAVE_FRAME || cap->save_status == ON ) { if(cap->cmd == SAVE_FRAME){ cap->save_status = ON; cap->cmd = COMMAND_UNUSED; } ret = do_save_frame(capture,buf.index); } //take yuv image,it will save the target frame exif info in the same time //image name: xxxx (set by usered through command) //exif info name: xxxx.exif if(cap->cmd == SAVE_IMAGE ) { ret = 0;//getExifInfo(&(cap->picture.exif)); //get target frame exif info successfully then save the target image //if get the exif info fail,it will try next frame if(ret == 0){ buffers[buf.index].phy_addr = buf.m.offset - 0x20000000; hv_dbg("index: %d buffers[buf.index].start = %p\n",buf.index,buffers[buf.index].start); //do_save_image(capture,buf.index); do_save_sub_image(capture,buf.index); cap->cmd = COMMAND_UNUSED; } } //get display addr int w,h; unsigned int addr; get_disp_addr(capture, buf.m.offset,&addr,&w,&h); // set disp buffer if (set_disp_addr){ set_disp_addr(w,h,&addr); } ret = ioctl(videofh, VIDIOC_QBUF, &buf); if (ret == -1) { hv_err("VIDIOC_DQBUF failed!\n"); goto stream_off; } pthread_mutex_unlock(mutex); return 0; stream_off: hv_err("err stream off\n"); ioctl(videofh, VIDIOC_STREAMOFF, &type); quit: capture_quit(capture); pthread_mutex_unlock(mutex); return -1; } R:\wyb\thl_r16_tinav2.0_hm1375\package\allwinner\cameratest\src\common\video_helper.c int set_cap_info(void* capture) { char info[500]; char exif[500]; char file_path[20]; capture_handle* cap = (capture_handle*)capture; memset(info,0,sizeof(info)); strcpy(file_path,"dev/info"); ÐÞ¸ÄΪ£º //strcpy(file_path, "dev/info"); sprintf(file_path, "%s/%s.info", PATH, cap->picture.path_name); //sync string: sensor_type:save_status:framrate:capture_w:capture_h,sub_w,sub_h# sprintf(info, \ "sensor_type = %s\n" \ "status = %d\n" \ "framerate = %0.2f\n" \ "subchanel_width = %d\n" \ "subchanel_height = %d\n" \ "rotation = %d\n\n", \ (cap->sensor_type == 1)?"raw":"yuv", \ cap->save_status, \ cap->cap_fps, \ cap->sub_w, \ cap->sub_h, \ cap->sub_rot); make_exif_info(exif,"none",&(cap->frame.exif),cap->cap_w,cap->cap_h); strcat(info,exif); //hv_dbg("info str:\n%s\n",info); return write_file(file_path,info,sizeof(info)); } int do_save_sub_image(void* capture,int buf_index) { int ret; char image_name[30]; capture_handle* cap = (capture_handle*)capture; memset(image_name,0,sizeof(image_name)); sprintf(image_name,"%s/%s", PATH,cap->picture.path_name); hv_dbg("image_name: %s\n",image_name); £¨½¨ÒéÔö¼ÓÕâÀ set_cap_info(capture); set_exif_info(capture); hv_dbg("--------set_exif_info end\n"); void* vir_sub_start = NULL; unsigned int phy_sub_start = 0; int w,h; if(cap->sensor_type == V4L2_SENSOR_TYPE_RAW){ vir_sub_start = (unsigned int)(buffers[buf_index].start) + ALIGN_4K(ALIGN_16B(cap->cap_w) * cap->cap_h * 3 >> 1); phy_sub_start = buffers[buf_index].phy_addr + ALIGN_4K(ALIGN_16B(cap->cap_w) * cap->cap_h * 3 >> 1); w = cap->sub_w; h = cap->sub_h; } else { vir_sub_start = buffers[buf_index].start; phy_sub_start = buffers[buf_index].phy_addr; w = cap->cap_w; h = cap->cap_h; } #ifdef ANDROID_ENV ret = save_jpeg_frame(image_name,phy_sub_start,w,h); //sprintf(image_name,"/data/camera/yuv%s", cap->picture.path_name); //ret = save_jpeg_frame_by_viraddr(image_name,(void*)vir_sub_start,cap->sub_w,cap->sub_h); #else sprintf(image_name,"%s/yuv%s", PATH,cap->picture.path_name); ret = save_frame_to_file(image_name, \ (void*)(vir_sub_start), \ w,h,cap->cap_fmt, \ 1); #endif if(ret == -1) hv_err("save image failed!\n"); return 0; } 5¡¢¿ÉÑ¡Ôö¼Ófpscamera£º R:\wyb\thl_r16_tinav2.0_hm1375\package\allwinner\fpscamera 6¡¢ define KernelPackage/sunxi-vfe SUBMENU:=$(VIDEO_MENU) TITLE:=sunxi-vfe support FILES:=$(LINUX_DIR)/drivers/media/video/videobuf-core.ko FILES+=$(LINUX_DIR)/drivers/media/video/videobuf-dma-contig.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/csi_cci/cci.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/vfe_os.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/vfe_subdev.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/device/gc0308.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/vfe_v4l2.ko AUTOLOAD:=$(call AutoLoad,90,videobuf-core videobuf-dma-contig cci vfe_os vfe_subdev gc0308 vfe_v4l2) endef ÐÞ¸ÄΪ£º define KernelPackage/sunxi-vfe SUBMENU:=$(VIDEO_MENU) TITLE:=sunxi-vfe support FILES:=$(LINUX_DIR)/drivers/media/video/videobuf-core.ko FILES+=$(LINUX_DIR)/drivers/media/video/videobuf-dma-contig.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/csi_cci/cci.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/vfe_os.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/vfe_subdev.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/device/hm1375.ko FILES+=$(LINUX_DIR)/drivers/media/video/sunxi-vfe/vfe_v4l2.ko AUTOLOAD:=$(call AutoLoad,90,videobuf-core videobuf-dma-contig cci vfe_os vfe_subdev hm1375 vfe_v4l2) endef 7¡¢ R:\wyb\thl_r16_tinav2.0_hm1375\target\allwinner\astar-parrot\configs\sys_config.fex ;---------------------------------------------------------------------------------- ;dcdc1_vol ---set dcdc1 voltage,mV,1600-3400,100mV/step ;dcdc2_vol ---set dcdc2 voltage,mV,600-1540,20mV/step ;dcdc3_vol ---set dcdc3 voltage,mV,600-1860,20mV/step ;dcdc4_vol ---set dcdc4 voltage,mV,600-1540,20mV/step ;dcdc5_vol ---set dcdc5 voltage,mV,1000-2550,50mV/step ;aldo2_vol ---set aldo2 voltage,mV,700-3300,100mV/step ;aldo3_vol ---set aldo3 voltage,mV,700-3300,100mV/step ;---------------------------------------------------------------------------------- [power_sply] dcdc1_vol = 3000 dcdc2_vol = 1100 dcdc3_vol = 1200 dcdc4_vol = 0 dcdc5_vol = 1500 aldo2_vol = 2500 aldo3_vol = 3000 dldo3_vol = 2800 ;gpio0_vol = 2800 ldoio0_vol = 2800 [twi2] twi_used = 1 twi_scl = port:PE12<3><default><default><default> twi_sda = port:PE13<3><default><default><default> ;-------------------------------------------------------------------------------- ;vip (video input port) configuration ;vip_used: 0:disable 1:enable ;vip_mode: 0:sample one interface to one buffer 1:sample two interface to one buffer ;vip_dev_qty: The quantity of devices linked to capture bus ; ;vip_define_sensor_list: If you want use sensor detect function, please set vip_define_sensor_list = 1, and ; verify that file /system/etc/hawkview/sensor_list_cfg.ini is properly configured! ; ;vip_dev(x)_pos: sensor position, "rear" or "front", if vip_define_sensor_list = 1,vip_dev(x)_pos must be configured! ; ;vip_dev(x)_isp_used 0:not use isp 1:use isp ;vip_dev(x)_fmt: 0:yuv 1:bayer raw rgb ;vip_dev(x)_stby_mode: 0:not shut down power at standby 1:shut down power at standby ;vip_dev(x)_vflip: flip in vertical direction 0:disable 1:enable ;vip_dev(x)_hflip: flip in horizontal direction 0:disable 1:enable ;vip_dev(x)_iovdd: camera module io power handle string, pmu power supply ;vip_dev(x)_iovdd_vol: camera module io power voltage, pmu power supply ;vip_dev(x)_avdd: camera module analog power handle string, pmu power supply ;vip_dev(x)_avdd_vol: camera module analog power voltage, pmu power supply ;vip_dev(x)_dvdd: camera module core power handle string, pmu power supply ;vip_dev(x)_dvdd_vol: camera module core power voltage, pmu power supply ;vip_dev(x)_afvdd: camera module vcm power handle string, pmu power supply ;vip_dev(x)_afvdd_vol: camera module vcm power voltage, pmu power supply ;x indicates the index of the devices which are linked to the same capture bus ;fill voltage in uV, e.g. iovdd = 2.8V, vip_devx_iovdd_vol = 2800000 ;fill handle string as below: ;axp22_eldo3 ;axp22_dldo4 ;axp22_eldo2 ;fill handle string "" when not using any pmu power supply ;-------------------------------------------------------------------------------- [csi0] vip_used = 1 vip_mode = 0 vip_dev_qty = 1 vip_define_sensor_list = 0 vip_csi_pck = port:PE00<2><default><default><default> vip_csi_mck = port:PE01<2><default><default><default> vip_csi_hsync = port:PE02<2><default><default><default> vip_csi_vsync = port:PE03<2><default><default><default> vip_csi_d0 = port:PE04<2><default><default><default> vip_csi_d1 = port:PE05<2><default><default><default> vip_csi_d2 = port:PE06<2><default><default><default> vip_csi_d3 = port:PE07<2><default><default><default> vip_csi_d4 = port:PE08<2><default><default><default> vip_csi_d5 = port:PE09<2><default><default><default> vip_csi_d6 = port:PE10<2><default><default><default> vip_csi_d7 = port:PE11<2><default><default><default> ;vip_csi_sck = port:PE12<2><default><default><default> ;vip_csi_sda = port:PE13<2><default><default><default> vip_dev0_mname = "hm1375" vip_dev0_pos = "rear" vip_dev0_lane = 1 vip_dev0_twi_id = 2 vip_dev0_twi_addr = 0x48 vip_dev0_isp_used = 0 vip_dev0_fmt = 0 £¨µ÷ÊÔµÄʱºòÍƼöÑ¡0£¬¸øÉãÏñͷʱÖÓ¹©µç£¬·½±ã²âÁ¿µçѹ£º£© vip_dev0_stby_mode = 0 vip_dev0_vflip = 0 vip_dev0_hflip = 0 vip_dev0_iovdd = "" vip_dev0_iovdd_vol = 2800000 vip_dev0_avdd = "axp22_ldoio0" vip_dev0_avdd_vol = 2800000 vip_dev0_dvdd = "" vip_dev0_dvdd_vol = 1800000 vip_dev0_afvdd = "" vip_dev0_afvdd_vol = 2800000 vip_dev0_power_en = vip_dev0_reset = port:PE14<1><default><default><0> vip_dev0_pwdn = port:PE15<1><default><default><1> vip_dev0_flash_en = vip_dev0_flash_mode = vip_dev0_af_pwdn = 8¡¢¿ÉÑ¡£º rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ make menuconfig Äں˵ÄÐ޸ı£´æÔÚÕâÀ R:\wyb\thl_r16_tinav2.0_hm1375\target\allwinner\astar-parrot\config-3.4 rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ make menuconfig ϵͳµÄÐ޸ı£´æÔÚÕâÀ R:\wyb\thl_r16_tinav2.0_hm1375\target\allwinner\astar-parrot\defconfig 9¡¢ÎªÁ˵÷ÊÔ·½±ã£¬¿ÉÑ¡Ð޸ģº R:\wyb\thl_r16_tinav2.0_hm1375\target\allwinner\generic\configs\env.cfg bootdelay=3 #default bootcmd, will change at runtime according to key press bootcmd=run setargs_nand boot_normal#default nand boot #kernel command arguments console=ttyS0,115200 nor_root=/dev/mtdblock4 nand_root=/dev/nandd mmc_root=/dev/mmcblk0p7 init=/sbin/init loglevel=8 #set kernel cmdline if boot.img or recovery.img has no cmdline we will use this setargs_nor=setenv bootargs console=${console} root=${nor_root} rootwait init=${init} ion_cma_list="8m,32m,64m,128m,256m"loglevel=${loglevel} partitions=${partitions} setargs_nand=setenv bootargs console=${console} root=${nand_root} rootwait init=${init} ion_cma_list="8m,32m,64m,128m,256m" loglevel=${loglevel} partitions=${partitions} setargs_mmc=setenv bootargs console=${console} root=${mmc_root} rootwait init=${init} ion_cma_list="8m,32m,64m,128m,256m" loglevel=${loglevel} partitions=${partitions} #nand command syntax: sunxi_flash read address partition_name read_bytes #0x40007800 = 0x40008000(kernel entry) - 0x800(boot.img header 2k) boot_normal=fatload sunxi_flash boot 43800000 uImage;bootm 43800000 boot_recovery=fatload sunxi_flash extend 43800000 uImage;bootm 43800000 boot_fastboot=fastboot #recovery key recovery_key_value_max=0x13 recovery_key_value_min=0x10 #fastboot key fastboot_key_value_max=0x8 fastboot_key_value_min=0x2 10¡¢ÏȱàÒëÒ»±étianv2.0µÄϵͳ£¬È»ºóÔö¼Ósunxi-vfe supportÖ§³Ö£º rootroot@rootroot-E400:~$ cd wyb/thl_r16_tinav2.0_hm1375/ rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ 7za x thl_r16_tinav2.0_hm1375µÈ´ý×îÖÕÑéÖ¤_20170824_1141.7z -r -o./ rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ source build/envsetup.sh including target/allwinner/octopus-dev/vendorsetup.sh including target/allwinner/astar-parrot/vendorsetup.sh including target/allwinner/astar-evb/vendorsetup.sh including target/allwinner/generic/vendorsetup.sh including target/allwinner/tulip-d1/vendorsetup.sh including target/allwinner/astar-spk/vendorsetup.sh rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ lunch You're building on Linux Lunch menu... pick a combo: 1. octopus_dev-tina 2. octopus_dev-dragonboard 3. astar_parrot-tina 4. astar_parrot-dragonboard 5. astar_evb-tina 6. tulip_d1-tina 7. tulip_d1-dragonboard 8. astar_spk-tina 9. astar_spk-dragonboard Which would you like?3 ============================================ PLATFORM_VERSION_CODENAME=Neptune PLATFORM_VERSION=2.0.0 TARGET_PRODUCT=astar_parrot TARGET_BUILD_VARIANT=tina TARGET_BUILD_TYPE=release TARGET_BUILD_APPS= TARGET_ARCH=arm TARGET_ARCH_VARIANT=armv7-a-neon TARGET_CPU_VARIANT=cortex-a7 TARGET_2ND_ARCH= TARGET_2ND_ARCH_VARIANT= TARGET_2ND_CPU_VARIANT= HOST_ARCH=x86_64 HOST_OS=linux HOST_OS_EXTRA=Linux-3.13.0-24-generic-x86_64-with-Ubuntu-14.04-trusty HOST_BUILD_TYPE=release BUILD_ID=57513AA3 OUT_DIR= ============================================ rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ make -j8 rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ pack -d rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ make menuconfig Allwinner ---> < > fpscamera................................. fpscamera just test the camera ÐÞ¸ÄΪ£º <*> fpscamera................................. fpscamera just test the camera Kernel modules ---> Video Support ---> < > kmod-sunxi-vfe......................................... sunxi-vfe support ÐÞ¸ÄΪ£º <*> kmod-sunxi-vfe......................................... sunxi-vfe support rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ make -j12 rootroot@rootroot-E400:~/wyb/thl_r16_tinav2.0_hm1375$ pack -d 11¡¢¼ÓÔØhm1375µÄÇý¶¯µÄʱºò²é¿´I2CÊÇ·ñÊÇͨµÄ£º R:\wyb\thl_r16_tinav2.0_hm1375\lichee\linux-3.4\drivers\media\video\sunxi-vfe\device\hm1375.c static int sensor_detect(struct v4l2_subdev *sd) { int ret; unsigned char rdval; printk("****wyb %s:%d/%s()! verify HM1375\n", __FILE__, __LINE__, __func__); LOG_ERR_RET(sensor_read(sd, 0x0001, &rdval)) ret = sensor_read(sd, 0x0001,&rdval); printk("****wyb %s:%d/%s()! reg:0x0001=value:0xx right=0x03/0x13\n", __FILE__, __LINE__, __func__, rdval); if (ret < 0) { vfe_dev_err("sensor_read err at sensor_detect!\n"); return ret; } if((rdval != 0x03) && (rdval != 0x13)) { vfe_dev_err("read high val: %d\n", rdval); return -ENODEV; } LOG_ERR_RET(sensor_read(sd, 0x0002, &rdval)) printk("****wyb %s:%d/%s()! reg:0x0002=value:0xx right=0x75\n", __FILE__, __LINE__, __func__, rdval); if(rdval != 0x75) { vfe_dev_err("read low val: %d\n", rdval); return -ENODEV; } printk("HM1375 sensor_detect OK\r\n"); return 0; } £¨Ææ¹ÖµÄʱºòHM1375µÄ0x0001ºÅ¼Ä´æÆ÷£¬µÚÒ»´Î¶ÁÊÇ0x03£¬ÒÔºó¶¼ÊÇ0x13£¬ºÃÉñÆ棡£© [ 16.030894] ****wyb drivers/media/video/sunxi-vfe/device/hm1375.c:2891/sensor_detect()! verify HM1375 [ 16.042100] ****wyb drivers/media/video/sunxi-vfe/device/hm1375.c:2895/sensor_detect()! reg:0x0001=value:0x03 right=0x03/0x13 [ 16.055259] ****wyb drivers/media/video/sunxi-vfe/device/hm1375.c:2909/sensor_detect()! reg:0x0002=value:0x75 right=0x75 [ 16.067560] HM1375 sensor_detect OK [ 47.398156] ****wyb drivers/media/video/sunxi-vfe/device/hm1375.c:2891/sensor_detect()! verify HM1375 [ 47.409351] ****wyb drivers/media/video/sunxi-vfe/device/hm1375.c:2895/sensor_detect()! reg:0x0001=value:0x13 right=0x03/0x13 [ 47.422492] ****wyb drivers/media/video/sunxi-vfe/device/hm1375.c:2909/sensor_detect()! reg:0x0002=value:0x75 right=0x75 [ 47.434769] HM1375 sensor_detect OK [ 88.217828] ****wyb drivers/media/video/sunxi-vfe/device/hm1375.c:2891/sensor_detect()! verify HM1375 [ 88.228920] ****wyb drivers/media/video/sunxi-vfe/device/hm1375.c:2895/sensor_detect()! reg:0x0001=value:0x13 right=0x03/0x13 [ 88.242056] ****wyb drivers/media/video/sunxi-vfe/device/hm1375.c:2909/sensor_detect()! reg:0x0002=value:0x75 right=0x75 [ 88.254325] HM1375 sensor_detect OK
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define;.amd?define([],e):"object"==typeof exports?exports.Hls=e():t.Hls=e()}(this,function(){return function(t){function e(i){if(r[i])return r[i].exports;var a=r[i]={i:i,l:!1,exports:{}};return t[i].call(a.exports,a,a.exports,e),a.l=!0,a.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,i){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/hls.js/dist/",e(e.s=7)}([function(t,e,r){"use strict";function i(){}function a(t,e){return e="["+t+"] > "+e}function n(t){var e=self.console[t];return e?function(){for(var r=arguments.length,i=Array(r),n=0;n1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];r.forEach(function(e){u[e]=t[e]?t[e].bind(t):n(e)})}r.d(e,"a",function(){return d}),r.d(e,"b",function(){return h});var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l={trace:i,debug:i,log:i,warn:i,info:i,error:i},u=l,d=function(t){if(!0===t||"object"===(void 0===t?"undefined":s(t))){o(t,"debug","log","info","warn","error");try{u.log()}catch(t){u=l}}else u=l},h=u},function(t,e,r){"use strict";e.a={MEDIA_ATTACHING:"hlsMediaAttaching",MEDIA_ATTACHED:"hlsMediaAttached",MEDIA_DETACHING:"hlsMediaDetaching",MEDIA_DETACHED:"hlsMediaDetached",BUFFER_RESET:"hlsBufferReset",BUFFER_CODECS:"hlsBufferCodecs",BUFFER_CREATED:"hlsBufferCreated",BUFFER_APPENDING:"hlsBufferAppending",BUFFER_APPENDED:"hlsBufferAppended",BUFFER_EOS:"hlsBufferEos",BUFFER_FLUSHING:"hlsBufferFlushing",BUFFER_FLUSHED:"hlsBufferFlushed",MANIFEST_LOADING:"hlsManifestLoading",MANIFEST_LOADED:"hlsManifestLoaded",MANIFEST_PARSED:"hlsManifestParsed",LEVEL_SWITCH:"hlsLevelSwitch",LEVEL_SWITCHING:"hlsLevelSwitching",LEVEL_SWITCHED:"hlsLevelSwitched",LEVEL_LOADING:"hlsLevelLoading",LEVEL_LOADED:"hlsLevelLoaded",LEVEL_UPDATED:"hlsLevelUpdated",LEVEL_PTS_UPDATED:"hlsLevelPtsUpdated",LEVEL_REMOVED:"hlsLevelRemoved",AUDIO_TRACKS_UPDATED:"hlsAudioTracksUpdated",AUDIO_TRACK_SWITCH:"hlsAudioTrackSwitch",AUDIO_TRACK_SWITCHING:"hlsAudioTrackSwitching",AUDIO_TRACK_SWITCHED:"hlsAudioTrackSwitched",AUDIO_TRACK_LOADING:"hlsAudioTrackLoading",AUDIO_TRACK_LOADED:"hlsAudioTrackLoaded",SUBTITLE_TRACKS_UPDATED:"hlsSubtitleTracksUpdated",SUBTITLE_TRACK_SWITCH:"hlsSubtitleTrackSwitch",SUBTITLE_TRACK_LOADING:"hlsSubtitleTrackLoading",SUBTITLE_TRACK_LOADED:"hlsSubtitleTrackLoaded",SUBTITLE_FRAG_PROCESSED:"hlsSubtitleFragProcessed",CUES_PARSED:"hlsCuesParsed",NON_NATIVE_TEXT_TRACKS_FOUND:"hlsNonNativeTextTracksFound",INIT_PTS_FOUND:"hlsInitPtsFound",FRAG_LOADING:"hlsFragLoading",FRAG_LOAD_PROGRESS:"hlsFragLoadProgress",FRAG_LOAD_EMERGENCY_ABORTED:"hlsFragLoadEmergencyAborted",FRAG_LOADED:"hlsFragLoaded",FRAG_DECRYPT_STARTED:"hlsFragDecryptStarted",FRAG_DECRYPTED:"hlsFragDecrypted",FRAG_PARSING_INIT_SEGMENT:"hlsFragParsingInitSegment",FRAG_PARSING_USERDATA:"hlsFragParsingUserdata",FRAG_PARSING_METADATA:"hlsFragParsingMetadata",FRAG_PARSING_DATA:"hlsFragParsingData",FRAG_PARSED:"hlsFragParsed",FRAG_BUFFERED:"hlsFragBuffered",FRAG_CHANGED:"hlsFragChanged",FPS_DROP:"hlsFpsDrop",FPS_DROP_LEVEL_CAPPING:"hlsFpsDropLevelCapping",ERROR:"hlsError",DESTROYING:"hlsDestroying",KEY_LOADING:"hlsKeyLoading",KEY_LOADED:"hlsKeyLoaded",STREAM_STATE_TRANSITION:"hlsStreamStateTransition"}},function(t,e,r){"use strict";r.d(e,"b",function(){return i}),r.d(e,"a",function(){return a});var i={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",MUX_ERROR:"muxError",OTHER_ERROR:"otherError"},a={MANIFEST_LOAD_ERROR:"manifestLoadError",MANIFEST_LOAD_TIMEOUT:"manifestLoadTimeOut",MANIFEST_PARSING_ERROR:"manifestParsingError",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"manifestIncompatibleCodecsError",MANIFEST_EMPTY_ERROR:"manifestEmptyError",LEVEL_LOAD_ERROR:"levelLoadError",LEVEL_LOAD_TIMEOUT:"levelLoadTimeOut",LEVEL_SWITCH_ERROR:"levelSwitchError",AUDIO_TRACK_LOAD_ERROR:"audioTrackLoadError",AUDIO_TRACK_LOAD_TIMEOUT:"audioTrackLoadTimeOut",FRAG_LOAD_ERROR:"fragLoadError",FRAG_LOOP_LOADING_ERROR:"fragLoopLoadingError",FRAG_LOAD_TIMEOUT:"fragLoadTimeOut",FRAG_DECRYPT_ERROR:"fragDecryptError",FRAG_PARSING_ERROR:"fragParsingError",REMUX_ALLOC_ERROR:"remuxAllocError",KEY_LOAD_ERROR:"keyLoadError",KEY_LOAD_TIMEOUT:"keyLoadTimeOut",BUFFER_ADD_CODEC_ERROR:"bufferAddCodecError",BUFFER_APPEND_ERROR:"bufferAppendError",BUFFER_APPENDING_ERROR:"bufferAppendingError",BUFFER_STALLED_ERROR:"bufferStalledError",BUFFER_FULL_ERROR:"bufferFullError",BUFFER_SEEK_OVER_HOLE:"bufferSeekOverHole",BUFFER_NUDGE_ON_STALL:"bufferNudgeOnStall",INTERNAL_EXCEPTION:"internalException",WEBVTT_EXCEPTION:"webVTTException"}},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=function(){function t(){i(this,t)}return t.isHeader=function(t,e){return e+10<=t.length&&73;===t[e]&&68;===t[e+1]&&51;===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128},t.isFooter=function(t,e){return e+10<=t.length&&51;===t[e]&&68;===t[e+1]&&73;===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]0)return e.subarray(i,i+a)},t._readSize=function(t,e){var r=0;return r=(127&t[e])<<21,r|=(127&t[e+1])<<14,r|=(127&t[e+2])<<7,r|=127&t[e+3]},t.getTimeStamp=function(e){for(var r=t.getID3Frames(e),i=0;i<r.length;i++){var a=r[i];if(t.isTimeStampFrame(a))return t._readTimeStamp(a)}},t.isTimeStampFrame=function(t){return t&&"PRIV"===t.key&&"com.apple.streaming.transportStreamTimestamp"===t.info},t._getFrameData=function(e){var r=String.fromCharCode(e[0],e[1],e[2],e[3]),i=t._readSize(e,4);return{type:r,size:i,data:e.subarray(10,10+i)}},t.getID3Frames=function(e){for(var r=0,i=[];t.isHeader(e,r);){var a=t._readSize(e,r+6);r+=10;for(var n=r+a;r+8<n;){var o=t._getFrameData(e.subarray(r)),s=t._decodeFrame(o);s&&i.push(s),r+=o.size+10}t.isFooter(e,r)&&(r+=10)}return i},t._decodeFrame=function(e){return"PRIV"===e.type?t._decodePrivFrame(e):"T"===e.type[0]?t._decodeTextFrame(e):"W"===e.type[0]?t._decodeURLFrame(e):void 0},t._readTimeStamp=function(t){if(8===t.data.byteLength){var e=new Uint8Array(t.data),r=1&e[3],i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,r&&(i+=47721858.84),Math.round(i)}},t._decodePrivFrame=function(e){if(!(e.size<2)){var r=t._utf8ArrayToStr(e.data),i=new Uint8Array(e.data.subarray(r.length+1));return{key:e.type,info:r,data:i.buffer}}},t._decodeTextFrame=function(e){if(!(e.size<2)){if("TXXX"===e.type){var r=1,i=t._utf8ArrayToStr(e.data.subarray(r));r+=i.length+1;var a=t._utf8ArrayToStr(e.data.subarray(r));return{key:e.type,info:i,data:a}}var n=t._utf8ArrayToStr(e.data.subarray(1));return{key:e.type,data:n}}},t._decodeURLFrame=function(e){if("WXXX"===e.type){if(e.size<2)return;var r=1,i=t._utf8ArrayToStr(e.data.subarray(r));r+=i.length+1;var a=t._utf8ArrayToStr(e.data.subarray(r));return{key:e.type,info:i,data:a}}var n=t._utf8ArrayToStr(e.data);return{key:e.type,data:n}},t._utf8ArrayToStr=function(t){for(var e=void 0,r=void 0,i="",a=0,n=t.length;a>4){case 0:return i;case 1:case 2:case 3:case 4:case 5:case 6:case 7:i+=String.fromCharCode(o);break;case 12:case 13:e=t[a++],i+=String.fromCharCode((31&o)<<6|63&e);break;case 14:e=t[a++],r=t[a++],i+=String.fromCharCode((15&o)<<12|(63&e)<<6|(63&r)<<0)}}return i},t}();e.a=a},function(t,e){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function a(t){return"number"==typeof t}function n(t){return"object"==typeof t&&null;!==t}function o(t){return void 0===t}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if(!a(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,r,a,s,l,u;if(this._events||(this._events={}),"error"===t&&(!this._events.error||n(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var d=new Error('Uncaught, unspecified "error" event. ('+e+")");throw d.context=e,d}if(r=this._events[t],o(r))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(n(r))for(s=Array.prototype.slice.call(arguments,1),u=r.slice(),a=u.length,l=0;l0&&this;._events[t].length>a&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console;.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function r(){this.removeListener(t,r),a||(a=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var a=!1;return r.listener=e,this.on(t,r),this},r.prototype.removeListener=function(t,e){var r,a,o,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],o=r.length,a=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this;.emit("removeListener",t,e);else if(n(r)){for(s=o;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){a=s;break}if(a>>6),(n=(60&e[r+2])>>>2)>h.length-1?void t.trigger(Event.ERROR,{type:k.b.MEDIA_ERROR,details:k.a.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+n}):(s=(1&e[r+2])<>>6,N.b.log("manifest codec:"+i+",ADTS data:type:"+a+",sampleingIndex:"+n+"["+h[n]+"Hz],channelConfig:"+s),/firefox/i.test(u)?n>=6?(a=5,l=new Array(4),o=n-3):(a=2,l=new Array(2),o=n):-1!==u.indexOf("android")?(a=2,l=new Array(2),o=n):(a=5,l=new Array(4),i&&(-1!==i.indexOf("mp4a.40.29")||-1!==i.indexOf("mp4a.40.5"))||!i&&n>=6?o=n-3:((i&&-1!==i.indexOf("mp4a.40.2")&&(n>=6&&1===s||/vivaldi/i.test(u))||!i&&1===s)&&(a=2,l=new Array(2)),o=n)),l[0]=a<>1,l[1]|=(1&n)<<7,l[1]|=s<>1,l[2]=(1&o)<<7,l[2]|=8,l[3]=0),{config:l,samplerate:h[n],channelCount:s,codec:"mp4a.40."+a,manifestCodec:d})}function l(t,e){return 255===t[e]&&240;==(246&t[e+1])}function u(t,e){return 1&t[e+1]?7:9}function d(t,e){return(3&t[e+3])<<11|t[e+4]<>>5}function h(t,e){return!!(e+1<t.length&&l(t,e))}function c(t,e){if(e+1<t.length&&l(t,e)){var r=u(t,e),i=r;e+5<t.length&&(i=d(t,e));var a=e+i;if(a===t.length||a+10&&e+n+o<=l)return s=r+i*a,{headerLength:n,frameLength:o,stamp:s}}function v(t,e,r,i,a){var n=p(t.samplerate),o=g(e,r,i,a,n);if(o){var s=o.stamp,l=o.headerLength,u=o.frameLength,d={unit:e.subarray(r+l,r+l+u),pts:s,dts:s};return t.samples.push(d),t.len+=u,{sample:d,length:u+l}}}function y(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function m(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function b(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function E(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function T(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function R(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function S(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function A(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function L(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function w(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var D=r(1),k=r(2),I=function(){function t(e,r){i(this,t),this.subtle=e,this.aesIV=r}return t.prototype.decrypt=function(t,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,t)},t}(),O=I,C=function(){function t(e,r){a(this,t),this.subtle=e,this.key=r}return t.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},t}(),P=C,x=function(){function t(){n(this,t),this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.initTable()}return t.prototype.uint8ArrayToUint32Array_=function(t){for(var e=new DataView(t),r=new Uint32Array(4),i=0;i<4;i++)r[i]=e.getUint32(4*i);return r},t.prototype.initTable=function(){var t=this.sBox,e=this.invSBox,r=this.subMix,i=r[0],a=r[1],n=r[2],o=r[3],s=this.invSubMix,l=s[0],u=s[1],d=s[2],h=s[3],c=new Uint32Array(256),f=0,p=0,g=0;for(g=0;g<256;g++)c[g]=g<128?g<<1:g<<1^283;for(g=0;g<256;g++){var v=p^p<<1^p<<2^p<<3^p<>>8^255&v^99,t[f]=v,e[v]=f;var y=c[f],m=c[y],b=c[m],E=257*c[v]^16843008*v;i[f]=E<>>8,a[f]=E<>>16,n[f]=E<>>24,o[f]=E,E=16843009*b^65537*m^257*y^16843008*f,l[v]=E<>>8,u[v]=E<>>16,d[v]=E<>>24,h[v]=E,f?(f=y^c[c[c[b^y]]],p^=c[c[p]]):f=p=1}},t.prototype.expandKey=function(t){for(var e=this.uint8ArrayToUint32Array_(t),r=!0,i=0;i<e.length&&r;)r=e[i]===this.key[i],i++;if(!r){this.key=e;var a=this.keySize=e.length;if(4!==a&&6!==a&&8!==a)throw new Error("Invalid aes key size="+a);var n=this.ksRows=4*(a+6+1),o=void 0,s=void 0,l=this.keySchedule=new Uint32Array(n),u=this.invKeySchedule=new Uint32Array(n),d=this.sBox,h=this.rcon,c=this.invSubMix,f=c[0],p=c[1],g=c[2],v=c[3],y=void 0,m=void 0;for(o=0;o<n;o++)o<a?y=l[o]=e[o]:(m=y,o%a==0?(m=m<>>24,m=d[m>>>24]<>>16&255;]<>>8&255;]<<8|d[255&m],m^=h[o/a|0]<6&&o%a==4&&(m=d[m>>>24]<>>16&255;]<>>8&255;]<>>0);for(s=0;s<n;s++)o=n-s,m=3&s?l[o]:l[o-4],u[s]=s<4||o>>24]]^p[d[m>>>16&255;]]^g[d[m>>>8&255;]]^v[d[255&m]],u[s]=u[s]>>>0}},t.prototype.networkToHostOrderSwap=function(t){return t<<24|(65280&t)<>8|t>>>24},t.prototype.decrypt=function(t,e,r){for(var i,a,n=this.keySize+6,o=this.invKeySchedule,s=this.invSBox,l=this.invSubMix,u=l[0],d=l[1],h=l[2],c=l[3],f=this.uint8ArrayToUint32Array_(r),p=f[0],g=f[1],v=f[2],y=f[3],m=new Int32Array(t),b=new Int32Array(m.length),E=void 0,T=void 0,R=void 0,S=void 0,A=void 0,_=void 0,L=void 0,w=void 0,D=void 0,k=void 0,I=void 0,O=void 0,C=this.networkToHostOrderSwap;e<m.length;){for(D=C(m[e]),k=C(m[e+1]),I=C(m[e+2]),O=C(m[e+3]),A=D^o[0],_=O^o[1],L=I^o[2],w=k^o[3],i=4,a=1;a>>24]^d[_>>16&255;]^h[L>>8&255;]^c[255&w]^o[i],T=u[_>>>24]^d[L>>16&255;]^h[w>>8&255;]^c[255&A]^o[i+1],R=u[L>>>24]^d[w>>16&255;]^h[A>>8&255;]^c[255&_]^o[i+2],S=u[w>>>24]^d[A>>16&255;]^h[_>>8&255;]^c[255&L]^o[i+3],A=E,_=T,L=R,w=S,i+=4;E=s[A>>>24]<>16&255;]<>8&255;]<>>24]<>16&255;]<>8&255;]<>>24]<>16&255;]<>8&255;]<>>24]<>16&255;]<>8&255;]<<8^s[255&L]^o[i+3],i+=3,b[e]=C(E^p),b[e+1]=C(S^g),b[e+2]=C(R^v),b[e+3]=C(T^y),p=D,g=k,v=I,y=O,e+=4}return b.buffer},t.prototype.destroy=function(){this.key=void 0,this.keySize=void 0,this.ksRows=void 0,this.sBox=void 0,this.invSBox=void 0,this.subMix=void 0,this.invSubMix=void 0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.rcon=void 0},t}(),F=x,N=r(0),M=function(){function t(e,r){o(this,t),this.observer=e,this.config=r,this.logEnabled=!0;try{var i=crypto||self.crypto;this.subtle=i.subtle||i.webkitSubtle}catch(t){}this.disableWebCrypto=!this.subtle}return t.prototype.isSync=function(){return this.disableWebCrypto&&this;.config.enableSoftwareAES},t.prototype.decrypt=function(t,e,r,i){var a=this;if(this.disableWebCrypto&&this;.config.enableSoftwareAES){this.logEnabled&&(N.b.log("JS AES decrypt"),this.logEnabled=!1);var n=this.decryptor;n||(this.decryptor=n=new F),n.expandKey(e),i(n.decrypt(t,0,r))}else{this.logEnabled&&(N.b.log("WebCrypto AES decrypt"),this.logEnabled=!1);var o=this.subtle;this.key!==e&&(this.key=e,this.fastAesKey=new P(o,e)),this.fastAesKey.expandKey().then(function(n){new O(o,r).decrypt(t,n).catch(function(n){a.onWebCryptoError(n,t,e,r,i)}).then(function(t){i(t)})}).catch(function(n){a.onWebCryptoError(n,t,e,r,i)})}},t.prototype. Error, disable WebCrypto API"),this.disableWebCrypto=!0,this.logEnabled=!0,this.decrypt(e,r,i,a)):(N.b.error("decrypting error : "+t.message),this.observer.trigger(Event.ERROR,{type:k.b.MEDIA_ERROR,details:k.a.FRAG_DECRYPT_ERROR,fatal:!0,reason:t.message}))},t.prototype.destroy=function(){var t=this.decryptor;t&&(t.destroy(),this.decryptor=void 0)},t}(),U=M,B=r(3),G=function(){function t(e,r,i){y(this,t),this.observer=e,this.config=i,this.remuxer=r}return t.prototype.resetInitSegment=function(t,e,r,i){this._audioTrack={container:"audio/adts",type:"audio",id:-1,sequenceNumber:0,isAAC:!0,samples:[],len:0,manifestCodec:e,duration:i,inputTimeScale:9e4}},t.prototype.resetTimeStamp=function(){},t.probe=function(t){if(!t)return!1;for(var e=B.a.getID3Data(t,0)||[],r=e.length,i=t.length;r<i;r++)if(c(t,r))return N.b.log("ADTS sync word found !"),!0;return!1},t.prototype.append=function(t,e,r,i){for(var a=this._audioTrack,n=B.a.getID3Data(t,0)||[],o=B.a.getTimeStamp(n),s=o?90*o:9e4*e,l=0,u=s,d=t.length,c=n.length,p=[{pts:u,dts:u,data:n}];c<d-1;)if(h(t,c)&&c+5=8){return["moof","ftyp","styp"].indexOf(t.bin2str(e.subarray(4,8)))>=0}return!1},t.bin2str=function(t){return String.fromCharCode.apply(null,t)},t.readUint32=function(t,e){t.data&&(e+=t.start,t=t.data);var r=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3];return r>24,t[e+1]=r>>16&255;,t[e+2]=r>>8&255;,t[e+3]=255&r},t.findBox=function(e,r){var i,a,n,o,s,l,u,d=[];if(e.data?(l=e.start,o=e.end,e=e.data):(l=0,o=e.byteLength),!r.length)return null;for(i=l;i1?i+a:o,n===r[0]&&(1===r.length?d.push({data:e,start:i+8,end:u}):(s=t.findBox({data:e,start:i+8,end:u},r.slice(1)),s.length&&(d=d.concat(s)))),i=u;return d},t.parseInitSegment=function(e){var r=[];return t.findBox(e,["moov","trak"]).forEach(function(e){var i=t.findBox(e,["tkhd"])[0];if(i){var a=i.data[i.start],n=0===a?12:20,o=t.readUint32(i,n),s=t.findBox(e,["mdia","mdhd"])[0];if(s){a=s.data[s.start],n=0===a?12:20;var l=t.readUint32(s,n),u=t.findBox(e,["mdia","hdlr"])[0];if(u){var d=t.bin2str(u.data.subarray(u.start+8,u.start+12)),h={soun:"audio",vide:"video"}[d];h&&(r[o]={timescale:l,type:h},r[h]={timescale:l,id:o})}}}}),r},t.getStartDTS=function(e,r){var i,a,n;return i=t.findBox(r,["moof","traf"]),a=[].concat.apply([],i.map(function(r){return t.findBox(r,["tfhd"]).map(function(i){var a,n,o;return a=t.readUint32(i,4),n=e[a].timescale||9e4,o=t.findBox(r,["tfdt"]).map(function(e){var r,i;return r=e.data[e.start],i=t.readUint32(e,4),1===r&&(i*=Math.pow(2,32),i+=t.readUint32(e,8)),i})[0],(o=o||1/0)/n})})),n=Math.min.apply(null,a),isFinite(n)?n:0},t.offsetStartDTS=function(e,r,i){t.findBox(r,["moof","traf"]).map(function(r){return t.findBox(r,["tfhd"]).map(function(a){var n=t.readUint32(a,4),o=e[n].timescale||9e4;t.findBox(r,["tfdt"]).map(function(e){var r=e.data[e.start],a=t.readUint32(e,4);if(0===r)t.writeUint32(e,4,a-i*o);else{a*=Math.pow(2,32),a+=t.readUint32(e,8),a-=i*o;var n=Math.floor(a/(j+1)),s=Math.floor(a%(j+1));t.writeUint32(e,4,n),t.writeUint32(e,8,s)}})})})},t.prototype.append=function(e,r,i,a){var n=this.initData;n||(this.resetInitSegment(e,this.audioCodec,this.videoCodec),n=this.initData);var o=void 0,s=this.initPTS;if(void 0===s){var l=t.getStartDTS(n,e);this.initPTS=s=l-r,this.observer.trigger(D.a.INIT_PTS_FOUND,{initPTS:s})}t.offsetStartDTS(n,e,s),o=t.getStartDTS(n,e),this.remuxer.remux(n.audio,n.video,null,null,o,i,a,e)},t.prototype.destroy=function(){},t}(),W=K,V={BitratesMap:[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],SamplingRateMap:[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],appendFrame:function(t,e,r,i,a){if(!(r+24>e.length)){var n=this.parseHeader(e,r);if(n&&r+n.frameLength>3&3,i=t[e+1]>>1&3,a=t[e+2]>>4&15;,n=t[e+2]>>2&3,o=!!(2&t[e+2]);if(1!==r&&0!==a&&15;!==a&&3!==n){var s=3===r?3-i:3===i?3:4,l=1e3*V.BitratesMap[14*s+a-1],u=3===r?0:2===r?1:2,d=V.SamplingRateMap[3*u+n],h=o?1:0;return{sampleRate:d,channelCount:t[e+3]>>6==3?1:2,frameLength:3===i?(3===r?12:6)*l/d+h<<2:(3===r?144:72)*l/d+h|0}}},isHeaderPattern:function(t,e){return 255===t[e]&&224;==(224&t[e+1])&&0!=(6&t[e+1])},isHeader:function(t,e){return!!(e+1<t.length&&this;.isHeaderPattern(t,e))},probe:function(t,e){if(e+1<t.length&&this;.isHeaderPattern(t,e)){var r=this.parseHeader(t,e),i=4;r&&r.frameLength&&(i=r.frameLength);var a=e+i;if(a===t.length||a+1t?(this.word<>3,t-=e>>3,this.bytesAvailable-=e,this.loadWord(),this.word<>>32-e;return t>32&&N.b.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0?this.word<0&&this;.loadWord(),e=t-e,e>0&&this;.bitsAvailable?r<<e|this.readBits(e):r},t.prototype.skipLZ=function(){var t;for(t=0;t>>t))return this.word<>>1:-1*(t>>>1)},t.prototype.readBoolean=function(){return 1===this.readBits(1)},t.prototype.readUByte=function(){return this.readBits(8)},t.prototype.readUShort=function(){return this.readBits(16)},t.prototype.readUInt=function(){return this.readBits(32)},t.prototype.skipScalingList=function(t){var e,r,i=8,a=8;for(e=0;e<t;e++)0!==a&&(r=this.readEG(),a=(i+r+256)%6),i=0===a?i:a},t.prototype.readSPS=function(){var t,e,r,i,a,n,o,s=0,l=0,u=0,d=0,h=this.readUByte.bind(this),c=this.readBits.bind(this),f=this.readUEG.bind(this),p=this.readBoolean.bind(this),g=this.skipBits.bind(this),v=this.skipEG.bind(this),y=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);if(h(),t=h(),c(5),g(3),h(),y(),100===t||110===t||122===t||244===t||44===t||83===t||86===t||118===t||128===t){var b=f();if(3===b&&g(1),y(),y(),g(1),p())for(n=3!==b?8:12,o=0;o<n;o++)p()&&m(o<6?16:64)}y();var E=f();if(0===E)f();else if(1===E)for(g(1),v(),v(),e=f(),o=0;o<e;o++)v();y(),g(1),r=f(),i=f(),a=c(1),0===a&&g(1),g(1),p()&&(s=f(),l=f(),u=f(),d=f());var T=[1,1];if(p()&&p()){switch(h()){case 1:T=[1,1];break;case 2:T=[12,11];break;case 3:T=[10,11];break;case 4:T=[16,11];break;case 5:T=[40,33];break;case 6:T=[24,11];break;case 7:T=[20,11];break;case 8:T=[32,11];break;case 9:T=[80,33];break;case 10:T=[18,11];break;case 11:T=[15,11];break;case 12:T=[64,33];break;case 13:T=[160,99];break;case 14:T=[4,3];break;case 15:T=[3,2];break;case 16:T=[2,1];break;case 255:T=[h()<<8|h(),h()<=t.length)return void r();if(!(t[e].unit.length<32)){var i=this.decrypter.isSync();if(this.decryptAacSample(t,e,r,i),!i)return}}},t.prototype.getAvcEncryptedData=function(t){for(var e=16*Math.floor((t.length-48)/160)+16,r=new Int8Array(e),i=0,a=32;a<=t.length-16;a+=160,i+=16)r.set(t.subarray(a,a+16),i);return r},t.prototype.getAvcDecryptedUnit=function(t,e){e=new Uint8Array(e);for(var r=0,i=32;i=t.length)return void i();for(var a=t[e].units;!(r>=a.length);r++){var n=a[r];if(!(n.length=564&&71;===t[0]&&71;===t[188]&&71;===t[376]},t.prototype.resetInitSegment=function(t,e,r,i){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack={container:"video/mp2t",type:"video",id:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],len:0,dropped:0},this._audioTrack={container:"video/mp2t",type:"audio",id:-1,inputTimeScale:9e4,duration:i,sequenceNumber:0,samples:[],len:0,isAAC:!0},this._id3Track={type:"id3",id:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],len:0},this._txtTrack={type:"text",id:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],len:0},this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=e,this.videoCodec=r,this._duration=i},t.prototype.resetTimeStamp=function(){},t.prototype.append=function(t,e,r,i){var a,n,o,s,l,u=t.length,d=!1;this.contiguous=r;var h=this.pmtParsed,c=this._avcTrack,f=this._audioTrack,p=this._id3Track,g=c.id,v=f.id,y=p.id,m=this._pmtId,b=c.pesData,E=f.pesData,T=p.pesData,R=this._parsePAT,S=this._parsePMT,A=this._parsePES,_=this._parseAVCPES.bind(this),L=this._parseAACPES.bind(this),w=this._parseMPEGPES.bind(this),I=this._parseID3PES.bind(this);for(u-=u8,a=0;a<u;a+=188)if(71===t[a]){if(n=!!(64&t[a+1]),o=((31&t[a+1])<>4>1){if((s=a+5+t[a+4])===a+188)continue}else s=a+4;switch(o){case g:n&&(b&&(l=A(b))&&_(l,!1),b={data:[],size:0}),b&&(b.data.push(t.subarray(s,a+188)),b.size+=a+188-s);break;case v:n&&(E&&(l=A(E))&&(f.isAAC?L(l):w(l)),E={data:[],size:0}),E&&(E.data.push(t.subarray(s,a+188)),E.size+=a+188-s);break;case y:n&&(T&&(l=A(T))&&I(l),T={data:[],size:0}),T&&(T.data.push(t.subarray(s,a+188)),T.size+=a+188-s);break;case 0:n&&(s+=t[s]+1),m=this._pmtId=R(t,s);break;case m:n&&(s+=t[s]+1);var O=S(t,s,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,null!=this.sampleAes);g=O.avc,g>0&&(c.id=g),v=O.audio,v>0&&(f.id=v,f.isAAC=O.isAAC),y=O.id3,y>0&&(p.id=y),d&&!h&&(N.b.log("reparse from beginning"),d=!1,a=-188),h=this.pmtParsed=!0;break;case 17:case 8191:break;default:d=!0}}else this.observer.trigger(D.a.ERROR,{type:k.b.MEDIA_ERROR,details:k.a.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});b&&(l=A(b))?(_(l,!0),c.pesData=null):c.pesData=b,E&&(l=A(E))?(f.isAAC?L(l):w(l),f.pesData=null):(E&&E.size&&N.b.log("last AAC PES packet truncated,might overlap between fragments"),f.pesData=E),T&&(l=A(T))?(I(l),p.pesData=null):p.pesData=T,null==this.sampleAes?this.remuxer.remux(f,c,p,this._txtTrack,e,r,i):this.decryptAndRemux(f,c,p,this._txtTrack,e,r,i)},t.prototype.decryptAndRemux=function(t,e,r,i,a,n,o){if(t.samples&&t.isAAC){var s=this;this.sampleAes.decryptAacSamples(t.samples,0,function(){s.decryptAndRemuxAvc(t,e,r,i,a,n,o)})}else this.decryptAndRemuxAvc(t,e,r,i,a,n,o)},t.prototype.decryptAndRemuxAvc=function(t,e,r,i,a,n,o){if(e.samples){var s=this;this.sampleAes.decryptAvcSamples(e.samples,0,0,function(){s.remuxer.remux(t,e,r,i,a,n,o)})}else this.remuxer.remux(t,e,r,i,a,n,o)},t.prototype.destroy=function(){this._initPTS=this._initDTS=void 0,this._duration=0},t.prototype._parsePAT=function(t,e){return(31&t[e+10])<<8|t[e+11]},t.prototype._parsePMT=function(t,e,r,i){var a,n,o,s,l={audio:-1,avc:-1,id3:-1,isAAC:!0};for(a=(15&t[e+1])<<8|t[e+2],n=e+3+a-4,o=(15&t[e+10])<<8|t[e+11],e+=12+o;e<n;){switch(s=(31&t[e+1])<<8|t[e+2],t[e]){case 207:if(!i){N.b.log("unkown stream type:"+t[e]);break}case 15:-1===l.audio&&(l.audio=s);break;case 21:-1===l.id3&&(l.id3=s);break;case 219:if(!i){N.b.log("unkown stream type:"+t[e]);break}case 27:-1===l.avc&&(l.avc=s);break;case 3:case 4:r?-1===l.audio&&(l.audio=s,l.isAAC=!1):N.b.log("MPEG audio found, not supported in this browser for now");break;case 36:N.b.warn("HEVC stream type found, not supported for now");break;default:N.b.log("unkown stream type:"+t[e])}e+=5+((15&t[e+3])<<8|t[e+4])}return l},t.prototype._parsePES=function(t){var e,r,i,a,n,o,s,l,u=0,d=t.data;if(!t||0===t.size)return null;for(;d[0].length1;){var h=new Uint8Array(d[0].length+d[1].length);h.set(d[0]),h.set(d[1],d[0].length),d[0]=h,d.splice(1,1)}if(e=d[0],1===(e[0]<<16)+(e[1]<<8)+e[2]){if((i=(e[4]<t.size-6)return null;r=e[7],192&r&&(o=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,o>4294967295&&(o-=8589934592),64&r?(s=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,s>4294967295&&(s-=8589934592),o-s>54e5&&(N.b.warn(Math.round((o-s)/9e4)+"s delta between PTS and DTS, align them"),o=s)):s=o),a=e[8],l=a+9,t.size-=l,n=new Uint8Array(t.size);for(var c=0,f=d.length;cp){l-=p;continue}e=e.subarray(l),p-=l,l=0}n.set(e,u),u+=p}return i&&(i-=a+3),{data:n,pts:o,dts:s,len:i}}return null},t.prototype.pushAccesUnit=function(t,e){if(t.units.length&&t.frame){var r=e.samples,i=r.length;!this.config.forceKeyFrameOnDiscontinuity||!0===t.key||e.sps&&(i||this.contiguous)?(t.id=i,r.push(t)):e.dropped++}t.debug.length&&N.b.log(t.pts+"/"+t.dts+":"+t.debug)},t.prototype._parseAVCPES=function(t,e){var r,i,a,n=this,o=this._avcTrack,s=this._parseAVCNALu(t.data),l=this.avcSample,u=!1,d=this.pushAccesUnit.bind(this),h=function(t,e,r,i){return{key:t,pts:e,dts:r,units:[],debug:i}};t.data=null,l&&s.length&&(d(l,o),l=this.avcSample=h(!1,t.pts,t.dts,"")),s.forEach(function(e){switch(e.type){case 1:i=!0,l.frame=!0;var s=e.data;if(u&&s.length>4){var c=new z(s).readSliceType();2!==c&&4!==c&&7!==c&&9!==c||(l.key=!0)}break;case 5:i=!0,l||(l=n.avcSample=h(!0,t.pts,t.dts,"")),l.key=!0,l.frame=!0;break;case 6:i=!0,r=new z(n.discardEPB(e.data)),r.readUByte();for(var f=0,p=0,g=!1,v=0;!g&&r.bytesAvailable>1;){f=0;do{v=r.readUByte(),f+=v}while(255===v);p=0;do{v=r.readUByte(),p+=v}while(255===v);if(4===f&&0!==r.bytesAvailable){g=!0;if(181===r.readUByte()){if(49===r.readUShort()){if(1195456820===r.readUInt()){if(3===r.readUByte()){var y=r.readUByte(),m=r.readUByte(),b=31&y,E=[y,m];for(a=0;a<b;a++)E.push(r.readUByte()),E.push(r.readUByte()),E.push(r.readUByte());n._insertSampleInOrder(n._txtTrack.samples,{type:3,pts:t.pts,bytes:E})}}}}}else if(p<r.bytesAvailable)for(a=0;a<p;a++)r.readUByte()}break;case 7:if(i=!0,u=!0,!o.sps){r=new z(e.data);var T=r.readSPS();o.width=T.width,o.height=T.height,o.pixelRatio=T.pixelRatio,o.sps=[e.data],o.duration=n._duration;var R=e.data.subarray(1,4),S="avc1.";for(a=0;a<3;a++){var A=R[a].toString(16);A.length0){if(e.pts>=t[r-1].pts)t.push(e);else for(var i=r-1;i>=0;i--)if(e.pts<t[i].pts){t.splice(i,0,e);break}}else t.push(e)},t.prototype._getLastNalUnit=function(){var t=this.avcSample,e=void 0;if(!t||0===t.units.length){var r=this._avcTrack,i=r.samples;t=i[i.length-1]}if(t){var a=t.units;e=a[a.length-1]}return e},t.prototype._parseAVCNALu=function(t){var e,r,i,a,n,o=0,s=t.byteLength,l=this._avcTrack,u=l.naluState||0,d=u,h=[],c=-1;for(-1===u&&(c=0,n=31&t[0],u=0,o=1);o=0)i={data:t.subarray(c,o-u-1),type:n},h.push(i);else{var f=this._getLastNalUnit();if(f&&(d&&o0)){var p=new Uint8Array(f.data.byteLength+r);p.set(f.data,0),p.set(t.subarray(0,r),f.data.byteLength),f.data=p}}o=0&&u>=0&&(i={data:t.subarray(c,s),type:n,state:u},h.push(i)),0===h.length){var g=this._getLastNalUnit();if(g){var v=new Uint8Array(g.data.byteLength+t.byteLength);v.set(g.data,0),v.set(t,g.data.byteLength),g.data=v}}return l.naluState=u,h},t.prototype.discardEPB=function(t){for(var e,r,i=t.byteLength,a=[],n=1;n<i-2;)0===t[n]&&0===t[n+1]&&3===t[n+2]?(a.push(n+2),n+=2):n++;if(0===a.length)return t;e=i-a.length,r=new Uint8Array(e);var o=0;for(n=0;n<e;o++,n++)o===a[0]&&(o++,a.shift()),r[n]=t[o];return r},t.prototype._parseAACPES=function(t){var e,r,i,a,n,o=this._audioTrack,s=t.data,l=t.pts,u=this.aacOverFlow,d=this.aacLastPTS;if(u){var c=new Uint8Array(u.byteLength+s.byteLength);c.set(u,0),c.set(s,u.byteLength),s=c}for(i=0,n=s.length;i<n-1&&!h(s,i);i++);if(i){var g,y;if(i1&&(N.b.log("AAC: align PTS for overlapping frames by "+Math.round((m-l)/90)),l=m)}for(;i<n;)if(h(s,i)&&i+5<n){var b=v(o,s,i,l,r);if(!b)break;i+=b.length,a=b.sample.pts,r++}else i++;u=i<n?s.subarray(i,n):null,this.aacOverFlow=u,this.aacLastPTS=a},t.prototype._parseMPEGPES=function(t){for(var e=t.data,r=e.length,i=0,a=0,n=t.pts;a<r;)if(Y.isHeader(e,a)){var o=Y.appendFrame(this._audioTrack,e,a,n,i);if(!o)break;a+=o.length,i++}else a++},t.prototype._parseID3PES=function(t){this._id3Track.samples.push(t)},t}(),$=J,Z=function(){function t(e,r,i){R(this,t),this.observer=e,this.config=i,this.remuxer=r}return t.prototype.resetInitSegment=function(t,e,r,i){this._audioTrack={container:"audio/mpeg",type:"audio",id:-1,sequenceNumber:0,isAAC:!1,samples:[],len:0,manifestCodec:e,duration:i,inputTimeScale:9e4}},t.prototype.resetTimeStamp=function(){},t.probe=function(t){var e,r,i=B.a.getID3Data(t,0);if(i&&void; 0!==B.a.getTimeStamp(i))for(e=i.length,r=Math.min(t.length-1,e+100);e<r;e++)if(Y.probe(t,e))return N.b.log("MPEG Audio sync word found !"),!0;return!1},t.prototype.append=function(t,e,r,i){for(var a=B.a.getID3Data(t,0),n=90*B.a.getTimeStamp(a),o=a.length,s=t.length,l=0,u=0,d=this._audioTrack,h=[{pts:n,dts:n,data:a}];o>24&255;,e[1]=i>>16&255;,e[2]=i>>8&255;,e[3]=255&i,e.set(t,4),a=0,i=8;a>24&255;,e>>16&255;,e>>8&255;,255&e,i>>24,i>>16&255;,i>>8&255;,255&i,a>>24,a>>16&255;,a>>8&255;,255&a,85,196,0,0]))},t.mdia=function(e){return t.box(t.types.mdia,t.mdhd(e.timescale,e.duration),t.hdlr(e.type),t.minf(e))},t.mfhd=function(e){return t.box(t.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255;,e>>8&255;,255&e]))},t.minf=function(e){return"audio"===e.type?t.box(t.types.minf,t.box(t.types.smhd,t.SMHD),t.DINF,t.stbl(e)):t.box(t.types.minf,t.box(t.types.vmhd,t.VMHD),t.DINF,t.stbl(e))},t.moof=function(e,r,i){return t.box(t.types.moof,t.mfhd(e),t.traf(i,r))},t.moov=function(e){for(var r=e.length,i=[];r--;)i[r]=t.trak(e[r]);return t.box.apply(null,[t.types.moov,t.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(t.mvex(e)))},t.mvex=function(e){for(var r=e.length,i=[];r--;)i[r]=t.trex(e[r]);return t.box.apply(null,[t.types.mvex].concat(i))},t.mvhd=function(e,r){r*=e;var i=Math.floor(r/(it+1)),a=Math.floor(r%(it+1)),n=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255;,e>>16&255;,e>>8&255;,255&e,i>>24,i>>16&255;,i>>8&255;,255&i,a>>24,a>>16&255;,a>>8&255;,255&a,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return t.box(t.types.mvhd,n)},t.sdtp=function(e){var r,i,a=e.samples||[],n=new Uint8Array(4+a.length);for(i=0;i<a.length;i++)r=a[i].flags,n[i+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return t.box(t.types.sdtp,n)},t.stbl=function(e){return t.box(t.types.stbl,t.stsd(e),t.box(t.types.stts,t.STTS),t.box(t.types.stsc,t.STSC),t.box(t.types.stsz,t.STSZ),t.box(t.types.stco,t.STCO))},t.avc1=function(e){var r,i,a,n=[],o=[];for(r=0;r>>8&255;),n.push(255&a),n=n.concat(Array.prototype.slice.call(i));for(r=0;r>>8&255;),o.push(255&a),o=o.concat(Array.prototype.slice.call(i));var s=t.box(t.types.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|e.sps.length].concat(n).concat([e.pps.length]).concat(o))),l=e.width,u=e.height,d=e.pixelRatio[0],h=e.pixelRatio[1];return t.box(t.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255;,255&l,u>>8&255;,255&u,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),s,t.box(t.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),t.box(t.types.pasp,new Uint8Array([d>>24,d>>16&255;,d>>8&255;,255&d,h>>24,h>>16&255;,h>>8&255;,255&h])))},t.esds=function(t){var e=t.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t.config).concat([6,1,2]))},t.mp4a=function(e){var r=e.samplerate;return t.box(t.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,r>>8&255;,255&r,0,0]),t.box(t.types.esds,t.esds(e)))},t.mp3=function(e){var r=e.samplerate;return t.box(t.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,r>>8&255;,255&r,0,0]))},t.stsd=function(e){return"audio"===e.type?e.isAAC||"mp3"!==e.codec?t.box(t.types.stsd,t.STSD,t.mp4a(e)):t.box(t.types.stsd,t.STSD,t.mp3(e)):t.box(t.types.stsd,t.STSD,t.avc1(e))},t.tkhd=function(e){var r=e.id,i=e.duration*e.timescale,a=e.width,n=e.height,o=Math.floor(i/(it+1)),s=Math.floor(i%(it+1));return t.box(t.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255;,r>>16&255;,r>>8&255;,255&r,0,0,0,0,o>>24,o>>16&255;,o>>8&255;,255&o,s>>24,s>>16&255;,s>>8&255;,255&s,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,a>>8&255;,255&a,0,0,n>>8&255;,255&n,0,0]))},t.traf=function(e,r){var i=t.sdtp(e),a=e.id,n=Math.floor(r/(it+1)),o=Math.floor(r%(it+1));return t.box(t.types.traf,t.box(t.types.tfhd,new Uint8Array([0,0,0,0,a>>24,a>>16&255;,a>>8&255;,255&a])),t.box(t.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255;,n>>8&255;,255&n,o>>24,o>>16&255;,o>>8&255;,255&o])),t.trun(e,i.length+16+20+8+16+8+8),i)},t.trak=function(e){return e.duration=e.duration||4294967295,t.box(t.types.trak,t.tkhd(e),t.mdia(e))},t.trex=function(e){var r=e.id;return t.box(t.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255;,r>>8&255;,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},t.trun=function(e,r){var i,a,n,o,s,l,u=e.samples||[],d=u.length,h=12+16*d,c=new Uint8Array(h);for(r+=8+h,c.set([0,0,15,1,d>>>24&255;,d>>>16&255;,d>>>8&255;,255&d,r>>>24&255;,r>>>16&255;,r>>>8&255;,255&r],0),i=0;i>>24&255;,n>>>16&255;,n>>>8&255;,255&n,o>>>24&255;,o>>>16&255;,o>>>8&255;,255&o,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<>>24&255;,l>>>16&255;,l>>>8&255;,255&l],12+16*i);return t.box(t.types.trun,c)},t.initSegment=function(e){t.types||t.init();var r,i=t.moov(e);return r=new Uint8Array(t.FTYP.byteLength+i.byteLength),r.set(t.FTYP),r.set(i,t.FTYP.byteLength),r},t}(),nt=at,ot=function(){function t(e,r,i,a){_(this,t),this.observer=e,this.config=r,this.typeSupported=i;var n=navigator.userAgent;this.isSafari=a&&a.indexOf("Apple")>-1&&n&&!n.match("CriOS"),this.ISGenerated=!1}return t.prototype.destroy=function(){},t.prototype.resetTimeStamp=function(t){this._initPTS=this._initDTS=t},t.prototype.resetInitSegment=function(){this.ISGenerated=!1},t.prototype.remux=function(t,e,r,i,a,n,o){if(this.ISGenerated){if(o){var s=this._initPTS,l=this._PTSNormalize,u=t.inputTimeScale||e.inputTimeScale,d=1/0,h=1/0,c=t.samples;if(c.length&&(d=h=l(c[0].pts-u*a,s)),c=e.samples,c.length){var f=c[0];d=Math.min(d,l(f.pts-u*a,s)),h=Math.min(h,l(f.dts-u*a,s))}if(d!==1/0){var p=s-d;Math.abs(p)>10*u&&(N.b.warn("timestamp inconsistency, "+(p/u).toFixed(3)+"s delta against expected value: missing discontinuity ? reset initPTS/initDTS"),this._initPTS=d,this._initDTS=h,this.observer.trigger(D.a.INIT_PTS_FOUND,{initPTS:d}))}}}else this.generateIS(t,e,a);if(this.ISGenerated)if(t.samples.length){t.timescale||(N.b.warn("regenerate InitSegment as audio detected"),this.generateIS(t,e,a));var g=this.remuxAudio(t,a,n,o);if(e.samples.length){var v=void 0;g&&(v=g.endPTS-g.startPTS),e.timescale||(N.b.warn("regenerate InitSegment as video detected"),this.generateIS(t,e,a)),this.remuxVideo(e,a,n,v,o)}}else{var y=void 0;e.samples.length&&(y=this.remuxVideo(e,a,n,o)),y&&t.codec&&this;.remuxEmptyAudio(t,a,n,y)}r.samples.length&&this;.remuxID3(r,a),i.samples.length&&this;.remuxText(i,a),this.observer.trigger(D.a.FRAG_PARSED)},t.prototype.generateIS=function(t,e,r){var i,a,n=this.observer,o=t.samples,s=e.samples,l=this.typeSupported,u="audio/mp4",d={},h={tracks:d},c=void 0===this._initPTS;if(c&&(i=a=1/0),t.config&&o.length&&(t.timescale=t.samplerate,N.b.log("audio sampling rate : "+t.samplerate),t.isAAC||(l.mpeg?(u="audio/mpeg",t.codec=""):l.mp3&&(t.codec="mp3")),d.audio={container:u,codec:t.codec,initSegment:!t.isAAC&&l.mpeg?new Uint8Array:nt.initSegment([t]),metadata:{channelCount:t.channelCount}},c&&(i=a=o[0].pts-t.inputTimeScale*r)),e.sps&&e.pps&&s.length){var f=e.inputTimeScale;e.timescale=f,d.video={container:"video/mp4",codec:e.codec,initSegment:nt.initSegment([e]),metadata:{width:e.width,height:e.height}},c&&(i=Math.min(i,s[0].pts-f*r),a=Math.min(a,s[0].dts-f*r),this.observer.trigger(D.a.INIT_PTS_FOUND,{initPTS:i}))}Object.keys(d).length?(n.trigger(D.a.FRAG_PARSING_INIT_SEGMENT,h),this.ISGenerated=!0,c&&(this._initPTS=i,this._initDTS=a)):n.trigger(D.a.ERROR,{type:k.b.MEDIA_ERROR,details:k.a.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})},t.prototype.remuxVideo=function(t,e,r,i,a){var n,o,s,l,u,d,h,c=8,f=t.timescale,p=t.samples,g=[],v=p.length,y=this._PTSNormalize,m=this._initDTS,b=this.nextAvcDts,E=this.isSafari;E&&(r|=p.length&&b&&(a&&Math;.abs(e-b/f)<.1||Math.abs(p[0].pts-b-m)<f/5)),r||(b=e*f),p.forEach(function(t){t.pts=y(t.pts-m,b),t.dts=y(t.dts-m,b)}),p.sort(function(t,e){var r=t.dts-e.dts,i=t.pts-e.pts;return r||(i||t.id-e.id)});var T=p.reduce(function(t,e){return Math.max(Math.min(t,e.pts-e.dts),-18e3)},0);if(T<0){N.b.warn("PTS < DTS detected in video samples, shifting DTS by "+Math.round(T/90)+" ms to overcome this issue");for(var R=0;R1?N.b.log("AVC:"+A+" ms hole between fragments detected,filling it"):A<-1&&N.b.log("AVC:"+-A+" ms overlapping between fragments detected"),u=b,p[0].dts=u,l=Math.max(l-A,b),p[0].pts=l,N.b.log("Video/PTS/DTS adjusted: "+Math.round(l/90)+"/"+Math.round(u/90)+",delta:"+A+" ms")),S=p[p.length-1],h=Math.max(S.dts,0),d=Math.max(S.pts,0,h),E&&(n=Math.round((h-u)/(p.length-1)));for(var _=0,L=0,w=0;w<v;w++){for(var I=p[w],O=I.units,C=O.length,P=0,x=0;x<C;x++)P+=O[x].data.length;L+=P,_+=C,I.length=P,I.dts=E?u+w*n:Math.max(I.dts,u),I.pts=Math.max(I.pts,I.dts)}var F=L+4*_+8;try{o=new Uint8Array(F)}catch(t){return void this.observer.trigger(D.a.ERROR,{type:k.b.MUX_ERROR,details:k.a.REMUX_ALLOC_ERROR,fatal:!1,bytes:F,reason:"fail allocating video mdat "+F})}var M=new DataView(o.buffer);M.setUint32(0,F),o.set(nt.types.mdat,4);for(var U=0;U<v;U++){for(var B=p[U],G=B.units,H=0,j=void 0,K=0,W=G.length;K<W;K++){var V=G[K],Y=V.data,X=V.data.byteLength;M.setUint32(c,X),c+=4,o.set(Y,c),c+=X,H+=4+X}if(E)j=Math.max(0,n*Math.round((B.pts-B.dts)/n));else{if(U0?U-1:U].dts;if(z.stretchShortVideoTrack){var Q=z.maxBufferHole,J=z.maxSeekHole,$=Math.floor(Math.min(Q,J)*f),Z=(i?l+i*f:this.nextAudioPts)-B.pts;Z>$?(n=Z-q,n-1){var et=g[0].flags;et.dependsOn=2,et.isNonSync=0}t.samples=g,s=nt.moof(t.sequenceNumber++,u,t),t.samples=[];var rt={data1:s,data2:o,startPTS:l/f,endPTS:(d+n)/f,startDTS:u/f,endDTS:this.nextAvcDts/f,type:"video",nb:g.length,dropped:tt};return this.observer.trigger(D.a.FRAG_PARSING_DATA,rt),rt},t.prototype.remuxAudio=function(t,e,r,i){var a,n,o,s,l,u,d,h=t.inputTimeScale,c=t.timescale,f=h/c,p=t.isAAC?1024:1152,g=p*f,v=this._PTSNormalize,y=this._initDTS,m=!t.isAAC&&this;.typeSupported.mpeg,b=t.samples,E=[],T=this.nextAudioPts;if(r|=b.length&&T&&(i&&Math;.abs(e-T/h)<.1||Math.abs(b[0].pts-T-y)<20*g),r||(T=e*h),b.forEach(function(t){t.pts=t.dts=v(t.pts-y,T)}),b.sort(function(t,e){return t.pts-e.pts}),i&&t.isAAC)for(var R=0,S=T;R<b.length;){var A,_=b[R],L=_.pts;A=L-S;var w=Math.abs(1e3*A/h);if(A=g&&w<1e4&&S){var I=Math.round(A/g);N.b.warn("Injecting "+I+" audio frame @ "+(S/h).toFixed(3)+"s due to "+Math.round(1e3*A/h)+" ms gap.");for(var O=0;O<I;O++){var C=Math.max(S,0);o=rt.getSilentFrame(t.manifestCodec||t.codec,t.channelCount),o||(N.b.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),o=_.unit.subarray()),b.splice(R,0,{unit:o,pts:C,dts:C}),t.len+=o.length,S+=g,R++}_.pts=_.dts=S,S+=g,R++}else Math.abs(A),_.pts=_.dts=S,S+=g,R++}for(var P=0,x=b.length;P0&&B0&&(o=rt.getSilentFrame(t.manifestCodec||t.codec,t.channelCount),o||(o=M.subarray()),t.len+=G*o.length);else if(B0))return;var H=m?t.len:t.len+8;a=m?0:8;try{s=new Uint8Array(H)}catch(t){return void this.observer.trigger(D.a.ERROR,{type:k.b.MUX_ERROR,details:k.a.REMUX_ALLOC_ERROR,fatal:!1,bytes:H,reason:"fail allocating audio mdat "+H})}if(!m){new DataView(s.buffer).setUint32(0,H),s.set(nt.types.mdat,4)}for(var j=0;j=2&&(W=E[V-2].duration,n.duration=W),V){this.nextAudioPts=T=d+f*W,t.len=0,t.samples=E,l=m?new Uint8Array:nt.moof(t.sequenceNumber++,u/f,t),t.samples=[];var Y=u/h,X=T/h,z={data1:l,data2:s,startPTS:Y,endPTS:X,startDTS:Y,endDTS:X,type:"audio",nb:V};return this.observer.trigger(D.a.FRAG_PARSING_DATA,z),z}return null},t.prototype.remuxEmptyAudio=function(t,e,r,i){var a=t.inputTimeScale,n=t.samplerate?t.samplerate:a,o=a/n,s=this.nextAudioPts,l=(void 0!==s?s:i.startDTS*a)+this._initDTS,u=i.endDTS*a+this._initDTS,d=1024*o,h=Math.ceil((u-l)/d),c=rt.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);if(N.b.warn("remux empty Audio"),!c)return void N.b.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!");for(var f=[],p=0;p<h;p++){var g=l+p*d;f.push({unit:c,pts:g,dts:g}),t.len+=c.length}t.samples=f,this.remuxAudio(t,e,r)},t.prototype.remuxID3=function(t,e){var r,i=t.samples.length,a=t.inputTimeScale,n=this._initPTS,o=this._initDTS;if(i){for(var s=0;s<i;s++)r=t.samples[s],r.pts=(r.pts-n)/a,r.dts=(r.dts-o)/a;this.observer.trigger(D.a.FRAG_PARSING_METADATA,{samples:t.samples})}t.samples=[],e=e},t.prototype.remuxText=function(t,e){t.samples.sort(function(t,e){return t.pts-e.pts});var r,i=t.samples.length,a=t.inputTimeScale,n=this._initPTS;if(i){for(var o=0;o<i;o++)r=t.samples[o],r.pts=(r.pts-n)/a;this.observer.trigger(D.a.FRAG_PARSING_USERDATA,{samples:t.samples})}t.samples=[],e=e},t.prototype._PTSNormalize=function(t,e){var r;if(void 0===e)return t;for(r=e4294967296;)t+=r;return t},t}(),st=ot,lt=function(){function t(e){L(this,t),this.observer=e}return t.prototype.destroy=function(){},t.prototype.resetTimeStamp=function(){},t.prototype.resetInitSegment=function(){},t.prototype.remux=function(t,e,r,i,a,n,o,s){var l=this.observer,u="";t&&(u+="audio"),e&&(u+="video"),l.trigger(D.a.FRAG_PARSING_DATA,{data1:s,startPTS:a,startDTS:a,type:u,nb:1,dropped:0}),l.trigger(D.a.FRAG_PARSED)},t}(),ut=lt,dt=function(){function t(e,r,i,a){w(this,t),this.observer=e,this.typeSupported=r,this.config=i,this.vendor=a}return t.prototype.destroy=function(){var t=this.demuxer;t&&t.destroy()},t.prototype.push=function(t,e,r,i,a,n,o,s,l,u,d,h){if(t.byteLength>0&&null;!=e&&null;!=e.key&&"AES-128"===e.method){var c=this.decrypter;null==c&&(c=this.decrypter=new U(this.observer,this.config));var f,p=this;try{f=performance.now()}catch(t){f=Date.now()}c.decrypt(t,e.key.buffer,e.iv.buffer,function(t){var c;try{c=performance.now()}catch(t){c=Date.now()}p.observer.trigger(D.a.FRAG_DECRYPTED,{stats:{tstart:f,tdecrypt:c}}),p.pushDecrypted(new Uint8Array(t),e,new Uint8Array(r),i,a,n,o,s,l,u,d,h)})}else this.pushDecrypted(new Uint8Array(t),e,new Uint8Array(r),i,a,n,o,s,l,u,d,h)},t.prototype.pushDecrypted=function(t,e,r,i,a,n,o,s,l,u,d,h){var c=this.demuxer;if(!c||o&&!this.probe(t)){for(var f=this.observer,p=this.typeSupported,g=this.config,v=[{demux:$,remux:st},{demux:H,remux:st},{demux:tt,remux:st},{demux:W,remux:ut}],y=0,m=v.length;ye?i.start+i.duration:Math.max(i.start-a.duration,0):r>e?(i.duration=n-i.start,i.duration<0&&wt;.b.warn("negative duration computed for frag "+i.sn+",level "+i.level+", there should be some duration drift between playlist and fragment!")):(a.duration=i.start-n,a.duration<0&&wt;.b.warn("negative duration computed for frag "+a.sn+",level "+a.level+", there should be some duration drift between playlist and fragment!"))}function v(t,e,r,i,a,n){if(!isNaN(e.startPTS)){var o=Math.abs(e.startPTS-r);isNaN(e.deltaPTS)?e.deltaPTS=o:e.deltaPTS=Math.max(o,e.deltaPTS),r=Math.min(r,e.startPTS),i=Math.max(i,e.endPTS),a=Math.min(a,e.startDTS),n=Math.max(n,e.endDTS)}var s=r-e.start;e.start=e.startPTS=r,e.endPTS=i,e.startDTS=a,e.endDTS=n,e.duration=i-r;var l=e.sn;if(!t||lt.endSN)return 0;var u,d,h;for(u=l-t.startSN,d=t.fragments,e=d[u],h=u;h>0;h--)g(d,h,h-1);for(h=u;h<d.length-1;h++)g(d,h,h+1);return t.PTSKnown=!0,s}function y(t,e){var r,i=Math.max(t.startSN,e.startSN)-e.startSN,a=Math.min(t.endSN,e.endSN)-e.startSN,n=e.startSN-t.startSN,o=t.fragments,s=e.fragments,l=0;if(a<i)return void(e.PTSKnown=!1);for(var u=i;u<=a;u++){var d=o[n+u],h=s[u];h&&d&&(l=d.cc-h.cc,isNaN(d.startPTS)||(h.start=h.startPTS=d.startPTS,h.endPTS=d.endPTS,h.duration=d.duration,h.backtracked=d.backtracked,h.dropped=d.dropped,r=h))}if(l)for(wt.b.log("discontinuity sliding from playlist, take drift into account"),u=0;u=0&&n<o.length){var c=o[n].start;for(u=0;u<s.length;u++)s[u].start+=c}e.PTSKnown=t.PTSKnown}function m(t,
根据给出的代码,可以绘制出以下的类图: ``` +---------------------+ | Marine_hydrology | +---------------------+ | - id: int | | - route: str | | - data_set_name: str | | - data_set_size: str | | - data_set_source: str | | - data_set_time_frame: str | | - data_set_loc: str | | - data_set_abstract: str| +---------------------+ | +query.filter() | +---------------------+ +---------------------+ | Hydrology_data | +---------------------+ | - id: int | | - data_route: str | | - data_name: str | | - data_time: datetime| | - data_format: str | | - data_kind: str | | - data_refresh: str | | - uid_hydrology: int| | - down_time: int | +---------------------+ | +query.filter() | +---------------------+ ``` 其中,`Marine_hydrology`和`Hydrology_data`类分别代表海洋水文学数据集和水文数据。`Marine_hydrology`类具有以下属性: - id:数据集ID,主键,自增长。 - route:数据集路由,非空字符串。 - data_set_name:数据集名称,非空字符串。 - data_set_size:数据集大小,非空字符串。 - data_set_source:数据集来源,非空字符串。 - data_set_time_frame:数据集时间范围,非空字符串。 - data_set_loc:数据集位置,非空字符串。 - data_set_abstract:数据集摘要,非空字符串。 `Hydrology_data`类具有以下属性: - id:数据ID,主键,自增长。 - data_route:数据路由,非空字符串。 - data_name:数据名称,非空字符串。 - data_time:数据时间,非空DateTime类型,默认为当前时间。 - data_format:数据格式,非空字符串。 - data_kind:数据种类,非空字符串。 - data_refresh:数据刷新时间,非空字符串。 - uid_hydrology:水文数据集ID,外键,引用`Marine_hydrology`类中的`id`属性。 - down_time:下载时间,非空整数。 两个类之间存在一对多的关系,即一个`Marine_hydrology`对象可以对应多个`Hydrology_data`对象。因此,`Hydrology_data`类中使用了`uid_hydrology`属性作为外键来引用`Marine_hydrology`类中的数据集ID。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值