[FFmpeg-cvslog] avformat/hlsenc: support multi level path in m3u8 with filename
Steven Liu
git at videolan.org
Tue Oct 4 01:43:46 EEST 2016
ffmpeg | branch: master | Steven Liu <lingjiujianke at gmail.com> | Mon Sep 26 15:51:02 2016 +0800| [be1d32492e58cbba6d69d3ce67545536b15e051d] | committer: Steven Liu
avformat/hlsenc: support multi level path in m3u8 with filename
before patch:
localhost:osx liuqi$ tree 20160926/
20160926/
└── file-20160909
└── 26
└── 16
└── 15
├── 46
│ ├── 13.ts
│ ├── 25.ts
│ ├── 36.ts
│ ├── 45.ts
│ └── 54.ts
└── 47
├── 04.ts
├── 14.ts
├── 24.ts
└── 35.ts
6 directories, 9 files
localhost:osx liuqi$ cat out.m3u8
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:12
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:11.360000,
13.ts
#EXTINF:10.800000,
25.ts
#EXTINF:9.120000,
36.ts
#EXTINF:8.760000,
45.ts
#EXTINF:10.200000,
54.ts
#EXTINF:10.720000,
04.ts
#EXTINF:9.600000,
14.ts
#EXTINF:10.600000,
24.ts
#EXTINF:8.760000,
35.ts
#EXT-X-ENDLIST
after patch:
localhost:osx liuqi$ tree 20160926/
20160926/
└── file-20160909
└── 26
└── 16
└── 15
├── 46
│ ├── 13.ts
│ ├── 25.ts
│ ├── 36.ts
│ ├── 45.ts
│ └── 54.ts
└── 47
├── 04.ts
├── 14.ts
├── 24.ts
└── 35.ts
6 directories, 9 files
localhost:osx liuqi$ cat out.m3u8
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:12
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:11.360000,
20160926/file-20160909/26/16/15/46/13.ts
#EXTINF:10.800000,
20160926/file-20160909/26/16/15/46/25.ts
#EXTINF:9.120000,
20160926/file-20160909/26/16/15/46/36.ts
#EXTINF:8.760000,
20160926/file-20160909/26/16/15/46/45.ts
#EXTINF:10.200000,
20160926/file-20160909/26/16/15/46/54.ts
#EXTINF:10.720000,
20160926/file-20160909/26/16/15/47/04.ts
#EXTINF:9.600000,
20160926/file-20160909/26/16/15/47/14.ts
#EXTINF:10.600000,
20160926/file-20160909/26/16/15/47/24.ts
#EXTINF:8.760000,
20160926/file-20160909/26/16/15/47/35.ts
#EXT-X-ENDLIST
Signed-off-by: Steven Liu <lingjiujianke at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=be1d32492e58cbba6d69d3ce67545536b15e051d
---
libavformat/hlsenc.c | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index c161937..e0bb44b 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -364,8 +364,7 @@ static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, double
int64_t pos, int64_t size)
{
HLSSegment *en = av_malloc(sizeof(*en));
- char *tmp, *p;
- const char *pl_dir, *filename;
+ const char *filename;
int ret;
if (!en)
@@ -374,19 +373,7 @@ static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, double
filename = av_basename(hls->avf->filename);
if (hls->use_localtime_mkdir) {
- /* Possibly prefix with mkdir'ed subdir, if playlist share same
- * base path. */
- tmp = av_strdup(s->filename);
- if (!tmp) {
- av_free(en);
- return AVERROR(ENOMEM);
- }
-
- pl_dir = av_dirname(tmp);
- p = hls->avf->filename;
- if (strstr(p, pl_dir) == p)
- filename = hls->avf->filename + strlen(pl_dir) + 1;
- av_free(tmp);
+ filename = hls->avf->filename;
}
av_strlcpy(en->filename, filename, sizeof(en->filename));
More information about the ffmpeg-cvslog
mailing list