int oggz_set_eos (OGGZ * oggz, long serialno) { oggz_stream_t * stream; int i, size; if (oggz == NULL) return OGGZ_ERR_BAD_OGGZ; if (serialno == -1) { size = oggz_vector_size (oggz->streams); for (i = 0; i < size; i++) { stream = (oggz_stream_t *) oggz_vector_nth_p (oggz->streams, i); stream->e_o_s = 1; } oggz->all_at_eos = 1; } else { stream = oggz_get_stream (oggz, serialno); if (stream == NULL) return OGGZ_ERR_BAD_SERIALNO; stream->e_o_s = 1; if (oggz_get_eos (oggz, -1)) oggz->all_at_eos = 1; } return 0; }
static int read_packet (OGGZ * ap_oggz, oggz_packet * ap_zp, long serialno, void * ap_user_data, const OMX_U32 a_pid) { oggdmux_prc_t * p_prc = ap_user_data; OMX_U32 op_offset = 0; bool * p_eos = NULL; ogg_packet * p_op = NULL; int rc = OGGZ_CONTINUE; assert (ap_oggz); assert (ap_zp); assert (p_prc); assert (a_pid <= ARATELIA_OGG_DEMUXER_VIDEO_PORT_BASE_INDEX); p_op = &(ap_zp->op); p_eos = get_eos_ptr (p_prc, a_pid); TIZ_TRACE (handleOf (p_prc), "%010lu: pid [%d] reading bytes [%d]", serialno, a_pid, p_op->bytes); #ifdef _DEBUG if (a_pid == ARATELIA_OGG_DEMUXER_AUDIO_PORT_BASE_INDEX) { g_total_read += p_op->bytes; g_last_read = p_op->bytes; } #endif if (oggz_get_eos (ap_oggz, serialno) == 1) { TIZ_TRACE (handleOf (p_prc), "%010lu: This is EOS\n", serialno); *p_eos = true; } /* Try to empty the ogg packet out to an omx buffer */ op_offset = flush_ogg_packet (p_prc, a_pid, p_op->packet, p_op->bytes); if (0 == op_offset) { if (*p_eos || !get_header (p_prc, a_pid) || (*get_store_offset_ptr (p_prc, a_pid)) > 0) { rc = OGGZ_STOP_OK; } else { rc = OGGZ_CONTINUE; } } else /* (op_offset != 0) */ { rc = OGGZ_STOP_ERR; } TIZ_TRACE (handleOf (p_prc), "%010lu: rc [%d] op_offset [%d]", serialno, rc, op_offset); return rc; }