History

avcodec/hcadec: implement proper .flush callback

Paul B Mahol committed 3 years ago

Commit 1703bfa1 parent 8b6ee741 file · +11 −3Browse files

Unified · Split

libavcodec/hcadec.c+11−3
@@ -65,7 +65,7 @@ typedef struct HCAContext { · 64 unmodified lines
65 uint8_t stereo_band_count;65 uint8_t stereo_band_count;
66 uint8_t bands_per_hfr_group;66 uint8_t bands_per_hfr_group;
67 67
68 // Set during init() and freed on close(). Untouched on flush()68 // Set during init() and freed on close(). Untouched on init_flush()
69 av_tx_fn tx_fn;69 av_tx_fn tx_fn;
70 AVTXContext *tx_ctx;70 AVTXContext *tx_ctx;
71 AVFloatDSPContext *fdsp;71 AVFloatDSPContext *fdsp;
@@ -197,7 +197,7 @@ static inline unsigned ceil2(unsigned a, unsigned b) · 125 unmodified lines
197 return (b > 0) ? (a / b + ((a % b) ? 1 : 0)) : 0;197 return (b > 0) ? (a / b + ((a % b) ? 1 : 0)) : 0;
198}198}
199 199
200static av_cold void decode_flush(AVCodecContext *avctx)200static av_cold void init_flush(AVCodecContext *avctx)
201{201{
202 HCAContext *c = avctx->priv_data;202 HCAContext *c = avctx->priv_data;
203 203
@@ -213,7 +213,7 @@ static int init_hca(AVCodecContext *avctx, const uint8_t *extradata, · 9 unmodified lines
213 unsigned b, chunk;213 unsigned b, chunk;
214 int version, ret;214 int version, ret;
215 215
216 decode_flush(avctx);216 init_flush(avctx);
217 217
218 if (extradata_size < 36)218 if (extradata_size < 36)
219 return AVERROR_INVALIDDATA;219 return AVERROR_INVALIDDATA;
@@ -609,6 +609,14 @@ static av_cold int decode_close(AVCodecContext *avctx) · 389 unmodified lines
609 return 0;609 return 0;
610}610}
611 611
612static av_cold void decode_flush(AVCodecContext *avctx)
613{
614 HCAContext *c = avctx->priv_data;
615
616 for (int ch = 0; ch < MAX_CHANNELS; ch++)
617 memset(c->ch[ch].imdct_prev, 0, sizeof(c->ch[ch].imdct_prev));
618}
619
612const FFCodec ff_hca_decoder = {620const FFCodec ff_hca_decoder = {
613 .p.name = "hca",621 .p.name = "hca",
614 CODEC_LONG_NAME("CRI HCA"),622 CODEC_LONG_NAME("CRI HCA"),

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