[FFmpeg-devel] SCTE-35 development

Anshul anshul.ffmpeg at gmail.com
Tue Dec 30 21:05:59 CET 2014


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

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-handle-scte-35-message-cue-data-stream.patch
Type: text/x-patch
Size: 37611 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141231/8c4a0a3a/attachment.bin>


More information about the ffmpeg-devel mailing list