4 bits_t(zmpeg3_t *zsrc, demuxer_t *demux)
19 /* Fill a buffer. Only works if bit_number is on an 8 bit boundary */
21 read_buffer(uint8_t *buffer, int bytes)
23 while( bit_number > 0 ) {
25 demuxer->read_prev_char();
31 int result = demuxer->read_data(buffer, bytes);
35 /* For mp3 decompression use a pointer in a buffer for get_bits. */
37 use_ptr(uint8_t *buffer)
39 bfr_size = bit_number = 0;
44 /* Go back to using the demuxer for get_bits in mp3. */
49 bfr_size = bit_number = 0;
55 /* Reconfigure for reverse operation */
56 /* Default is forward operation */
61 input_ptr -= (bfr_size+7)/8;
62 else for( int i=0; i<bfr_size; i+=8 )
63 demuxer->read_prev_char();
66 /* Reconfigure for forward operation */
70 // If already at the bof, the buffer is already invalid.
71 if( demuxer && bof() ) {
79 input_ptr += (bfr_size+7)/8;
80 else for( int i=0; i<bfr_size; i+=8 )
84 /* Erase the buffer with the next 4 bytes in the file. */
90 bfr = (uint32_t)(*input_ptr++) << 24;
91 bfr |= (uint32_t)(*input_ptr++) << 16;
92 bfr |= (uint32_t)(*input_ptr++) << 8;
93 bfr |= (uint32_t)*input_ptr++;
94 return demuxer->eof();
102 bfr = (uint32_t)demuxer->read_char() << 24;
103 bfr |= (uint32_t)demuxer->read_char() << 16;
104 bfr |= (uint32_t)demuxer->read_char() << 8;
105 bfr |= (uint32_t)demuxer->read_char();
106 return demuxer->eof();
109 /* Erase the buffer with the previous 4 bytes in the file. */
115 bfr = (uint32_t)demuxer->read_prev_char();
116 bfr |= (uint32_t)demuxer->read_prev_char() << 8;
117 bfr |= (uint32_t)demuxer->read_prev_char() << 16;
118 bfr |= (uint32_t)demuxer->read_prev_char() << 24;
119 return demuxer->eof();
123 open_title(int title)
125 bfr_size = bit_number = 0;
126 return demuxer->open_title(title);
131 * seek_time(double time_position)
133 * bfr_size = bit_number = 0;
134 * return demuxer->seek_time(time_position);
139 seek_byte(int64_t position)
141 bfr_size = bit_number = 0;
142 return demuxer->seek_byte(position);