예제 #1
0
int main(int argc, char **argv) {

  if (argc < 2) {
    printHelpMessage();
    return -1;
  }

  MP4Container_t *container = new_mp4_container(argv[1]);

  AVCCAtom_t *avc = get_video_info(container);
  if (avc == NULL) {
    printf("FAILED: Didn't find the avcC atom\n");
    return -1;
  }

  printf("\n avcC atom @ %d - length: %d", avc->position, avc->length);
  print_buffer_data(avc->bytes, avc->size);
  printf("\n");

  for (size_t i = 0; i < avc->number_of_sps_nalus; i++) {
    SPS_t *sps = avc->sps_array[i];
    printf(" SPS #%ld - size: %d", i + 1, sps->size);
    print_buffer_data(sps->bytes, sps->size);
    printf("\n");
  }

  for (size_t i = 0; i < avc->number_of_pps_nalus; i++) {
    PPS_t *pps = avc->pps_array[i];
    printf(" PPS #%ld - size %d", i + 1, pps->size);
    print_buffer_data(pps->bytes, pps->size);
    printf("\n");
  }

  printf(" version: %d\n", avc->version);
  printf(" profile: %d\n", avc->profile);
  printf(" compatibility: %d\n", avc->compatibility);
  printf(" level: %d\n", avc->level);

  printf(" reserved: %d\n           ", avc->reserved);
  print_byte(avc->reserved);
  printf("\n");

  printf(" nalu_length_minus_one: %d\n", avc->nalu_length_minus_one);

  printf(" reserved: ");
  print_byte(avc->reserved_after_length_minus_one);
  printf("\n");

  printf(" number_of_sps_nalus: %d\n", avc->number_of_sps_nalus);
  printf(" number_of_pps_nalus: %d\n", avc->number_of_pps_nalus);

  close_mp4_container(container);
}
예제 #2
0
파일: andzop.c 프로젝트: DastanIqbal/AndZop
//contains the init code for both android and linux
static void andzop_init(int pDebug) {
    int l_i;
    int l_mbH, l_mbW;
    gCurrentDecodingVideoFileIndex = 0;
    get_video_info(pDebug);
    gVideoPacketNum = 0;
#ifdef SELECTIVE_DECODING
    for (l_i = 0; l_i < gNumOfVideoFiles; ++l_i) {
        LOGI(10, "allocate_selected_decoding_fields for %d, current video index %d", l_i, gCurrentDecodingVideoFileIndex);
        l_mbH = (gVideoCodecCtxList[l_i]->height + 15) / 16;
        l_mbW = (gVideoCodecCtxList[l_i]->width + 15) / 16;
        allocate_selected_decoding_fields(l_i, l_mbH, l_mbW);
    }
#ifdef BG_DUMP_THREAD
	if (gDumpDep) {
		LOGI(10, "initialize dumping threads, current video index %d", gCurrentDecodingVideoFileIndex);
		gDepDumpThreadList = (pthread_t*)malloc(gNumOfVideoFiles *sizeof(pthread_t));
		gDumpThreadParams = (DUMP_DEP_PARAMS *)malloc(sizeof(DUMP_DEP_PARAMS)*gNumOfVideoFiles);
		for (l_i = 0; l_i < gNumOfVideoFiles; ++l_i) {
		    //start a background thread for dependency dumping
		    gDumpThreadParams[l_i].videoFileIndex = l_i;
		    if (pthread_create(&gDepDumpThreadList[l_i], NULL, dump_dependency_function, (void *)&gDumpThreadParams[l_i])) {
			LOGE(1, "Error: failed to create a native thread for dumping dependency");
		    }
		    LOGI(10, "tttttt: dependency dumping thread started! tttttt");
		}
	}
#endif		//for BG_DUMP_THREAD
#ifdef PRE_LOAD_DEP
    //preload the first GOP at start up
    pthread_mutex_init(&preloadMutex, NULL);
    pthread_cond_init(&preloadCondVar, NULL);
    LOGI(10, "preload at initialization");
    //TODO: initialize the ROI
    gRoiSh = 10;
    gRoiSw = 10;
    gRoiEh = 100; 
    gRoiEw = 100;
    get_gop_info_given_gop_num(gCurrentDecodingVideoFileIndex, 1, &gNextGopStart, &gNextGopEnd);
    preload_pre_computation_result(gCurrentDecodingVideoFileIndex, 1);
    LOGI(10, "preload at initialization done");
    LOGI(10, "initialize thread to preload dependencies");
    if (pthread_create(&gPreloadThread, NULL, preload_dependency_function, NULL)) {
        LOGE(1, "Error: failed to create a native thread for preloading dependency");
        exit(1);
    }
    LOGI(10, "preloading thread started!");
#endif		//for PRE_LOAD_DEP
#endif		//for SELECTIVE_DECODING
    LOGI(10, "initialization done, current video index %d", gCurrentDecodingVideoFileIndex);
}
예제 #3
0
static void add_connection(struct obs_encoder *encoder)
{
	if (encoder->info.type == OBS_ENCODER_AUDIO) {
		struct audio_convert_info audio_info = {0};
		get_audio_info(encoder, &audio_info);

		audio_output_connect(encoder->media, encoder->mixer_idx,
				&audio_info, receive_audio, encoder);
	} else {
		struct video_scale_info info = {0};
		get_video_info(encoder, &info);

		video_output_connect(encoder->media, &info, receive_video,
			encoder);
	}

	encoder->active = true;
}
예제 #4
0
static __s32 hdmi_get_video_timing(__disp_tv_mode_t mode,
	struct __disp_video_timing *video_timing_dest)
{
	__u32 hdmi_mode;
	__s32 vic_tab;

	hdmi_mode = Hdmi_tv_mode_to_hdmi_mode(mode);
	if (!hdmi_mode)
		return -1;

	vic_tab = get_video_info(hdmi_mode);
	if (vic_tab == -1)
		return -1;

	memcpy(video_timing_dest, &video_timing[vic_tab],
	       sizeof(struct __disp_video_timing));
	return 0;
}
예제 #5
0
__s32 video_config(__u32 vic)
{

	__s32 vic_tab, clk_div,reg_val;

	__inf("video_config, vic:%d\n", vic);
	
	vic_tab = get_video_info(vic);   
	if(  vic_tab == -1)
		return 0;
	else
	    video_mode = vic;
	HDMI_WUINT32(0x004,0x00000000);
	HDMI_WUINT32(0x040,0x00000000);						//disable audio output
	HDMI_WUINT32(0x010,0x00000000);						//disable video output
    HDMI_WUINT32(0x008,0xffffffff);						//interrupt mask and clear all interrupt
    
    if( (vic == HDMI1440_480I) || (vic == HDMI1440_576I) )		//interlace and repeation
    {
    	HDMI_WUINT32(0x010,0x00000011);						
    }
    else if( (vic == HDMI1080I_50) || (vic == HDMI1080I_60) )	//interlace
    {
    	HDMI_WUINT32(0x010,0x00000010);           
    }else														//progressive
    {
    	HDMI_WUINT32(0x010,0x00000000);
    }   

    if( (vic == HDMI1440_480I) || (vic == HDMI1440_576I) )			//need to use repeation
    {
     	HDMI_WUINT16(0x014,(video_timing[vic_tab].INPUTX<<1) -1);             	//active H
     	HDMI_WUINT16(0x018,(video_timing[vic_tab].HBP<<1)    -1);           	//active HBP
     	HDMI_WUINT16(0x01c,(video_timing[vic_tab].HFP<<1)    -1);         		//active HFP
     	HDMI_WUINT16(0x020,(video_timing[vic_tab].HPSW<<1)   -1);        		//active HSPW
    }
    else
    {
     	HDMI_WUINT16(0x014,(video_timing[vic_tab].INPUTX<<0) -1);              	//active H
     	HDMI_WUINT16(0x018,(video_timing[vic_tab].HBP<<0)    -1);            		//active HBP
     	HDMI_WUINT16(0x01c,(video_timing[vic_tab].HFP<<0)    -1);         		//active HFP
     	HDMI_WUINT16(0x020,(video_timing[vic_tab].HPSW<<0)   -1);               	//active HSPW
    }

    if( ( vic == HDMI1080P_24_3D_FP) || (vic == HDMI720P_50_3D_FP ) || (vic == HDMI720P_60_3D_FP ) )
    {
    	HDMI_WUINT16(0x016,video_timing[vic_tab].INPUTY + video_timing[vic_tab].VBP + video_timing[vic_tab].VFP -1);             		//active V
    }else    
    {
    	HDMI_WUINT16(0x016,video_timing[vic_tab].INPUTY   -1);             			//active V
	}
	
    HDMI_WUINT16(0x01a,video_timing[vic_tab].VBP    -1);               			//active VBP
    HDMI_WUINT16(0x01e,video_timing[vic_tab].VFP    -1);                		//active VFP
    HDMI_WUINT16(0x022,video_timing[vic_tab].VPSW   -1);              			//active VSPW

    if( video_timing[vic_tab].PCLK < 74250000)				//SD format
    {    
    	HDMI_WUINT16(0x024,0x00   );                		//Vsync/Hsync pol
    }
    else													//HD format		
    {  
    	HDMI_WUINT16(0x024,0x03   );                		//Vsync/Hsync pol
    }
    
    HDMI_WUINT16(0x026,0x03e0 );                			//TX clock sequence


    //avi packet
    HDMI_WUINT8 (0x080,0x82);
    HDMI_WUINT8 (0x081,0x02);
    HDMI_WUINT8 (0x082,0x0d);
    HDMI_WUINT8 (0x083,0x00);
    if(cts_enable &&(!YCbCr444_Support))
    {
        HDMI_WUINT8 (0x084,0x10);								//RGB444
        __inf("HDMI RGB444 output mode\n");
    }
    else
    {
        HDMI_WUINT8 (0x084,0x50);									//YCbCr444
        __inf("HDMI YCbCr444 output mode\n");
    }
    if( video_timing[vic_tab].PCLK < 74250000)	//SD format
    {
    	HDMI_WUINT8 (0x085,0x58);							//4:3 601
    }else													//HD format
    {
    	HDMI_WUINT8 (0x085,0xa8);							//16:9 709
    }
    HDMI_WUINT8 (0x086,0x00); 
    HDMI_WUINT8 (0x087,video_timing[vic_tab].VIC	 );
    HDMI_WUINT8 (0x088,video_timing[vic_tab].AVI_PR);    
    HDMI_WUINT8 (0x089,0x00);
    HDMI_WUINT8 (0x08a,0x00);
    HDMI_WUINT8 (0x08b,0x00);
    HDMI_WUINT8 (0x08c,0x00);
    HDMI_WUINT8 (0x08d,0x00);
    HDMI_WUINT8 (0x08e,0x00);
    HDMI_WUINT8 (0x08f,0x00);
    HDMI_WUINT8 (0x090,0x00);
    
    reg_val = 	HDMI_RUINT8(0x080) + 
    			HDMI_RUINT8(0x081) +
    			HDMI_RUINT8(0x082) +  
    			HDMI_RUINT8(0x084) + 
    			HDMI_RUINT8(0x085) + 
    			HDMI_RUINT8(0x086) + 
    			HDMI_RUINT8(0x087) +
    			HDMI_RUINT8(0x088) + 
    			HDMI_RUINT8(0x089) +
    			HDMI_RUINT8(0x08a) +
    			HDMI_RUINT8(0x08b) +
    			HDMI_RUINT8(0x08c) +
    			HDMI_RUINT8(0x08d) + 
    			HDMI_RUINT8(0x08e) + 
    			HDMI_RUINT8(0x08f) +
    			HDMI_RUINT8(0x090);      
    reg_val = reg_val & 0xff;
    if(reg_val != 0)
    	reg_val = 0x100 - reg_val;
    HDMI_WUINT8 (0x083,reg_val);		//checksum
    //gcp packet
    HDMI_WUINT32(0x0e0,0x00000003);
    HDMI_WUINT32(0x0e4,0x00000000);
    
    //vendor infoframe
    HDMI_WUINT8 (0x240,0x81);
    HDMI_WUINT8 (0x241,0x01);
    HDMI_WUINT8 (0x242,6    );	//length
    
    HDMI_WUINT8 (0x243,0x29);	//pb0:checksum
    HDMI_WUINT8 (0x244,0x03);	//pb1-3:24bit ieee id
    HDMI_WUINT8 (0x245,0x0c);  	//
    HDMI_WUINT8 (0x246,0x00);
    HDMI_WUINT8 (0x247,0x40);   //pb4
    HDMI_WUINT8 (0x248,0x00);	//pb5:3d meta not present, frame packing
    
    HDMI_WUINT8 (0x249,0x00);  	//pb6:extra data for 3d
    HDMI_WUINT8 (0x24a,0x00);  	//pb7: matadata type=0,len=8
    HDMI_WUINT8 (0x24b,0x00);
    HDMI_WUINT8 (0x24c,0x00);
    HDMI_WUINT8 (0x24d,0x00);
    HDMI_WUINT8 (0x24e,0x00);
    HDMI_WUINT8 (0x24f,0x00);
    HDMI_WUINT8 (0x250,0x00);
    HDMI_WUINT8 (0x251,0x00);
    HDMI_WUINT8 (0x252,0x00);
    
    //packet config
    if( ( vic != HDMI1080P_24_3D_FP) && (vic != HDMI720P_50_3D_FP) && ( vic != HDMI720P_60_3D_FP) )
    { 
    	HDMI_WUINT32(0x2f0,0x0000f321);
    	HDMI_WUINT32(0x2f4,0x0000000f);  
    }
    else
    {
    	HDMI_WUINT32(0x2f0,0x00005321);
    	HDMI_WUINT32(0x2f4,0x0000000f); 
    }    
      
    HDMI_WUINT32(0x300,0x08000000);			// set input sync enable
    
    if( (cts_enable == 0) || isHDMI)
    {
        __inf("hdmi mode:  cts_enable=%d, isHDMI=%d\n", cts_enable,isHDMI);
        HDMI_WUINT8 (0x013,0xc0);				//hdmi mode
    }else
    {
        __inf("dvi mode:   cts_enable=%d, isHDMI=%d\n", cts_enable,isHDMI);
        HDMI_WUINT8 (0x013,0x80);				//dvi mode
    }
    HDMI_WUINT32(0x004,0x80000000);			//start hdmi controller
    //////////////////////
    //hdmi pll setting
    if( (vic == HDMI1440_480I) || (vic == HDMI1440_576I))
    {
        clk_div = hdmi_clk/video_timing[vic_tab].PCLK;
        clk_div /= 2;
    }
    else
    {
        clk_div = hdmi_clk/video_timing[vic_tab].PCLK;
    }
	clk_div &= 0x0f;
	HDMI_WUINT32(0x208,(1<<31)+ (1<<30)+ (1<<29)+ (3<<27)+ (0<<26)+ 
	    		       (1<<25)+ (0<<24)+ (0<<23)+ (4<<20)+ (7<<17)+
	    		       (15<<12)+ (7<<8)+ (clk_div<<4)+(8<<0) );	
	// tx driver setting
 	HDMI_WUINT32(0x200,0xfe800000);   			//txen enable
	HDMI_WUINT32(0x204,0x00D8C850);   			//ckss = 1

    HDMI_WUINT32(0x20c, hdmi_pll << 21);
    
    return 0;
}
예제 #6
0
__s32 Hdmi_hal_get_video_info(__s32 vic)
{
	return get_video_info(vic);
}