mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-02-12 04:59:59 +00:00
avformat/cafenc: don't keep track of nb packets ourselves
Just reuse AVStream.nb_frames. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
96475bfa21
commit
fcfb33922f
1 changed files with 2 additions and 4 deletions
|
|
@ -35,7 +35,6 @@
|
|||
typedef struct {
|
||||
int64_t data;
|
||||
int64_t total_duration;
|
||||
int64_t packets;
|
||||
uint32_t frame_size;
|
||||
|
||||
uint8_t *pakt_buf;
|
||||
|
|
@ -271,7 +270,6 @@ static int caf_write_packet(AVFormatContext *s, AVPacket *pkt)
|
|||
pakt_buf = put_variable_length_num(pakt_buf, pkt->duration);
|
||||
caf->pakt_buf_size = pakt_buf - caf->pakt_buf;
|
||||
}
|
||||
caf->packets++;
|
||||
caf->total_duration += pkt->duration;
|
||||
|
||||
avio_write(s->pb, pkt->data, pkt->size);
|
||||
|
|
@ -287,8 +285,8 @@ static int caf_write_trailer(AVFormatContext *s)
|
|||
|
||||
if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
|
||||
int64_t file_size = avio_tell(pb);
|
||||
int64_t packets = (!par->block_align || !caf->frame_size) ? caf->packets : 0;
|
||||
int64_t valid_frames = caf->frame_size ? caf->packets * caf->frame_size : caf->total_duration;
|
||||
int64_t packets = (!par->block_align || !caf->frame_size) ? st->nb_frames : 0;
|
||||
int64_t valid_frames = caf->frame_size ? st->nb_frames * caf->frame_size : caf->total_duration;
|
||||
unsigned remainder_frames = valid_frames > caf->total_duration
|
||||
? valid_frames - caf->total_duration : 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue