Example #1
0
Stream* create_stream(uint8_t *header, size_t net_packet_size, size_t net_buf_size) {
  Stream *stream = (Stream*)malloc(sizeof(Stream));

  size_t *size_t_ptr;
  uint8_t *uint8_t_ptr;

  stream->net_packet_size = net_packet_size;
  stream->net_buf_fill = 0;
  stream->net_buf_size = net_buf_size;
  proc_info("Net Buf Size %u", (unsigned int)stream->net_buf_size);
  stream->net_buf = (uint8_t*)calloc(stream->net_buf_size, sizeof(uint8_t));

  stream->reader = vpx_video_stream_reader_open(header);
  if (!stream->reader)
    proc_die("Failed to create new stream");

  stream->info = vpx_video_stream_reader_get_info(stream->reader);
  proc_info("Frame Width %u\n", stream->info->frame_width);
  proc_info("Frame Height %u\n", stream->info->frame_height);
  // proc_info("Frame Count %u\n", stream->info->frame_count);

  // stream->gl_luma_buf_fill = 0;
  // stream->gl_luma_buf_size = stream->info->frame_width * stream->info->frame_height;
  // // proc_info("GL Buf Size %u", (unsigned int)stream->gl_buf_size);
  // stream->gl_luma_buf = (uint8_t*)calloc(stream->gl_luma_buf_size, sizeof(uint8_t));
  //
  // stream->gl_chromaB_buf_fill = 0;
  // stream->gl_chromaB_buf_size = stream->info->frame_width/2 * stream->info->frame_height/2;
  // // proc_info("GL Buf Size %u", (unsigned int)stream->gl_buf_size);
  // stream->gl_chromaB_buf = (uint8_t*)calloc(stream->gl_chromaB_buf_size, sizeof(uint8_t));
  //
  // stream->gl_chromaR_buf_fill = 0;
  // stream->gl_chromaR_buf_size = stream->info->frame_width/2 * stream->info->frame_height/2;
  // // proc_info("GL Buf Size %u", (unsigned int)stream->gl_buf_size);
  // stream->gl_chromaR_buf = (uint8_t*)calloc(stream->gl_chromaR_buf_size, sizeof(uint8_t));

  stream->decoder = get_vpx_decoder_by_fourcc(stream->info->codec_fourcc);
  if (!stream->decoder)
    proc_die("Unknown input codec.");

  printf("Using %s\r\n", vpx_codec_iface_name(stream->decoder->codec_interface()));

  if (vpx_codec_dec_init(&stream->codec, stream->decoder->codec_interface(), NULL, 0))
    die_codec(&stream->codec, "Failed to initialize decoder.");

  // stream->postproc = (vp8_postproc_cfg_t){
  //   VP8_DEBLOCK | VP8_DEMACROBLOCK,
  //   4, // strength of deblocking, valid range [0, 16]
  //   0
  // };
  //
  // if(vpx_codec_control(&stream->codec, VP8_SET_POSTPROC, &stream->postproc))
  //   die_codec(&stream->codec, "Failed to turn on postproc");

  return stream;
}
Example #2
0
bool tsh_exec() {
	bool ret_value = false;
	if (strcmp(&command_buffer, "kheap")==0) {
		kheap_status();
		return true;
	} else if (strcmp(&command_buffer, "kheaptest")==0) {
		kheap_test();
		return true;
	} else if (strcmp(&command_buffer, "ata")==0) {
		ata_show_info();
		return true;
	} else if (strcmp(&command_buffer, "pci")==0) {
		pci_show_info();
		return true;
	} else if (strcmp(&command_buffer, "atatest")==0) {
		ata_rw_test(0);
		return true;
	} else if (strcmp(&command_buffer, "proc")==0) {
		proc_info();
		return true;
	} else if (strcmp(&command_buffer, "kill")==0) {
		proc_kill(1);
		return true;
	} else if (strcmp(&command_buffer, "reset")==0) {
		kbrd_reset_system();
		return true;
	} else if (strcmp(&command_buffer, "help")==0) {
		tiny_shell_help();
		return true;
	}
	return ret_value;
}
Example #3
0
static size_t ctrl_write( struct file *filp, 
	const char __user *buf, 
	size_t count, 
	loff_t *f_pos )
{
    int capacity = 255;
    char myBuf[256];
    size_t pos=0;
    if (count > capacity)
    {
        printk(KERN_INFO "too long command\n");
        return -1;
    }
	
	printk(KERN_INFO "procfile_write (/proc/%s/io len=%d) called\n", USGDMA_PROC_DIR, (int)count);
    if (copy_from_user( myBuf, buf, count ))
    {
        return -2;
    }
    
	myBuf[count] = '\0';
	pos = cmpCommand(myBuf,"w");
	if( pos ) {
		proc_iowrite( myBuf+pos );
		goto end;
	}
	pos = cmpCommand(myBuf,"r");
	if( pos ) {
		proc_ioread( myBuf+pos );
		goto end;
	}
	pos = cmpCommand(myBuf,"i");
	if( pos ) {
		proc_info( );
		goto end;
	}

end:
    return count;
}