mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-05-23 21:19:15 +00:00
examples/decoding_encoding: flush audio frames in the encoder
This commit is contained in:
parent
535df748c5
commit
a7219529d1
1 changed files with 14 additions and 0 deletions
|
@ -205,6 +205,20 @@ static void audio_encode_example(const char *filename)
|
|||
av_free_packet(&pkt);
|
||||
}
|
||||
}
|
||||
|
||||
/* get the delayed frames */
|
||||
for (got_output = 1; got_output; i++) {
|
||||
ret = avcodec_encode_audio2(c, &pkt, NULL, &got_output);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "error encoding frame\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (got_output) {
|
||||
fwrite(pkt.data, 1, pkt.size, f);
|
||||
av_free_packet(&pkt);
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
av_freep(&samples);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue