mirror of
https://mirror.skon.top/https://github.com/FFmpeg/FFmpeg
synced 2026-04-20 21:00:41 +08:00
avformat: Avoid allocation for AVFormatInternal
Do this by allocating AVFormatContext together with the data that is currently in AVFormatInternal; or rather: Put AVFormatContext at the beginning of a new structure called FFFormatContext (which encompasses more than just the internal fields and is a proper context in its own right, hence the name) and remove AVFormatInternal altogether. The biggest simplifications occured in avformat_alloc_context(), where one can now simply call avformat_free_context() in case of errors. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -441,9 +441,10 @@ static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c,
|
||||
int64_t timestamp, int flags)
|
||||
{
|
||||
// FIXME: sys may be wrong if last dv_read_packet() failed (buffer is junk)
|
||||
FFFormatContext *const si = ffformatcontext(s);
|
||||
const int frame_size = c->sys->frame_size;
|
||||
int64_t offset;
|
||||
int64_t size = avio_size(s->pb) - s->internal->data_offset;
|
||||
int64_t size = avio_size(s->pb) - si->data_offset;
|
||||
int64_t max_offset = ((size - 1) / frame_size) * frame_size;
|
||||
|
||||
offset = frame_size * timestamp;
|
||||
@@ -453,7 +454,7 @@ static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c,
|
||||
else if (offset < 0)
|
||||
offset = 0;
|
||||
|
||||
return offset + s->internal->data_offset;
|
||||
return offset + si->data_offset;
|
||||
}
|
||||
|
||||
void ff_dv_offset_reset(DVDemuxContext *c, int64_t frame_offset)
|
||||
|
||||
Reference in New Issue
Block a user