bool AV::openVideo(AVContext& context) { if(avcodec_open2(context.vs->codec, NULL, NULL) < 0) { printf("Cannot open the encoder.\n"); return false; } context.vbuf = NULL; context.vsize = 200000; context.vbuf = (uint8_t*) av_malloc(context.vsize); context.vframe = allocFrame(context.vs->codec->pix_fmt, context.vs->codec->width, context.vs->codec->height); // we could use "w" and "h", this seems more versatile if(!context.vframe) { printf("Cannot allocate memory for vframe.\n"); return false; } context.tmp_vframe = allocFrame(PIX_FMT_RGB24, src_w, src_h); if(!context.tmp_vframe) { printf("Cannot allocate memory for tmp_vframe we need for conversion.\n"); return false; } AVCodecContext* c = context.vs->codec; printf("Video time_base.num = %d, time_base.den = %d\n", c->time_base.num, c->time_base.den); return true; }
void paging_init() { uint32_t memsize = getTotalMem(); nframes = memsize / FRAME_BLOCK_SIZE; pFrames = (uint32_t)malloc(INDEX_BIT(nframes)); memset(pFrames,0,INDEX_BIT(nframes)); kerneldir = (page_dir_t*)malloc_a(sizeof(page_dir_t)); curdir = kerneldir; //You may ask why I didnt use for loop //Because kernel end will change.If I use for lopp dont take effect from kernel //end change.Which can give us unexcepted results int i = 0; while(i < place_addr) { allocFrame(getFrame(i,TRUE,kerneldir),FALSE,FALSE); i += FRAME_BLOCK_SIZE; } //isr_install_interrupt(16,page_handle); paging_changedir(kerneldir); }