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

From: Carlos Fernandez <car...@ccextractor.org>

Signed-off-by: Carlos Fernandez <car...@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
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to