History

avcodec/ac3dec: add a flush callback for the ac3 and eac3 decoders

Fixes ticket #10732

James Almer committed 1 year ago

Commit 045a8b11 parent a9e85864 files · +14 −0Browse files

Showing the changes to libavcodec (4 of 4 files). Show all

Unified · Split

4 files
  1. libavcodec/ac3dec.c +10 −0
  2. libavcodec/ac3dec.h +1 −0
  3. libavcodec/ac3dec_fixed.c +1 −0
  4. libavcodec/ac3dec_float.c +2 −0
libavcodec/ac3dec.c+10−0
@@ -252,6 +252,16 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx) · 251 unmodified lines
252 return 0;252 return 0;
253}253}
254 254
255static av_cold void ac3_decode_flush(AVCodecContext *avctx)
256{
257 AC3DecodeContext *s = avctx->priv_data;
258
259 memset(&s->frame_type, 0, sizeof(*s) - offsetof(AC3DecodeContext, frame_type));
260
261 AC3_RENAME(ff_kbd_window_init)(s->window, 5.0, 256);
262 av_lfg_init(&s->dith_state, 0);
263}
264
255/**265/**
256 * Parse the 'sync info' and 'bit stream info' from the AC-3 bitstream.266 * Parse the 'sync info' and 'bit stream info' from the AC-3 bitstream.
257 * GetBitContext within AC3DecodeContext must point to267 * GetBitContext within AC3DecodeContext must point to
libavcodec/ac3dec.h+1−0
@@ -96,6 +96,7 @@ typedef struct AC3DecodeContext { · 95 unmodified lines
96 SHORTFLOAT *downmix_coeffs[2]; ///< stereo downmix coefficients96 SHORTFLOAT *downmix_coeffs[2]; ///< stereo downmix coefficients
97 97
98// Start of flushable fields.98// Start of flushable fields.
99// frame_type must be the flushable field, or the offset changed in ac3_decode_flush().
99 100
100///@name Bit stream information101///@name Bit stream information
101///@{102///@{
libavcodec/ac3dec_fixed.c+1−0
@@ -181,6 +181,7 @@ const FFCodec ff_ac3_fixed_decoder = { · 180 unmodified lines
181 .p.priv_class = &ac3_decoder_class,181 .p.priv_class = &ac3_decoder_class,
182 .priv_data_size = sizeof (AC3DecodeContext),182 .priv_data_size = sizeof (AC3DecodeContext),
183 .init = ac3_decode_init,183 .init = ac3_decode_init,
184 .flush = ac3_decode_flush,
184 .close = ac3_decode_end,185 .close = ac3_decode_end,
185 FF_CODEC_DECODE_CB(ac3_decode_frame),186 FF_CODEC_DECODE_CB(ac3_decode_frame),
186 .p.capabilities = AV_CODEC_CAP_CHANNEL_CONF |187 .p.capabilities = AV_CODEC_CAP_CHANNEL_CONF |
libavcodec/ac3dec_float.c+2−0
@@ -70,6 +70,7 @@ const FFCodec ff_ac3_decoder = { · 69 unmodified lines
70 .p.id = AV_CODEC_ID_AC3,70 .p.id = AV_CODEC_ID_AC3,
71 .priv_data_size = sizeof (AC3DecodeContext),71 .priv_data_size = sizeof (AC3DecodeContext),
72 .init = ac3_decode_init,72 .init = ac3_decode_init,
73 .flush = ac3_decode_flush,
73 .close = ac3_decode_end,74 .close = ac3_decode_end,
74 FF_CODEC_DECODE_CB(ac3_decode_frame),75 FF_CODEC_DECODE_CB(ac3_decode_frame),
75 .p.capabilities = AV_CODEC_CAP_CHANNEL_CONF |76 .p.capabilities = AV_CODEC_CAP_CHANNEL_CONF |
@@ -88,6 +89,7 @@ const FFCodec ff_eac3_decoder = { · 12 unmodified lines
88 .p.id = AV_CODEC_ID_EAC3,89 .p.id = AV_CODEC_ID_EAC3,
89 .priv_data_size = sizeof (AC3DecodeContext),90 .priv_data_size = sizeof (AC3DecodeContext),
90 .init = ac3_decode_init,91 .init = ac3_decode_init,
92 .flush = ac3_decode_flush,
91 .close = ac3_decode_end,93 .close = ac3_decode_end,
92 FF_CODEC_DECODE_CB(ac3_decode_frame),94 FF_CODEC_DECODE_CB(ac3_decode_frame),
93 .p.capabilities = AV_CODEC_CAP_CHANNEL_CONF |95 .p.capabilities = AV_CODEC_CAP_CHANNEL_CONF |

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