... | ... |
@@ -86,7 +86,6 @@ static int get_bitrate_mode(int bitrate, void *log_ctx) |
86 | 86 |
|
87 | 87 |
typedef struct AMRContext { |
88 | 88 |
AVClass *av_class; |
89 |
- AVFrame frame; |
|
90 | 89 |
void *dec_state; |
91 | 90 |
void *enc_state; |
92 | 91 |
int enc_bitrate; |
... | ... |
@@ -119,9 +118,6 @@ static av_cold int amr_nb_decode_init(AVCodecContext *avctx) |
119 | 119 |
return -1; |
120 | 120 |
} |
121 | 121 |
|
122 |
- avcodec_get_frame_defaults(&s->frame); |
|
123 |
- avctx->coded_frame = &s->frame; |
|
124 |
- |
|
125 | 122 |
return 0; |
126 | 123 |
} |
127 | 124 |
|
... | ... |
@@ -137,6 +133,7 @@ static av_cold int amr_nb_decode_close(AVCodecContext *avctx) |
137 | 137 |
static int amr_nb_decode_frame(AVCodecContext *avctx, void *data, |
138 | 138 |
int *got_frame_ptr, AVPacket *avpkt) |
139 | 139 |
{ |
140 |
+ AVFrame *frame = data; |
|
140 | 141 |
const uint8_t *buf = avpkt->data; |
141 | 142 |
int buf_size = avpkt->size; |
142 | 143 |
AMRContext *s = avctx->priv_data; |
... | ... |
@@ -148,8 +145,8 @@ static int amr_nb_decode_frame(AVCodecContext *avctx, void *data, |
148 | 148 |
buf, buf_size, avctx->frame_number); |
149 | 149 |
|
150 | 150 |
/* get output buffer */ |
151 |
- s->frame.nb_samples = 160; |
|
152 |
- if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { |
|
151 |
+ frame->nb_samples = 160; |
|
152 |
+ if ((ret = ff_get_buffer(avctx, frame)) < 0) { |
|
153 | 153 |
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); |
154 | 154 |
return ret; |
155 | 155 |
} |
... | ... |
@@ -166,10 +163,9 @@ static int amr_nb_decode_frame(AVCodecContext *avctx, void *data, |
166 | 166 |
av_dlog(avctx, "packet_size=%d buf= 0x%X %X %X %X\n", |
167 | 167 |
packet_size, buf[0], buf[1], buf[2], buf[3]); |
168 | 168 |
/* call decoder */ |
169 |
- Decoder_Interface_Decode(s->dec_state, buf, (short *)s->frame.data[0], 0); |
|
169 |
+ Decoder_Interface_Decode(s->dec_state, buf, (short *)frame->data[0], 0); |
|
170 | 170 |
|
171 |
- *got_frame_ptr = 1; |
|
172 |
- *(AVFrame *)data = s->frame; |
|
171 |
+ *got_frame_ptr = 1; |
|
173 | 172 |
|
174 | 173 |
return packet_size; |
175 | 174 |
} |
... | ... |
@@ -315,7 +311,6 @@ AVCodec ff_libopencore_amrnb_encoder = { |
315 | 315 |
#include <opencore-amrwb/if_rom.h> |
316 | 316 |
|
317 | 317 |
typedef struct AMRWBContext { |
318 |
- AVFrame frame; |
|
319 | 318 |
void *state; |
320 | 319 |
} AMRWBContext; |
321 | 320 |
|
... | ... |
@@ -329,15 +324,13 @@ static av_cold int amr_wb_decode_init(AVCodecContext *avctx) |
329 | 329 |
|
330 | 330 |
s->state = D_IF_init(); |
331 | 331 |
|
332 |
- avcodec_get_frame_defaults(&s->frame); |
|
333 |
- avctx->coded_frame = &s->frame; |
|
334 |
- |
|
335 | 332 |
return 0; |
336 | 333 |
} |
337 | 334 |
|
338 | 335 |
static int amr_wb_decode_frame(AVCodecContext *avctx, void *data, |
339 | 336 |
int *got_frame_ptr, AVPacket *avpkt) |
340 | 337 |
{ |
338 |
+ AVFrame *frame = data; |
|
341 | 339 |
const uint8_t *buf = avpkt->data; |
342 | 340 |
int buf_size = avpkt->size; |
343 | 341 |
AMRWBContext *s = avctx->priv_data; |
... | ... |
@@ -346,8 +339,8 @@ static int amr_wb_decode_frame(AVCodecContext *avctx, void *data, |
346 | 346 |
static const uint8_t block_size[16] = {18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1}; |
347 | 347 |
|
348 | 348 |
/* get output buffer */ |
349 |
- s->frame.nb_samples = 320; |
|
350 |
- if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { |
|
349 |
+ frame->nb_samples = 320; |
|
350 |
+ if ((ret = ff_get_buffer(avctx, frame)) < 0) { |
|
351 | 351 |
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); |
352 | 352 |
return ret; |
353 | 353 |
} |
... | ... |
@@ -361,10 +354,9 @@ static int amr_wb_decode_frame(AVCodecContext *avctx, void *data, |
361 | 361 |
return AVERROR_INVALIDDATA; |
362 | 362 |
} |
363 | 363 |
|
364 |
- D_IF_decode(s->state, buf, (short *)s->frame.data[0], _good_frame); |
|
364 |
+ D_IF_decode(s->state, buf, (short *)frame->data[0], _good_frame); |
|
365 | 365 |
|
366 |
- *got_frame_ptr = 1; |
|
367 |
- *(AVFrame *)data = s->frame; |
|
366 |
+ *got_frame_ptr = 1; |
|
368 | 367 |
|
369 | 368 |
return packet_size; |
370 | 369 |
} |