History

avcodec/bsf: add a flushing mechanism to AVBSFContext

Meant to reset the internal bsf state without the need to reinitialize it.

James Almer committed 8 years ago

Commit b33f5291 parent fe06ed24 files · +21 −2Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavcodec/avcodec.h +6 −0
  3. libavcodec/bsf.c +10 −0
  4. libavcodec/version.h +2 −2
doc/APIchanges+3−0
@@ -15,6 +15,9 @@ libavutil: 2017-10-21 · 14 unmodified lines
15 15
16API changes, most recent first:16API changes, most recent first:
17 17
182018-08-16 - xxxxxxxxxx - lavc 58.23.100 - avcodec.h
19 Add av_bsf_flush().
20
182018-05-xx - xxxxxxxxxx - lavf 58.15.100 - avformat.h212018-05-xx - xxxxxxxxxx - lavf 58.15.100 - avformat.h
19 Add pmt_version field to AVProgram22 Add pmt_version field to AVProgram
20 23
libavcodec/avcodec.h+6−0
@@ -5769,6 +5769,7 @@ typedef struct AVBitStreamFilter { · 5768 unmodified lines
5769 int (*init)(AVBSFContext *ctx);5769 int (*init)(AVBSFContext *ctx);
5770 int (*filter)(AVBSFContext *ctx, AVPacket *pkt);5770 int (*filter)(AVBSFContext *ctx, AVPacket *pkt);
5771 void (*close)(AVBSFContext *ctx);5771 void (*close)(AVBSFContext *ctx);
5772 void (*flush)(AVBSFContext *ctx);
5772} AVBitStreamFilter;5773} AVBitStreamFilter;
5773 5774
5774#if FF_API_OLD_BSF5775#if FF_API_OLD_BSF
@@ -5895,6 +5896,11 @@ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt); · 120 unmodified lines
5895 */5896 */
5896int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt);5897int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt);
5897 5898
5899/**
5900 * Reset the internal bitstream filter state / flush internal buffers.
5901 */
5902void av_bsf_flush(AVBSFContext *ctx);
5903
5898/**5904/**
5899 * Free a bitstream filter context and everything associated with it; write NULL5905 * Free a bitstream filter context and everything associated with it; write NULL
5900 * into the supplied pointer.5906 * into the supplied pointer.
libavcodec/bsf.c+10−0
@@ -172,6 +172,16 @@ int av_bsf_init(AVBSFContext *ctx) · 171 unmodified lines
172 return 0;172 return 0;
173}173}
174 174
175void av_bsf_flush(AVBSFContext *ctx)
176{
177 ctx->internal->eof = 0;
178
179 av_packet_unref(ctx->internal->buffer_pkt);
180
181 if (ctx->filter->flush)
182 ctx->filter->flush(ctx);
183}
184
175int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)185int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
176{186{
177 int ret;187 int ret;
libavcodec/version.h+2−2
@@ -28,8 +28,8 @@ · 27 unmodified lines
28#include "libavutil/version.h"28#include "libavutil/version.h"
29 29
30#define LIBAVCODEC_VERSION_MAJOR 5830#define LIBAVCODEC_VERSION_MAJOR 58
31#define LIBAVCODEC_VERSION_MINOR 2231#define LIBAVCODEC_VERSION_MINOR 23
32#define LIBAVCODEC_VERSION_MICRO 10132#define LIBAVCODEC_VERSION_MICRO 100
33 33
34#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \34#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
35 LIBAVCODEC_VERSION_MINOR, \35 LIBAVCODEC_VERSION_MINOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t