Re: [FFmpeg-devel] [PATCH v2 2/2] avformat/dashenc: Option to generate hls playlist as well

2017-11-22 Thread Jeyapal, Karthick


On 11/22/17, 9:06 PM, "Michael Niedermayer"  wrote:

>On Wed, Nov 22, 2017 at 02:50:12PM +0530, Karthick J wrote:
>>  
>> +static void get_hls_playlist_name(char *playlist_name, const char 
>> *base_url, int id) {
>> +if (base_url)
>> +sprintf(playlist_name, "%smedia_%d.m3u8", base_url, id);
>> +else
>> +sprintf(playlist_name, "media_%d.m3u8", id);
>> +}

>please always use snprint, not sprintf as it can overwrite the array
Thanks for the comments. I have uploaded a new patch(v3) with snprintf.

>[...]
>-- 
>Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
>Everything should be made as simple as possible, but not simpler.
>-- Albert Einstein

regards,
Karthick

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 2/2] avformat/dashenc: Option to generate hls playlist as well

2017-11-22 Thread Michael Niedermayer
On Wed, Nov 22, 2017 at 02:50:12PM +0530, Karthick J wrote:
> This is to take full advantage of Common Media Application Format.
> Now server can generate one content and serve both HLS and DASH players.
> ---
>  doc/muxers.texi   |   3 ++
>  libavformat/dashenc.c | 102 
> --
>  2 files changed, 101 insertions(+), 4 deletions(-)
> 
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index 0bb8ad2..1cf2481 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -249,6 +249,9 @@ DASH-templated name to used for the media segments. 
> Default is "chunk-stream$Rep
>  URL of the page that will return the UTC timestamp in ISO format. Example: 
> "https://time.akamai.com/?iso";
>  @item -http_user_agent @var{user_agent}
>  Override User-Agent field in HTTP header. Applicable only for HTTP output.
> +@item -hls_playlist @var{hls_playlist}
> +Generate HLS playlist files as well. The master playlist is generated with 
> the filename master.m3u8.
> +One media playlist file is generated for each stream with filenames 
> media_0.m3u8, media_1.m3u8, etc.
>  @item -adaptation_sets @var{adaptation_sets}
>  Assign streams to AdaptationSets. Syntax is "id=x,streams=a,b,c 
> id=y,streams=d,e" with x and y being the IDs
>  of the adaptation sets and a,b,c,d and e are the indices of the mapped 
> streams.
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index 201668a..4c3962a 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -36,6 +36,7 @@
>  #include "avc.h"
>  #include "avformat.h"
>  #include "avio_internal.h"
> +#include "hlsenc.h"
>  #include "internal.h"
>  #include "isom.h"
>  #include "os_support.h"
> @@ -101,6 +102,8 @@ typedef struct DASHContext {
>  const char *media_seg_name;
>  const char *utc_timing_url;
>  const char *user_agent;
> +int hls_playlist;
> +int master_playlist_created;
>  } DASHContext;
>  
>  static struct codec_string {
> @@ -217,6 +220,13 @@ static void set_http_options(AVDictionary **options, 
> DASHContext *c)
>  av_dict_set(options, "user_agent", c->user_agent, 0);
>  }
>  
> +static void get_hls_playlist_name(char *playlist_name, const char *base_url, 
> int id) {
> +if (base_url)
> +sprintf(playlist_name, "%smedia_%d.m3u8", base_url, id);
> +else
> +sprintf(playlist_name, "media_%d.m3u8", id);
> +}

please always use snprint, not sprintf as it can overwrite the array

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel