Meant to reset the internal bsf state without the need to reinitialize it. Signed-off-by: James Almer <jamrial@gmail.com>tags/n4.1
| @@ -13,6 +13,9 @@ libavutil: 2017-03-23 | |||||
| API changes, most recent first: | API changes, most recent first: | ||||
| 2018-xx-xx - xxxxxxx - lavc 58.10.0 - avcodec.h | |||||
| Add av_bsf_flush(). | |||||
| 2018-02-xx - xxxxxxx - lavfi 7.1.0 - avfilter.h | 2018-02-xx - xxxxxxx - lavfi 7.1.0 - avfilter.h | ||||
| Add AVFilterContext.extra_hw_frames. | Add AVFilterContext.extra_hw_frames. | ||||
| @@ -4927,6 +4927,7 @@ typedef struct AVBitStreamFilter { | |||||
| int (*init)(AVBSFContext *ctx); | int (*init)(AVBSFContext *ctx); | ||||
| int (*filter)(AVBSFContext *ctx, AVPacket *pkt); | int (*filter)(AVBSFContext *ctx, AVPacket *pkt); | ||||
| void (*close)(AVBSFContext *ctx); | void (*close)(AVBSFContext *ctx); | ||||
| void (*flush)(AVBSFContext *ctx); | |||||
| } AVBitStreamFilter; | } AVBitStreamFilter; | ||||
| #if FF_API_OLD_BSF | #if FF_API_OLD_BSF | ||||
| @@ -5029,6 +5030,11 @@ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt); | |||||
| */ | */ | ||||
| int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt); | int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt); | ||||
| /** | |||||
| * Reset the internal bitstream filter state / flush internal buffers. | |||||
| */ | |||||
| void av_bsf_flush(AVBSFContext *ctx); | |||||
| /** | /** | ||||
| * Free a bitstream filter context and everything associated with it; write NULL | * Free a bitstream filter context and everything associated with it; write NULL | ||||
| * into the supplied pointer. | * into the supplied pointer. | ||||
| @@ -170,6 +170,16 @@ int av_bsf_init(AVBSFContext *ctx) | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| void av_bsf_flush(AVBSFContext *ctx) | |||||
| { | |||||
| ctx->internal->eof = 0; | |||||
| av_packet_unref(ctx->internal->buffer_pkt); | |||||
| if (ctx->filter->flush) | |||||
| ctx->filter->flush(ctx); | |||||
| } | |||||
| int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt) | int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt) | ||||
| { | { | ||||
| if (!pkt || !pkt->data) { | if (!pkt || !pkt->data) { | ||||
| @@ -28,7 +28,7 @@ | |||||
| #include "libavutil/version.h" | #include "libavutil/version.h" | ||||
| #define LIBAVCODEC_VERSION_MAJOR 58 | #define LIBAVCODEC_VERSION_MAJOR 58 | ||||
| #define LIBAVCODEC_VERSION_MINOR 9 | |||||
| #define LIBAVCODEC_VERSION_MINOR 10 | |||||
| #define LIBAVCODEC_VERSION_MICRO 0 | #define LIBAVCODEC_VERSION_MICRO 0 | ||||
| #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | ||||