Esempio n. 1
0
/***************************************************************************************************
*Name        : robin_get_subtitle_item
*Prototype   : __s32  robin_get_subtitle_item( __u32 time, __cedar_subtitle_item_t *subtitle_item_p );
*Arguments   : time              input. unit : ms.
*              subtitle_item_p   output. the subtitle item information corresponding to the time.
*Return      : ==0    succeed
*              !=0    there is no subtitle item information corresponding to the time.
*Description : get the subtitle item information corresponding to the time.
*Other       :
***************************************************************************************************/
__s32  robin_get_subtitle_item( __u32 time, __cedar_subtitle_item_t *subtitle_item_p )
{
	__cedar_subtitle_item_t  *p = NULL;
	__u8   err;
		
	if( subtitle_item_p == NULL )
		return -1;
		
	g_pend_mutex( robin_cedar_mutex, &err );
	robin_wait_no_file( );

	p = (__cedar_subtitle_item_t *)esMODS_MIoctrl( robin_hced, CEDAR_CMD_GET_SUB_INFO, time, 
	                                               (void *)CEDAR_GET_SUB_INF_ITEM );
	if( p == NULL )           // no subtitle information at present
	{
		g_post_mutex( robin_cedar_mutex );
		return -1;
	}
	else
	{
		g_memcpy( subtitle_item_p, p, sizeof(__cedar_subtitle_item_t) );
		g_post_mutex( robin_cedar_mutex );
		return 0;
	}
}
Esempio n. 2
0
/***************************************************************************************************
*Name        : robin_set_ab_loop_count
*Prototype   : __s32  robin_set_ab_loop_count( __u32 count )
*Arguments   : count     input. AB loop count.
*Return      : ==0       succeed
*              !=0       fail
*Description : set the loop count in AB play mode.
*Other       :
***************************************************************************************************/
__s32  robin_set_ab_loop_count( __u32 count )
{
	/*-----------------===== to be refreshed =====-----------------------*/
	if( esMODS_MIoctrl( robin_hced, CEDAR_CMD_SET_AB_LOOPCNT, count, NULL ) == EPDK_OK )
		return 0;
	else
		return -1;
}
Esempio n. 3
0
/***************************************************************************************************
*Name        : robin_set_ab_b
*Prototype   : __s32  robin_set_ab_b( void )
*Arguments   : void
*Return      : ==0       succeed
*              !=0       fail
*Description : set the current time point as the B point in AB play mode and start AB play mode.
*Other       :
***************************************************************************************************/
__s32  robin_set_ab_b( void )
{
	/*-----------------===== to be refreshed =====-----------------------*/
	if( esMODS_MIoctrl( robin_hced, CEDAR_CMD_SET_AB_B, 0, NULL ) == EPDK_OK )
		return 0;
	else
		return -1;
}
Esempio n. 4
0
/***************************************************************************************************
*Name        : robin_cancle_ab
*Prototype   : __s32  robin_cancle_ab( void )
*Arguments   : void
*Return      : ==0       succeed
*              !=0       fail
*Description : cancle AB play.
*Other       :
***************************************************************************************************/
__s32  robin_cancle_ab( void )
{
	/*-----------------===== to be refreshed =====-----------------------*/
	if( esMODS_MIoctrl( robin_hced, CEDAR_CMD_CLEAR_AB, 0, NULL ) == EPDK_OK )
		return 0;
	else
		return -1;
}
Esempio n. 5
0
/***************************************************************************************************
*Name        : robin_get_subtitle_format
*Prototype   : __cedar_lyric_fmt_t  robin_get_subtitle_format( void )
*Arguments   : void
*Return      : the subtitle format of the current playing file. the formats are defined in mod_cedar.h,
*              see __cedar_lyric_fmt_t.
*Description : get the subtitle format of the current playing file.
*Other       :
***************************************************************************************************/
__cedar_lyric_fmt_t  robin_get_subtitle_format( void )
{
	__cedar_lyric_fmt_t  ret;	
	__u8   err;
	
	g_pend_mutex( robin_cedar_mutex, &err );
	robin_wait_no_file( );
	
	ret = (__cedar_lyric_fmt_t)esMODS_MIoctrl( robin_hced, CEDAR_CMD_GET_LBSTYPE, 0, NULL );
	
	g_post_mutex( robin_cedar_mutex );
	return ret;
}
Esempio n. 6
0
/***************************************************************************************************
*Name        : robin_get_subtitle_index
*Prototype   : __s32  robin_get_subtitle_index( void )
*Arguments   : void
*Return      : the current subtitle index among the subtitle list gotten by robin_get_subtitle_list(). If
*              return -1, that means there is no subtitle or some error occurs.
*Description : get the current subtitle index among the subtitle list gotten by robin_get_subtitle_list().
*Other       :
***************************************************************************************************/
__s32  robin_get_subtitle_index( void )
{
	__s32  ret;
	__u8   err;
	
	g_pend_mutex( robin_cedar_mutex, &err );
	robin_wait_no_file( );
	
	ret = (__s32)esMODS_MIoctrl( robin_hced, CEDAR_CMD_GET_SUBTITLE, 0, NULL );
	
	g_post_mutex( robin_cedar_mutex );
	return ret;
}
Esempio n. 7
0
/***************************************************************************************************
*Name        : robin_select_subtitle
*Prototype   : __s32  robin_select_subtitle( __u32 subtitle_index )
*Arguments   : subtitle_index   input. the subtitle index among the subtitle list gotten by 
*                               robin_get_subtitle_list().
*Return      : ==0     succeed
*              !=0     fail
*Description : select a subtitle among the subtitle list.
*Other       :
***************************************************************************************************/
__s32  robin_select_subtitle( __u32 subtitle_index )
{
	__u8   err;
	
	g_pend_mutex( robin_cedar_mutex, &err );
	robin_wait_no_file( );
	
	if( esMODS_MIoctrl( robin_hced, CEDAR_CMD_SELECT_SUBTITLE, subtitle_index, NULL ) == EPDK_OK )
	{
		g_post_mutex( robin_cedar_mutex );
		return 0;
	}
	else
	{
		g_post_mutex( robin_cedar_mutex );
		return -1;
	}
}
Esempio n. 8
0
/***************************************************************************************************
*Name        : robin_subtitle_exist
*Prototype   : __bool robin_subtitle_exist( void )
*Arguments   : void
*Return      : EPDK_TRUE      there are subtitles corresponding to the current playing file.
*              EPDK_FALSE     there is NO subtitle corresponding to the current playing file.
*Description : check whether there are subtitles corresponding to the current playing file or not.
*Other       :
***************************************************************************************************/
__bool robin_subtitle_exist( void )
{
	__s32  subtitle_format;
	__u8   err;
	
	g_pend_mutex( robin_cedar_mutex, &err );
	robin_wait_no_file( );
	
	subtitle_format = esMODS_MIoctrl( robin_hced, CEDAR_CMD_GET_LBSTYPE, 0, NULL );
	if( subtitle_format == CEDAR_LRC_TYPE_NONE || subtitle_format == CEDAR_LRC_TYPE_NOTSPT )
	{
		g_post_mutex( robin_cedar_mutex );
		return EPDK_FALSE;
	}
	else
	{
		g_post_mutex( robin_cedar_mutex );
		return EPDK_TRUE;
	}
}
Esempio n. 9
0
/***************************************************************************************************
*Name        : robin_get_subtitle_list
*Prototype   : __s32  robin_get_subtitle_list( __subtitle_profile_t  *subtitle_info_p )
*Arguments   : subtitle_info_p   output. a buffer to store subtitle info.
*Return      : ==0     subtttle list information has been parsed completely and return these info.
*              !=0     subtttle list information has NOT been parsed completely, call the function later.
*Description : get the subtitle list information of the current playing file.
*Other       :
***************************************************************************************************/
__s32  robin_get_subtitle_list( __subtitle_profile_t  *subtitle_info_p )
{
	__u8   err;
	
	if( subtitle_info_p == NULL )
		return -1;
		
	g_pend_mutex( robin_cedar_mutex, &err );
	robin_wait_no_file( );
	
	if( esMODS_MIoctrl( robin_hced, CEDAR_CMD_GET_SUBTITLE_PROFILE, 0, subtitle_info_p ) == EPDK_OK )
	{
		g_post_mutex( robin_cedar_mutex );
		return 0;
	}
	else
	{
		g_post_mutex( robin_cedar_mutex );
		return -1;
	}
}
Esempio n. 10
0
static s32 vdecoder_display_request(cedarv_decoder_t* p, cedarv_picture_t* picture)
{
#if (DISPLAY_FREE_RUN == 0)
    u32              video_time;
#endif

    vpicture_t*      frame;

    video_decoder_t* decoder;

    if(p == NULL)
        return CEDARV_RESULT_ERR_INVALID_PARAM;

    decoder = (video_decoder_t*)p;

    if(decoder->fbm == NULL)
    {
        if(decoder->ve == NULL)
            return CEDARV_RESULT_ERR_FAIL;

        decoder->fbm = libve_get_fbm(decoder->ve);

        if(decoder->fbm == NULL)
            return CEDARV_RESULT_ERR_FAIL;
    }

    if(decoder->status == CEDARV_STATUS_PREVIEW)
    	frame = fbm_display_request_frame(decoder->fbm);
    else
    {
#if (DISPLAY_FREE_RUN == 1)
	    frame = fbm_display_request_frame(decoder->fbm);
#else
	    if(decoder->display_already_begin == 1)
	    {
get_frame_again:
	        frame = fbm_display_pick_frame(decoder->fbm);
	        if(frame != NULL)
	        {
	            if(frame->pts != (u64)(-1))
	            {
	                video_time = esMODS_MIoctrl(vdrv_com->avsync, DRV_AVS_CMD_GET_VID_TIME, DRV_AVS_TIME_TOTAL, 0); //* get system time.

	                if(decoder->status == CEDARV_STATUS_BACKWARD)
	                {
	                    if(video_time > (frame->pts/1000) + DISPLAY_TIME_WINDOW_WIDTH)
	                        return -1;  //* too early to display.
	                }
	                else
	                {
	                    if(video_time + DISPLAY_TIME_WINDOW_WIDTH < (frame->pts/1000))
	                        return -1;  //* too early to display.
	                }

	                frame = fbm_display_request_frame(decoder->fbm);

	                if(decoder->status == CEDARV_STATUS_PLAY)
	                {
	                	if((frame->pts/1000) + DISPLAY_TIME_WINDOW_WIDTH < video_time)
	                	{
	                    	if(fbm_display_pick_frame(decoder->fbm) != NULL)
	                    	{
	                        	fbm_display_return_frame(frame, decoder->fbm);
	                        	if(p->release_frame_buffer_sem != NULL)
	                            	p->release_frame_buffer_sem(p->cedarx_cookie);
	                        	goto get_frame_again;
	                    	}
	                    }
	                }
	            }
	            else
	            {
	                frame = fbm_display_request_frame(decoder->fbm);
	            }
	        }
	    }
	    else
	    {
	        frame = fbm_display_request_frame(decoder->fbm);
	    }
#endif
    }


    if(frame == NULL)
        return CEDARV_RESULT_ERR_FAIL;

    picture->id                     = frame->id;
    picture->width                  = frame->width;
    picture->height                 = frame->height;
    picture->top_offset				= frame->top_offset;
    picture->left_offset			= frame->left_offset;
    picture->display_width			= frame->display_width;
    picture->display_height			= frame->display_height;
    picture->rotate_angle           = frame->rotate_angle;
    picture->horizontal_scale_ratio = frame->horizontal_scale_ratio;
    picture->vertical_scale_ratio   = frame->vertical_scale_ratio;
    picture->store_width            = frame->store_width;
    picture->store_height           = frame->store_height;
    picture->frame_rate             = frame->frame_rate;
    picture->aspect_ratio           = frame->aspect_ratio;
    picture->is_progressive         = frame->is_progressive;
    picture->top_field_first        = frame->top_field_first;
    picture->repeat_top_field       = frame->repeat_top_field;
    picture->repeat_bottom_field    = frame->repeat_bottom_field;
    picture->size_y					= frame->size_y;
    picture->size_u					= frame->size_u;
    picture->size_v					= frame->size_v;

    if(frame->pixel_format == PIXEL_FORMAT_AW_YUV422)
    	picture->pixel_format = CEDARV_PIXEL_FORMAT_AW_YUV422;
    else if(frame->pixel_format == PIXEL_FORMAT_AW_YUV411)
    	picture->pixel_format = CEDARV_PIXEL_FORMAT_AW_YUV411;
    else
    	picture->pixel_format = CEDARV_PIXEL_FORMAT_AW_YUV420;

    picture->pts                    = frame->pts;
    picture->pcr                    = frame->pcr;

	//* the CedarX player need we return physic address of display frame.
    picture->y                      = mem_get_phy_addr(frame->y);
    picture->u                      = mem_get_phy_addr(frame->u);

    picture->v                      = NULL;
    picture->alpha                  = NULL;

    decoder->last_frame_index = frame->id;
    if(decoder->display_already_begin == 0)
        decoder->display_already_begin = 1;

    return CEDARV_RESULT_OK;
}
Esempio n. 11
0
static s32 vdecoder_decode(cedarv_decoder_t* p)
{
    vresult_e        vresult;

#if (DECODE_FREE_RUN == 0)
    u64              video_time;
#endif

    video_decoder_t* decoder;

    if(p == NULL)
        return CEDARV_RESULT_ERR_INVALID_PARAM;

    decoder = (video_decoder_t*)p;

    if(decoder->mode_switched)
    {
    	libve_reset(0, decoder->ve);

        vbv_reset(decoder->vbv);
        if(p->free_vbs_buffer_sem != NULL)
            p->free_vbs_buffer_sem(p->cedarx_cookie);

        if(decoder->fbm != NULL)
        {
			fbm_flush(decoder->fbm);
            if(p->release_frame_buffer_sem != NULL)
                p->release_frame_buffer_sem(p->cedarx_cookie);
        }

    	decoder->mode_switched = 0;

    	return CEDARV_RESULT_NO_BITSTREAM;
    }

    if(decoder->status == CEDARV_STATUS_BACKWARD || decoder->status == CEDARV_STATUS_FORWARD)
    {
    	vresult = libve_decode(1, 0, 0, decoder->ve);
    }
    else
    {
    	if(decoder->stream_info.format == STREAM_FORMAT_H264 && decoder->display_already_begin == 0)
    	{
    		//* for H264, when decoding the first data unit containing PPS, we have to promise
    		//* there is more than one bitstream frame for decoding.
    		//* that is because the decoder uses the start code of the second bitstream frame
    		//* to judge PPS end.
    		if(vbv_get_stream_num(decoder->vbv) < 2)
    			return CEDARV_RESULT_NO_BITSTREAM;
    	}

    	if(decoder->status == CEDARV_STATUS_PREVIEW)
    	{
    		vresult = libve_decode(1, 0, 0, decoder->ve);
    	}
    	else
    	{
#if (DECODE_FREE_RUN == 0)
    	video_time = esMODS_MIoctrl(vdrv_com->avsync, DRV_AVS_CMD_GET_VID_TIME, DRV_AVS_TIME_TOTAL, 0);
    	video_time *= 1000;
    	vresult = libve_decode(0, 1, video_time, decoder->ve);
#else
    	vresult = libve_decode(0, 0, 0, decoder->ve);
#endif
    	}
    }

    if(vresult == VRESULT_OK)
    {
        return CEDARV_RESULT_OK;
    }
    else if(vresult == VRESULT_FRAME_DECODED)
    {
    	return CEDARV_RESULT_FRAME_DECODED;
    }
    else if(vresult == VRESULT_KEYFRAME_DECODED)
    {
    	if(decoder->status == CEDARV_STATUS_BACKWARD || decoder->status == CEDARV_STATUS_FORWARD || decoder->status == CEDARV_STATUS_PREVIEW)
    	{
    		libve_reset(1, decoder->ve);
    	}
        return CEDARV_RESULT_KEYFRAME_DECODED;
    }
    else if(vresult == VRESULT_NO_FRAME_BUFFER)
    {
        return CEDARV_RESULT_NO_FRAME_BUFFER;
    }
    else if(vresult == VRESULT_NO_BITSTREAM)
    {
        return CEDARV_RESULT_NO_BITSTREAM;
    }
    else if(vresult == VRESULT_ERR_NO_MEMORY)
    {
        return CEDARV_RESULT_ERR_NO_MEMORY;
    }
    else if( vresult == VRESULT_ERR_UNSUPPORTED)
    {
        return CEDARV_RESULT_ERR_UNSUPPORTED;
    }
    else if(vresult == VRESULT_ERR_LIBRARY_NOT_OPEN)
    {
        return CEDARV_RESULT_ERR_FAIL;
    }
    else
    {
        return CEDARV_RESULT_OK;
    }
}