r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / libmpeg3 / mpeg3protos.h
blobb1cc0f590bd448aa957077671c3b922f7c03a82f
1 #ifndef MPEG3PROTOS_H
2 #define MPEG3PROTOS_H
5 /* CSS */
7 mpeg3_css_t* mpeg3_new_css();
10 /* Workarounds */
12 int64_t mpeg3io_tell_gcc(mpeg3_fs_t *fs);
13 double mpeg3_add_double_gcc(double x, double y);
14 double mpeg3_divide_double_gcc(double x, double y);
15 int64_t mpeg3_total_bytes_gcc(mpeg3_title_t *title);
16 int64_t mpeg3io_path_total_bytes(char *path);
17 int64_t mpeg3io_get_total_bytes(mpeg3_fs_t *fs);
22 /* TITLE */
24 mpeg3_title_t* mpeg3_new_title(mpeg3_t *file, char *path);
25 void mpeg3_new_timecode(mpeg3_title_t *title,
26 long start_byte,
27 double start_time,
28 long end_byte,
29 double end_time,
30 int program);
31 mpeg3demux_timecode_t* mpeg3_append_timecode(mpeg3_demuxer_t *demuxer,
32 mpeg3_title_t *title,
33 long prev_byte,
34 double prev_time,
35 long start_byte,
36 double start_time,
37 int dont_store,
38 int program);
41 /* ATRACK */
43 mpeg3_atrack_t* mpeg3_new_atrack(mpeg3_t *file,
44 int stream_id,
45 int is_ac3,
46 mpeg3_demuxer_t *demuxer,
47 int number);
48 int mpeg3_delete_atrack(mpeg3_t *file, mpeg3_atrack_t *atrack);
51 /* These return 1 on failure and 0 on success */
52 int mpeg3_next_header();
54 /* VTRACK */
56 mpeg3_vtrack_t* mpeg3_new_vtrack(mpeg3_t *file,
57 int stream_id,
58 mpeg3_demuxer_t *demuxer,
59 int number);
60 int mpeg3_delete_vtrack(mpeg3_t *file, mpeg3_vtrack_t *vtrack);
62 /* AUDIO */
63 mpeg3audio_t* mpeg3audio_new(mpeg3_t *file, mpeg3_atrack_t *track, int is_ac3);
64 int mpeg3audio_delete(mpeg3audio_t *audio);
65 /* Read header and store common parameters in audio structure */
66 int mpeg3audio_read_header(mpeg3audio_t *audio);
69 /* Audio consists of many possible formats, each packetized into frames. */
70 /* Each format has a constructor, header decoder, frame decoder, and destructor. */
71 /* The function set is determined by the audio format. */
73 /* To decode audio, for each frame read the header sized number of bytes. */
74 /* Call the header decoder for the format. */
75 /* Call the frame decoder for the format. */
77 int mpeg3_new_decode_tables(mpeg3_layer_t *audio);
78 int mpeg3_init_layer3(mpeg3_layer_t *audio);
79 int mpeg3_init_layer2(mpeg3_layer_t *audio);
81 /* Create a new layer decoder */
82 mpeg3_layer_t* mpeg3_new_layer();
84 /* Create a new ac3 decoder */
85 mpeg3_ac3_t* mpeg3_new_ac3();
87 /* Create a new pcm decoder */
88 mpeg3_pcm_t* mpeg3_new_pcm();
91 /* Delete a new layer decoder */
92 void mpeg3_delete_layer(mpeg3_layer_t *audio);
94 /* Delete a new ac3 decoder */
95 void mpeg3_delete_ac3(mpeg3_ac3_t *audio);
97 /* Delete a new pcm decoder */
98 void mpeg3_delete_pcm(mpeg3_pcm_t *audio);
101 /* Return 1 if the data isn't a header */
102 int mpeg3_layer_check(unsigned char *data);
103 int mpeg3_ac3_check(unsigned char *header);
104 int mpeg3_pcm_check(unsigned char *header);
106 /* These return the size of the next frame including the header */
107 /* or 0 if it wasn't a header. */
108 /* Decode a layer header */
109 int mpeg3_layer_header(mpeg3_layer_t *audio, unsigned char *data);
112 /* Decode an AC3 header */
113 int mpeg3_ac3_header(mpeg3_ac3_t *audio, unsigned char *header);
115 /* Decode an PCM header */
116 int mpeg3_pcm_header(mpeg3_pcm_t *audio, unsigned char *header);
119 /* Reset after a seek */
120 void mpeg3_layer_reset(mpeg3_layer_t *audio);
122 /* Decode a frame of layer 3 audio. */
123 /* The output is linear, one buffer for every channel. */
124 /* The user should get the channel count from one of the header commands */
125 /* The output must be big enough to hold the largest frame of audio */
126 /* These functions return the number of samples rendered */
127 int mpeg3audio_dolayer3(mpeg3_layer_t *audio,
128 char *frame,
129 int frame_size,
130 float **output,
131 int render);
133 /* Decode a frame of layer 2 audio */
134 int mpeg3audio_dolayer2(mpeg3_layer_t *audio,
135 char *frame,
136 int frame_size,
137 float **output,
138 int render);
140 /* Decode a frame of ac3 audio */
141 int mpeg3audio_doac3(mpeg3_ac3_t *audio,
142 char *frame,
143 int frame_size,
144 float **output,
145 int render);
148 /* Decode a frame of ac3 audio */
149 int mpeg3audio_dopcm(mpeg3_pcm_t *audio,
150 char *frame,
151 int frame_size,
152 float **output,
153 int render);
156 /* VIDEO */
157 mpeg3video_t* mpeg3video_new(mpeg3_t *file, mpeg3_vtrack_t *track);
158 int mpeg3video_delete(mpeg3video_t *video);
159 int mpeg3video_read_frame(mpeg3video_t *video,
160 long frame_number,
161 unsigned char **output_rows,
162 int in_x,
163 int in_y,
164 int in_w,
165 int in_h,
166 int out_w,
167 int out_h,
168 int color_model);
169 void mpeg3video_dump(mpeg3video_t *video);
173 /* FILESYSTEM */
175 mpeg3_fs_t* mpeg3_new_fs(char *path);
176 int mpeg3_delete_fs(mpeg3_fs_t *fs);
177 int mpeg3io_open_file(mpeg3_fs_t *fs);
178 int mpeg3io_close_file(mpeg3_fs_t *fs);
179 int mpeg3io_seek(mpeg3_fs_t *fs, int64_t byte);
180 int mpeg3io_read_data(unsigned char *buffer, long bytes, mpeg3_fs_t *fs);
181 int mpeg3io_next_code(mpeg3_fs_t *fs, uint32_t code, int count);
182 int mpeg3io_prev_code(mpeg3_fs_t *fs, uint32_t code, int count);
198 // Demuxer
202 mpeg3_demuxer_t* mpeg3_new_demuxer(mpeg3_t *file,
203 int do_audio,
204 int do_video,
205 int stream_id);
206 int mpeg3_delete_demuxer(mpeg3_demuxer_t *demuxer);
207 int mpeg3demux_read_data(mpeg3_demuxer_t *demuxer,
208 unsigned char *output,
209 long size);
210 unsigned int mpeg3demux_read_int32(mpeg3_demuxer_t *demuxer);
211 unsigned int mpeg3demux_read_int24(mpeg3_demuxer_t *demuxer);
212 unsigned int mpeg3demux_read_int16(mpeg3_demuxer_t *demuxer);
213 double mpeg3demux_length(mpeg3_demuxer_t *demuxer);
214 mpeg3_demuxer_t* mpeg3_get_demuxer(mpeg3_t *file);
216 /* Give byte offset relative to current title */
217 int64_t mpeg3demux_tell(mpeg3_demuxer_t *demuxer);
219 /* Give byte offset relative to start of movie */
220 int64_t mpeg3demux_tell_absolute(mpeg3_demuxer_t *demuxer);
222 /* Give total number of bytes in all titles */
223 int64_t mpeg3demux_movie_size(mpeg3_demuxer_t *demuxer);
225 double mpeg3demux_tell_percentage(mpeg3_demuxer_t *demuxer);
227 /* Return the current title */
228 int mpeg3demux_tell_title(mpeg3_demuxer_t *demuxer);
230 double mpeg3demux_get_time(mpeg3_demuxer_t *demuxer);
231 int mpeg3demux_eof(mpeg3_demuxer_t *demuxer);
232 int mpeg3demux_bof(mpeg3_demuxer_t *demuxer);
233 void mpeg3demux_start_reverse(mpeg3_demuxer_t *demuxer);
234 void mpeg3demux_start_forward(mpeg3_demuxer_t *demuxer);
235 int mpeg3demux_open_title(mpeg3_demuxer_t *demuxer, int title_number);
236 int mpeg3demux_seek_byte(mpeg3_demuxer_t *demuxer, int64_t byte);
237 int mpeg3demux_seek_percentage(mpeg3_demuxer_t *demuxer, double percentage);
238 int64_t mpeg3demuxer_total_bytes(mpeg3_demuxer_t *demuxer);
239 unsigned char mpeg3demux_read_char_packet(mpeg3_demuxer_t *demuxer);
240 unsigned char mpeg3demux_read_prev_char_packet(mpeg3_demuxer_t *demuxer);
241 int mpeg3demux_read_program(mpeg3_demuxer_t *demuxer);
243 /* Get last pts read */
244 double mpeg3demux_audio_pts(mpeg3_demuxer_t *demuxer);
246 double mpeg3demux_video_pts(mpeg3_demuxer_t *demuxer);
248 /* Set the last pts read to -1 for audio and video */
249 void mpeg3demux_reset_pts(mpeg3_demuxer_t *demuxer);
251 /* scan forward for next pts. Used in percentage seeking to synchronize */
252 double mpeg3demux_scan_pts(mpeg3_demuxer_t *demuxer);
254 /* seek using sequential search to the pts given. Used in percentage seeking. */
255 int mpeg3demux_goto_pts(mpeg3_demuxer_t *demuxer, double pts);
258 unsigned char mpeg3demux_read_char_packet(mpeg3_demuxer_t *demuxer);
259 unsigned char mpeg3demux_read_prev_char_packet(mpeg3_demuxer_t *demuxer);
261 #define mpeg3demux_error(demuxer) (((mpeg3_demuxer_t *)(demuxer))->error_flag)
263 #define mpeg3demux_time_offset(demuxer) (((mpeg3_demuxer_t *)(demuxer))->time_offset)
265 #define mpeg3demux_current_time(demuxer) (((mpeg3_demuxer_t *)(demuxer))->time + ((mpeg3_demuxer_t *)(demuxer))->time_offset)
267 static unsigned char mpeg3demux_read_char(mpeg3_demuxer_t *demuxer)
269 //printf("mpeg3demux_read_char %lx %lx\n", demuxer->data_position, demuxer->data_size);
270 if(demuxer->data_position < demuxer->data_size)
272 return demuxer->data_buffer[demuxer->data_position++];
274 else
276 return mpeg3demux_read_char_packet(demuxer);
282 static unsigned char mpeg3demux_read_prev_char(mpeg3_demuxer_t *demuxer)
284 if(demuxer->data_position != 0)
286 return demuxer->data_buffer[demuxer->data_position--];
288 else
290 return mpeg3demux_read_prev_char_packet(demuxer);
306 // Bitstream
308 mpeg3_bits_t* mpeg3bits_new_stream(mpeg3_t *file, mpeg3_demuxer_t *demuxer);
309 int mpeg3bits_delete_stream(mpeg3_bits_t* stream);
310 int mpeg3bits_seek_byte(mpeg3_bits_t* stream, int64_t position);
311 int mpeg3bits_open_title(mpeg3_bits_t* stream, int title);
312 int64_t mpeg3bits_tell(mpeg3_bits_t* stream);
319 #define mpeg3bits_tell_percentage(stream) mpeg3demux_tell_percentage((stream)->demuxer)
321 #define mpeg3bits_packet_time(stream) mpeg3demux_current_time((stream)->demuxer)
323 #define mpeg3bits_time_offset(stream) mepg2demux_time_offset((stream)->demuxer)
325 #define mpeg3bits_error(stream) mpeg3demux_error((stream)->demuxer)
327 #define mpeg3bits_eof(stream) mpeg3demux_eof((stream)->demuxer)
329 #define mpeg3bits_bof(stream) mpeg3demux_bof((stream)->demuxer)
331 /* Read bytes backward from the file until the reverse_bits is full. */
332 static void mpeg3bits_fill_reverse_bits(mpeg3_bits_t* stream, int bits)
334 // Right justify
335 while(stream->bit_number > 7)
337 stream->bfr >>= 8;
338 stream->bfr_size -= 8;
339 stream->bit_number -= 8;
342 // Insert bytes before bfr_size
343 while(stream->bfr_size - stream->bit_number < bits)
345 if(stream->input_ptr)
346 stream->bfr |= (unsigned int)(*--stream->input_ptr) << stream->bfr_size;
347 else
348 stream->bfr |= (unsigned int)mpeg3demux_read_prev_char(stream->demuxer) << stream->bfr_size;
349 stream->bfr_size += 8;
353 /* Read bytes forward from the file until the forward_bits is full. */
354 static void mpeg3bits_fill_bits(mpeg3_bits_t* stream, int bits)
356 while(stream->bit_number < bits)
358 stream->bfr <<= 8;
359 if(stream->input_ptr)
361 stream->bfr |= *stream->input_ptr++;
363 else
365 stream->bfr |= mpeg3demux_read_char(stream->demuxer);
367 stream->bit_number += 8;
368 stream->bfr_size += 8;
369 if(stream->bfr_size > 32) stream->bfr_size = 32;
373 /* Return 8 bits, advancing the file position. */
374 static unsigned int mpeg3bits_getbyte_noptr(mpeg3_bits_t* stream)
376 if(stream->bit_number < 8)
378 stream->bfr <<= 8;
379 if(stream->input_ptr)
380 stream->bfr |= *stream->input_ptr++;
381 else
382 stream->bfr |= mpeg3demux_read_char(stream->demuxer);
384 stream->bfr_size += 8;
385 if(stream->bfr_size > 32) stream->bfr_size = 32;
387 return (stream->bfr >> stream->bit_number) & 0xff;
389 return (stream->bfr >> (stream->bit_number -= 8)) & 0xff;
392 static unsigned int mpeg3bits_getbit_noptr(mpeg3_bits_t* stream)
394 if(!stream->bit_number)
396 stream->bfr <<= 8;
397 stream->bfr |= mpeg3demux_read_char(stream->demuxer);
399 stream->bfr_size += 8;
400 if(stream->bfr_size > 32) stream->bfr_size = 32;
402 stream->bit_number = 7;
404 return (stream->bfr >> 7) & 0x1;
406 return (stream->bfr >> (--stream->bit_number)) & (0x1);
409 /* Return n number of bits, advancing the file position. */
410 /* Use in place of flushbits */
411 static unsigned int mpeg3bits_getbits(mpeg3_bits_t* stream, int bits)
413 if(bits <= 0) return 0;
414 mpeg3bits_fill_bits(stream, bits);
415 return (stream->bfr >> (stream->bit_number -= bits)) & (0xffffffff >> (32 - bits));
418 static unsigned int mpeg3bits_showbits24_noptr(mpeg3_bits_t* stream)
420 while(stream->bit_number < 24)
422 stream->bfr <<= 8;
423 stream->bfr |= mpeg3demux_read_char(stream->demuxer);
424 stream->bit_number += 8;
425 stream->bfr_size += 8;
426 if(stream->bfr_size > 32) stream->bfr_size = 32;
428 return (stream->bfr >> (stream->bit_number - 24)) & 0xffffff;
431 static unsigned int mpeg3bits_showbits32_noptr(mpeg3_bits_t* stream)
433 while(stream->bit_number < 32)
435 stream->bfr <<= 8;
436 stream->bfr |= mpeg3demux_read_char(stream->demuxer);
437 stream->bit_number += 8;
438 stream->bfr_size += 8;
439 if(stream->bfr_size > 32) stream->bfr_size = 32;
441 return stream->bfr;
444 static unsigned int mpeg3bits_showbits(mpeg3_bits_t* stream, int bits)
446 mpeg3bits_fill_bits(stream, bits);
447 return (stream->bfr >> (stream->bit_number - bits)) & (0xffffffff >> (32 - bits));
450 static unsigned int mpeg3bits_getbits_reverse(mpeg3_bits_t* stream, int bits)
452 unsigned int result;
453 mpeg3bits_fill_reverse_bits(stream, bits);
454 result = (stream->bfr >> stream->bit_number) & (0xffffffff >> (32 - bits));
455 stream->bit_number += bits;
456 return result;
459 static unsigned int mpeg3bits_showbits_reverse(mpeg3_bits_t* stream, int bits)
461 unsigned int result;
462 mpeg3bits_fill_reverse_bits(stream, bits);
463 result = (stream->bfr >> stream->bit_number) & (0xffffffff >> (32 - bits));
464 return result;
475 // I/O
484 void mpeg3io_read_buffer(mpeg3_fs_t *fs);
486 #define mpeg3io_tell(fs) (((mpeg3_fs_t *)(fs))->current_byte)
488 // End of file
489 #define mpeg3io_eof(fs) (((mpeg3_fs_t *)(fs))->current_byte >= ((mpeg3_fs_t *)(fs))->total_bytes)
491 // Beginning of file
492 #define mpeg3io_bof(fs) (((mpeg3_fs_t *)(fs))->current_byte < 0)
494 #define mpeg3io_get_fd(fs) (fileno(((mpeg3_fs_t *)(fs))->fd))
496 #define mpeg3io_total_bytes(fs) (((mpeg3_fs_t *)(fs))->total_bytes)
498 static int mpeg3io_sync_buffer(mpeg3_fs_t *fs)
500 if(fs->buffer_position + fs->buffer_offset != fs->current_byte)
501 // Reposition buffer offset
503 fs->buffer_offset = fs->current_byte - fs->buffer_position;
506 // Load new buffer
507 if(fs->current_byte < fs->buffer_position ||
508 fs->current_byte >= fs->buffer_position + fs->buffer_size)
510 mpeg3io_read_buffer(fs);
513 return !fs->buffer_size;
516 static unsigned int mpeg3io_read_char(mpeg3_fs_t *fs)
518 unsigned int result;
519 mpeg3io_sync_buffer(fs);
520 result = fs->buffer[fs->buffer_offset++];
521 fs->current_byte++;
522 return result;
525 static unsigned char mpeg3io_next_char(mpeg3_fs_t *fs)
527 unsigned char result;
528 mpeg3io_sync_buffer(fs);
529 result = fs->buffer[fs->buffer_offset];
530 return result;
533 static uint32_t mpeg3io_read_int32(mpeg3_fs_t *fs)
535 int a, b, c, d;
536 uint32_t result;
537 /* Do not fread. This breaks byte ordering. */
538 a = mpeg3io_read_char(fs);
539 b = mpeg3io_read_char(fs);
540 c = mpeg3io_read_char(fs);
541 d = mpeg3io_read_char(fs);
542 result = (a << 24) |
543 (b << 16) |
544 (c << 8) |
545 (d);
546 return result;
549 static uint32_t mpeg3io_read_int24(mpeg3_fs_t *fs)
551 int b, c, d;
552 uint32_t result;
553 /* Do not fread. This breaks byte ordering. */
554 b = mpeg3io_read_char(fs);
555 c = mpeg3io_read_char(fs);
556 d = mpeg3io_read_char(fs);
557 result = (b << 16) |
558 (c << 8) |
559 (d);
560 return result;
563 static uint16_t mpeg3io_read_int16(mpeg3_fs_t *fs)
565 int c, d;
566 uint16_t result;
567 /* Do not fread. This breaks byte ordering. */
568 c = mpeg3io_read_char(fs);
569 d = mpeg3io_read_char(fs);
570 result = (c << 8) |
571 (d);
572 return result;
583 // More bitstream
593 #define mpeg3slice_fillbits(buffer, nbits) \
594 while(((mpeg3_slice_buffer_t*)(buffer))->bits_size < (nbits)) \
596 if(((mpeg3_slice_buffer_t*)(buffer))->current_position < ((mpeg3_slice_buffer_t*)(buffer))->buffer_size) \
598 ((mpeg3_slice_buffer_t*)(buffer))->bits <<= 8; \
599 ((mpeg3_slice_buffer_t*)(buffer))->bits |= ((mpeg3_slice_buffer_t*)(buffer))->data[((mpeg3_slice_buffer_t*)(buffer))->current_position++]; \
601 ((mpeg3_slice_buffer_t*)(buffer))->bits_size += 8; \
604 #define mpeg3slice_flushbits(buffer, nbits) \
606 mpeg3slice_fillbits((buffer), (nbits)); \
607 ((mpeg3_slice_buffer_t*)(buffer))->bits_size -= (nbits); \
610 #define mpeg3slice_flushbit(buffer) \
612 if(((mpeg3_slice_buffer_t*)(buffer))->bits_size) \
613 ((mpeg3_slice_buffer_t*)(buffer))->bits_size--; \
614 else \
615 if(((mpeg3_slice_buffer_t*)(buffer))->current_position < ((mpeg3_slice_buffer_t*)(buffer))->buffer_size) \
617 ((mpeg3_slice_buffer_t*)(buffer))->bits = \
618 ((mpeg3_slice_buffer_t*)(buffer))->data[((mpeg3_slice_buffer_t*)(buffer))->current_position++]; \
619 ((mpeg3_slice_buffer_t*)(buffer))->bits_size = 7; \
623 static unsigned int mpeg3slice_getbit(mpeg3_slice_buffer_t *buffer)
625 if(buffer->bits_size)
626 return (buffer->bits >> (--buffer->bits_size)) & 0x1;
627 else
628 if(buffer->current_position < buffer->buffer_size)
630 buffer->bits = buffer->data[buffer->current_position++];
631 buffer->bits_size = 7;
632 return (buffer->bits >> 7) & 0x1;
634 return 0;
638 static unsigned int mpeg3slice_getbits2(mpeg3_slice_buffer_t *buffer)
640 if(buffer->bits_size >= 2)
641 return (buffer->bits >> (buffer->bits_size -= 2)) & 0x3;
642 else
643 if(buffer->current_position < buffer->buffer_size)
645 buffer->bits <<= 8;
646 buffer->bits |= buffer->data[buffer->current_position++];
647 buffer->bits_size += 6;
648 return (buffer->bits >> buffer->bits_size) & 0x3;
650 return 0;
653 static unsigned int mpeg3slice_getbyte(mpeg3_slice_buffer_t *buffer)
655 if(buffer->bits_size >= 8)
656 return (buffer->bits >> (buffer->bits_size -= 8)) & 0xff;
657 else
658 if(buffer->current_position < buffer->buffer_size)
660 buffer->bits <<= 8;
661 buffer->bits |= buffer->data[buffer->current_position++];
662 return (buffer->bits >> buffer->bits_size) & 0xff;
664 return 0;
668 static unsigned int mpeg3slice_getbits(mpeg3_slice_buffer_t *slice_buffer, int bits)
670 if(bits == 1) return mpeg3slice_getbit(slice_buffer);
671 mpeg3slice_fillbits(slice_buffer, bits);
672 return (slice_buffer->bits >> (slice_buffer->bits_size -= bits)) & (0xffffffff >> (32 - bits));
675 static unsigned int mpeg3slice_showbits16(mpeg3_slice_buffer_t *buffer)
677 if(buffer->bits_size >= 16)
678 return (buffer->bits >> (buffer->bits_size - 16)) & 0xffff;
679 else
680 if(buffer->current_position < buffer->buffer_size)
682 buffer->bits <<= 16;
683 buffer->bits_size += 16;
684 buffer->bits |= (unsigned int)buffer->data[buffer->current_position++] << 8;
685 buffer->bits |= buffer->data[buffer->current_position++];
686 return (buffer->bits >> (buffer->bits_size - 16)) & 0xffff;
688 return 0;
691 static unsigned int mpeg3slice_showbits9(mpeg3_slice_buffer_t *buffer)
693 if(buffer->bits_size >= 9)
694 return (buffer->bits >> (buffer->bits_size - 9)) & 0x1ff;
695 else
696 if(buffer->current_position < buffer->buffer_size)
698 buffer->bits <<= 16;
699 buffer->bits_size += 16;
700 buffer->bits |= (unsigned int)buffer->data[buffer->current_position++] << 8;
701 buffer->bits |= buffer->data[buffer->current_position++];
702 return (buffer->bits >> (buffer->bits_size - 9)) & 0x1ff;
704 return 0;
707 static unsigned int mpeg3slice_showbits5(mpeg3_slice_buffer_t *buffer)
709 if(buffer->bits_size >= 5)
710 return (buffer->bits >> (buffer->bits_size - 5)) & 0x1f;
711 else
712 if(buffer->current_position < buffer->buffer_size)
714 buffer->bits <<= 8;
715 buffer->bits_size += 8;
716 buffer->bits |= buffer->data[buffer->current_position++];
717 return (buffer->bits >> (buffer->bits_size - 5)) & 0x1f;
719 return 0;
722 static unsigned int mpeg3slice_showbits(mpeg3_slice_buffer_t *slice_buffer, int bits)
724 mpeg3slice_fillbits(slice_buffer, bits);
725 return (slice_buffer->bits >> (slice_buffer->bits_size - bits)) & (0xffffffff >> (32 - bits));
733 #endif