[FFmpeg-devel] [PATCH 2/4] V11 - SCTE-35 extraction from mpegts

Marton Balint cus at passwd.hu
Wed Sep 28 01:13:20 EEST 2016


On Tue, 27 Sep 2016, Carlos Fernandez Sanz wrote:

> From: Carlos Fernandez <carlos at ccextractor.org>
>
> Signed-off-by: Carlos Fernandez <carlos at ccextractor.org>
> ---
> libavformat/mpegts.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 46 insertions(+), 2 deletions(-)
>

[...]

> +static void scte_data_cb(MpegTSFilter *filter, const uint8_t *section,
> +                    int section_len)
> +{
> +    AVProgram *prg = NULL;
> +    MpegTSContext *ts = filter->u.section_filter.opaque;
> +
> +    int idx = ff_find_stream_index(ts->stream, filter->pid);
> +    new_data_packet(section, section_len, ts->pkt);

One more thing you might consider: now, you are creating a data packet 
from the whole section, including the header and the rest. Since the 
section is already parsed, and the crc is already checked, and as far 
as I see there is nothing useful in the header, it might make 
sense to create a data packet only from the buffer _after_ the 
section_length field, skipping the last CRC32 field as well.

This way, the SCTE codec does not have to do any section parsing at all, 
which seems a cleaner solution to me. What do you think?

Regards,
Marton


More information about the ffmpeg-devel mailing list