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
1515
1616 API changes, most recent first:
1717
18+2018-08-16 - xxxxxxxxxx - lavc 58.23.100 - avcodec.h
19+ Add av_bsf_flush().
20+
1821 2018-05-xx - xxxxxxxxxx - lavf 58.15.100 - avformat.h
1922 Add pmt_version field to AVProgram
2023
libavcodec/avcodec.h+6−0
@@ -5769,6 +5769,7 @@ typedef struct AVBitStreamFilter { · 5768 unmodified lines
57695769 int (*init)(AVBSFContext *ctx);
57705770 int (*filter)(AVBSFContext *ctx, AVPacket *pkt);
57715771 void (*close)(AVBSFContext *ctx);
5772+ void (*flush)(AVBSFContext *ctx);
57725773 } AVBitStreamFilter;
57735774
57745775 #if FF_API_OLD_BSF
@@ -5895,6 +5896,11 @@ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt); · 120 unmodified lines
58955896 */
58965897 int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt);
58975898
5899+/**
5900+ * Reset the internal bitstream filter state / flush internal buffers.
5901+ */
5902+void av_bsf_flush(AVBSFContext *ctx);
5903+
58985904 /**
58995905 * Free a bitstream filter context and everything associated with it; write NULL
59005906 * into the supplied pointer.
libavcodec/bsf.c+10−0
@@ -172,6 +172,16 @@ int av_bsf_init(AVBSFContext *ctx) · 171 unmodified lines
172172 return 0;
173173 }
174174
175+void 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+
175185 int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
176186 {
177187 int ret;
libavcodec/version.h+2−2
@@ -28,8 +28,8 @@ · 27 unmodified lines
2828 #include "libavutil/version.h"
2929
3030 #define LIBAVCODEC_VERSION_MAJOR 58
31−#define LIBAVCODEC_VERSION_MINOR 22
32−#define LIBAVCODEC_VERSION_MICRO 101
31+#define LIBAVCODEC_VERSION_MINOR 23
32+#define LIBAVCODEC_VERSION_MICRO 100
3333
3434 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
3535 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