Mercurial > pt1
comparison 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 |
comparison
equal
deleted
inserted
replaced
1:29f3b2bbbd67 | 2:8ac7c59fefc9 |
---|---|
1 #include <stdlib.h> | |
2 | |
3 #include "decoder.h" | |
4 | |
5 decoder * | |
6 b25_startup(void) | |
7 { | |
8 decoder *dec = calloc(1, sizeof(decoder)); | |
9 int code; | |
10 | |
11 dec->b25 = create_arib_std_b25(); | |
12 dec->b25->set_multi2_round(dec->b25, 4); //xxx round should be configurable | |
13 dec->b25->set_strip(dec->b25, 0); //ditto | |
14 dec->b25->set_emm_proc(dec->b25, 0); //ditto | |
15 dec->bcas = create_b_cas_card(); | |
16 code = dec->bcas->init(dec->bcas); | |
17 code = dec->b25->set_b_cas_card(dec->b25, dec->bcas); | |
18 | |
19 return dec; | |
20 } | |
21 | |
22 int | |
23 b25_shutdown(decoder *dec) | |
24 { | |
25 dec->b25->release(dec->b25); | |
26 dec->bcas->release(dec->bcas); | |
27 free(dec); | |
28 | |
29 return 0; | |
30 } | |
31 | |
32 int | |
33 b25_decode(decoder *dec, ARIB_STD_B25_BUFFER *sbuf, ARIB_STD_B25_BUFFER *dbuf) | |
34 { | |
35 int code; | |
36 | |
37 code = dec->b25->put(dec->b25, sbuf); | |
38 if(code < 0) | |
39 return code; | |
40 | |
41 code = dec->b25->get(dec->b25, dbuf); | |
42 return code; | |
43 } | |
44 | |
45 int | |
46 b25_finish(decoder *dec, ARIB_STD_B25_BUFFER *sbuf, ARIB_STD_B25_BUFFER *dbuf) | |
47 { | |
48 int code; | |
49 | |
50 code = dec->b25->flush(dec->b25); | |
51 if(code < 0) | |
52 return code; | |
53 | |
54 code = dec->b25->get(dec->b25, dbuf); | |
55 return code; | |
56 } |