Mercurial > libavcodec.hg
comparison dvdsubenc.c @ 5067:6166fbf375cc libavcodec
Remove duplicate bytestream functions
author | ramiro |
---|---|
date | Wed, 23 May 2007 14:55:13 +0000 |
parents | 6d4ac21853d7 |
children | 50093e0b6b54 |
comparison
equal
deleted
inserted
replaced
5066:27afc3835257 | 5067:6166fbf375cc |
---|---|
17 * You should have received a copy of the GNU Lesser General Public | 17 * You should have received a copy of the GNU Lesser General Public |
18 * License along with FFmpeg; if not, write to the Free Software | 18 * License along with FFmpeg; if not, write to the Free Software |
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
20 */ | 20 */ |
21 #include "avcodec.h" | 21 #include "avcodec.h" |
22 #include "bytestream.h" | |
22 | 23 |
23 #undef NDEBUG | 24 #undef NDEBUG |
24 #include <assert.h> | 25 #include <assert.h> |
25 | 26 |
26 // ncnt is the nibble counter | 27 // ncnt is the nibble counter |
80 if (ncnt & 1) | 81 if (ncnt & 1) |
81 PUTNIBBLE(0); | 82 PUTNIBBLE(0); |
82 bitmap += linesize; | 83 bitmap += linesize; |
83 } | 84 } |
84 | 85 |
85 *pq = q; | |
86 } | |
87 | |
88 static inline void putbe16(uint8_t **pq, uint16_t v) | |
89 { | |
90 uint8_t *q = *pq; | |
91 *q++ = v >> 8; | |
92 *q++ = v; | |
93 *pq = q; | 86 *pq = q; |
94 } | 87 } |
95 | 88 |
96 static int encode_dvd_subtitles(uint8_t *outbuf, int outbuf_size, | 89 static int encode_dvd_subtitles(uint8_t *outbuf, int outbuf_size, |
97 const AVSubtitle *h) | 90 const AVSubtitle *h) |
161 cmap); | 154 cmap); |
162 } | 155 } |
163 | 156 |
164 // set data packet size | 157 // set data packet size |
165 qq = outbuf + 2; | 158 qq = outbuf + 2; |
166 putbe16(&qq, q - outbuf); | 159 bytestream_put_be16(&qq, q - outbuf); |
167 | 160 |
168 // send start display command | 161 // send start display command |
169 putbe16(&q, (h->start_display_time*90) >> 10); | 162 bytestream_put_be16(&q, (h->start_display_time*90) >> 10); |
170 putbe16(&q, (q - outbuf) /*- 2 */ + 8 + 12*rects + 2); | 163 bytestream_put_be16(&q, (q - outbuf) /*- 2 */ + 8 + 12*rects + 2); |
171 *q++ = 0x03; // palette - 4 nibbles | 164 *q++ = 0x03; // palette - 4 nibbles |
172 *q++ = 0x03; *q++ = 0x7f; | 165 *q++ = 0x03; *q++ = 0x7f; |
173 *q++ = 0x04; // alpha - 4 nibbles | 166 *q++ = 0x04; // alpha - 4 nibbles |
174 *q++ = 0xf0; *q++ = 0x00; | 167 *q++ = 0xf0; *q++ = 0x00; |
175 //*q++ = 0x0f; *q++ = 0xff; | 168 //*q++ = 0x0f; *q++ = 0xff; |
190 *q++ = (h->rects[object_id].y << 4) | ((y2 >> 8) & 0xf); | 183 *q++ = (h->rects[object_id].y << 4) | ((y2 >> 8) & 0xf); |
191 *q++ = y2; | 184 *q++ = y2; |
192 | 185 |
193 *q++ = 0x06; | 186 *q++ = 0x06; |
194 // offset1, offset2 | 187 // offset1, offset2 |
195 putbe16(&q, offset1[object_id]); | 188 bytestream_put_be16(&q, offset1[object_id]); |
196 putbe16(&q, offset2[object_id]); | 189 bytestream_put_be16(&q, offset2[object_id]); |
197 } | 190 } |
198 *q++ = 0x01; // start command | 191 *q++ = 0x01; // start command |
199 *q++ = 0xff; // terminating command | 192 *q++ = 0xff; // terminating command |
200 | 193 |
201 // send stop display command last | 194 // send stop display command last |
202 putbe16(&q, (h->end_display_time*90) >> 10); | 195 bytestream_put_be16(&q, (h->end_display_time*90) >> 10); |
203 putbe16(&q, (q - outbuf) - 2 /*+ 4*/); | 196 bytestream_put_be16(&q, (q - outbuf) - 2 /*+ 4*/); |
204 *q++ = 0x02; // set end | 197 *q++ = 0x02; // set end |
205 *q++ = 0xff; // terminating command | 198 *q++ = 0xff; // terminating command |
206 | 199 |
207 qq = outbuf; | 200 qq = outbuf; |
208 putbe16(&qq, q - outbuf); | 201 bytestream_put_be16(&qq, q - outbuf); |
209 | 202 |
210 av_log(NULL, AV_LOG_DEBUG, "subtitle_packet size=%td\n", q - outbuf); | 203 av_log(NULL, AV_LOG_DEBUG, "subtitle_packet size=%td\n", q - outbuf); |
211 return q - outbuf; | 204 return q - outbuf; |
212 } | 205 } |
213 | 206 |