static s32 vdecoder_update_data(cedarv_decoder_t* p, cedarv_stream_data_info_t* data_info) { Handle vbv; vstream_data_t* stream; video_decoder_t* decoder; if(p == NULL) return CEDARV_RESULT_ERR_INVALID_PARAM; decoder = (video_decoder_t*)p; if(data_info == NULL) return CEDARV_RESULT_ERR_INVALID_PARAM; vbv = decoder->vbv; stream = &decoder->cur_stream_part; if(data_info->flags & CEDARV_FLAG_FIRST_PART) { if(stream->length != 0) { stream->valid = 0; vbv_add_stream(stream, vbv); } stream->data = vbv_get_current_write_addr(vbv); stream->length = data_info->lengh; if(data_info->flags & CEDARV_FLAG_PTS_VALID) { stream->pts = data_info->pts; } else { stream->pts = (u64)(-1); } } else { stream->length += data_info->lengh; } if(data_info->flags & CEDARV_FLAG_LAST_PART) { if(data_info->flags & CEDARV_FLAG_DATA_INVALID) { stream->valid = 0; } else { stream->valid = 1; } vbv_add_stream(stream, vbv); stream->data = NULL; stream->length = 0; stream->pts = 0; stream->valid = 0; } return 0; }
static s32 vdecoder_update_data(cedarv_decoder_t* p, cedarv_stream_data_info_t* data_info) { Handle vbv = NULL; vstream_data_t* stream= NULL; video_decoder_t* decoder = NULL; if(p == NULL) return CEDARV_RESULT_ERR_INVALID_PARAM; decoder = (video_decoder_t*)p; if(data_info == NULL) return CEDARV_RESULT_ERR_INVALID_PARAM; vbv = decoder->vbv; stream = &decoder->cur_stream_part; if(data_info->flags & CEDARV_FLAG_FIRST_PART) { if(stream->length != 0) { stream->valid = 0; vbv_add_stream(stream, vbv); } stream->data = vbv_get_current_write_addr(vbv); stream->length = data_info->lengh; if(data_info->flags & CEDARV_FLAG_PTS_VALID) { stream->pts = data_info->pts; } else { stream->pts = (u64)(-1); } } else { stream->length += data_info->lengh; } if(data_info->flags & CEDARV_FLAG_LAST_PART) { if(data_info->flags & CEDARV_FLAG_DATA_INVALID) { stream->valid = 0; } else { stream->valid = 1; } vbv_add_stream(stream, vbv); #ifdef SAVE_DATA if(fpStream) { u8* vbv_end; u32 tmp_length; printf("writing data.........., stream length %x\n", stream->length); vbv_end = vbv_get_base_addr(decoder->vbv) + vbv_get_buffer_size(decoder->vbv); if(stream->data + stream->length > vbv_end) { tmp_length = vbv_end - stream->data; fwrite(stream->data, 1, tmp_length, fpStream); fwrite(vbv_get_base_addr(decoder->vbv), 1, stream->length - tmp_length, fpStream); } else { fwrite(stream->data, 1, stream->length, fpStream); } } #endif stream->data = NULL; stream->length = 0; stream->pts = 0; stream->valid = 0; } return 0; }