On Fri, Dec 05, 2014 at 11:06:19AM -0600, Christian Suloway wrote: > This option allows segment filenames to be specified. Unless -hls_flags > single_file is enabled the filename is used as a string format with the > segment number. > > Example: > ffmpeg -f lavfi -i testsrc -c:v h264 -map 0 -hls_segment_filename > bar%03d.ts foo.m3u8 > > Signed-off-by: Christian Suloway <csulo...@globaleagleent.com>` > --- > libavformat/hlsenc.c | 46 ++++++++++++++++++++++++++++++---------------- > 1 file changed, 30 insertions(+), 16 deletions(-)
missing update to doc/muxers.texi also it doesnt work when the hls_segment_filename is not in the current directory, aka no path can be specified ./ffmpeg -f lavfi -i testsrc -c:v h264 -map 0 -hls_segment_filename /tmp/bar%03d.ts foo.m3u8 fails with invalid segment filename /tmp/bar%03d.ts [...] > @@ -270,21 +268,36 @@ static int hls_write_header(AVFormatContext *s) > goto fail; > } > > - hls->basename = av_malloc(basename_size); > - > - if (!hls->basename) { > - ret = AVERROR(ENOMEM); > - goto fail; > - } > - > - strcpy(hls->basename, s->filename); > + if (hls->segment_filename) { > + hls->basename = av_strdup(av_basename(hls->segment_filename)); > + if (!hls->basename) { > + ret = AVERROR(ENOMEM); > + goto fail; > + } > + if (strlen(hls->basename) != strlen(hls->segment_filename)) { > + av_log(hls, AV_LOG_ERROR, "invalid segment filename %s\n", > + hls->segment_filename); > + ret = AVERROR(EINVAL); > + goto fail; > + } > + } else { > + if (hls->flags & HLS_SINGLE_FILE) > + pattern = ".ts"; > > - p = strrchr(hls->basename, '.'); > + basename_size = strlen(s->filename) + strlen(pattern) + 1; > + hls->basename = av_malloc(basename_size); > + if (!hls->basename) { > + ret = AVERROR(ENOMEM); > + goto fail; > + } > > - if (p) > - *p = '\0'; > + strlcpy(hls->basename, s->filename, basename_size); av_strlcpy [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If a bugfix only changes things apparently unrelated to the bug with no further explanation, that is a good sign that the bugfix is wrong.
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel