* commit '2df0c32ea12ddfa72ba88309812bfb13b674130f': lavc: use a separate field for exporting audio encoder padding Conflicts: libavcodec/audio_frame_queue.c libavcodec/avcodec.h libavcodec/libvorbisenc.c libavcodec/utils.c libavcodec/version.h libavcodec/wmaenc.c
Unified · Split
| @@ -15,6 +15,10 @@ libavutil: 2014-08-09 · 14 unmodified lines | |||
| 15 | 15 | ||
| 16 | API changes, most recent first: | 16 | API changes, most recent first: |
| 17 | 17 | ||
| 18 | 2014-10-13 - xxxxxxx - lavc 55.03.0 - avcodec.h | ||
| 19 | Add AVCodecContext.initial_padding. Deprecate the use of AVCodecContext.delay | ||
| 20 | for audio encoding. | ||
| 21 | |||
| 18 | 2014-09-xx - xxxxxxx - lavu 54.04.0 - pixdesc.h | 22 | 2014-09-xx - xxxxxxx - lavu 54.04.0 - pixdesc.h |
| 19 | Add API to return the name of frame and context color properties. | 23 | Add API to return the name of frame and context color properties. |
| 20 | 24 | ||
| @@ -776,7 +776,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) · 775 unmodified lines | |||
| 776 | for (i = 0; i < 428; i++) | 776 | for (i = 0; i < 428; i++) |
| 777 | ff_aac_pow34sf_tab[i] = sqrt(ff_aac_pow2sf_tab[i] * sqrt(ff_aac_pow2sf_tab[i])); | 777 | ff_aac_pow34sf_tab[i] = sqrt(ff_aac_pow2sf_tab[i] * sqrt(ff_aac_pow2sf_tab[i])); |
| 778 | 778 | ||
| 779 | avctx->delay = 1024; | 779 | avctx->initial_padding = 1024; |
| 780 | ff_af_queue_init(avctx, &s->afq); | 780 | ff_af_queue_init(avctx, &s->afq); |
| 781 | 781 | ||
| 782 | return 0; | 782 | return 0; |
| @@ -2434,7 +2434,7 @@ av_cold int ff_ac3_encode_init(AVCodecContext *avctx) · 2433 unmodified lines | |||
| 2434 | return ret; | 2434 | return ret; |
| 2435 | 2435 | ||
| 2436 | avctx->frame_size = AC3_BLOCK_SIZE * s->num_blocks; | 2436 | avctx->frame_size = AC3_BLOCK_SIZE * s->num_blocks; |
| 2437 | avctx->delay = AC3_BLOCK_SIZE; | 2437 | avctx->initial_padding = AC3_BLOCK_SIZE; |
| 2438 | 2438 | ||
| 2439 | s->bitstream_mode = avctx->audio_service_type; | 2439 | s->bitstream_mode = avctx->audio_service_type; |
| 2440 | if (s->bitstream_mode == AV_AUDIO_SERVICE_TYPE_KARAOKE) | 2440 | if (s->bitstream_mode == AV_AUDIO_SERVICE_TYPE_KARAOKE) |
| @@ -28,8 +28,8 @@ · 27 unmodified lines | |||
| 28 | av_cold void ff_af_queue_init(AVCodecContext *avctx, AudioFrameQueue *afq) | 28 | av_cold void ff_af_queue_init(AVCodecContext *avctx, AudioFrameQueue *afq) |
| 29 | { | 29 | { |
| 30 | afq->avctx = avctx; | 30 | afq->avctx = avctx; |
| 31 | afq->remaining_delay = avctx->delay; | 31 | afq->remaining_delay = avctx->initial_padding; |
| 32 | afq->remaining_samples = avctx->delay; | 32 | afq->remaining_samples = avctx->initial_padding; |
| 33 | afq->frame_count = 0; | 33 | afq->frame_count = 0; |
| 34 | } | 34 | } |
| 35 | 35 | ||
| @@ -1373,16 +1373,7 @@ typedef struct AVCodecContext { · 1372 unmodified lines | |||
| 1373 | * encoded input. | 1373 | * encoded input. |
| 1374 | * | 1374 | * |
| 1375 | * Audio: | 1375 | * Audio: |
| 1376 | * For encoding, this is the number of "priming" samples added by the | 1376 | * For encoding, this field is unused (see initial_padding). |
| 1377 | * encoder to the beginning of the stream. The decoded output will be | ||
| 1378 | * delayed by this many samples relative to the input to the encoder (or | ||
| 1379 | * more, if the decoder adds its own padding). | ||
| 1380 | * The timestamps on the output packets are adjusted by the encoder so | ||
| 1381 | * that they always refer to the first sample of the data actually | ||
| 1382 | * contained in the packet, including any added padding. | ||
| 1383 | * E.g. if the timebase is 1/samplerate and the timestamp of the first | ||
| 1384 | * input sample is 0, the timestamp of the first output packet will be | ||
| 1385 | * -delay. | ||
| 1386 | * | 1377 | * |
| 1387 | * For decoding, this is the number of samples the decoder needs to | 1378 | * For decoding, this is the number of samples the decoder needs to |
| 1388 | * output before the decoder's output is valid. When seeking, you should | 1379 | * output before the decoder's output is valid. When seeking, you should |
| @@ -2980,6 +2971,23 @@ typedef struct AVCodecContext { · 1591 unmodified lines | |||
| 2980 | */ | 2971 | */ |
| 2981 | int side_data_only_packets; | 2972 | int side_data_only_packets; |
| 2982 | 2973 | ||
| 2974 | /** | ||
| 2975 | * Audio only. The number of "priming" samples (padding) inserted by the | ||
| 2976 | * encoder at the beginning of the audio. I.e. this number of leading | ||
| 2977 | * decoded samples must be discarded by the caller to get the original audio | ||
| 2978 | * without leading padding. | ||
| 2979 | * | ||
| 2980 | * - decoding: unused | ||
| 2981 | * - encoding: Set by libavcodec. The timestamps on the output packets are | ||
| 2982 | * adjusted by the encoder so that they always refer to the | ||
| 2983 | * first sample of the data actually contained in the packet, | ||
| 2984 | * including any added padding. E.g. if the timebase is | ||
| 2985 | * 1/samplerate and the timestamp of the first input sample is | ||
| 2986 | * 0, the timestamp of the first output packet will be | ||
| 2987 | * -initial_padding. | ||
| 2988 | */ | ||
| 2989 | int initial_padding; | ||
| 2990 | |||
| 2983 | /** | 2991 | /** |
| 2984 | * Timebase in which pkt_dts/pts and AVPacket.dts/pts are. | 2992 | * Timebase in which pkt_dts/pts and AVPacket.dts/pts are. |
| 2985 | * Code outside libavcodec should access this field using: | 2993 | * Code outside libavcodec should access this field using: |
| @@ -107,7 +107,7 @@ static av_cold int g722_encode_init(AVCodecContext * avctx) · 106 unmodified lines | |||
| 107 | a common packet size for VoIP applications */ | 107 | a common packet size for VoIP applications */ |
| 108 | avctx->frame_size = 320; | 108 | avctx->frame_size = 320; |
| 109 | } | 109 | } |
| 110 | avctx->delay = 22; | 110 | avctx->initial_padding = 22; |
| 111 | 111 | ||
| 112 | if (avctx->trellis) { | 112 | if (avctx->trellis) { |
| 113 | /* validate trellis */ | 113 | /* validate trellis */ |
| @@ -374,7 +374,7 @@ static int g722_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 260 unmodified lines | |||
| 374 | } | 374 | } |
| 375 | 375 | ||
| 376 | if (frame->pts != AV_NOPTS_VALUE) | 376 | if (frame->pts != AV_NOPTS_VALUE) |
| 377 | avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay); | 377 | avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding); |
| 378 | *got_packet_ptr = 1; | 378 | *got_packet_ptr = 1; |
| 379 | return 0; | 379 | return 0; |
| 380 | } | 380 | } |
| @@ -167,7 +167,7 @@ static av_cold int Faac_encode_init(AVCodecContext *avctx) · 166 unmodified lines | |||
| 167 | } | 167 | } |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | avctx->delay = FAAC_DELAY_SAMPLES; | 170 | avctx->initial_padding = FAAC_DELAY_SAMPLES; |
| 171 | ff_af_queue_init(avctx, &s->afq); | 171 | ff_af_queue_init(avctx, &s->afq); |
| 172 | 172 | ||
| 173 | return 0; | 173 | return 0; |
| @@ -286,7 +286,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) · 285 unmodified lines | |||
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | avctx->frame_size = info.frameLength; | 288 | avctx->frame_size = info.frameLength; |
| 289 | avctx->delay = info.encoderDelay; | 289 | avctx->initial_padding = info.encoderDelay; |
| 290 | ff_af_queue_init(avctx, &s->afq); | 290 | ff_af_queue_init(avctx, &s->afq); |
| 291 | 291 | ||
| 292 | if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) { | 292 | if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) { |
| @@ -138,7 +138,7 @@ static av_cold int mp3lame_encode_init(AVCodecContext *avctx) · 137 unmodified lines | |||
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | /* get encoder delay */ | 140 | /* get encoder delay */ |
| 141 | avctx->delay = lame_get_encoder_delay(s->gfp) + 528 + 1; | 141 | avctx->initial_padding = lame_get_encoder_delay(s->gfp) + 528 + 1; |
| 142 | ff_af_queue_init(avctx, &s->afq); | 142 | ff_af_queue_init(avctx, &s->afq); |
| 143 | 143 | ||
| 144 | avctx->frame_size = lame_get_framesize(s->gfp); | 144 | avctx->frame_size = lame_get_framesize(s->gfp); |
| @@ -199,7 +199,7 @@ static av_cold int amr_nb_encode_init(AVCodecContext *avctx) · 198 unmodified lines | |||
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | avctx->frame_size = 160; | 201 | avctx->frame_size = 160; |
| 202 | avctx->delay = 50; | 202 | avctx->initial_padding = 50; |
| 203 | ff_af_queue_init(avctx, &s->afq); | 203 | ff_af_queue_init(avctx, &s->afq); |
| 204 | 204 | ||
| 205 | s->enc_state = Encoder_Interface_init(s->enc_dtx); | 205 | s->enc_state = Encoder_Interface_init(s->enc_dtx); |
| @@ -246,7 +246,7 @@ static int amr_nb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 40 unmodified lines | |||
| 246 | return AVERROR(ENOMEM); | 246 | return AVERROR(ENOMEM); |
| 247 | memcpy(flush_buf, samples, frame->nb_samples * sizeof(*flush_buf)); | 247 | memcpy(flush_buf, samples, frame->nb_samples * sizeof(*flush_buf)); |
| 248 | samples = flush_buf; | 248 | samples = flush_buf; |
| 249 | if (frame->nb_samples < avctx->frame_size - avctx->delay) | 249 | if (frame->nb_samples < avctx->frame_size - avctx->initial_padding) |
| 250 | s->enc_last_frame = -1; | 250 | s->enc_last_frame = -1; |
| 251 | } | 251 | } |
| 252 | if ((ret = ff_af_queue_add(&s->afq, frame)) < 0) { | 252 | if ((ret = ff_af_queue_add(&s->afq, frame)) < 0) { |
| @@ -87,7 +87,7 @@ static void libopus_write_header(AVCodecContext *avctx, int stream_count, · 86 unmodified lines | |||
| 87 | bytestream_put_buffer(&p, "OpusHead", 8); | 87 | bytestream_put_buffer(&p, "OpusHead", 8); |
| 88 | bytestream_put_byte(&p, 1); /* Version */ | 88 | bytestream_put_byte(&p, 1); /* Version */ |
| 89 | bytestream_put_byte(&p, channels); | 89 | bytestream_put_byte(&p, channels); |
| 90 | bytestream_put_le16(&p, avctx->delay); /* Lookahead samples at 48kHz */ | 90 | bytestream_put_le16(&p, avctx->initial_padding); /* Lookahead samples at 48kHz */ |
| 91 | bytestream_put_le32(&p, avctx->sample_rate); /* Original sample rate */ | 91 | bytestream_put_le32(&p, avctx->sample_rate); /* Original sample rate */ |
| 92 | bytestream_put_le16(&p, 0); /* Gain of 0dB is recommended. */ | 92 | bytestream_put_le16(&p, 0); /* Gain of 0dB is recommended. */ |
| 93 | 93 | ||
| @@ -284,7 +284,7 @@ static av_cold int libopus_encode_init(AVCodecContext *avctx) · 190 unmodified lines | |||
| 284 | goto fail; | 284 | goto fail; |
| 285 | } | 285 | } |
| 286 | 286 | ||
| 287 | ret = opus_multistream_encoder_ctl(enc, OPUS_GET_LOOKAHEAD(&avctx->delay)); | 287 | ret = opus_multistream_encoder_ctl(enc, OPUS_GET_LOOKAHEAD(&avctx->initial_padding)); |
| 288 | if (ret != OPUS_OK) | 288 | if (ret != OPUS_OK) |
| 289 | av_log(avctx, AV_LOG_WARNING, | 289 | av_log(avctx, AV_LOG_WARNING, |
| 290 | "Unable to get number of lookahead samples: %s\n", | 290 | "Unable to get number of lookahead samples: %s\n", |
| @@ -236,7 +236,7 @@ static av_cold int encode_init(AVCodecContext *avctx) · 235 unmodified lines | |||
| 236 | s->header.frames_per_packet = s->frames_per_packet; | 236 | s->header.frames_per_packet = s->frames_per_packet; |
| 237 | 237 | ||
| 238 | /* set encoding delay */ | 238 | /* set encoding delay */ |
| 239 | speex_encoder_ctl(s->enc_state, SPEEX_GET_LOOKAHEAD, &avctx->delay); | 239 | speex_encoder_ctl(s->enc_state, SPEEX_GET_LOOKAHEAD, &avctx->initial_padding); |
| 240 | ff_af_queue_init(avctx, &s->afq); | 240 | ff_af_queue_init(avctx, &s->afq); |
| 241 | 241 | ||
| 242 | /* create header packet bytes from header struct */ | 242 | /* create header packet bytes from header struct */ |
| @@ -60,7 +60,7 @@ static av_cold int twolame_encode_init(AVCodecContext *avctx) · 59 unmodified lines | |||
| 60 | int ret; | 60 | int ret; |
| 61 | 61 | ||
| 62 | avctx->frame_size = TWOLAME_SAMPLES_PER_FRAME; | 62 | avctx->frame_size = TWOLAME_SAMPLES_PER_FRAME; |
| 63 | avctx->delay = 512 - 32 + 1; | 63 | avctx->initial_padding = 512 - 32 + 1; |
| 64 | 64 | ||
| 65 | s->glopts = twolame_init(); | 65 | s->glopts = twolame_init(); |
| 66 | if (!s->glopts) | 66 | if (!s->glopts) |
| @@ -155,7 +155,7 @@ static int twolame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 88 unmodified lines | |||
| 155 | if (frame) { | 155 | if (frame) { |
| 156 | avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples); | 156 | avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples); |
| 157 | if (frame->pts != AV_NOPTS_VALUE) | 157 | if (frame->pts != AV_NOPTS_VALUE) |
| 158 | avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay); | 158 | avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding); |
| 159 | } else { | 159 | } else { |
| 160 | avpkt->pts = s->next_pts; | 160 | avpkt->pts = s->next_pts; |
| 161 | } | 161 | } |
| @@ -61,7 +61,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) · 60 unmodified lines | |||
| 61 | int index, ret; | 61 | int index, ret; |
| 62 | 62 | ||
| 63 | avctx->frame_size = FRAME_SIZE; | 63 | avctx->frame_size = FRAME_SIZE; |
| 64 | avctx->delay = ENC_DELAY; | 64 | avctx->initial_padding = ENC_DELAY; |
| 65 | s->last_frame = 2; | 65 | s->last_frame = 2; |
| 66 | ff_af_queue_init(avctx, &s->afq); | 66 | ff_af_queue_init(avctx, &s->afq); |
| 67 | 67 | ||
| @@ -93,7 +93,7 @@ static av_cold int amr_wb_encode_init(AVCodecContext *avctx) · 92 unmodified lines | |||
| 93 | s->last_bitrate = avctx->bit_rate; | 93 | s->last_bitrate = avctx->bit_rate; |
| 94 | 94 | ||
| 95 | avctx->frame_size = 320; | 95 | avctx->frame_size = 320; |
| 96 | avctx->delay = 80; | 96 | avctx->initial_padding = 80; |
| 97 | 97 | ||
| 98 | s->state = E_IF_init(); | 98 | s->state = E_IF_init(); |
| 99 | 99 | ||
| @@ -129,7 +129,7 @@ static int amr_wb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 29 unmodified lines | |||
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | if (frame->pts != AV_NOPTS_VALUE) | 131 | if (frame->pts != AV_NOPTS_VALUE) |
| 132 | avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay); | 132 | avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding); |
| 133 | 133 | ||
| 134 | avpkt->size = size; | 134 | avpkt->size = size; |
| 135 | *got_packet_ptr = 1; | 135 | *got_packet_ptr = 1; |
| @@ -345,8 +345,8 @@ static int libvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 344 unmodified lines | |||
| 345 | if (duration > 0) { | 345 | if (duration > 0) { |
| 346 | /* we do not know encoder delay until we get the first packet from | 346 | /* we do not know encoder delay until we get the first packet from |
| 347 | * libvorbis, so we have to update the AudioFrameQueue counts */ | 347 | * libvorbis, so we have to update the AudioFrameQueue counts */ |
| 348 | if (!avctx->delay && s->afq.frames) { | 348 | if (!avctx->initial_padding && s->afq.frames) { |
| 349 | avctx->delay = duration; | 349 | avctx->initial_padding = duration; |
| 350 | av_assert0(!s->afq.remaining_delay); | 350 | av_assert0(!s->afq.remaining_delay); |
| 351 | s->afq.frames->duration += duration; | 351 | s->afq.frames->duration += duration; |
| 352 | if (s->afq.frames->pts != AV_NOPTS_VALUE) | 352 | if (s->afq.frames->pts != AV_NOPTS_VALUE) |
| @@ -89,7 +89,7 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx) · 88 unmodified lines | |||
| 89 | bitrate = bitrate / 1000; | 89 | bitrate = bitrate / 1000; |
| 90 | s->nb_channels = channels; | 90 | s->nb_channels = channels; |
| 91 | avctx->frame_size = MPA_FRAME_SIZE; | 91 | avctx->frame_size = MPA_FRAME_SIZE; |
| 92 | avctx->delay = 512 - 32 + 1; | 92 | avctx->initial_padding = 512 - 32 + 1; |
| 93 | 93 | ||
| 94 | /* encoding freq */ | 94 | /* encoding freq */ |
| 95 | s->lsf = 0; | 95 | s->lsf = 0; |
| @@ -771,7 +771,7 @@ static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 675 unmodified lines | |||
| 771 | encode_frame(s, bit_alloc, padding); | 771 | encode_frame(s, bit_alloc, padding); |
| 772 | 772 | ||
| 773 | if (frame->pts != AV_NOPTS_VALUE) | 773 | if (frame->pts != AV_NOPTS_VALUE) |
| 774 | avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay); | 774 | avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding); |
| 775 | 775 | ||
| 776 | avpkt->size = put_bits_count(&s->pb) / 8; | 776 | avpkt->size = put_bits_count(&s->pb) / 8; |
| 777 | *got_packet_ptr = 1; | 777 | *got_packet_ptr = 1; |
| @@ -165,7 +165,7 @@ static av_cold int encode_init(AVCodecContext *avctx) · 164 unmodified lines | |||
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | avctx->frame_size = NELLY_SAMPLES; | 167 | avctx->frame_size = NELLY_SAMPLES; |
| 168 | avctx->delay = NELLY_BUF_LEN; | 168 | avctx->initial_padding = NELLY_BUF_LEN; |
| 169 | ff_af_queue_init(avctx, &s->afq); | 169 | ff_af_queue_init(avctx, &s->afq); |
| 170 | s->avctx = avctx; | 170 | s->avctx = avctx; |
| 171 | if ((ret = ff_mdct_init(&s->mdct_ctx, 8, 0, 32768.0)) < 0) | 171 | if ((ret = ff_mdct_init(&s->mdct_ctx, 8, 0, 32768.0)) < 0) |
| @@ -55,7 +55,7 @@ static av_cold int ra144_encode_init(AVCodecContext * avctx) · 54 unmodified lines | |||
| 55 | return -1; | 55 | return -1; |
| 56 | } | 56 | } |
| 57 | avctx->frame_size = NBLOCKS * BLOCKSIZE; | 57 | avctx->frame_size = NBLOCKS * BLOCKSIZE; |
| 58 | avctx->delay = avctx->frame_size; | 58 | avctx->initial_padding = avctx->frame_size; |
| 59 | avctx->bit_rate = 8000; | 59 | avctx->bit_rate = 8000; |
| 60 | ractx = avctx->priv_data; | 60 | ractx = avctx->priv_data; |
| 61 | ractx->lpc_coef[0] = ractx->lpc_tables[0]; | 61 | ractx->lpc_coef[0] = ractx->lpc_tables[0]; |
| @@ -1609,6 +1609,11 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code · 1608 unmodified lines | |||
| 1609 | 1609 | ||
| 1610 | ret=0; | 1610 | ret=0; |
| 1611 | 1611 | ||
| 1612 | #if FF_API_AUDIOENC_DELAY | ||
| 1613 | if (av_codec_is_encoder(avctx->codec)) | ||
| 1614 | avctx->delay = avctx->initial_padding; | ||
| 1615 | #endif | ||
| 1616 | |||
| 1612 | if (av_codec_is_decoder(avctx->codec)) { | 1617 | if (av_codec_is_decoder(avctx->codec)) { |
| 1613 | if (!avctx->bit_rate) | 1618 | if (!avctx->bit_rate) |
| 1614 | avctx->bit_rate = get_bit_rate(avctx); | 1619 | avctx->bit_rate = get_bit_rate(avctx); |
| @@ -1921,6 +1926,10 @@ end: · 306 unmodified lines | |||
| 1921 | av_frame_free(&padded_frame); | 1926 | av_frame_free(&padded_frame); |
| 1922 | av_free(extended_frame); | 1927 | av_free(extended_frame); |
| 1923 | 1928 | ||
| 1929 | #if FF_API_AUDIOENC_DELAY | ||
| 1930 | avctx->delay = avctx->initial_padding; | ||
| 1931 | #endif | ||
| 1932 | |||
| 1924 | return ret; | 1933 | return ret; |
| 1925 | } | 1934 | } |
| 1926 | 1935 | ||
| @@ -29,8 +29,8 @@ · 28 unmodified lines | |||
| 29 | #include "libavutil/version.h" | 29 | #include "libavutil/version.h" |
| 30 | 30 | ||
| 31 | #define LIBAVCODEC_VERSION_MAJOR 56 | 31 | #define LIBAVCODEC_VERSION_MAJOR 56 |
| 32 | #define LIBAVCODEC_VERSION_MINOR 4 | 32 | #define LIBAVCODEC_VERSION_MINOR 5 |
| 33 | #define LIBAVCODEC_VERSION_MICRO 101 | 33 | #define LIBAVCODEC_VERSION_MICRO 100 |
| 34 | 34 | ||
| 35 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | 35 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| 36 | LIBAVCODEC_VERSION_MINOR, \ | 36 | LIBAVCODEC_VERSION_MINOR, \ |
| @@ -175,5 +175,8 @@ · 138 unmodified lines | |||
| 175 | #ifndef FF_API_DV_FRAME_PROFILE | 175 | #ifndef FF_API_DV_FRAME_PROFILE |
| 176 | #define FF_API_DV_FRAME_PROFILE (LIBAVCODEC_VERSION_MAJOR < 57) | 176 | #define FF_API_DV_FRAME_PROFILE (LIBAVCODEC_VERSION_MAJOR < 57) |
| 177 | #endif | 177 | #endif |
| 178 | #ifndef FF_API_AUDIOENC_DELAY | ||
| 179 | #define FF_API_AUDIOENC_DELAY (LIBAVCODEC_VERSION_MAJOR < 58) | ||
| 180 | #endif | ||
| 178 | 181 | ||
| 179 | #endif /* AVCODEC_VERSION_H */ | 182 | #endif /* AVCODEC_VERSION_H */ |
| @@ -88,9 +88,7 @@ static av_cold int encode_init(AVCodecContext *avctx) · 87 unmodified lines | |||
| 88 | (avctx->sample_rate * 8); | 88 | (avctx->sample_rate * 8); |
| 89 | block_align = FFMIN(block_align, MAX_CODED_SUPERFRAME_SIZE); | 89 | block_align = FFMIN(block_align, MAX_CODED_SUPERFRAME_SIZE); |
| 90 | avctx->block_align = block_align; | 90 | avctx->block_align = block_align; |
| 91 | 91 | avctx->frame_size = avctx->initial_padding = s->frame_len; | |
| 92 | avctx->frame_size = | ||
| 93 | avctx->delay = s->frame_len; | ||
| 94 | 92 | ||
| 95 | return 0; | 93 | return 0; |
| 96 | } | 94 | } |
| @@ -403,7 +401,7 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt, · 306 unmodified lines | |||
| 403 | av_assert0(put_bits_ptr(&s->pb) - s->pb.buf == avctx->block_align); | 401 | av_assert0(put_bits_ptr(&s->pb) - s->pb.buf == avctx->block_align); |
| 404 | 402 | ||
| 405 | if (frame->pts != AV_NOPTS_VALUE) | 403 | if (frame->pts != AV_NOPTS_VALUE) |
| 406 | avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay); | 404 | avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->initial_padding); |
| 407 | 405 | ||
| 408 | avpkt->size = avctx->block_align; | 406 | avpkt->size = avctx->block_align; |
| 409 | *got_packet_ptr = 1; | 407 | *got_packet_ptr = 1; |