[FFmpeg-devel] [PATCH 2/2] SCTE-35 support in hlsenc

James Almer jamrial at gmail.com
Fri Jul 22 04:56:44 EEST 2016


On 7/21/2016 7:31 PM, Carlos Fernandez Sanz wrote:
> From: carlos <carlos at ccextractor.org>
> 
> Signed-off-by: carlos <carlos at ccextractor.org>
> ---
>  libavformat/Makefile  |   1 +
>  libavformat/hlsenc.c  | 179 +++++++++++-------
>  libavformat/scte_35.c | 489 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  libavformat/scte_35.h |  76 ++++++++
>  4 files changed, 680 insertions(+), 65 deletions(-)
>  create mode 100644 libavformat/scte_35.c
>  create mode 100644 libavformat/scte_35.h
> 
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index c3f38b4..59f5046 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -21,6 +21,7 @@ OBJS = allformats.o         \
>         qtpalette.o          \
>         protocols.o          \
>         riff.o               \
> +       scte_35.o            \

Add this to the hls muxer dependencies instead. No reason to build it
unconditionally on every libavformat build.

[...]

> +static int parse_insert_cmd(struct scte_35_interface *iface,
> +    const uint8_t *buf,const int len, int64_t pts_adjust, int64_t current_pts)
> +{
> +    GetBitContext gb;
> +    int ret;
> +    const uint8_t *sbuf = buf;
> +    int program_splice_flag;
> +    int duration_flag;
> +    int splice_immediate_flag;
> +    int component_tag;
> +    int auto_return;
> +    uint16_t u_program_id;
> +    uint8_t avail_num;
> +    uint8_t avail_expect;
> +    int inout;
> +    int event_id;
> +    struct scte_35_event *event;
> +    time_t rawtime;
> +    struct tm * timeinfo;
> +    char buffer[128];
> +
> +    time ( &rawtime );
> +    timeinfo = localtime ( &rawtime );
> +    strftime(buffer, 25, "%Y:%m:%d%H:%M:%S", timeinfo);

You need to include the time.h system header for these.

Alternatively, use localtime_r and include libavutil/time_internal.h
instead.



More information about the ffmpeg-devel mailing list