65 #define SEGMENT_LIST_FLAG_CACHE 1 
   66 #define SEGMENT_LIST_FLAG_LIVE  2 
  121     int needs_quoting = !!str[strcspn(str, 
"\",\n\r")];
 
  126     for (; *str; str++) {
 
  185         struct tm *tm, tmpbuf;
 
  266         double max_duration = 0;
 
  279         avio_printf(seg->
list_pb, 
"#EXT-X-TARGETDURATION:%"PRId64
"\n", (int64_t)ceil(max_duration));
 
  310                    "Error writing list entry '%s' in list file\n", list_entry->
filename);
 
  345             memcpy(entry, &seg->
cur_entry, 
sizeof(*entry));
 
  383 static int parse_times(
void *log_ctx, int64_t **times, 
int *nb_times,
 
  384                        const char *times_str)
 
  389     char *saveptr = 
NULL;
 
  394 #define FAIL(err) ret = err; goto end 
  397     for (p = times_str1; *p; p++)
 
  408     for (i = 0; i < *nb_times; i++) {
 
  410         char *tstr = 
av_strtok(p, 
",", &saveptr);
 
  413         if (!tstr || !tstr[0]) {
 
  422                    "Invalid time duration specification '%s' in times list %s\n", tstr, times_str);
 
  428         if (i && (*times)[i-1] > (*times)[i]) {
 
  430                    "Specified time %f is greater than the following time %f\n",
 
  431                    (
float)((*times)[i])/1000000, (
float)((*times)[i-1])/1000000);
 
  442                         const char *frames_str)
 
  446     char *frames_str1 = 
av_strdup(frames_str);
 
  447     char *saveptr = 
NULL;
 
  452 #define FAIL(err) ret = err; goto end 
  455     for (p = frames_str1; *p; p++)
 
  466     for (i = 0; i < *nb_frames; i++) {
 
  469         char *fstr = 
av_strtok(p, 
",", &saveptr);
 
  477         f = strtol(fstr, &tailptr, 10);
 
  478         if (*tailptr || f <= 0 || f >= INT_MAX) {
 
  480                    "Invalid argument '%s', must be a positive integer <= INT64_MAX\n",
 
  487         if (i && (*frames)[i-1] > (*frames)[i]) {
 
  489                    "Specified frame %d is greater than the following frame %d\n",
 
  490                    (*frames)[i], (*frames)[i-1]);
 
  502     int buf_size = 32768;
 
  529         static const enum AVMediaType type_priority_list[] = {
 
  539             type_index_map[i] = -1;
 
  544             if ((
unsigned)type < AVMEDIA_TYPE_NB && type_index_map[type] == -1
 
  547                 type_index_map[
type] = i;
 
  551             type = type_priority_list[i];
 
  598                "segment_time, segment_times, and segment_frames options " 
  599                "are mutually exclusive, select just one of them\n");
 
  615                    "Invalid time duration specification '%s' for segment_time option\n",
 
  685                "Some of the provided format options in '%s' are not recognized\n", seg->
format_options_str);
 
  725     int64_t end_pts = INT64_MAX, 
offset;
 
  726     int start_frame = INT_MAX;
 
  744             time_t sec = avgt / 1000000;
 
  746             usecs = (int64_t)(ti.tm_hour*3600 + ti.tm_min*60 + ti.tm_sec) * 1000000 + (avgt % 1000000);
 
  747             wrapped_val = usecs % seg->
time;
 
  748             if (seg->
last_cut != usecs && wrapped_val < seg->last_val) {
 
  758     av_dlog(s, 
"packet stream:%d pts:%s pts_time:%s duration_time:%s is_key:%d frame:%d\n",
 
  794         av_log(s, 
AV_LOG_VERBOSE, 
"segment:'%s' starts with packet stream:%d pts:%s pts_time:%s frame:%d\n",
 
  799     av_log(s, 
AV_LOG_DEBUG, 
"stream:%d start_pts_time:%s pts:%s pts_time:%s dts:%s dts_time:%s",
 
  872 #define OFFSET(x) offsetof(SegmentContext, x) 
  873 #define E AV_OPT_FLAG_ENCODING_PARAM 
  875     { 
"reference_stream",  
"set reference stream", 
OFFSET(reference_stream_specifier), 
AV_OPT_TYPE_STRING, {.str = 
"auto"}, CHAR_MIN, CHAR_MAX, 
E },
 
  877     { 
"segment_format_options", 
"set list of options for the container format used for the segments", 
OFFSET(format_options_str), 
AV_OPT_TYPE_STRING, {.str = 
NULL}, 0, 0, 
E },
 
  884     { 
"segment_list_size", 
"set the maximum number of playlist entries", 
OFFSET(list_size), 
AV_OPT_TYPE_INT,  {.i64 = 0},     0, INT_MAX, 
E },
 
  894     { 
"segment_atclocktime",      
"set segment to be cut at clocktime",  
OFFSET(use_clocktime), 
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, 
E},
 
  896     { 
"segment_time_delta",
"set approximation value used for the segment times", 
OFFSET(time_delta), 
AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, 0, 
E },
 
  899     { 
"segment_wrap",      
"set number after which the index wraps",     
OFFSET(segment_idx_wrap), 
AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, 
E },
 
  901     { 
"segment_start_number", 
"set the sequence number of the first segment", 
OFFSET(segment_idx), 
AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, 
E },
 
  902     { 
"segment_wrap_number", 
"set the number of wrap before the first segment", 
OFFSET(segment_idx_wrap_nb), 
AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, 
E },
 
  903     { 
"strftime",          
"set filename expansion with strftime at segment creation", 
OFFSET(use_strftime), 
AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, 
E },
 
  905     { 
"individual_header_trailer", 
"write header/trailer to each segment", 
OFFSET(individual_header_trailer), 
AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, 
E },
 
  906     { 
"write_header_trailer", 
"write a header to the first segment and a trailer to the last one", 
OFFSET(write_header_trailer), 
AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, 
E },
 
  907     { 
"reset_timestamps", 
"reset timestamps at the begin of each segment", 
OFFSET(reset_timestamps), 
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, 
E },
 
  908     { 
"initial_offset", 
"set initial timestamp offset", 
OFFSET(initial_offset), 
AV_OPT_TYPE_DURATION, {.i64 = 0}, -INT64_MAX, INT64_MAX, 
E },
 
  927     .priv_class     = &seg_class,
 
  938     .
name           = 
"stream_segment,ssegment",
 
  945     .priv_class     = &sseg_class,