[FFmpeg-devel] SCTE-35 development
Michael Niedermayer
michaelni at gmx.at
Wed Dec 31 14:43:21 CET 2014
On Wed, Dec 31, 2014 at 01:58:20PM +0530, Anshul wrote:
> On 12/31/2014 02:14 AM, Michael Niedermayer wrote:
> > On Wed, Dec 31, 2014 at 01:35:59AM +0530, Anshul wrote:
> >> On 12/30/2014 10:06 PM, Michael Niedermayer wrote:
> >>> On Tue, Dec 30, 2014 at 07:39:38PM +0530, Anshul wrote:
> >>>> On 12/30/2014 03:56 PM, Clément Bœsch wrote:
> >>>>> They are also probably useless since you can use av_asprintf() directly.
> >>>>>
> >>>> Thanks I didn't knew about that function.
> >>>>
> >>>>
> >>>> Attached new patch with removing those function.
> >>> [...]
> >>>> --- a/libavcodec/allcodecs.c
> >>>> +++ b/libavcodec/allcodecs.c
> >>>> @@ -536,6 +536,8 @@ void avcodec_register_all(void)
> >>>> REGISTER_ENCODER(LIBAACPLUS, libaacplus);
> >>>>
> >>>> /* text */
> >>>> + REGISTER_DECODER(SCTE_35, scte_35)
> >>>> + REGISTER_ENCODER(CUE_XML, cue_xml);
> >>> you are missing a ; here
> >>>
> >> done
> >>>> REGISTER_DECODER(BINTEXT, bintext);
> >>>> REGISTER_DECODER(XBIN, xbin);
> >>>> REGISTER_DECODER(IDF, idf);
> >>>> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> >>>> index 99467bb..bd966d5 100644
> >>>> --- a/libavcodec/avcodec.h
> >>>> +++ b/libavcodec/avcodec.h
> >>>> @@ -523,6 +523,8 @@ enum AVCodecID {
> >>>> /* other specific kind of codecs (generally used for attachments) */
> >>>> AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
> >>>> AV_CODEC_ID_TTF = 0x18000,
> >>>> + AV_CODEC_ID_SCTE_35 = MKBETAG('C','U','E','I'),
> >>>> + AV_CODEC_ID_CUE_XML = MKBETAG('C','U','E','X'),
> >>>> AV_CODEC_ID_BINTEXT = MKBETAG('B','T','X','T'),
> >>>> AV_CODEC_ID_XBIN = MKBETAG('X','B','I','N'),
> >>>> AV_CODEC_ID_IDF = MKBETAG( 0 ,'I','D','F'),
> >>>> @@ -3157,6 +3159,13 @@ typedef struct AVCodecDefault AVCodecDefault;
> >>>>
> >>>> struct AVSubtitle;
> >>>>
> >>>> +typedef struct AVData {
> >>>> + void *data;
> >>>> + int len;
> >>>> + int ref_count;
> >>>> + int valid;
> >>>> +} AVData;
> >>> missing documentation
> >> removed all of it. used AVBuffer instead
> >>>> +
> >>>> /**
> >>>> * AVCodec.
> >>>> */
> >>>> @@ -3233,6 +3242,8 @@ typedef struct AVCodec {
> >>>> int (*init)(AVCodecContext *);
> >>>> int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size,
> >>>> const struct AVSubtitle *sub);
> >>>> + int (*encode_data)(AVCodecContext *avctx, const AVData *input, AVData *output,
> >>>> + enum AVCodecID in_codec_id);
> >>>> /**
> >>>> * Encode data to an AVPacket.
> >>>> *
> >>>> @@ -3246,6 +3257,7 @@ typedef struct AVCodec {
> >>>> int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame,
> >>>> int *got_packet_ptr);
> >>>> int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt);
> >>>> + int (*decode_data)(AVCodecContext *,AVData *output, const AVPacket *avpkt);
> >>>> int (*close)(AVCodecContext *);
> >>>> /**
> >>>> * Flush buffers.
> >>> this breaks ABI
> >>>
> >> add at end of structure, if that solve problem
> >>>> @@ -4195,6 +4207,9 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
> >>>> int *got_sub_ptr,
> >>>> AVPacket *avpkt);
> >>>>
> >>>> +int avcodec_decode_data(AVCodecContext *avctx,
> >>>> + AVData *output,
> >>>> + const AVPacket *avpkt);
> >>>> /**
> >>>> * @defgroup lavc_parsing Frame parsing
> >>>> * @{
> >>>> @@ -4585,6 +4600,8 @@ int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
> >>>>
> >>>> int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
> >>>> const AVSubtitle *sub);
> >>>> +int avcodec_encode_data(AVCodecContext *avctx,const AVData *input, AVData *output,
> >>>> + enum AVCodecID in_codec_id);
> >>>>
> >>>>
> >>> this is missing documentation
> >>>
> >> added documentation
> >>> [...]
> >>>> diff --git a/libavcodec/scte_35.c b/libavcodec/scte_35.c
> >>>> new file mode 100644
> >>>> index 0000000..2723225
> >>>> --- /dev/null
> >>>> +++ b/libavcodec/scte_35.c
> >>>> @@ -0,0 +1,294 @@
> >>>> +/*
> >>>> + * SCTE 35 decoder
> >>>> + * Copyright (c) 2014 Anshul Maheshwaari
> >>>> + *
> >>>> + * This file is part of FFmpeg.
> >>>> + *
> >>>> + * FFmpeg is free software; you can redistribute it and/or
> >>>> + * modify it under the terms of the GNU Lesser General Public
> >>>> + * License as published by the Free Software Foundation; either
> >>>> + * version 2.1 of the License, or (at your option) any later version.
> >>>> + *
> >>>> + * FFmpeg is distributed in the hope that it will be useful,
> >>>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> >>>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> >>>> + * Lesser General Public License for more details.
> >>>> + *
> >>>> + * You should have received a copy of the GNU Lesser General Public
> >>>> + * License along with FFmpeg; if not, write to the Free Software
> >>>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> >>>> + */
> >>> please add a reference to the spezification & exact revission used
> >>> to implement this
> >>>
> >>> [...]
> >> I have attached the document on trac, following is link to it.
> >> here is helper document on how to implement
> >> http://trac.ffmpeg.org/attachment/ticket/3356/SCTE%2067%202014.pdf
> >> here is a document What to implement
> >> http://trac.ffmpeg.org/attachment/ticket/3356/ANSI_SCTE%2035%202013.pdf
> > please add a reference in the source code to the spezification that
> > you used. Note you should not upload anything, you should not use
> > any URLs. Just a proper reference like
> > "This is based on this and that" or "This is an implementation of ..."
> > Such reference should contain the full title of the specification and
> > and any revissions and dates associated
> >
> I have used this line "Refrence Material Used"
> done
> I was unable to find out dates associated in that spec.
> I downloaded it from http://www.scte.org/standards/ page
>
> >> To make it really usable I have to write some/one filters, which takes 2
> >> program stream
> >> and give one output program stream.
> >> Which will use data decoder output to analyse which stream it has to
> >> accept and
> >> which stream to be droped.
> >>
> >> The Xml format that I have choosen, is made by me and Improvement or
> >> addition to
> >> it (comments) would be appriciated.
> >>
> >> Attached new patch with review comments on irc from Tim_G about AVBuffer
> >> and doc related things.
> >>
> >> -Anshul
> >
> >> ffmpeg.c | 50 +++++++-
> >> ffmpeg_opt.c | 9 -
> >> libavcodec/Makefile | 2
> >> libavcodec/allcodecs.c | 2
> >> libavcodec/avcodec.h | 39 ++++++
> >> libavcodec/codec_desc.c | 12 +
> >> libavcodec/cue_xml.c | 250 ++++++++++++++++++++++++++++++++++++++++
> >> libavcodec/scte_35.c | 298 ++++++++++++++++++++++++++++++++++++++++++++++++
> >> libavcodec/scte_35.h | 31 ++++
> >> libavcodec/utils.c | 33 ++++-
> >> libavformat/avformat.h | 16 ++
> >> libavformat/mpegts.c | 45 ++++++-
> >> libavformat/utils.c | 1
> >> 13 files changed, 774 insertions(+), 14 deletions(-)
> >> 2410fa240726c375505826b320af4cd2a807c945 0001-handle-scte-35-message-cue-data-stream.patch
> >> From 4e95ec0923af73a07ae9bacb1f371f43be93ca61 Mon Sep 17 00:00:00 2001
> >> From: Anshul Maheshwari <anshul.ffmpeg at gmail.com>
> >> Date: Wed, 31 Dec 2014 01:23:20 +0530
> >> Subject: [PATCH] handle scte 35 message cue data stream
> >>
> > missing signoff in the commit message
> done, Thanks for link,previously I had an interpretation that signoff
> was done by reviewer.
> >
> > [...]
> >> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> >> index 99467bb..daa7448 100644
> >> --- a/libavcodec/avcodec.h
> >> +++ b/libavcodec/avcodec.h
> >> @@ -523,6 +523,8 @@ enum AVCodecID {
> >> /* other specific kind of codecs (generally used for attachments) */
> >> AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
> >> AV_CODEC_ID_TTF = 0x18000,
> >> + AV_CODEC_ID_SCTE_35 = MKBETAG('C','U','E','I'),
> >> + AV_CODEC_ID_CUE_XML = MKBETAG('C','U','E','X'),
> >> AV_CODEC_ID_BINTEXT = MKBETAG('B','T','X','T'),
> >> AV_CODEC_ID_XBIN = MKBETAG('X','B','I','N'),
> >> AV_CODEC_ID_IDF = MKBETAG( 0 ,'I','D','F'),
> >> @@ -3233,6 +3235,8 @@ typedef struct AVCodec {
> >> int (*init)(AVCodecContext *);
> >> int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size,
> >> const struct AVSubtitle *sub);
> >> + int (*encode_data)(AVCodecContext *avctx, const AVBuffer *input, AVBuffer *output,
> >> + enum AVCodecID in_codec_id);
> >> /**
> >> * Encode data to an AVPacket.
> >> *
> > breaks ABI
> > if someone reading this knows of a good introduction about ABI/API
> > compatibility and such stuff please reply, i think debian had a
> > guide but also something which described the "why" behind all the ABI
> > stuff could be usefull
> > id quote a link but i dunno a good introduction to that stuff
> I was searching for version number to increase, but thought let other
> discussion get to end.
> I have moved this API too down of structure.
> >
> >> @@ -3252,6 +3256,7 @@ typedef struct AVCodec {
> >> * Will be called when seeking
> >> */
> >> void (*flush)(AVCodecContext *);
> >> + int (*decode_data)(AVCodecContext *,AVBuffer *output, const AVPacket *avpkt);
> >> } AVCodec;
> >>
> >> int av_codec_get_max_lowres(const AVCodec *codec);
> >> @@ -4196,6 +4201,20 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
> >> AVPacket *avpkt);
> >>
> >> /**
> >> + * Decode a subtitle message.
> > please use avcodec_decode_subtitle2() if thats the case
> > if not please try to read your patch before submission
> >
> > [...]
> sry fr that.
> >
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> nfxjfg at googlemail.com wrote:
>
> It's still not clear what the function actually does. What's the output
> format? Why is avcodec_decode_subtitle2() not used for this? (I'm being
> naive and dumb here; while I don't know what this patch is actually
> about, users trying to understand the lavc APIs in general will have
> the same questions.)
>
> Also, it mixes the words "decode" and "decompress".
>
> I have tried to elaborate the document. please comment, if still not
> sufficient.
> This is far different from subtitle, here only interface is generic but
> data inside
> is dependent on decoder and encoder used.
>
> Another patch attached.
>
> -Anshul
>
>
>
[...]
> diff --git a/libavcodec/scte_35.h b/libavcodec/scte_35.h
> new file mode 100644
> index 0000000..63bbac5
> --- /dev/null
> +++ b/libavcodec/scte_35.h
> @@ -0,0 +1,31 @@
> +/*
> + * SCTE 35 decoder
> + * Copyright (c) 2014 Anshul Maheshwaari
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +#ifndef SCTE_35_H
> +#define SCTE_35_H
> +struct scte_35_interface {
> + int32_t event_id;
> + uint64_t pts;
> + int64_t duration;
> + /* flag */
> + int inout;
> + int cancel;
> +};
So SCTE-35 is basically about segmenting a video timewise
(primarely to mark Ads but not always)
We already have a API to segment videos timewise, its
AVFormatContext.chapters
that may need some changes to handle incrementally added (and
on the muxer side incrementally stored) data
or we might even choose a different system entirely than that AVChapter
array for such incrementally stored segments
but i dont think data decoders with a completely opaque input and
output are a reasonable API for communicating such temporal segmenting
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141231/e4950fdc/attachment.asc>
More information about the ffmpeg-devel
mailing list