static void hds_scale_segment_durations(hds_segment_durations_t* segments) { segment_durations_t* segment_durations = &segments->durations; segment_duration_item_t* last_item = segment_durations->items + segment_durations->item_count; segment_duration_item_t* cur_item; segments->zero_segments = 0; segment_durations->end_time = hds_rescale_millis(segment_durations->end_time); for (cur_item = segment_durations->items; cur_item < last_item; cur_item++) { cur_item->time = segment_durations->timescale == 1000 ? hds_rescale_millis(cur_item->time) : // special case for 1000 to prevent overflow in time rescale_time(cur_item->time, segment_durations->timescale, HDS_TIMESCALE); cur_item->duration = rescale_time(cur_item->duration, segment_durations->timescale, HDS_TIMESCALE); if (cur_item->duration == 0) { segments->zero_segments++; } } }
static vod_status_t hds_muxer_init_track( hds_muxer_state_t* state, hds_muxer_stream_state_t* cur_stream, media_track_t* cur_track) { vod_status_t rc; cur_stream->track = cur_track; cur_stream->media_type = cur_track->media_info.media_type; cur_stream->timescale = cur_track->media_info.timescale; cur_stream->frames_source = cur_track->frames_source; cur_stream->frames_source_context = cur_track->frames_source_context; cur_stream->first_frame = cur_track->first_frame; cur_stream->last_frame = cur_track->last_frame; cur_stream->clip_start_time = hds_rescale_millis(cur_track->clip_start_time); cur_stream->first_frame_time_offset = cur_track->first_frame_time_offset; cur_stream->next_frame_time_offset = cur_stream->first_frame_time_offset; cur_stream->next_frame_dts = rescale_time(cur_stream->next_frame_time_offset, cur_stream->timescale, HDS_TIMESCALE); cur_stream->cur_frame = cur_stream->first_frame; cur_stream->first_frame_input_offset = cur_track->frame_offsets; cur_stream->cur_frame_input_offset = cur_stream->first_frame_input_offset; if (cur_track->media_info.media_type == MEDIA_TYPE_AUDIO) { rc = hds_get_sound_info(state->request_context, &cur_track->media_info, &cur_stream->sound_info); if (rc != VOD_OK) { vod_log_debug1(VOD_LOG_DEBUG_LEVEL, state->request_context->log, 0, "hds_muxer_init_track: hds_get_sound_info failed %i", rc); return rc; } } return VOD_OK; }