Lines Matching refs:p_stream

192 void OPJ_CALLCONV opj_stream_destroy(opj_stream_t* p_stream)  in opj_stream_destroy()  argument
194 opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream; in opj_stream_destroy()
206 void OPJ_CALLCONV opj_stream_set_read_function(opj_stream_t* p_stream, opj_stream_read_fn p_functio… in opj_stream_set_read_function() argument
208 opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream; in opj_stream_set_read_function()
217 void OPJ_CALLCONV opj_stream_set_seek_function(opj_stream_t* p_stream, opj_stream_seek_fn p_functio… in opj_stream_set_seek_function() argument
219 opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream; in opj_stream_set_seek_function()
227 void OPJ_CALLCONV opj_stream_set_write_function(opj_stream_t* p_stream, opj_stream_write_fn p_funct… in opj_stream_set_write_function() argument
229 opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream; in opj_stream_set_write_function()
238 void OPJ_CALLCONV opj_stream_set_skip_function(opj_stream_t* p_stream, opj_stream_skip_fn p_functio… in opj_stream_set_skip_function() argument
240 opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream; in opj_stream_set_skip_function()
249 void OPJ_CALLCONV opj_stream_set_user_data(opj_stream_t* p_stream, void * p_data, opj_stream_free_u… in opj_stream_set_user_data() argument
251 opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream; in opj_stream_set_user_data()
258 void OPJ_CALLCONV opj_stream_set_user_data_length(opj_stream_t* p_stream, OPJ_UINT64 data_length) in opj_stream_set_user_data_length() argument
260 opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream; in opj_stream_set_user_data_length()
266 OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_buffer, OPJ_SIZE_T p_… in opj_stream_read_data() argument
269 if (p_stream->m_bytes_in_buffer >= p_size) { in opj_stream_read_data()
270 memcpy(p_buffer,p_stream->m_current_data,p_size); in opj_stream_read_data()
271 p_stream->m_current_data += p_size; in opj_stream_read_data()
272 p_stream->m_bytes_in_buffer -= p_size; in opj_stream_read_data()
274 p_stream->m_byte_offset += (OPJ_OFF_T)p_size; in opj_stream_read_data()
279 if (p_stream->m_status & opj_stream_e_end) { in opj_stream_read_data()
280 l_read_nb_bytes += p_stream->m_bytes_in_buffer; in opj_stream_read_data()
281 memcpy(p_buffer,p_stream->m_current_data,p_stream->m_bytes_in_buffer); in opj_stream_read_data()
282 p_stream->m_current_data += p_stream->m_bytes_in_buffer; in opj_stream_read_data()
283 p_stream->m_byte_offset += (OPJ_OFF_T)p_stream->m_bytes_in_buffer; in opj_stream_read_data()
284 p_stream->m_bytes_in_buffer = 0; in opj_stream_read_data()
289 if (p_stream->m_bytes_in_buffer) { in opj_stream_read_data()
290 l_read_nb_bytes += p_stream->m_bytes_in_buffer; in opj_stream_read_data()
291 memcpy(p_buffer,p_stream->m_current_data,p_stream->m_bytes_in_buffer); in opj_stream_read_data()
292 p_stream->m_current_data = p_stream->m_stored_data; in opj_stream_read_data()
293 p_buffer += p_stream->m_bytes_in_buffer; in opj_stream_read_data()
294 p_size -= p_stream->m_bytes_in_buffer; in opj_stream_read_data()
295 p_stream->m_byte_offset += (OPJ_OFF_T)p_stream->m_bytes_in_buffer; in opj_stream_read_data()
296 p_stream->m_bytes_in_buffer = 0; in opj_stream_read_data()
302 p_stream->m_current_data = p_stream->m_stored_data; in opj_stream_read_data()
307 if (p_size < p_stream->m_buffer_size) { in opj_stream_read_data()
309p_stream->m_bytes_in_buffer = p_stream->m_read_fn(p_stream->m_stored_data,p_stream->m_buffer_size, in opj_stream_read_data()
311 if (p_stream->m_bytes_in_buffer == (OPJ_SIZE_T)-1) { in opj_stream_read_data()
315 p_stream->m_bytes_in_buffer = 0; in opj_stream_read_data()
316 p_stream->m_status |= opj_stream_e_end; in opj_stream_read_data()
320 else if (p_stream->m_bytes_in_buffer < p_size) { in opj_stream_read_data()
322 l_read_nb_bytes += p_stream->m_bytes_in_buffer; in opj_stream_read_data()
323 memcpy(p_buffer,p_stream->m_current_data,p_stream->m_bytes_in_buffer); in opj_stream_read_data()
324 p_stream->m_current_data = p_stream->m_stored_data; in opj_stream_read_data()
325 p_buffer += p_stream->m_bytes_in_buffer; in opj_stream_read_data()
326 p_size -= p_stream->m_bytes_in_buffer; in opj_stream_read_data()
327 p_stream->m_byte_offset += (OPJ_OFF_T)p_stream->m_bytes_in_buffer; in opj_stream_read_data()
328 p_stream->m_bytes_in_buffer = 0; in opj_stream_read_data()
332 memcpy(p_buffer,p_stream->m_current_data,p_size); in opj_stream_read_data()
333 p_stream->m_current_data += p_size; in opj_stream_read_data()
334 p_stream->m_bytes_in_buffer -= p_size; in opj_stream_read_data()
335 p_stream->m_byte_offset += (OPJ_OFF_T)p_size; in opj_stream_read_data()
341 p_stream->m_bytes_in_buffer = p_stream->m_read_fn(p_buffer,p_size,p_stream->m_user_data); in opj_stream_read_data()
343 if (p_stream->m_bytes_in_buffer == (OPJ_SIZE_T)-1) { in opj_stream_read_data()
347 p_stream->m_bytes_in_buffer = 0; in opj_stream_read_data()
348 p_stream->m_status |= opj_stream_e_end; in opj_stream_read_data()
352 else if (p_stream->m_bytes_in_buffer < p_size) { in opj_stream_read_data()
354 l_read_nb_bytes += p_stream->m_bytes_in_buffer; in opj_stream_read_data()
355 p_stream->m_current_data = p_stream->m_stored_data; in opj_stream_read_data()
356 p_buffer += p_stream->m_bytes_in_buffer; in opj_stream_read_data()
357 p_size -= p_stream->m_bytes_in_buffer; in opj_stream_read_data()
358 p_stream->m_byte_offset += (OPJ_OFF_T)p_stream->m_bytes_in_buffer; in opj_stream_read_data()
359 p_stream->m_bytes_in_buffer = 0; in opj_stream_read_data()
363 l_read_nb_bytes += p_stream->m_bytes_in_buffer; in opj_stream_read_data()
364 p_stream->m_byte_offset += (OPJ_OFF_T)p_stream->m_bytes_in_buffer; in opj_stream_read_data()
365 p_stream->m_current_data = p_stream->m_stored_data; in opj_stream_read_data()
366 p_stream->m_bytes_in_buffer = 0; in opj_stream_read_data()
373 OPJ_SIZE_T opj_stream_write_data (opj_stream_private_t * p_stream, in opj_stream_write_data() argument
381 if (p_stream->m_status & opj_stream_e_error) { in opj_stream_write_data()
386 l_remaining_bytes = p_stream->m_buffer_size - p_stream->m_bytes_in_buffer; in opj_stream_write_data()
390 memcpy(p_stream->m_current_data, p_buffer, p_size); in opj_stream_write_data()
392 p_stream->m_current_data += p_size; in opj_stream_write_data()
393 p_stream->m_bytes_in_buffer += p_size; in opj_stream_write_data()
395 p_stream->m_byte_offset += (OPJ_OFF_T)p_size; in opj_stream_write_data()
404 memcpy(p_stream->m_current_data,p_buffer,l_remaining_bytes); in opj_stream_write_data()
406 p_stream->m_current_data = p_stream->m_stored_data; in opj_stream_write_data()
410 p_stream->m_bytes_in_buffer += l_remaining_bytes; in opj_stream_write_data()
411 p_stream->m_byte_offset += (OPJ_OFF_T)l_remaining_bytes; in opj_stream_write_data()
414 if (! opj_stream_flush(p_stream, p_event_mgr)) { in opj_stream_write_data()
421 OPJ_BOOL opj_stream_flush (opj_stream_private_t * p_stream, opj_event_mgr_t * p_event_mgr) in opj_stream_flush() argument
426 p_stream->m_current_data = p_stream->m_stored_data; in opj_stream_flush()
428 while (p_stream->m_bytes_in_buffer) { in opj_stream_flush()
430 l_current_write_nb_bytes = p_stream->m_write_fn(p_stream->m_current_data, in opj_stream_flush()
431 p_stream->m_bytes_in_buffer, in opj_stream_flush()
432 p_stream->m_user_data); in opj_stream_flush()
435 p_stream->m_status |= opj_stream_e_error; in opj_stream_flush()
441 p_stream->m_current_data += l_current_write_nb_bytes; in opj_stream_flush()
442 p_stream->m_bytes_in_buffer -= l_current_write_nb_bytes; in opj_stream_flush()
445 p_stream->m_current_data = p_stream->m_stored_data; in opj_stream_flush()
450 OPJ_OFF_T opj_stream_read_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, opj_event_mgr_t … in opj_stream_read_skip() argument
457 if (p_stream->m_bytes_in_buffer >= (OPJ_SIZE_T)p_size) { in opj_stream_read_skip()
458 p_stream->m_current_data += p_size; in opj_stream_read_skip()
461 p_stream->m_bytes_in_buffer -= (OPJ_SIZE_T)p_size; in opj_stream_read_skip()
463 p_stream->m_byte_offset += l_skip_nb_bytes; in opj_stream_read_skip()
468 if (p_stream->m_status & opj_stream_e_end) { in opj_stream_read_skip()
469 l_skip_nb_bytes += (OPJ_OFF_T)p_stream->m_bytes_in_buffer; in opj_stream_read_skip()
470 p_stream->m_current_data += p_stream->m_bytes_in_buffer; in opj_stream_read_skip()
471 p_stream->m_bytes_in_buffer = 0; in opj_stream_read_skip()
472 p_stream->m_byte_offset += l_skip_nb_bytes; in opj_stream_read_skip()
477 if (p_stream->m_bytes_in_buffer) { in opj_stream_read_skip()
478 l_skip_nb_bytes += (OPJ_OFF_T)p_stream->m_bytes_in_buffer; in opj_stream_read_skip()
479 p_stream->m_current_data = p_stream->m_stored_data; in opj_stream_read_skip()
480 p_size -= (OPJ_OFF_T)p_stream->m_bytes_in_buffer; in opj_stream_read_skip()
481 p_stream->m_bytes_in_buffer = 0; in opj_stream_read_skip()
486 l_current_skip_nb_bytes = p_stream->m_skip_fn(p_size, p_stream->m_user_data); in opj_stream_read_skip()
490 p_stream->m_status |= opj_stream_e_end; in opj_stream_read_skip()
491 p_stream->m_byte_offset += l_skip_nb_bytes; in opj_stream_read_skip()
499 p_stream->m_byte_offset += l_skip_nb_bytes; in opj_stream_read_skip()
504 OPJ_OFF_T opj_stream_write_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, opj_event_mgr_t… in opj_stream_write_skip() argument
510 if (p_stream->m_status & opj_stream_e_error) { in opj_stream_write_skip()
515 l_is_written = opj_stream_flush (p_stream, p_event_mgr); in opj_stream_write_skip()
517 p_stream->m_status |= opj_stream_e_error; in opj_stream_write_skip()
518 p_stream->m_bytes_in_buffer = 0; in opj_stream_write_skip()
525 l_current_skip_nb_bytes = p_stream->m_skip_fn(p_size, p_stream->m_user_data); in opj_stream_write_skip()
530 p_stream->m_status |= opj_stream_e_error; in opj_stream_write_skip()
531 p_stream->m_byte_offset += l_skip_nb_bytes; in opj_stream_write_skip()
539 p_stream->m_byte_offset += l_skip_nb_bytes; in opj_stream_write_skip()
544 OPJ_OFF_T opj_stream_tell (const opj_stream_private_t * p_stream) in opj_stream_tell() argument
546 return p_stream->m_byte_offset; in opj_stream_tell()
549 OPJ_OFF_T opj_stream_get_number_byte_left (const opj_stream_private_t * p_stream) in opj_stream_get_number_byte_left() argument
551 assert( p_stream->m_byte_offset >= 0 ); in opj_stream_get_number_byte_left()
552 assert( p_stream->m_user_data_length >= (OPJ_UINT64)p_stream->m_byte_offset); in opj_stream_get_number_byte_left()
553 return p_stream->m_user_data_length ? in opj_stream_get_number_byte_left()
554 (OPJ_OFF_T)(p_stream->m_user_data_length) - p_stream->m_byte_offset : in opj_stream_get_number_byte_left()
558 OPJ_OFF_T opj_stream_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, opj_event_mgr_t * p_e… in opj_stream_skip() argument
561 return p_stream->m_opj_skip(p_stream,p_size,p_event_mgr); in opj_stream_skip()
564 OPJ_BOOL opj_stream_read_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, opj_event_mgr_t *… in opj_stream_read_seek() argument
567 p_stream->m_current_data = p_stream->m_stored_data; in opj_stream_read_seek()
568 p_stream->m_bytes_in_buffer = 0; in opj_stream_read_seek()
570 if( !(p_stream->m_seek_fn(p_size,p_stream->m_user_data)) ) { in opj_stream_read_seek()
571 p_stream->m_status |= opj_stream_e_end; in opj_stream_read_seek()
576 p_stream->m_status &= (~opj_stream_e_end); in opj_stream_read_seek()
577 p_stream->m_byte_offset = p_size; in opj_stream_read_seek()
584 OPJ_BOOL opj_stream_write_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, opj_event_mgr_t … in opj_stream_write_seek() argument
586 if (! opj_stream_flush(p_stream,p_event_mgr)) { in opj_stream_write_seek()
587 p_stream->m_status |= opj_stream_e_error; in opj_stream_write_seek()
591 p_stream->m_current_data = p_stream->m_stored_data; in opj_stream_write_seek()
592 p_stream->m_bytes_in_buffer = 0; in opj_stream_write_seek()
594 if (! p_stream->m_seek_fn(p_size,p_stream->m_user_data)) { in opj_stream_write_seek()
595 p_stream->m_status |= opj_stream_e_error; in opj_stream_write_seek()
599 p_stream->m_byte_offset = p_size; in opj_stream_write_seek()
605 OPJ_BOOL opj_stream_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr *… in opj_stream_seek() argument
608 return p_stream->m_opj_seek(p_stream,p_size,p_event_mgr); in opj_stream_seek()
611 OPJ_BOOL opj_stream_has_seek (const opj_stream_private_t * p_stream) in opj_stream_has_seek() argument
613 return p_stream->m_seek_fn != opj_stream_default_seek; in opj_stream_has_seek()