/** * ALI_DTV_SUB_Get_Region_Info: * @ SUBHandle: IN, the context ptr of SUB module * @ display_set: IN, the ready display set. * @ region: IN/OUT, the ptr of struct region_info will be filled. * @ region_index: IN, the index of region want to find. * * Description: get the region info of display set from index * * Returns: -1, error * >=0, ok */ int ALI_DTV_SUB_Get_Region_Info(HANDLE SUBHandle,void* display_set,region_info* region,unsigned int region_index) { pSUBCtxt hr = (pSUBCtxt)SUBHandle; tDisplaySet *ds=(tDisplaySet *)display_set; tPageCompositionSeg* pcs=NULL; if(IS_HANDLE_VALID(hr)&& IS_HANDLE_VALID(ds)&& region){ pcs=ds->page_composition_seg; if(region_index<pcs->number_of_region_compositions){ tRegionCompositionSeg* rcs=NULL; rcs = RegionCompositionSegFind( ds->region_composition_segs,pcs->regions[region_index].region_id); if(rcs){ memset(region,0,sizeof(region_info)); region->region_id=rcs->region_id; region->region_horizontal_address=pcs->regions[region_index].region_horizontal_address; region->region_vertical_address=pcs->regions[region_index].region_vertical_address; region->region_width=rcs->region_width; region->region_height=rcs->region_height; region->bkcolor=RegionBackGroundColorGet(rcs); return 0; } else{ return -1; } } } return -1; }
/** * ALI_DTV_SUB_Get_Region_Count_Of_DS: * @ SUBHandle: IN, the context ptr of SUB module * @ display_set: IN, the ready display set. * * Description: get the number of regions of this display set * * Returns: -1, error * >=0, ok */ int ALI_DTV_SUB_Get_Region_Count_Of_DS(HANDLE SUBHandle,void* display_set) { pSUBCtxt hr = (pSUBCtxt)SUBHandle; tDisplaySet *ds=(tDisplaySet *)display_set; if(IS_HANDLE_VALID(hr)&& IS_HANDLE_VALID(ds)){ return (ds->page_composition_seg->number_of_region_compositions); } return -1; }
/** * ALI_DTV_SUB_Region_Render_Context_Destroy: * @ SUBHandle: IN, the context ptr of SUB module * @ ctxt: IN, the context ptr of region render. * * Description: Destroy the render context * * Returns: -1, error * >=0, ok */ int ALI_DTV_SUB_Region_Render_Context_Destroy(HANDLE SUBHandle,void* ctxt) { pSUBCtxt hr = (pSUBCtxt)SUBHandle; tRenderingContext *r_cntx=(tRenderingContext *)ctxt; if(IS_HANDLE_VALID(hr)&& IS_HANDLE_VALID(r_cntx)){ ReleaseRender(r_cntx); return 0; } return -1; }
/** * ALI_DTV_SUB_Region_Actual_Rendering: * @ SUBHandle: IN, the context ptr of SUB module * @ ctxt: IN, the context ptr of region render. * * Description: Actual Rendering of this region * * Returns: -1, error * >=0, ok */ int ALI_DTV_SUB_Region_Actual_Rendering(HANDLE SUBHandle,void* ctxt) { pSUBCtxt hr = (pSUBCtxt)SUBHandle; tRenderingContext *r_cntx=(tRenderingContext *)ctxt; if(IS_HANDLE_VALID(hr)&& IS_HANDLE_VALID(r_cntx)){ RenderRegion(r_cntx); return 0; } return -1; }
/** * ALI_DTV_SUB_Get_Time_Out_Of_DS: * @ SUBHandle: IN, the context ptr of SUB module * @ display_set: IN, the ready display set. * * Description: get the time out seconds of this display set * * Returns: -1, error * >=0, Maximum time to show this page in seconds */ int ALI_DTV_SUB_Get_Time_Out_Of_DS(HANDLE SUBHandle,void* display_set) { pSUBCtxt hr = (pSUBCtxt)SUBHandle; tDisplaySet *ds=(tDisplaySet *)display_set; if(IS_HANDLE_VALID(hr)&& IS_HANDLE_VALID(ds)){ return (ds->page_composition_seg->page_time_out); } return -1; }
/** * ALI_DTV_SUB_Display_Set_Destroy: * @ SUBHandle: IN, the context ptr of SUB module * @ display_set: IN, the display set will be handle. * * Description: Destroy this display set * * Returns: -1, error * >=0, ok */ int ALI_DTV_SUB_Display_Set_Destroy(HANDLE SUBHandle,void* display_set) { pSUBCtxt hr = (pSUBCtxt)SUBHandle; tDisplaySet *ds=(tDisplaySet *)display_set; if(IS_HANDLE_VALID(hr)&& IS_HANDLE_VALID(ds)){ DisplaySetRelease(ds); return 0; } return -1; }
/** * ALI_DTV_SUB_Region_Render_Context_Create: * @ SUBHandle: IN, the context ptr of SUB module * @ display_set: IN, the ready display set. * @ region_id: IN, the ID of the region you want to render. * @ hline_callback: IN, function to draw a horizontal line (may be NULL) * @ string_callback: IN, function to draw a string (may be NULL) * @ set_color_callback: IN, function to map pseudo color to display color * @ priv: IN, private data to callback functions * * Description: Create a rendering context of a region * * Returns: !NULL, the Context * NULL, err */ void* ALI_DTV_SUB_Region_Render_Context_Create(HANDLE SUBHandle,void* display_set,unsigned int region_id, DrawHLine_CB hline_callback,DrawString_CB string_callback, ColorSet_CB set_color_callback,void *priv) { pSUBCtxt hr = (pSUBCtxt)SUBHandle; tDisplaySet *ds=(tDisplaySet *)display_set; if(IS_HANDLE_VALID(hr)&& IS_HANDLE_VALID(ds)){ return CreateRender(ds,region_id,hline_callback,string_callback,set_color_callback,priv); } return NULL; }
void SAL_Open( const char* the_storage_id, STORAGE_HANDLE the_storage_handle ) { int idx; assert( the_storage_id != NULL ); assert( the_storage_handle != NULL ); assert( !IS_HANDLE_VALID( the_storage_handle ) ); for( idx = 0; idx < SystemStorageAmount; ++idx ) { if( 0 == strcmp( the_storage_id, SystemStorageTable[idx].s_id ) ) { break; } } if( idx != SystemStorageAmount ) { *( the_storage_handle ) = &( SystemStorageTable[idx].storage_desc ); if( FILE_TYPE == ( *the_storage_handle )->backend_type ) { ( *the_storage_handle )->backend_info.file.pFileName = the_storage_id; } } else { *the_storage_handle = NULL; } }
int CShaderInterface::GetCurrentShaderIndex() { if( IS_HANDLE_VALID( m_curShader ) ) return m_curShader; return INVALID_HANDLE; }
void SAL_Close( STORAGE_HANDLE aHandle ) { assert( IS_HANDLE_VALID( aHandle ) ); // add clean up code if needed *aHandle = NULL; }
int ALI_DTV_SUB_Push_PES_Pkt(HANDLE SUBHandle,char* pkt,int max_size) { pSUBCtxt hr = (pSUBCtxt)SUBHandle; if(IS_HANDLE_VALID(hr)&& hr->dsub_decoder && pkt){ if(hr->sub_en) return PESPacketPush(hr->dsub_decoder,(const unsigned char*)pkt,max_size); } return -1; }
int ALI_DTV_SUB_Push_ES_Pkt(HANDLE SUBHandle,char* pkt,int max_size, unsigned int PTS) { pSUBCtxt hr = (pSUBCtxt)SUBHandle; if(IS_HANDLE_VALID(hr)&& hr->dsub_decoder && pkt){ if(hr->sub_en) { uint64_t TempPts = PTS * 90; return ESPacketPush(max_size, (const unsigned char*)pkt, hr->dsub_decoder, TempPts); } } return -1; }
void DisplaySetRelease(tDisplaySet *display_set) { /* Assume that display sets pointing to this ancillary display set won't be used anymore and so we don't have to modify ancillary_display_set pointers. */ if(IS_HANDLE_VALID(display_set)){ PageCompositionSegRelease(display_set->page_composition_seg); RegionCompositionSegListRelease(display_set->region_composition_segs); CLUT_DefinitionSegListRelease(display_set->CLUT_definition_segs); ObjectDataSegListRelease(display_set->object_data_segs); free(display_set); return; } SUB_DP(( "DisplaySetRelease: display_set ERR\n")); }
/** * ALI_DTV_SUB_Release: * @ SUBHandle: IN, the context ptr of SUB module * * Description: Release the SUB module; * * Returns: -1, error * 0, ok * */ int ALI_DTV_SUB_Release(HANDLE SUBHandle) { pSUBCtxt hr = (pSUBCtxt)SUBHandle; if(IS_HANDLE_VALID(hr)) { hr->sub_en=0; Sleep(1); if(hr->page_decoder) PageDecoderRelease(hr->page_decoder); if(hr->ancillary_page_decoder) PageDecoderRelease(hr->ancillary_page_decoder); if(hr->dsub_decoder) DSubDecoderRelease(hr->dsub_decoder); free(hr); return 0; } return -1; }
int SAL_GetSize( STORAGE_HANDLE aHandle ) { int sz; Ptr_Storage_Desc ptr_storage; sz = -1; assert( IS_HANDLE_VALID( aHandle ) ); ptr_storage = *aHandle; switch( ptr_storage->backend_type ) { case NAND_TYPE: sz = ptr_storage->backend_info.nand.size_in_bytes; break; case FILE_TYPE: sz = file_get_size( ptr_storage->backend_info.file.pFileName ); break; default: break; } return sz; }
int SAL_Read( STORAGE_HANDLE aHandle, unsigned int r_offset, void* p_read_buffer, unsigned int buf_sz_B ) { int read_bytes; Ptr_Storage_Desc ptr_storage; read_bytes = 0U; assert( IS_HANDLE_VALID( aHandle ) ); ptr_storage = *aHandle; // debug code // printf("%s( .., offset = %d, p_read_buffer->0x%x, buf_sz = %d)\n" , __FUNCTION__, r_offset, (p_read_buffer), buf_sz_B ); if( NULL == p_read_buffer ) { //client shouldn't pass an empty buffer to me, this cause error while access storage return -1; } if( 0 == buf_sz_B ) { return 0; } switch( ptr_storage->backend_type ) { case NAND_TYPE: break; case FILE_TYPE: read_bytes = file_read( ptr_storage->backend_info.file.pFileName, r_offset, p_read_buffer, buf_sz_B ); break; default: read_bytes = -1; break; } return read_bytes; }
int SAL_Write( STORAGE_HANDLE aHandle, unsigned int w_offset, void* p_write_buffer, unsigned int buf_sz_B ) { int write_bytes; Ptr_Storage_Desc ptr_storage; write_bytes = 0U; assert( IS_HANDLE_VALID( aHandle ) ); ptr_storage = *aHandle; switch( ptr_storage->backend_type ) { case NAND_TYPE: write_bytes = -1; break; case FILE_TYPE: write_bytes = file_write( ptr_storage->backend_info.file.pFileName, w_offset, p_write_buffer, buf_sz_B ); break; default: write_bytes = -1; break; } return write_bytes; }
VOID NTAPI DbgDumpGdiHandleTable(void) { static int leak_reported = 0; int i, j, idx, nTraces = 0; KIRQL OldIrql; if (leak_reported) { DPRINT1("gdi handle abusers already reported!\n"); return; } leak_reported = 1; DPRINT1("reporting gdi handle abusers:\n"); /* We've got serious business to do */ KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); /* Step through GDI handle table and find out who our culprit is... */ for (idx = RESERVE_ENTRIES_COUNT; idx < GDI_HANDLE_COUNT; idx++) { /* If the handle is free, continue */ if (!IS_HANDLE_VALID(idx)) continue; /* Step through all previous backtraces */ for (j = 0; j < nTraces; j++) { /* Check if the backtrace matches */ if (CompareBacktraces(idx, AllocatorTable[j].idx)) { /* It matches, increment count and break out */ AllocatorTable[j].count++; break; } } /* Did we find a new backtrace? */ if (j == nTraces) { /* Break out, if we reached the maximum */ if (nTraces == MAX_BACKTRACES) break; /* Initialize this entry */ AllocatorTable[j].idx = idx; AllocatorTable[j].count = 1; nTraces++; } } /* bubble sort time! weeeeee!! */ for (i = 0; i < nTraces-1; i++) { if (AllocatorTable[i].count < AllocatorTable[i+1].count) { struct DbgOpenGDIHandle temp; temp = AllocatorTable[i+1]; AllocatorTable[i+1] = AllocatorTable[i]; j = i; while (j > 0 && AllocatorTable[j-1].count < temp.count) j--; AllocatorTable[j] = temp; } } /* Print the worst offenders... */ DbgPrint("Worst GDI Handle leak offenders (out of %i unique locations):\n", nTraces); for (i = 0; i < nTraces && AllocatorTable[i].count > 1; i++) { /* Print out the allocation count */ DbgPrint(" %i allocs, type = 0x%lx:\n", AllocatorTable[i].count, GdiHandleTable->Entries[AllocatorTable[i].idx].Type); /* Dump the frames */ KeRosDumpStackFrames(GDIHandleAllocator[AllocatorTable[i].idx], GDI_STACK_LEVELS); //KeRosDumpStackFrames(GDIHandleShareLocker[AllocatorTable[i].idx], GDI_STACK_LEVELS); /* Print new line for better readability */ DbgPrint("\n"); } if (i < nTraces) DbgPrint("(list terminated - the remaining entries have 1 allocation only)\n"); KeLowerIrql(OldIrql); ASSERT(FALSE); }