[FFmpeg-devel] [PATCH 1/4] avformat/hlsplaylist: Add const where appropriate

Steven Liu lq at chinaffmpeg.org
Wed May 27 09:46:37 EEST 2020



> 2020年5月26日 上午3:42,Andreas Rheinhardt <andreas.rheinhardt at gmail.com> 写道:
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> ---
> libavformat/hlsplaylist.c | 27 ++++++++++++++++-----------
> libavformat/hlsplaylist.h | 23 +++++++++++++----------
> 2 files changed, 29 insertions(+), 21 deletions(-)
> 
> diff --git a/libavformat/hlsplaylist.c b/libavformat/hlsplaylist.c
> index 43f9d281ba..7a89846369 100644
> --- a/libavformat/hlsplaylist.c
> +++ b/libavformat/hlsplaylist.c
> @@ -35,8 +35,10 @@ void ff_hls_write_playlist_version(AVIOContext *out, int version) {
>     avio_printf(out, "#EXT-X-VERSION:%d\n", version);
> }
> 
> -void ff_hls_write_audio_rendition(AVIOContext *out, char *agroup,
> -                                  const char *filename, char *language, int name_id, int is_default) {
> +void ff_hls_write_audio_rendition(AVIOContext *out, const char *agroup,
> +                                  const char *filename, const char *language,
> +                                  int name_id, int is_default)
> +{
>     if (!out || !agroup || !filename)
>         return;
> 
> @@ -48,8 +50,10 @@ void ff_hls_write_audio_rendition(AVIOContext *out, char *agroup,
>     avio_printf(out, "URI=\"%s\"\n", filename);
> }
> 
> -void ff_hls_write_subtitle_rendition(AVIOContext *out, char *sgroup,
> -                                  const char *filename, char *language, int name_id, int is_default) {
> +void ff_hls_write_subtitle_rendition(AVIOContext *out, const char *sgroup,
> +                                     const char *filename, const char *language,
> +                                     int name_id, int is_default)
> +{
>     if (!out || !filename)
>         return;
> 
> @@ -61,10 +65,11 @@ void ff_hls_write_subtitle_rendition(AVIOContext *out, char *sgroup,
>     avio_printf(out, "URI=\"%s\"\n", filename);
> }
> 
> -void ff_hls_write_stream_info(AVStream *st, AVIOContext *out,
> -                              int bandwidth, const char *filename, char *agroup,
> -                              char *codecs, char *ccgroup, char *sgroup) {
> -
> +void ff_hls_write_stream_info(AVStream *st, AVIOContext *out, int bandwidth,
> +                              const char *filename, const char *agroup,
> +                              const char *codecs, const char *ccgroup,
> +                              const char *sgroup)
> +{
>     if (!out || !filename)
>         return;
> 
> @@ -112,7 +117,7 @@ void ff_hls_write_playlist_header(AVIOContext *out, int version, int allowcache,
>     }
> }
> 
> -void ff_hls_write_init_file(AVIOContext *out, char *filename,
> +void ff_hls_write_init_file(AVIOContext *out, const char *filename,
>                             int byterange_mode, int64_t size, int64_t pos) {
>     avio_printf(out, "#EXT-X-MAP:URI=\"%s\"", filename);
>     if (byterange_mode) {
> @@ -125,8 +130,8 @@ int ff_hls_write_file_entry(AVIOContext *out, int insert_discont,
>                              int byterange_mode,
>                              double duration, int round_duration,
>                              int64_t size, int64_t pos, //Used only if HLS_SINGLE_FILE flag is set
> -                             char *baseurl, //Ignored if NULL
> -                             char *filename, double *prog_date_time,
> +                            const char *baseurl /* Ignored if NULL */,
> +                            const char *filename, double *prog_date_time,
>                              int64_t video_keyframe_size, int64_t video_keyframe_pos, int iframe_mode) {
>     if (!out || !filename)
>         return AVERROR(EINVAL);
> diff --git a/libavformat/hlsplaylist.h b/libavformat/hlsplaylist.h
> index a124bdcffb..4348a26c75 100644
> --- a/libavformat/hlsplaylist.h
> +++ b/libavformat/hlsplaylist.h
> @@ -37,24 +37,27 @@ typedef enum {
> } PlaylistType;
> 
> void ff_hls_write_playlist_version(AVIOContext *out, int version);
> -void ff_hls_write_audio_rendition(AVIOContext *out, char *agroup,
> -                                  const char *filename, char *language, int name_id, int is_default);
> -void ff_hls_write_subtitle_rendition(AVIOContext *out, char *sgroup,
> -                                  const char *filename, char *language, int name_id, int is_default);
> -void ff_hls_write_stream_info(AVStream *st, AVIOContext *out,
> -                              int bandwidth, const char *filename, char *agroup,
> -                              char *codecs, char *ccgroup, char *sgroup);
> +void ff_hls_write_audio_rendition(AVIOContext *out, const char *agroup,
> +                                  const char *filename, const char *language,
> +                                  int name_id, int is_default);
> +void ff_hls_write_subtitle_rendition(AVIOContext *out, const char *sgroup,
> +                                     const char *filename, const char *language,
> +                                     int name_id, int is_default);
> +void ff_hls_write_stream_info(AVStream *st, AVIOContext *out, int bandwidth,
> +                              const char *filename, const char *agroup,
> +                              const char *codecs, const char *ccgroup,
> +                              const char *sgroup);
> void ff_hls_write_playlist_header(AVIOContext *out, int version, int allowcache,
>                                   int target_duration, int64_t sequence,
>                                   uint32_t playlist_type, int iframe_mode);
> -void ff_hls_write_init_file(AVIOContext *out, char *filename,
> +void ff_hls_write_init_file(AVIOContext *out, const char *filename,
>                             int byterange_mode, int64_t size, int64_t pos);
> int ff_hls_write_file_entry(AVIOContext *out, int insert_discont,
>                              int byterange_mode,
>                              double duration, int round_duration,
>                              int64_t size, int64_t pos, //Used only if HLS_SINGLE_FILE flag is set
> -                             char *baseurl, //Ignored if NULL
> -                             char *filename, double *prog_date_time,
> +                            const char *baseurl /* Ignored if NULL */,
> +                            const char *filename, double *prog_date_time,
>                              int64_t video_keyframe_size, int64_t video_keyframe_pos, int iframe_mode);
> void ff_hls_write_end_list (AVIOContext *out);
> 
> -- 
> 2.20.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".

patchset lgtm

Thanks

Steven Liu





More information about the ffmpeg-devel mailing list