static void range_dump (range_desc_t *rptr, const char *start) { char buffer[80]; if (rptr->have_range == FALSE) return; printf("%sRange is ", start); if (rptr->range_is_npt) { printf("npt - start %g, end ", rptr->range_start); if (rptr->range_end_infinite) { printf("infinite\n"); } else { printf("%g\n", rptr->range_end); } } else { printf("smtpe - start "); sdp_smpte_to_str(rptr->range_start, rptr->range_smpte_fps, buffer); printf("%s, end ", buffer); if (rptr->range_end_infinite) { printf("infinite\n"); } else { sdp_smpte_to_str(rptr->range_end, rptr->range_smpte_fps, buffer); printf("%s\n", buffer); } } }
static int encode_range (range_desc_t *rptr, sdp_encode_t *se) { char buffer[80]; if (rptr->have_range) { if (rptr->range_is_npt) { ADD_STR_TO_ENCODE_WITH_RETURN(se, "a=npt:"); sprintf(buffer, "%g-", rptr->range_start); ADD_STR_TO_ENCODE_WITH_RETURN(se, buffer); if (rptr->range_end_infinite == FALSE) { // 2005.04.25 Sky modify : don't use double type #if 0 sprintf(buffer,"%g", rptr->range_end); #else sprintf(buffer,"%s", rptr->range_end); #endif // 2005.04.25 End of modification ADD_STR_TO_ENCODE_WITH_RETURN(se, buffer); } } else { ADD_STR_TO_ENCODE_WITH_RETURN(se, "a=smpte"); if (rptr->range_smpte_fps != 0) { sprintf(buffer, "-%d", rptr->range_smpte_fps); ADD_STR_TO_ENCODE_WITH_RETURN(se, buffer); } ADD_STR_TO_ENCODE_WITH_RETURN(se, "="); sdp_smpte_to_str(rptr->range_start, rptr->range_smpte_fps, buffer); ADD_STR_TO_ENCODE_WITH_RETURN(se, buffer); ADD_STR_TO_ENCODE_WITH_RETURN(se, "-"); if (rptr->range_end_infinite == FALSE) { sdp_smpte_to_str(rptr->range_end, rptr->range_smpte_fps, buffer); ADD_STR_TO_ENCODE_WITH_RETURN(se, buffer); } } ADD_STR_TO_ENCODE_WITH_RETURN(se, "\n"); } return (0); }