On Sat, Aug 27, 2016 at 10:42:25PM +0800, Steven Liu wrote: > 2016-08-27 19:15 GMT+08:00 Steven Liu <lingjiujia...@gmail.com>: > > > > > > > 2016-08-27 18:25 GMT+08:00 Michael Niedermayer <mich...@niedermayer.cc>: > > > >> On Sat, Aug 27, 2016 at 07:44:01AM +0800, Steven Liu wrote: > >> > 2016-08-27 4:49 GMT+08:00 Michael Niedermayer <mich...@niedermayer.cc>: > >> > > >> > > On Fri, Aug 26, 2016 at 05:30:41PM +0800, Steven Liu wrote: > >> > > > recover segments duration time by hls_time after init hls window. > >> > > > This is reuqested by Ibrahim Tachijian > >> > > > > >> > > > Signed-off-by: LiuQi <li...@gosun.com> > >> > > > --- > >> > > > libavformat/hlsenc.c | 14 +++++++++++++- > >> > > > 1 file changed, 13 insertions(+), 1 deletion(-) > >> > > [...] > >> > > > hlsenc.c | 14 +++++++++++++- > >> > > > 1 file changed, 13 insertions(+), 1 deletion(-) > >> > > > f38066079d46206d1bc970f026a7a9de25ace8d1 > >> 0001-add-option-hls_init_time- > >> > > to-set-init-hls-window-segm.patch > >> > > > From 937e5301414f1c43c4c564ee59a4dfeee690293c Mon Sep 17 00:00:00 > >> 2001 > >> > > > From: Steven Liu <lingjiujia...@gmail.com> > >> > > > Date: Fri, 26 Aug 2016 14:34:58 +0800 > >> > > > Subject: [PATCH 1/2] add option hls_init_time to set init hls window > >> > > segment > >> > > > duration > >> > > > > >> > > > And recover segments duration time by hls_time after init hls > >> window. > >> > > > This is reuqested by Ibrahim Tachijian > >> > > > > >> > > > Signed-off-by: LiuQi <li...@gosun.com> > >> > > > --- > >> > > > libavformat/hlsenc.c | 14 +++++++++++++- > >> > > > 1 file changed, 13 insertions(+), 1 deletion(-) > >> > > > > >> > > > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > >> > > > index e65f002..f5ceb60 100644 > >> > > > --- a/libavformat/hlsenc.c > >> > > > +++ b/libavformat/hlsenc.c > >> > > > @@ -85,6 +85,7 @@ typedef struct HLSContext { > >> > > > AVFormatContext *vtt_avf; > >> > > > > >> > > > float time; // Set by a private option. > >> > > > + float init_time; // Set by a private option. > >> > > > int max_nb_segments; // Set by a private option. > >> > > > int wrap; // Set by a private option. > >> > > > >> > > the comment looks oddly aligned, it should be at the same horizontal > >> > > position as teh others > >> > > > >> > > > >> > > > uint32_t flags; // enum HLSFlags > >> > > > @@ -706,7 +707,7 @@ static int hls_write_header(AVFormatContext *s) > >> > > > int vtt_basename_size; > >> > > > > >> > > > hls->sequence = hls->start_sequence; > >> > > > - hls->recording_time = hls->time * AV_TIME_BASE; > >> > > > + hls->recording_time = (hls->init_time ? hls->init_time : > >> hls->time) > >> > > * AV_TIME_BASE; > >> > > > hls->start_pts = AV_NOPTS_VALUE; > >> > > > > >> > > > if (hls->format_options_str) { > >> > > > @@ -860,9 +861,19 @@ static int hls_write_packet(AVFormatContext > >> *s, > >> > > AVPacket *pkt) > >> > > > AVStream *st = s->streams[pkt->stream_index]; > >> > > > int64_t end_pts = hls->recording_time * hls->number; > >> > > > int is_ref_pkt = 1; > >> > > > >> > > > + int init_list_dur = 0; > >> > > > + int after_init_list_dur = 0; > >> > > > >> > > the initialized value is not used > >> > > also the declaration can be moved into the if() below > >> > > > >> > > > int ret, can_split = 1; > >> > > > int stream_index = 0; > >> > > > > >> > > > + if (hls->sequence - hls->nb_entries > hls->start_sequence && > >> > > hls->init_time > 0) { > >> > > > + /* reset end_pts, hls->recording_time at end of the init > >> hls > >> > > list */ > >> > > > + init_list_dur = hls->init_time * hls->nb_entries * > >> AV_TIME_BASE; > >> > > > + after_init_list_dur = (hls->sequence - hls->nb_entries ) * > >> > > hls->time * AV_TIME_BASE; > >> > > > + hls->recording_time = hls->time * AV_TIME_BASE; > >> > > > + end_pts = init_list_dur + after_init_list_dur ; > >> > > > + } > >> > > > + > >> > > > if( st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE ) { > >> > > > oc = hls->vtt_avf; > >> > > > stream_index = 0; > >> > > > @@ -972,6 +983,7 @@ static int hls_write_trailer(struct > >> AVFormatContext > >> > > *s) > >> > > [...] > >> > > > >> > > > >> > > -- > >> > > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC7 > >> 87040B0FAB > >> > > > >> > > Let us carefully observe those good qualities wherein our enemies > >> excel us > >> > > and endeavor to excel them, by avoiding what is faulty, and imitating > >> what > >> > > is excellent in them. -- Plutarch > >> > > > >> > > _______________________________________________ > >> > > ffmpeg-devel mailing list > >> > > ffmpeg-devel@ffmpeg.org > >> > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > >> > > > >> > > Update patch > >> > >> > hlsenc.c | 14 +++++++++++++- > >> > 1 file changed, 13 insertions(+), 1 deletion(-) > >> > 2feb683487b70430f2ea423d2678d7f30d0c3079 > >> 0001-add-option-hls_init_time-to-set-init-hls-window-segm.patch > >> > From dfadb857714867613afebe1a740a8e7fccaa5443 Mon Sep 17 00:00:00 2001 > >> > From: Steven Liu <lingjiujia...@gmail.com> > >> > Date: Sat, 27 Aug 2016 07:32:40 +0800 > >> > Subject: [PATCH 1/2] add option hls_init_time to set init hls window > >> segment > >> > duration > >> > > >> > recover segments duration time by hls_time after init hls window. > >> > This is reuqested by Ibrahim Tachijian > >> > > >> > Reviewed-by: Michael Niedermayer <mich...@niedermayer.cc> > >> > Signed-off-by: LiuQi <li...@gosun.com> > >> > --- > >> > libavformat/hlsenc.c | 14 +++++++++++++- > >> > 1 file changed, 13 insertions(+), 1 deletion(-) > >> > > >> > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > >> > index e65f002..95da86c 100644 > >> > --- a/libavformat/hlsenc.c > >> > +++ b/libavformat/hlsenc.c > >> > @@ -85,6 +85,7 @@ typedef struct HLSContext { > >> > AVFormatContext *vtt_avf; > >> > > >> > float time; // Set by a private option. > >> > + float init_time; // Set by a private option. > >> > int max_nb_segments; // Set by a private option. > >> > int wrap; // Set by a private option. > >> > uint32_t flags; // enum HLSFlags > >> > @@ -706,7 +707,7 @@ static int hls_write_header(AVFormatContext *s) > >> > int vtt_basename_size; > >> > > >> > hls->sequence = hls->start_sequence; > >> > - hls->recording_time = hls->time * AV_TIME_BASE; > >> > + hls->recording_time = (hls->init_time ? hls->init_time : > >> hls->time) * AV_TIME_BASE; > >> > hls->start_pts = AV_NOPTS_VALUE; > >> > > >> > if (hls->format_options_str) { > >> > >> > @@ -863,6 +864,16 @@ static int hls_write_packet(AVFormatContext *s, > >> AVPacket *pkt) > >> > int ret, can_split = 1; > >> > int stream_index = 0; > >> > > >> > + if (hls->sequence - hls->nb_entries > hls->start_sequence && > >> hls->init_time > 0) { > >> > + int init_list_dur = 0; > >> > + int after_init_list_dur = 0; > >> > + /* reset end_pts, hls->recording_time at end of the init hls > >> list */ > >> > + init_list_dur = hls->init_time * hls->nb_entries * > >> AV_TIME_BASE; > >> > + after_init_list_dur = (hls->sequence - hls->nb_entries ) * > >> hls->time * AV_TIME_BASE; > >> > >> the first assignment does nothing > >> int a = 0; > >> a = 5; > >> is the same as > >> int a = 5 > >> > >> [...] > >> > >> -- > >> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > >> > >> Breaking DRM is a little like attempting to break through a door even > >> though the window is wide open and the only thing in the house is a bunch > >> of things you dont want and which you would get tomorrow for free anyway > >> > >> _______________________________________________ > >> ffmpeg-devel mailing list > >> ffmpeg-devel@ffmpeg.org > >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > >> > >> refined the patch and update patch by Michael's suggestion > > > Ignore prev patch, this is update patch: Update commit Author
> hlsenc.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > 7bd461c0aa903c61e2c24ab039599559366a3bbf > 0001-add-option-hls_init_time-to-set-init-hls-window-segm.patch > From a5ae310a049c3a4c0531c5700246ace62261798a Mon Sep 17 00:00:00 2001 > From: Steven Liu <lingjiujia...@gmail.com> > Date: Sat, 27 Aug 2016 19:11:14 +0800 > Subject: [PATCH 1/2] add option hls_init_time to set init hls window segment > duration > > recover segments duration time by hls_time after init hls window. > This is reuqested by Ibrahim Tachijian > > Reviewed-by: Michael Niedermayer <mich...@niedermayer.cc> applied thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB There will always be a question for which you do not know the correct answer.
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel