s->options.max_partition_order = ((int[]){ 2, 2, 3, 3, 3, 8, 8, 8, 8, 8, 8, 8, 8})[level];
/* set compression option overrides from AVCodecContext */
-#if LIBAVCODEC_VERSION_MAJOR < 53
+#if FF_API_USE_LPC
/* for compatibility with deprecated AVCodecContext.use_lpc */
if (avctx->use_lpc == 0) {
s->options.lpc_type = AV_LPC_TYPE_FIXED;
}
-static void output_frame_header(FlacEncodeContext *s)
+static void write_frame_header(FlacEncodeContext *s)
{
FlacFrame *frame;
int crc;
}
-static void output_subframes(FlacEncodeContext *s)
+static void write_subframes(FlacEncodeContext *s)
{
int ch;
}
-static void output_frame_footer(FlacEncodeContext *s)
+static void write_frame_footer(FlacEncodeContext *s)
{
int crc;
flush_put_bits(&s->pb);
static int write_frame(FlacEncodeContext *s, uint8_t *frame, int buf_size)
{
init_put_bits(&s->pb, frame, buf_size);
- output_frame_header(s);
- output_subframes(s);
- output_frame_footer(s);
+ write_frame_header(s);
+ write_subframes(s);
+ write_frame_footer(s);
return put_bits_count(&s->pb) >> 3;
}
channel_decorrelation(s);
frame_bytes = encode_frame(s);
- if (buf_size < frame_bytes) {
- av_log(avctx, AV_LOG_ERROR, "output buffer too small\n");
- return 0;
- }
- out_bytes = write_frame(s, frame, buf_size);
/* fallback to verbatim mode if the compressed frame is larger than it
would be if encoded uncompressed. */
- if (out_bytes > s->max_framesize) {
+ if (frame_bytes > s->max_framesize) {
s->frame.verbatim_only = 1;
frame_bytes = encode_frame(s);
- if (buf_size < frame_bytes) {
- av_log(avctx, AV_LOG_ERROR, "output buffer too small\n");
- return 0;
- }
- out_bytes = write_frame(s, frame, buf_size);
}
+ if (buf_size < frame_bytes) {
+ av_log(avctx, AV_LOG_ERROR, "output buffer too small\n");
+ return 0;
+ }
+ out_bytes = write_frame(s, frame, buf_size);
+
s->frame_count++;
avctx->coded_frame->pts = s->sample_count;
s->sample_count += avctx->frame_size;