Re: [libav-devel] [PATCH 5/6] lavc: add a bitstream filter for extracting extradata from packets

2016-09-27 Thread Anton Khirnov
Quoting Diego Biurrun (2016-09-22 18:06:32)
> I think this needs a version bump.
> 
> On Thu, Sep 22, 2016 at 04:29:10PM +0200, Anton Khirnov wrote:
> > --- a/doc/bitstream_filters.texi
> > +++ b/doc/bitstream_filters.texi
> > @@ -21,6 +21,24 @@ Below is a description of the currently available 
> > bitstream filters.
> > +@table @option
> > +@item remove
> > +When this option is enabled, the long-term headers are additionally 
> > removed from
> > +the bitstream.
> 
> This sounds somehow awkward to me.  I suggest
> 
>   When this option is enabled, the long-term headers are removed from
>   the bitstream after extraction.
> 
> > --- /dev/null
> > +++ b/libavcodec/extract_extradata_bsf.c
> > @@ -0,0 +1,300 @@
> > +
> > +typedef struct ExtractExtradataContext {
> > +const AVClass *class;
> > +
> > +int (*extract)(AVBSFContext *ctx, AVPacket *pkt,
> > +   uint8_t **data, int *size);
> 
> IMO we could use more size_t for sizes.

Generally yes, but in this case this variable is exported as side data
size, which is int.

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 5/6] lavc: add a bitstream filter for extracting extradata from packets

2016-09-27 Thread Anton Khirnov
Quoting Diego Biurrun (2016-09-22 18:06:32)
> I think this needs a version bump.
> 
> On Thu, Sep 22, 2016 at 04:29:10PM +0200, Anton Khirnov wrote:
> > --- a/doc/bitstream_filters.texi
> > +++ b/doc/bitstream_filters.texi
> > @@ -21,6 +21,24 @@ Below is a description of the currently available 
> > bitstream filters.
> > +@table @option
> > +@item remove
> > +When this option is enabled, the long-term headers are additionally 
> > removed from
> > +the bitstream.
> 
> This sounds somehow awkward to me.  I suggest
> 
>   When this option is enabled, the long-term headers are removed from
>   the bitstream after extraction.
> 
> > --- /dev/null
> > +++ b/libavcodec/extract_extradata_bsf.c
> > @@ -0,0 +1,300 @@
> > +
> > +typedef struct ExtractExtradataContext {
> > +const AVClass *class;
> > +
> > +int (*extract)(AVBSFContext *ctx, AVPacket *pkt,
> > +   uint8_t **data, int *size);
> 
> IMO we could use more size_t for sizes.
> 
> > +static int extract_extradata_mpeg124(AVBSFContext *ctx, AVPacket *pkt,
> > + uint8_t **data, int *size)
> > +{
> > +for (i = 0; i < pkt->size; i++) {
> > +state = (state << 8) | pkt->data[i];
> > +if ((is_mpeg12 && state != 0x1B3 && state != 0x1B5 && state < 
> > 0x200 && state >= 0x100) ||
> > +(!is_mpeg12 && (state == 0x1B3 || state == 0x1B6))) {
> 
> magic

It's just copied verbatim from the current code.

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 5/6] lavc: add a bitstream filter for extracting extradata from packets

2016-09-22 Thread Diego Biurrun
I think this needs a version bump.

On Thu, Sep 22, 2016 at 04:29:10PM +0200, Anton Khirnov wrote:
> --- a/doc/bitstream_filters.texi
> +++ b/doc/bitstream_filters.texi
> @@ -21,6 +21,24 @@ Below is a description of the currently available 
> bitstream filters.
> +@table @option
> +@item remove
> +When this option is enabled, the long-term headers are additionally removed 
> from
> +the bitstream.

This sounds somehow awkward to me.  I suggest

  When this option is enabled, the long-term headers are removed from
  the bitstream after extraction.

> --- /dev/null
> +++ b/libavcodec/extract_extradata_bsf.c
> @@ -0,0 +1,300 @@
> +
> +typedef struct ExtractExtradataContext {
> +const AVClass *class;
> +
> +int (*extract)(AVBSFContext *ctx, AVPacket *pkt,
> +   uint8_t **data, int *size);

IMO we could use more size_t for sizes.

> +static int extract_extradata_mpeg124(AVBSFContext *ctx, AVPacket *pkt,
> + uint8_t **data, int *size)
> +{
> +for (i = 0; i < pkt->size; i++) {
> +state = (state << 8) | pkt->data[i];
> +if ((is_mpeg12 && state != 0x1B3 && state != 0x1B5 && state < 0x200 
> && state >= 0x100) ||
> +(!is_mpeg12 && (state == 0x1B3 || state == 0x1B6))) {

magic

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel