Mercurial > pt1
diff recpt1/decoder.c @ 2:8ac7c59fefc9
added b25 decode functionality
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Mon, 16 Feb 2009 21:40:16 +0900 |
parents | |
children | 43d177fa65c9 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/recpt1/decoder.c Mon Feb 16 21:40:16 2009 +0900 @@ -0,0 +1,56 @@ +#include <stdlib.h> + +#include "decoder.h" + +decoder * +b25_startup(void) +{ + decoder *dec = calloc(1, sizeof(decoder)); + int code; + + dec->b25 = create_arib_std_b25(); + dec->b25->set_multi2_round(dec->b25, 4); //xxx round should be configurable + dec->b25->set_strip(dec->b25, 0); //ditto + dec->b25->set_emm_proc(dec->b25, 0); //ditto + dec->bcas = create_b_cas_card(); + code = dec->bcas->init(dec->bcas); + code = dec->b25->set_b_cas_card(dec->b25, dec->bcas); + + return dec; +} + +int +b25_shutdown(decoder *dec) +{ + dec->b25->release(dec->b25); + dec->bcas->release(dec->bcas); + free(dec); + + return 0; +} + +int +b25_decode(decoder *dec, ARIB_STD_B25_BUFFER *sbuf, ARIB_STD_B25_BUFFER *dbuf) +{ + int code; + + code = dec->b25->put(dec->b25, sbuf); + if(code < 0) + return code; + + code = dec->b25->get(dec->b25, dbuf); + return code; +} + +int +b25_finish(decoder *dec, ARIB_STD_B25_BUFFER *sbuf, ARIB_STD_B25_BUFFER *dbuf) +{ + int code; + + code = dec->b25->flush(dec->b25); + if(code < 0) + return code; + + code = dec->b25->get(dec->b25, dbuf); + return code; +}