Browse code

Merge commit '5c08ae4f37281441188447cd04dcaf7cd7ce031f'

* commit '5c08ae4f37281441188447cd04dcaf7cd7ce031f':
segment: Add an option to prepend a string to the list entries

Conflicts:
doc/muxers.texi
libavformat/segment.c

See: 5e278c19c752d65fdc1da1ceb599b091f71a4b4b
Merged-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2014/04/29 22:42:04
Showing 2 changed files
... ...
@@ -789,8 +789,8 @@ segments. If 0 the list file will contain all the segments. Default
789 789
 value is 0.
790 790
 
791 791
 @item segment_list_entry_prefix @var{prefix}
792
-Set @var{prefix} to prepend to the name of each entry filename. By
793
-default no prefix is applied.
792
+Prepend @var{prefix} to each entry. Useful to generate absolute paths.
793
+By default no prefix is applied.
794 794
 
795 795
 @item segment_list_type @var{type}
796 796
 Specify the format for the segment list file.
... ...
@@ -73,7 +73,7 @@ typedef struct {
73 73
     char *list;            ///< filename for the segment list file
74 74
     int   list_flags;      ///< flags affecting list generation
75 75
     int   list_size;       ///< number of entries for the segment list file
76
-    char *list_entry_prefix; ///< prefix to add to list entry filenames
76
+    char *entry_prefix;    ///< prefix to add to list entry filenames
77 77
     ListType list_type;    ///< set the list type
78 78
     AVIOContext *list_pb;  ///< list file put-byte context
79 79
     char *time_str;        ///< segment duration specification string
... ...
@@ -172,14 +172,14 @@ static int set_segment_filename(AVFormatContext *s)
172 172
 
173 173
     /* copy modified name in list entry */
174 174
     size = strlen(av_basename(oc->filename)) + 1;
175
-    if (seg->list_entry_prefix)
176
-        size += strlen(seg->list_entry_prefix);
175
+    if (seg->entry_prefix)
176
+        size += strlen(seg->entry_prefix);
177 177
 
178 178
     seg->cur_entry.filename = av_mallocz(size);
179 179
     if (!seg->cur_entry.filename)
180 180
         return AVERROR(ENOMEM);
181 181
     snprintf(seg->cur_entry.filename, size, "%s%s",
182
-             seg->list_entry_prefix ? seg->list_entry_prefix : "",
182
+             seg->entry_prefix ? seg->entry_prefix : "",
183 183
              av_basename(oc->filename));
184 184
 
185 185
     return 0;
... ...
@@ -783,7 +783,6 @@ static const AVOption options[] = {
783 783
     { "live",              "enable live-friendly list generation (useful for HLS)", 0, AV_OPT_TYPE_CONST, {.i64 = SEGMENT_LIST_FLAG_LIVE }, INT_MIN, INT_MAX,    E, "list_flags"},
784 784
 
785 785
     { "segment_list_size", "set the maximum number of playlist entries", OFFSET(list_size), AV_OPT_TYPE_INT,  {.i64 = 0},     0, INT_MAX, E },
786
-    { "segment_list_entry_prefix", "set prefix to prepend to each list entry filename", OFFSET(list_entry_prefix), AV_OPT_TYPE_STRING,  {.str = NULL}, 0, 0, E },
787 786
 
788 787
     { "segment_list_type", "set the segment list type",                  OFFSET(list_type), AV_OPT_TYPE_INT,  {.i64 = LIST_TYPE_UNDEFINED}, -1, LIST_TYPE_NB-1, E, "list_type" },
789 788
     { "flat", "flat format",     0, AV_OPT_TYPE_CONST, {.i64=LIST_TYPE_FLAT }, INT_MIN, INT_MAX, E, "list_type" },
... ...
@@ -798,6 +797,7 @@ static const AVOption options[] = {
798 798
     { "segment_times",     "set segment split time points",              OFFSET(times_str),AV_OPT_TYPE_STRING,{.str = NULL},  0, 0,       E },
799 799
     { "segment_frames",    "set segment split frame numbers",            OFFSET(frames_str),AV_OPT_TYPE_STRING,{.str = NULL},  0, 0,       E },
800 800
     { "segment_wrap",      "set number after which the index wraps",     OFFSET(segment_idx_wrap), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E },
801
+    { "segment_list_entry_prefix", "set base url prefix for segments", OFFSET(entry_prefix), AV_OPT_TYPE_STRING,  {.str = NULL}, 0, 0, E },
801 802
     { "segment_start_number", "set the sequence number of the first segment", OFFSET(segment_idx), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E },
802 803
     { "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 },
803 804