author | kui.zhang <kui.zhang@amlogic.com> | 2012-11-14 03:24:51 (GMT) |
---|---|---|
committer | kui.zhang <kui.zhang@amlogic.com> | 2012-11-14 03:24:51 (GMT) |
commit | 1f1ca83351f33ae8033c78b0e9af508653d2fb15 (patch) | |
tree | d03fc9120df1fcc3c78dacc90d5fcb35f177f31a | |
parent | f1f0637301231571d58d0795329cbd4a3737404f (diff) | |
download | libzvbi-1f1ca83351f33ae8033c78b0e9af508653d2fb15.zip libzvbi-1f1ca83351f33ae8033c78b0e9af508653d2fb15.tar.gz libzvbi-1f1ca83351f33ae8033c78b0e9af508653d2fb15.tar.bz2 |
add stop vbi thread function
-rwxr-xr-x | ntsc_decode/am_vbi.c | 43 | ||||
-rwxr-xr-x | ntsc_decode/include/am_vbi.h | 7 |
2 files changed, 47 insertions, 3 deletions
diff --git a/ntsc_decode/am_vbi.c b/ntsc_decode/am_vbi.c index ec6380c..257b172 100755 --- a/ntsc_decode/am_vbi.c +++ b/ntsc_decode/am_vbi.c @@ -13,7 +13,7 @@ #include "sliced_vbi.h" #include "am_vbi.h" #include "vbi_dmx.h" -#include "am_xds.h" + /********************define variable***************************/ @@ -395,6 +395,47 @@ vbi_bool AM_VBI_CC_Create(AM_VBI_Handle_t *handle, AM_VBI_CC_Para_t *para) return AM_SUCCESS; } + + + + +/********************************************************/ +AM_ErrorCode_t AM_VBI_CC_Stop(AM_VBI_Handle_t handle) +{ + AM_DEBUG("NTSC-------------------- ******************AM_VBI_CC_Stop \n"); + AM_VBI_Parser_t *parser = (AM_VBI_Parser_t*)handle; + vbi_bool ret = AM_SUCCESS; + + pthread_t th; + vbi_bool wait = AM_FALSE; + + if(!parser) + { + AM_DEBUG("NTSC-------------------- ******************AM_CC_ERR_INVALID_HANDLE \n"); + return AM_CC_ERR_INVALID_HANDLE; + } + + pthread_mutex_lock(&parser->lock); + + if(parser->running) + { + parser->running = AM_FALSE; + wait = AM_TRUE; + th = parser->thread; + } + + pthread_mutex_unlock(&parser->lock); + pthread_cond_signal(&parser->cond); + + if(wait) + { + pthread_join(th, NULL); + } + + return AM_SUCCESS; +} + + void* AM_VBI_CC_GetUserData(AM_VBI_Handle_t handle) { AM_VBI_Parser_t *parser = (AM_VBI_Parser_t*)handle; diff --git a/ntsc_decode/include/am_vbi.h b/ntsc_decode/include/am_vbi.h index 427a24d..7b19f62 100755 --- a/ntsc_decode/include/am_vbi.h +++ b/ntsc_decode/include/am_vbi.h @@ -23,7 +23,8 @@ #include "tables.h" #include "vbi.h" #include <android/log.h> -#include <am_xds.h> +#include <am_xds.h> +#include "vbi_dmx.h" #ifdef __cplusplus extern "C" { @@ -95,7 +96,9 @@ typedef enum { 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); +extern AM_ErrorCode_t AM_VBI_CC_Start(AM_VBI_Handle_t handle); + +extern AM_ErrorCode_t AM_VBI_CC_Stop(AM_VBI_Handle_t handle); extern vbi_bool decode_vbi (int dev_no, int fid, const uint8_t *data, int len, void *user_data); |