Mercurial > pt1.oyama
comparison src/decoder.c @ 124:9c7bc6c0327e
Add DLNA server function test. (from uShare project)
author | naoyan@johnstown.minaminoshima.org |
---|---|
date | Wed, 29 Sep 2010 23:18:55 +0900 |
parents | recpt1/decoder.c@b6607f6e2851 |
children |
comparison
equal
deleted
inserted
replaced
123:215a51fa3df3 | 124:9c7bc6c0327e |
---|---|
1 #include <stdlib.h> | |
2 #include <stdio.h> | |
3 | |
4 #include "decoder.h" | |
5 | |
6 #ifdef HAVE_LIBARIB25 | |
7 | |
8 decoder * | |
9 b25_startup(decoder_options *opt) | |
10 { | |
11 decoder *dec = calloc(1, sizeof(decoder)); | |
12 int code; | |
13 const char *err = NULL; | |
14 | |
15 dec->b25 = create_arib_std_b25(); | |
16 if(!dec->b25) { | |
17 err = "create_arib_std_b25 failed"; | |
18 goto error; | |
19 } | |
20 | |
21 code = dec->b25->set_multi2_round(dec->b25, opt->round); | |
22 if(code < 0) { | |
23 err = "set_multi2_round failed"; | |
24 goto error; | |
25 } | |
26 | |
27 code = dec->b25->set_strip(dec->b25, opt->strip); | |
28 if(code < 0) { | |
29 err = "set_strip failed"; | |
30 goto error; | |
31 } | |
32 | |
33 code = dec->b25->set_emm_proc(dec->b25, opt->emm); | |
34 if(code < 0) { | |
35 err = "set_emm_proc failed"; | |
36 goto error; | |
37 } | |
38 | |
39 dec->bcas = create_b_cas_card(); | |
40 if(!dec->bcas) { | |
41 err = "create_b_cas_card failed"; | |
42 goto error; | |
43 } | |
44 code = dec->bcas->init(dec->bcas); | |
45 if(code < 0) { | |
46 err = "bcas->init failed"; | |
47 goto error; | |
48 } | |
49 | |
50 code = dec->b25->set_b_cas_card(dec->b25, dec->bcas); | |
51 if(code < 0) { | |
52 err = "set_b_cas_card failed"; | |
53 goto error; | |
54 } | |
55 | |
56 return dec; | |
57 | |
58 error: | |
59 fprintf(stderr, "%s\n", err); | |
60 free(dec); | |
61 return NULL; | |
62 } | |
63 | |
64 int | |
65 b25_shutdown(decoder *dec) | |
66 { | |
67 dec->b25->release(dec->b25); | |
68 dec->bcas->release(dec->bcas); | |
69 free(dec); | |
70 | |
71 return 0; | |
72 } | |
73 | |
74 int | |
75 b25_decode(decoder *dec, ARIB_STD_B25_BUFFER *sbuf, ARIB_STD_B25_BUFFER *dbuf) | |
76 { | |
77 int code; | |
78 | |
79 code = dec->b25->put(dec->b25, sbuf); | |
80 if(code < 0) { | |
81 fprintf(stderr, "b25->put failed\n"); | |
82 return code; | |
83 } | |
84 | |
85 code = dec->b25->get(dec->b25, dbuf); | |
86 if(code < 0) { | |
87 fprintf(stderr, "b25->get failed\n"); | |
88 return code; | |
89 } | |
90 | |
91 return code; | |
92 } | |
93 | |
94 int | |
95 b25_finish(decoder *dec, ARIB_STD_B25_BUFFER *sbuf, ARIB_STD_B25_BUFFER *dbuf) | |
96 { | |
97 int code; | |
98 | |
99 code = dec->b25->flush(dec->b25); | |
100 if(code < 0) { | |
101 fprintf(stderr, "b25->flush failed\n"); | |
102 return code; | |
103 } | |
104 | |
105 code = dec->b25->get(dec->b25, dbuf); | |
106 if(code < 0) { | |
107 fprintf(stderr, "b25->get failed\n"); | |
108 return code; | |
109 } | |
110 | |
111 return code; | |
112 } | |
113 | |
114 #else | |
115 | |
116 /* functions */ | |
117 decoder *b25_startup(decoder_options *opt) | |
118 { | |
119 return NULL; | |
120 } | |
121 | |
122 int b25_shutdown(decoder *dec) | |
123 { | |
124 return 0; | |
125 } | |
126 | |
127 int b25_decode(decoder *dec, | |
128 ARIB_STD_B25_BUFFER *sbuf, | |
129 ARIB_STD_B25_BUFFER *dbuf) | |
130 { | |
131 return 0; | |
132 } | |
133 | |
134 int b25_finish(decoder *dec, | |
135 ARIB_STD_B25_BUFFER *sbuf, | |
136 ARIB_STD_B25_BUFFER *dbuf) | |
137 { | |
138 return 0; | |
139 } | |
140 | |
141 #endif |