void EPG_Message_CallBack(unsigned short serviceid,unsigned short tsid,unsigned short onid)
{
	JNIEnv *env = NULL;

	if(CheckEPG(serviceid,tsid,onid)!=0)
	{
		return;
	}
	
	if( NULL == g_epgVM || NULL == g_epgMsgObj )
	{
		DEBUG_MSG(-1,T("epg message-- ---------- mjvm or obj is null--------------------"));
		return;
	}
	if (g_epgVM->AttachCurrentThread(&env, NULL) != JNI_OK)
	{
		 DEBUG_MSG1(-1,T("%s: AttachCurrentThread() failed"), __FUNCTION__);
		 return;
	}
	if( NULL == env )
	{
		DEBUG_MSG1(-1,T("%s: new is null "), __FUNCTION__);
		return;
	}

	_epgMessage(env,g_epgMsgObj,serviceid,tsid,onid);
	if(g_epgVM->DetachCurrentThread() != JNI_OK) 
	{
		 DEBUG_MSG1(-1,T("%s: DetachCurrentThread() failed"), __FUNCTION__); 
	}


}
Example #2
0
/* 根据指定文件内的数据,往样式库里添加相应样式 */
LCUI_API int
StyleLib_AddStyleFromFile(	LCUI_StyleLibrary *lib,
				const char *filepath )
{
	char *buff;
	FILE *fp;
	style_scan_status status;
	buff = (char*)malloc(sizeof(char)*BUFFER_SIZE);
	if( buff == NULL ) {
		return -1;
	}
	DEBUG_MSG1("open file: %s\n", filepath);
	/* 先初始化样式扫描状态 */
	style_scan_status_init( &status );
	/* 打开文件 */
	fp = fopen( filepath, "rb" );
	if(fp == NULL) {
		DEBUG_MSG1("open file fail\n");
		return -2;
	}
	DEBUG_MSG1("open file success\n");
	/* 分段读取文件内容,并解析样式数据 */
	while( fread(buff, sizeof(char), BUFFER_SIZE, fp) ) {
		StyleLib_ScanStyle( lib, &status, buff, BUFFER_SIZE );
	}
	fclose( fp );
	return 0;
}
BOOL IRenderPipeline3D::Init(RenderPipeline_InitData & initData)
{
	mBufferWidth = initData.bufferWidth;
	mBufferHeight = initData.bufferHeight;
	if (initData.pOutColorBuffer != nullptr)
	{
		m_pOutColorBuffer = initData.pOutColorBuffer;
	}
	else
	{
		DEBUG_MSG1("Render PipeLine: color buffer ptr invalid!!");
		return FALSE;
	}


	if (initData.pZBuffer != nullptr)
	{
		m_pZBuffer = initData.pZBuffer;
	}
	else
	{
		DEBUG_MSG1("Render PipeLine: Z buffer ptr invalid!!");
		return FALSE;

	}
	return TRUE;
}
Example #4
0
void
TextLayer_Text_GenerateBMP( LCUI_TextLayer *layer )
/* 为文本图层中的文本生成位图,已存在位图的文字将不重新生成 */
{
	BOOL refresh = FALSE;
	LCUI_Pos pos;
	int i, j, len, rows;
	Text_RowData *row_ptr;
	LCUI_CharData *char_ptr;
	
	DEBUG_MSG1("enter\n");
	DEBUG_MSG1("thread: %lu\n", thread_self());
	rows = Queue_Get_Total( &layer->rows_data );
	for( pos.y=0,j=0; j<rows; ++j ) {
		row_ptr = Queue_Get( &layer->rows_data, j );
		len = Queue_Get_Total( &row_ptr->string );
		DEBUG_MSG1("row %d, len: %d\n", j, len);
		for( pos.x=0,i=0; i<len; ++i) {
			char_ptr = Queue_Get( &row_ptr->string, i );
			DEBUG_MSG1("generate FontBMP, get char_ptr: %p, char: %c\n", 
					char_ptr, char_ptr->char_code );
			if( !char_ptr || !char_ptr->display ) {
				DEBUG_MSG1("no display\n");
				continue;
			}
			if( FontBMP_Valid( &char_ptr->bitmap ) ) {
				DEBUG_MSG1("have FontBMP\n");
				if( !refresh ) {
					pos.x += char_ptr->bitmap.advance.x;
					continue;
				}
			} else {
				refresh = TRUE;
				DEBUG_MSG1( "generate FontBMP, char code: %d\n", char_ptr->char_code );
				TextLayer_Get_Char_BMP ( &layer->default_data, char_ptr );
			}
			DEBUG_MSG1( "char_data->bitmap.advance.x: %d\n", char_ptr->bitmap.advance.x );
			TextLayer_Clear( layer, pos, row_ptr->max_size.h, char_ptr );
			char_ptr->need_update = TRUE;
			pos.x += char_ptr->bitmap.advance.x;
		}
		refresh = FALSE;
		/* 更新当前行的尺寸 */
		TextLayer_Update_RowSize( layer, j );
		DEBUG_MSG1("row size: %d,%d\n", row_ptr->max_size.w, row_ptr->max_size.h);
		pos.y += row_ptr->max_size.h;
	}
	DEBUG_MSG1("quit\n");
}
int UDPConnection::ConnectToServer(int block){

  if(m_ConMode!=CONMODE_CLIENT){
    ERROR_MSG("Client not initialized\n");
    return FALSE;
  }

  int first = 1;
  while((block==1)||(first==1)){
    if(first==1){
      DEBUG_MSG("Connecting to server\n");
    }
    if(first==0)
      sleep(1);

    m_Connected = true;
    if(!SendMessage(QUERY_CONNECTION,NULL,0)){
      ERROR_MSG("Sending connection query failed\n");
      m_Connected = false;
      return FALSE;
    }

    if(first==1){
      DEBUG_MSG("Waiting for connection\n");
    }


    MsgType type;
    if(GetMessage(&type,NULL,NULL,0)){
      if((type)==ACCEPT_CONNECTION){
        DEBUG_MSG1("Connection accepted: %s\n",(char*)((((int*)m_buffer)+1)));
        m_Connected = true;
        return TRUE;
      }
      m_Connected = false;
      if((type)==REFUSE_CONNECTION){
        DEBUG_MSG1("Connection refused: %s\n",(char*)((((int*)m_buffer)+1)));
        return FALSE;
      }
    }
    m_Connected = false;
    first = 0;
  }
  return FALSE;
}
BOOL IPicture::LoadPPM(std::string ppmFilePath)
{
	BOOL yes=IFileManager::ImportFile_PPM(ppmFilePath, mWidth, mHeight, *m_pColorBuffer);
	if (yes == TRUE)
	{
		return TRUE;
	}
	else
	{
		mWidth = 0;
		mHeight = 0;
		DEBUG_MSG1("IPicture: Load PPM failed!!");
		return FALSE;
	}
}
Example #7
0
static void Picture( mpeg_decode* dec )
{
	static const int16_t aspect[16] = 
	{
		    0,10000, 6735, 7031,
		 7615, 8055, 8437, 8935,
		 9157, 9815,10255,10695,
		10950,11575,12015,    0,
	};

	if (!dec->Codec.In.Format.Format.Video.Aspect && aspect[dec->aspect])
		dec->Codec.In.Format.Format.Video.Aspect = Scale(ASPECT_ONE,10000,aspect[dec->aspect]);

	CodecIDCTSetFormat(&dec->Codec,PF_YUV420,dec->width,dec->height,dec->width,dec->height,dec->Codec.In.Format.Format.Video.Aspect);

    flushbits(dec,10); // temporal ref

    loadbits(dec);
	dec->prediction_type = getbits(dec,3);

    flushbits(dec,16); // non constant bit rate

	loadbits(dec);
    if (dec->prediction_type == P_VOP || dec->prediction_type == B_VOP)
	{
        dec->full_pixel[0] = getbits(dec,1);
        dec->fcode[0] = getbits(dec,3)-1;
    }

    if (dec->prediction_type == B_VOP) 
	{
        dec->full_pixel[1] = getbits(dec,1);
        dec->fcode[1] = getbits(dec,3)-1;
    }

    dec->frame_state = 1;

	DEBUG_MSG1(DEBUG_VCODEC,T("MPEG Picture:%d"),dec->prediction_type);
}
// Initialize the server socket at a given port
int UDPConnection::InitServer(int port){

  if(m_ConMode!=CONMODE_NONE){
    ERROR_MSG("Connection already initialized\n");
    return FALSE;
  }

  DEBUG_MSG1("Server Initialization, port: %d\n",port);

  // Checking port number
  m_port = port;
  if((port<1024)||(port>65000)){
    ERROR_MSG1("Port number: %d must be 1024<port<65000\n",port);
    return FALSE;
  }

  // Creating socket
  m_socket = socket(PF_INET,SOCK_DGRAM,0);
  if(m_socket<0){
    ERROR_MSG("Socket initialization error\n");
    return FALSE;
  }

  // Binding socket
  m_server.sin_family      = AF_INET;
  m_server.sin_addr.s_addr = INADDR_ANY;
  m_server.sin_port        = htons(m_port);

  if(bind(m_socket,(struct sockaddr *)&m_server, sizeof(m_server))<0){
    PERROR("Socket bind error");
    return FALSE;
  }

  m_ConMode = CONMODE_SERVER;

  // Done
  return TRUE;
}
bool _register_epg_msg_callback_methods(JNIEnv *env)
{
	jclass jClass = NULL;

	jClass = env->FindClass("com/pbi/dvb/dvbinterface/NativeEpgMsg");
	if( NULL == jClass )
	{
		DEBUG_MSG1( -1, "%s class is NULL!", __FUNCTION__ );
		return false;
	}
	
	g_Epg_Msg_Callback.MsgClass = (jclass)env->NewGlobalRef( (jobject)jClass );
	if( NULL == g_Epg_Msg_Callback.MsgClass )
	{
		DEBUG_MSG(-1, "_register_epg_msg_callback_methods error!");
		return false;
	}

	//g_Epg_Msg_Callback.Constructor = env->GetMethodID(g_Epg_Msg_Callback.MsgClass, "<init>", "()V");
	//g_Epg_Msg_Callback.epgMessage = env->GetMethodID(g_Epg_Msg_Callback.MsgClass, "epgmsgNotify", "(SSS)V");

	return true;
}
Example #10
0
static int Process( ffmpeg_video_real* p, const packet* Packet, const flowstate* State )
{
	int Picture;
	int Len;

	if (Packet)
	{
		if (State->DropLevel)
		{
			if (State->DropLevel>1)
			{
				p->SkipToKey = 1;
				p->DropToKey = 1;
				p->Dropping = 1;
				p->Context->hurry_up = 5;
			}
			else
				p->Context->hurry_up = 1;
			if (!SupportDrop(p))
				p->Context->hurry_up = 0;
		}
		else
			p->Context->hurry_up = 0;

		if (!Packet->Key && p->DropToKey)
		{
			if (p->Dropping)
			{
				flowstate DropState;
				DropState.CurrTime = TIME_UNKNOWN;
				DropState.DropLevel = 1;
				p->Codec.Out.Process(p->Codec.Out.Pin.Node,NULL,&DropState);
			}
			if (SupportDrop(p))
				avcodec_flush_buffers(p->Context);
			return ERR_DROPPING;
		}

		if (p->DropToKey)
			p->DropToKey = 0;

		if (Packet->RefTime >= 0 && p->RefTime < 0)
			p->RefTime = Packet->RefTime;
		/*	if (Packet->RefTime >= 0)
			p->Codec.Packet.RefTime = Packet->RefTime;
*/
		DEBUG_MSG1(-1,T("Packet->RefTime %d"),Packet->RefTime);

		BufferPack(&p->Buffer,0);
		
		if(p->Codec.In.Pin.Node->Class==FOURCC('R','V','_','0')&&
			(p->Codec.In.Format.Format.Video.Pixel.FourCC == FOURCC('R','V','1','0')||
			p->Codec.In.Format.Format.Video.Pixel.FourCC == FOURCC('R','V','2','0')||
			p->Codec.In.Format.Format.Video.Pixel.FourCC == FOURCC('R','V','3','0')||
			p->Codec.In.Format.Format.Video.Pixel.FourCC == FOURCC('R','V','4','0')))
		{
		
				int32_t ret = rm_assemble_video_frame(p,Packet);
				if(ret != ERR_NONE)
					return ERR_NEED_MORE_DATA;
				else
				{
					DEBUG_MSG1(-1,T("VPASS:Packet->RefTime %d"),Packet->RefTime);
					p->Codec.Packet.RefTime = p->RefTime;
				}
		}
		else
		{
			BufferWrite(&p->Buffer,Packet->Data[0],Packet->Length,2048);//for other demuxer eg.mkv rv10-rv40 demuxer;
			p->Codec.Packet.RefTime = Packet->RefTime;
		}
	}
	else
	{
		if (p->FrameTime<0)
			p->Codec.Packet.RefTime = TIME_UNKNOWN;
		else
		if (!State)
			p->Codec.Packet.RefTime += p->FrameTime;

		if (!State && p->Buffer.WritePos == p->Buffer.ReadPos)
			return ERR_NEED_MORE_DATA;
	}

	if (p->SkipToKey)
		p->Picture->pict_type = 0;

	Len = avcodec_decode_video(p->Context, p->Picture, &Picture, p->Buffer.Data + p->Buffer.ReadPos, 
		p->Buffer.WritePos - p->Buffer.ReadPos);

	if (Len < 0)
	{
		BufferDrop(&p->Buffer);
		return ERR_INVALID_DATA;
	}

	p->Buffer.ReadPos += Len;

	if (!Picture)
	{
		if (p->SkipToKey>1 && p->Picture->pict_type)
			--p->SkipToKey;

		return ERR_NONE;
	}

	if (p->SkipToKey>0)
	{
		if ((!p->Picture->key_frame && p->Picture->pict_type) || p->SkipToKey>1)
		{
			if (p->SkipToKey>1)
				--p->SkipToKey;
			if (p->Dropping)
			{
				flowstate DropState;
				DropState.CurrTime = TIME_UNKNOWN;
				DropState.DropLevel = 1;
				p->Codec.Out.Process(p->Codec.Out.Pin.Node,NULL,&DropState);
				p->RefTime = TIME_UNKNOWN;
			}
			return ERR_DROPPING;
		}
		p->SkipToKey = 0;
	}

	if (p->Context->pix_fmt != p->PixelFormat ||
		p->Context->sample_aspect_ratio.num != p->Aspect.num ||
		p->Context->sample_aspect_ratio.den != p->Aspect.den ||
		p->Context->width != p->Codec.Out.Format.Format.Video.Width ||
		p->Context->height != p->Codec.Out.Format.Format.Video.Height ||
		p->Picture->linesize[0] != p->Codec.Out.Format.Format.Video.Pitch)
	{
		if (!BuildOutputFormat(p))
			return ERR_INVALID_DATA;

		ConnectionUpdate(&p->Codec.Node,CODEC_OUTPUT,p->Codec.Out.Pin.Node,p->Codec.Out.Pin.No);
	}

	p->Codec.Packet.Data[0] = p->Picture->data[0];
	p->Codec.Packet.Data[1] = p->Picture->data[1];
	p->Codec.Packet.Data[2] = p->Picture->data[2];
	p->RefTime = TIME_UNKNOWN;
	return ERR_NONE;
}
Example #11
0
TextLayer_Text_Process(	LCUI_TextLayer *layer,
				int pos_type,
				wchar_t *new_text )
{
	LCUI_BOOL refresh = TRUE;
	LCUI_Pos cur_pos, des_pos;
	int total, cur_len, row, src_pos, total_row, n_ignore = 0;
	wchar_t *finish, *p, *q;
	
	LCUI_Pos tmp_pos;
	LCUI_CharData *char_ptr, char_data; 
	Text_RowData *cur_row_ptr, *tmp_row_ptr;
	
	/* 如果有选中的文本,那就删除 */
	//......  
	DEBUG_MSG1("enter\n");
	/* 如果是将文本追加至文本末尾 */
	if( pos_type == AT_TEXT_LAST ) {
		cur_pos.y = Queue_GetTotal( &layer->rows_data );
		if( cur_pos.y > 0 ) {
			--cur_pos.y;
		}
		cur_row_ptr = Queue_Get( &layer->rows_data, cur_pos.y );
		if( !cur_row_ptr ) {
			TextLayer_Text_Add_NewRow( layer );
			cur_row_ptr = Queue_Get( &layer->rows_data, cur_pos.y );
		}
		cur_pos.x = Queue_GetTotal( &cur_row_ptr->string );
		src_pos = Queue_GetTotal( &layer->text_source_data );
		des_pos = cur_pos;
	} else {/* 否则,是将文本插入至光标所在位置 */
		cur_pos = TextLayer_Cursor_GetPos( layer );
		DEBUG_MSG1( "cur_pos: %d,%d\n", cur_pos.x, cur_pos.y );
		cur_row_ptr = Queue_Get( &layer->rows_data, cur_pos.y );
		DEBUG_MSG1( "cur_row_ptr: %p\n", cur_row_ptr );
		if( !cur_row_ptr ) {
			TextLayer_Text_Add_NewRow( layer );
			cur_row_ptr = Queue_Get( &layer->rows_data, cur_pos.y );
		}
		src_pos = layer->current_src_pos;
		des_pos = layer->current_des_pos;
		DEBUG_MSG1( "src_pos: %d\n", src_pos );
		DEBUG_MSG1( "des_pos: %d,%d\n", des_pos.x, des_pos.y );
	}
	row = cur_pos.y;
	total = wcslen( new_text );
	total_row = TextLayer_GetRows( layer );
	/* 判断当前要添加的字符的总数是否超出最大限制 */
	cur_len = Queue_GetTotal( &layer->text_source_data );
	if( total + cur_len > layer->max_text_len ) {
		total = layer->max_text_len - cur_len;
	}
	if( total < 0 ) {
		total = 0;
	}
	//_DEBUG_MSG( "layer: %p, cur total: %d, max_len: %d\n", 
	// layer, cur_len, layer->max_text_len );
	DEBUG_MSG1( "total char: %d\n", total );
	DEBUG_MSG1( "total row: %d\n", total_row );
	
	char_data.bitmap = NULL;
	/* 先记录这一行需要刷新的区域,起点为光标所在位置 */
	TextLayer_CharLater_Refresh( layer, cur_pos );
	for(p=new_text, finish=new_text+total; p<finish; ++p) { 
		DEBUG_MSG2( "1, char: %c\n", *p );
		if( layer->using_style_tags ) {
			/* 处理样式的结束标签 */ 
			q = StyleTag_ProcessEndingTag( &layer->tag_buff, p );
			if( q ) {
				/* 计算需忽略的字符数 */
				n_ignore = q-p+1;
			} else {
				/* 处理样式标签 */
				q = StyleTag_ProcessTag( &layer->tag_buff, p );
				if( q ) {
					n_ignore = q-p+1;
				}
			}
		}
		/* 针对换行符模式为Win(CR/LF)的文本,进行处理 */
		if(*p == '\n' || *p == '\r') { 
			/* 计算需要忽略的换行符的数量 */
			for( n_ignore=0,q=p; *q == '\n' || *q == '\r'; 
				++q,++n_ignore);
		} 
		if(n_ignore > 0) {
			/* 被忽略的字符的属性都一样,所以只需赋一次值 */
			char_data.data = NULL;
			char_data.display = FALSE; 
			char_data.need_update = FALSE;
			char_data.bitmap = NULL;
		}
		while(n_ignore > 0) {
			DEBUG_MSG2( "ignore = %d\n", n_ignore );
			char_data.char_code = *p++;
			Queue_Insert( &layer->text_source_data, src_pos, &char_data ); 
			char_ptr = Queue_Get( &layer->text_source_data, src_pos );
			/* 如果启用多行显示,并遇到换行符,那就增加新行 */
			if( layer->enable_multiline 
			 && char_data.char_code == '\n' ) {
				++row;
				if( refresh ) {
					tmp_pos.x = 0;
					tmp_pos.y = row;
					/* 刷新该行后面所有行的字符 */
					for( ; tmp_pos.y<total_row; ++tmp_pos.y ) {
						TextLayer_CharLater_Refresh( layer, tmp_pos );
					}
					refresh = FALSE;
				}
				/* 换行符的数据单独保存 */
				cur_row_ptr->last_char = char_ptr;
				/* 在该行插入新行 */
				TextLayer_Text_Insert_NewRow( layer, row );
				/* 获取新行的行指针 */
				tmp_row_ptr = Queue_Get( &layer->rows_data, row );
				/* 当前位置后面的字符转移到新行里 */
				TextLayer_Text_RowBreak( layer, cur_row_ptr, 
				 des_pos.x, tmp_row_ptr );
				/* 行指针切换到下一行 */
				cur_row_ptr = tmp_row_ptr;
				/* 更新当前字符坐标 */
				des_pos.x = 0;
				des_pos.y = row;
				/* 更新总行数 */
				total_row = TextLayer_GetRows( layer );
			}
			++src_pos; 
			--n_ignore;
			if(n_ignore == 0) {
				n_ignore = -1;
				break;
			}
		}
		if(n_ignore == -1) {
			--p; n_ignore = 0;
			continue;
		}
		DEBUG_MSG2( "2, char: %c\n", *p );
		char_data.char_code = *p;
		char_data.display = TRUE; 
		char_data.need_update = TRUE; 
		char_data.data = StyleTag_GetCurrentStyle( &layer->tag_buff );
		/* 插入至源文本中 */
		Queue_Insert( &layer->text_source_data, src_pos, &char_data );
		/* 获取源文本中的字符数据的指针 */
		char_ptr = Queue_Get( &layer->text_source_data, src_pos );
		/* 将该指针添加至行数据队列中 */
		cur_row_ptr = Queue_Get( &layer->rows_data, des_pos.y );
		Queue_InsertPointer( &cur_row_ptr->string, des_pos.x, char_ptr );
		++src_pos; ++des_pos.x; 
	}
	
	if( pos_type == AT_CURSOR_POS ) {
		layer->current_des_pos = des_pos;
		layer->current_src_pos = src_pos;
	}
	DEBUG_MSG1("quit\n");
}
Example #12
0
static void StyleLib_ScanStyle(
		LCUI_StyleLibrary *lib,
		style_scan_status *status,
		const char *style_string,
		int max_len )
{
	const char *cur, *max;

	cur = style_string;
	max = cur + max_len;
	DEBUG_MSG1("len: %d\n", strlen(style_string));
	for( status->ch_pos=0; cur<max && *cur!='\0'; ++cur ) {
		if( status->save_attr_name ) {
			switch(*cur) {
			case '\r':
			case '\t':
			case '\n':
			case ' ': break;
			case ':':
				status->name_buff[status->ch_pos] = 0;
				status->ch_pos = 0;
				status->save_attr_name = FALSE;
				status->save_attr_value = TRUE;
				DEBUG_MSG1("end save, attr name: %s\n", status->name_buff);
				break;
			default:
				DEBUG_MSG1("name_buff[%d]: %c\n", status->ch_pos, *cur);
				status->name_buff[status->ch_pos] = *cur;
				++status->ch_pos;
			}
			continue;
		} else if( status->save_attr_value ) {
			switch(*cur) {
			case '\r':
			case '\t':
			case '\n':
				break;
			case '}':
			case ';':
				DEBUG_MSG1("i==%d\n", status->ch_pos);
				status->value_buff[status->ch_pos] = 0;
				status->ch_pos = 0;
				StyleClass_SetStyleAttr( status->cur_style, NULL, status->name_buff, status->value_buff );
				status->save_attr_name = TRUE;
				status->save_attr_value = FALSE;
				DEBUG_MSG1("add attr: %s = %s\n\n", status->name_buff, status->value_buff);
				break;
			case ' ':
				if(status->ch_pos == 0) {
					break;
				}
			default:
				DEBUG_MSG1("value_buff[%d]: %c\n", status->ch_pos, *cur);
				status->value_buff[status->ch_pos] = *cur;
				++status->ch_pos;
			}
			continue;
		} else if( status->save_class_name ) {
			switch(*cur) {
			case '\r':
			case '\t':
			case '\n':
			case ' ':
				break;
			case '{':
				status->name_buff[status->ch_pos] = 0;
				status->ch_pos = 0;
				status->save_class_name = FALSE;
				status->save_attr_name = TRUE;
				status->cur_style = StyleLib_AddStyleClass( lib, status->name_buff );
				DEBUG_MSG1("add class: %s\n", status->name_buff);
				break;
			default:
				DEBUG_MSG1("name_buff[%d]: %c\n", status->ch_pos, *cur);
				status->name_buff[status->ch_pos] = *cur;
				++status->ch_pos;
			}
			continue;
		}
		if( *cur == '.' ) {
			status->save_class_name = TRUE;
			status->ch_pos = 0;
		}
	}
	DEBUG_MSG1("quit\n");
}
Example #13
0
void CA_Message_CallBack(U32	uEventType, U32 u32EventLen, unsigned char* pEventData, unsigned char* pPrivateData)
{
	JNIEnv *env = NULL;
	
	if( NULL == g_caVM || NULL == g_CaMsgObj )
	{
		DEBUG_MSG(-1,T("ca message-- ---------- mjvm or obj is null--------------------"));
		return;
	}
	
	if (g_caVM->AttachCurrentThread(&env, NULL) != JNI_OK)
	{
		 DEBUG_MSG1(-1,T("%s: AttachCurrentThread() failed"), __FUNCTION__);
		 return;
	}
	if( NULL == env )
	{
		DEBUG_MSG1(-1,T("%s: new is null "), __FUNCTION__);
		return;
	}
	DEBUG_MSG3(-1,"[zshang][%s|%d]type[%d]\n", __FUNCTION__, __LINE__, uEventType);
	switch(uEventType)
	{
		case SET_PARENTAL_QUERY_REPLY:
		case CHECK_PIN_QUERY_REPLY:
		case CHANGE_PIN_QUERY_REPLY:			
		case SUBTITLE_NOTIFY:
		case SC_INFO_NOTIFY:
		case PPID_NOTIFY:
		case PPID_INFO_NOTIFY:
		case USER_VIEW_INFO_NOTIFY:
		case PROG_SKIP_NOTIFY:
		case PPV_LIST_INFO_NOTIFY:
		case IPPV_LIST_INFO_NOTIFY:
		case ANTI_RECORD_QUERY_REPLY:
		case IPPV_QUERY_REPLY:
		{
			if(pEventData != NULL && u32EventLen >= 1)
			_CaStatusMessage(env, g_CaMsgObj, uEventType, pEventData[0]);
		}
		break;
	}
	switch(uEventType)
	{
		case CAT_QUERY_REPLY:
		case PMT_QUERY_REPLY :
		case STOP_PROG_QUERY_REPLY :
		case CAT_INFO_NOTIFY:
		case PMT_INFO_NOTIFY:
		case EMM_STATUS_NOTIFY:		
		case NIT_QUERY_REPLY:
		case NVRAM_OP_REPLY:
			break;
		case IPPV_NOTIFY:
		{
			_CaIppNotifyMessage(env, g_CaMsgObj, (int)pPrivateData);
		}
		break;
		case BMAIL_NOTIFY:		
		case SUBTITLE_NOTIFY:
		{
			_CaMailMessage(env, g_CaMsgObj,(int)pPrivateData);
		}
		break;
		case OSD_DISPLAY_NOTIFY:
		{
			_CaOsdDisplayMessage(env, g_CaMsgObj,(int)pPrivateData);
		}
		break;
		case SC_INFO_NOTIFY:
		{
			if(pEventData != NULL && u32EventLen >= 2 && pEventData[1] == 1)
			{
				DEBUG_MSG3(-1,"[zshang][%s|%d]status[%d]\n", __FUNCTION__, __LINE__, pEventData[1]);
					_CaSCInfoMessage(env, g_CaMsgObj,(int)pPrivateData);
				}
			}
		break;
		case PPID_NOTIFY:
		{
			if(pEventData != NULL && u32EventLen >= 1 && pEventData[0] == 0)
			_CaPPidListMessage(env, g_CaMsgObj,(int)pPrivateData);
		}
		break;
		case PPID_INFO_NOTIFY:
		{
			if(pEventData != NULL && u32EventLen >= 1 && pEventData[0] == 0)
			_CaPPidInfoMessage(env, g_CaMsgObj,(int)pPrivateData);
		}
		break;
		case CA_MESSAGE_CODE:
		{
			if(pEventData != NULL && u32EventLen >= 4)
				_CaServiceMessage(env, g_CaMsgObj,pEventData[0],  (pEventData[1]<<8 | pEventData[2]), pEventData[3]);
		}
		break;
		case FINGERPRINT_NOTIFY:
		{
			if(pEventData != NULL && pEventData[0] == 0  && u32EventLen >= 11)
				_CaFp(env, g_CaMsgObj, pEventData[1], (int)(pEventData+2));
		}
		break;
		case USER_VIEW_INFO_NOTIFY:
		{
			if(pEventData != NULL && u32EventLen >= 1 && pEventData[0] == 1)
				_CaUseViewMessage(env, g_CaMsgObj,(int)pPrivateData);
			}
		break;
		case PROG_SKIP_NOTIFY:
		{
			if(pEventData != NULL && u32EventLen >= 1 && pEventData[0] == 0)
			_caEnhanceChanPlay(env, g_CaMsgObj,(int)pPrivateData);
		}
		break;
		case PPV_LIST_INFO_NOTIFY:
		{
			if(pEventData != NULL && u32EventLen >= 1 && pEventData[0] == 0)
			_CaPPVListMessage(env, g_CaMsgObj,(int)pPrivateData);
		}
		break;
		case IPPV_LIST_INFO_NOTIFY:
		{
			if(pEventData != NULL && u32EventLen >= 1 && pEventData[0] == 0)
			_CaIppvListMessage(env, g_CaMsgObj,(int)pPrivateData);
		}
		break;
		case PROG_PARENTAL_RATE_NOTIFY:
		case SECURITY_INIT_ERROR_NOTIFY:

		case COS_SYSTEM_NOTIFY:
		break;
		case MODIFY_STB_PASSWORD:
			if(pEventData != NULL && u32EventLen >= 1 && pEventData[0] != 0)
			_STBPassword(env, g_CaMsgObj, (int)pEventData);
			/****修改盒子密码*/
		break;
		default: 
		{
			
		}
		break;
	}
}
Example #14
0
void CA_Message_CallBack(int eCaMsg, unsigned short wDemux,  int ulParam, int param2 )
{
	JNIEnv *env = NULL;
	
	if( NULL == g_caVM || NULL == g_CaMsgObj )
	{
		DEBUG_MSG(-1,T("ca message-- ---------- mjvm or obj is null--------------------"));
		return;
	}
	
	if (g_caVM->AttachCurrentThread(&env, NULL) != JNI_OK)
	{
		 DEBUG_MSG1(-1,T("%s: AttachCurrentThread() failed"), __FUNCTION__);
		 return;
	}
	if( NULL == env )
	{
		DEBUG_MSG1(-1,T("%s: new is null "), __FUNCTION__);
		return;
	}
#if 0
	switch( eCaMsg )
	{
		case CAS_MC_DECODER_INFO:/*解扰信息------errmsg  不需要处理*/		
		case CAS_MC_SERVICE_INFO:/*节目信息errmsg不需要处理*/
		{
        }
        break;
		
		case CAS_MC_SC_ACCESS:/*节目信息errmsg对应显示E04或是e07*/
		{
			//_utiCaServiceMessage();
			DEBUG_MSG2(-1,T("ca message- SC- - dfg---------eCaMsg[%d]  wDemuxl[%d]--------------------"),eCaMsg,wDemux);
			_CaServiceMessage(env, g_CaMsgObj,0,0,0,wDemux);
			
        }
        break;
		case CAS_MC_IPP_NOTIFY:/*IPP */
		{
			_CaIppNotifyMessage(env, g_CaMsgObj,param2);
        }
        break;
		case CAS_MC_IPP_INFO_UPDATE:/*IPPV */
		{
			//_CaIppNotifyMessage(env, g_CaMsgObj,param2);
			_CaIppUpdate(env, g_CaMsgObj,param2);
		}
		break;
		case CAS_MC_ENHANCED_SHORT_MESSAGE:/*邮件*/
		{
			
		}
		break;
		case CAS_MC_ENHANCED_FINGER_PRINT:/*强制指纹显示*/
		{
			
        }
		break;
		case CAS_MC_FORCE_CHANNEL:/*强制频道切换*/
		{
			_caEnhanceChanPlay(env, g_CaMsgObj,param2);
		}
		break;
		case CAS_MC_FINGER_PRINT:/*指纹信息*/
		{
			_CaFp(env, g_CaMsgObj,param2);
		}
		break;
		case CAS_MC_EMM_DOWNLOAD:/*升级信息*/
		{
			
        }
		break;
		case CAS_MC_EMM_CHANGEPIN:/*智能卡密码更换 不需要处理*/
		case CAS_MC_PIN_CODE_CHECK:/*智能卡密码更换 不需要处理*/
		case CAS_MC_NOTIFY_EXPIRY_STATE:/*不需要处理*/
		case CAS_MC_MONITOR_ECM:/*不需要处理*/
		case CAS_MC_MONITOR_EMM:/*不需要处理*/
		{
			
        }
		break;
		case CAS_MC_NOTIFY_CURRENT_STATE:/*当前状态errmsg*/
		{
			/*根据wDemux 显示当前的状态 E00~E30,其中e00不用显示*/
			_CaServiceMessage(env, g_CaMsgObj,0,0,0,wDemux);
			
			DEBUG_MSG2(-1,T("ca message- err --sdf--------eCaMsg[%d]  wDemuxl[%d]--------------------"),eCaMsg,wDemux);
        }
        break;
		case CAS_MC_NOTIFY_SHORT_MESSAGE:/*短消息*/
		{
			_CaMailMessage(env, g_CaMsgObj,param2);			
		}
		break;
		default:
		{

		}
		break;
	}


	if(g_caVM->DetachCurrentThread() != JNI_OK) 
	{
		 DEBUG_MSG1(-1,T("%s: DetachCurrentThread() failed"), __FUNCTION__); 
	}
	#endif

}