[FFmpeg-devel] [PATCH] avformat/hlsenc: refine EXT-X-BYTERANGE support for segments

Steven Liu lingjiujianke at gmail.com
Sun Sep 18 02:28:03 EEST 2016


2016-09-18 1:07 GMT+08:00 Michael Niedermayer <michael at niedermayer.cc>:

> On Sat, Sep 17, 2016 at 01:09:02PM +0800, Steven Liu wrote:
> [...]
> > @@ -867,6 +886,16 @@ static int hls_write_header(AVFormatContext *s)
> >      for (i = 0; i < s->nb_streams; i++) {
> >          AVStream *inner_st;
> >          AVStream *outer_st = s->streams[i];
> > +
> > +        if (hls->max_seg_size > 0) {
> > +            if ((outer_st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
> &&
> > +                outer_st->codecpar->bit_rate > hls->max_seg_size) {
> > +                av_log(s, AV_LOG_WARNING, "Your video bitrate is bigger
> than hls_segment_size, "
> > +                       "%lld > %lld ( video birate > hls_segment_size
> ),the result maybe not you want.",
> > +                       outer_st->codecpar->bit_rate, hls->max_seg_size);
>
> %lld is the wrong type for *int64_t
>
> The compiler should produce a warning for this, though probably not
> every copiler does
> please make sure your changes add no warnings
>


Hi Michael,


Bellow is my compile history before i send the last patch mail, maybe i
need cross complie cross any platform:


localhost:xxx StevenLiu$ make
CC libavformat/hlsenc.o
src/libavformat/hlsenc.c:326:14: error: use of undeclared identifier 'st'
        if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) &&
             ^
src/libavformat/hlsenc.c:327:13: error: use of undeclared identifier 'st'
            st->codecpar->bit_rate > hls->max_seg_size) {
            ^
src/libavformat/hlsenc.c:330:20: error: use of undeclared identifier 'st'
                   st->codecpar->bit_rate, hls->max_seg_size);
                   ^
src/libavformat/hlsenc.c:573:27: warning: absolute value function 'abs'
given an argument of type 'long' but has parameter of type 'int' which may
cause truncation of value [-Wabsolute-value]
                tz_min = (abs(wrongsecs - tt) + 30) / 60;
                          ^
src/libavformat/hlsenc.c:573:27: note: use function 'labs' instead
                tz_min = (abs(wrongsecs - tt) + 30) / 60;
                          ^~~
                          labs
1 warning and 3 errors generated.
make: *** [libavformat/hlsenc.o] Error 1
localhost:xxx StevenLiu$ make
CC libavformat/hlsenc.o
src/libavformat/hlsenc.c:564:27: warning: absolute value function 'abs'
given an argument of type 'long' but has parameter of type 'int' which may
cause truncation of value [-Wabsolute-value]
                tz_min = (abs(wrongsecs - tt) + 30) / 60;
                          ^
src/libavformat/hlsenc.c:564:27: note: use function 'labs' instead
                tz_min = (abs(wrongsecs - tt) + 30) / 60;
                          ^~~
                          labs
src/libavformat/hlsenc.c:890:18: error: use of undeclared identifier 'st'
            if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) &&
                 ^
src/libavformat/hlsenc.c:891:17: error: use of undeclared identifier 'st'
                st->codecpar->bit_rate > hls->max_seg_size) {
                ^
src/libavformat/hlsenc.c:894:24: error: use of undeclared identifier 'st'
                       st->codecpar->bit_rate, hls->max_seg_size);
                       ^
1 warning and 3 errors generated.
make: *** [libavformat/hlsenc.o] Error 1
localhost:xxx StevenLiu$
localhost:xxx StevenLiu$
localhost:xxx StevenLiu$ make
CC libavformat/hlsenc.o
src/libavformat/hlsenc.c:564:27: warning: absolute value function 'abs'
given an argument of type 'long' but has parameter of type 'int' which may
cause truncation of value [-Wabsolute-value]
                tz_min = (abs(wrongsecs - tt) + 30) / 60;
                          ^
src/libavformat/hlsenc.c:564:27: note: use function 'labs' instead
                tz_min = (abs(wrongsecs - tt) + 30) / 60;
                          ^~~
                          labs
1 warning generated.
AR libavformat/libavformat.a
LD ffmpeg_g
CP ffmpeg
STRIP ffmpeg
LD ffplay_g
CP ffplay
STRIP ffplay
LD ffprobe_g
CP ffprobe
STRIP ffprobe
LD ffserver_g
CP ffserver
STRIP ffserver
localhost:xxx StevenLiu$


More information about the ffmpeg-devel mailing list