[FFmpeg-devel] [RFC] avcodec/bsf: support operations on side data in AVBSFContext
Andreas Rheinhardt
andreas.rheinhardt at gmail.com
Wed May 27 14:03:59 EEST 2020
leozhang:
> Signed-off-by: leozhang <leozhang at qiyi.com>
> ---
> Please note that this is not a formal patch firstly. I send this to sincerely request your suggestions/objections.
>
> And why need operating side data in AVBSFContext? Because I'm planning to create a bitstream filter which inject AV_PKT_DATA_SPHERICAL info, and transfer to AVCodecContext/AVStream.
The bsf API does not work with AVStreams. The best you could do is
attach the side data to the first packet. And to do this in a bsf, you
do not need additional fields in AVBSFContext. It can be done with an
ordinary option of the bsf you intend to create.
>
> libavcodec/bsf.h | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/libavcodec/bsf.h b/libavcodec/bsf.h
> index 7ed5167..740fa78 100644
> --- a/libavcodec/bsf.h
> +++ b/libavcodec/bsf.h
> @@ -93,6 +93,12 @@ typedef struct AVBSFContext {
> * filter in av_bsf_init().
> */
> AVRational time_base_out;
> +
> + /**
> + * Additional data associated with the entire bitstream.
> + */
> + AVPacketSideData *side_data;
> + size_t nb_side_data;> } AVBSFContext;
>
> typedef struct AVBitStreamFilter {
> @@ -318,6 +324,18 @@ int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf);
> */
> int av_bsf_get_null_filter(AVBSFContext **bsf);
>
> +/*
> + * functions To Be Implement
> +int av_bsf_add_side_data(AVBSFContext *bsf, enum AVPacketSideDataType type,
> + uint8_t *data, size_t size);
> +
> +uint8_t *av_bsf_new_side_data(AVBSFContext *bsf,
> + enum AVPacketSideDataType type, size_t size);
> +
> +uint8_t *av_bsf_get_side_data(const AVBSFContext *bsf,
> + enum AVPacketSideDataType type, size_t *size);
Nowadays side data consists mostly of structures and not of plain
buffers, so these should return void *.
- Andreas
More information about the ffmpeg-devel
mailing list