author | kui.zhang <kui.zhang@amlogic.com> | 2012-09-14 06:58:23 (GMT) |
---|---|---|
committer | kui.zhang <kui.zhang@amlogic.com> | 2012-09-14 06:58:23 (GMT) |
commit | f6a7f3cfc475c1437ecae1a8282d5d309bc665c8 (patch) | |
tree | 234db415111d47c10c7b39044a60b89944c8830f | |
parent | 474e96c31b1d0247563fd6cb4d5747ea7381bd18 (diff) | |
download | libzvbi-f6a7f3cfc475c1437ecae1a8282d5d309bc665c8.zip libzvbi-f6a7f3cfc475c1437ecae1a8282d5d309bc665c8.tar.gz libzvbi-f6a7f3cfc475c1437ecae1a8282d5d309bc665c8.tar.bz2 |
add cc interface
-rwxr-xr-x | ntsc_decode/am_vbi.c | 51 | ||||
-rwxr-xr-x | ntsc_decode/include/am_vbi.h | 18 | ||||
-rwxr-xr-x | ntsc_decode/ntsc_dmx/linux_vbi/linux_ntsc.c | 4 |
3 files changed, 64 insertions, 9 deletions
diff --git a/ntsc_decode/am_vbi.c b/ntsc_decode/am_vbi.c index a34b719..ec6380c 100755 --- a/ntsc_decode/am_vbi.c +++ b/ntsc_decode/am_vbi.c @@ -20,7 +20,7 @@ typedef struct { vbi_decoder *dec; - //vbi_search *search; + vbi_bool cc_status; AM_VBI_CC_Para_t cc_para; AM_VBI_XDS_Para_t xds_para; int page_no; @@ -113,15 +113,22 @@ static void* vbi_cc_thread(void *arg) static void vbi_cc_handler(vbi_event * ev,void * user_data) { AM_VBI_Parser_t *parser = (AM_VBI_Parser_t*)user_data; - AM_DEBUG("NTSC-------------------- vbi_cc_handler****************"); - //if(parser->page_no != ev->ev.caption.pgno){ - parser->page_no = ev->ev.caption.pgno; + + if(parser->page_no == 0) + return; + //***************************************************temp add cc status + if(parser->cc_status == AM_TRUE) + if(parser->page_no == ev->ev.caption.pgno){ + //parser->page_no = ev->ev.caption.pgno; parser->disp_update = AM_TRUE; pthread_cond_signal(&parser->cond); //vbi_cc_show(parser); - //} + } } + + + @@ -362,7 +369,10 @@ vbi_bool AM_VBI_CC_Create(AM_VBI_Handle_t *handle, AM_VBI_CC_Para_t *para) AM_DEBUG("NTSC-------------------- ******************AM_NTSC_CC_Start \n"); AM_VBI_Parser_t *parser = (AM_VBI_Parser_t*)handle; vbi_bool ret = AM_SUCCESS; - + + //*******************************************************temp + parser->cc_status = AM_TRUE; + //*******************************************************temp if(!parser) { AM_DEBUG("NTSC-------------------- ******************AM_CC_ERR_INVALID_HANDLE \n"); @@ -419,4 +429,31 @@ vbi_bool AM_VBI_XDS_Create(AM_VBI_Handle_t *handle,AM_VBI_XDS_Para_t *para) assert (ret); return AM_SUCCESS; -}
\ No newline at end of file +} + + +vbi_bool AM_VBI_CC_set_type(AM_VBI_Handle_t handle,VBI_CC_TYPE cc_type) +{ + AM_DEBUG("NTSC-------------------- ******************AM_VBI_CC_set_type ===%d\n",cc_type); + AM_VBI_Parser_t *parser = (AM_VBI_Parser_t*)handle; + + if(cc_type < 1 || cc_type >8) + return AM_FAILURE; + else + parser->page_no = cc_type; + return AM_SUCCESS; +} + +vbi_bool AM_VBI_CC_set_status(AM_VBI_Handle_t handle,vbi_bool flag) +{ + AM_DEBUG("NTSC-------------------- ******************AM_VBI_CC_set_status ===%d\n"); + AM_VBI_Parser_t *parser = (AM_VBI_Parser_t*)handle; + if(flag == AM_TRUE) + parser->cc_status = AM_TRUE; + else + if(flag == AM_FAILURE) + parser->cc_status = AM_FAILURE; + return AM_SUCCESS; + +} + diff --git a/ntsc_decode/include/am_vbi.h b/ntsc_decode/include/am_vbi.h index a2851f8..427a24d 100755 --- a/ntsc_decode/include/am_vbi.h +++ b/ntsc_decode/include/am_vbi.h @@ -80,6 +80,19 @@ typedef void (*AM_VBI_xds_callback_t)(AM_VBI_Handle_t handle, vbi_xds_subclass_p +typedef enum { + VBI_CC1 = 0x01, + VBI_CC2, + VBI_CC3, + VBI_CC4, + VBI_TT1, + VBI_TT2, + VBI_TT3, + VBI_TT4, + +} VBI_CC_TYPE; + + extern vbi_bool AM_VBI_CC_Create(AM_VBI_Handle_t *handle, AM_VBI_CC_Para_t *para); extern vbi_bool AM_VBI_CC_Start(AM_VBI_Handle_t handle); @@ -89,9 +102,14 @@ decode_vbi (int dev_no, int fid, const uint8_t *data, int len, void *user_data) extern void* AM_VBI_CC_GetUserData(AM_VBI_Handle_t handle); +extern vbi_bool AM_VBI_CC_set_type(AM_VBI_Handle_t handle,VBI_CC_TYPE cc_type); //*cc_type caption 1-4, text 1-4, garbage */ + +extern vbi_bool AM_VBI_CC_set_status(AM_VBI_Handle_t handle,vbi_bool flag); extern vbi_bool AM_VBI_XDS_Create(AM_VBI_Handle_t *handle,AM_VBI_XDS_Para_t *para); + + #ifdef __cplusplus } #endif diff --git a/ntsc_decode/ntsc_dmx/linux_vbi/linux_ntsc.c b/ntsc_decode/ntsc_dmx/linux_vbi/linux_ntsc.c index 0791ac1..7b891da 100755 --- a/ntsc_decode/ntsc_dmx/linux_vbi/linux_ntsc.c +++ b/ntsc_decode/ntsc_dmx/linux_vbi/linux_ntsc.c @@ -183,7 +183,7 @@ static AM_ErrorCode_t vbi_set_buf_size(AM_VBI_Device_t *dev, AM_VBI_Filter_t *fi { int fd = (int)filter->drv_data; int ret; - AM_DEBUG("vbi_set_buf_size fd =%d\n",fd); + AM_DEBUG("vbi_set_buf_size fd =%d size = %d\n",fd,size); @@ -196,7 +196,7 @@ static AM_ErrorCode_t vbi_set_buf_size(AM_VBI_Device_t *dev, AM_VBI_Filter_t *fi //} //**************************temp****************************/// - ret = ioctl(fd, VBI_IOC_S_BUF_SIZE, 20000); + ret = ioctl(fd, VBI_IOC_S_BUF_SIZE, size); if(ret==-1) { AM_DEBUG( "set buffer size failed (%s)", strerror(errno)); |