Commit Graph

13 Commits

Author SHA1 Message Date
Andreas Rheinhardt
d61240f8c9 avcodec/packet_internal: Add proper PacketList struct
Up until now, we had a PacketList structure which is actually
a PacketListEntry; a proper PacketList did not exist
and all the related functions just passed pointers to pointers
to the head and tail elements around. All these pointers were
actually consecutive elements of their containing structs,
i.e. the users already treated them as if they were a struct.

So add a proper PacketList struct and rename the current PacketList
to PacketListEntry; also make the functions use this structure
instead of the pair of pointers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 13:16:50 +01:00
Andreas Rheinhardt
3485e79f07 avformat/(aiff|flac|mov|mp3|tta)enc: Don't create unnecessary references
The packet given to muxers is not used afterwards; it is always
unreferenced by libavformat. Ergo muxers are allowed to keep
the references in the packets and e.g. move the ownership to
a packet list. This is what this commit does.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 04:58:57 +01:00
Andreas Rheinhardt
751e334aa9 avformat/ttaenc: Avoid stack packet
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-03 20:56:12 +02:00
Andreas Rheinhardt
bc70684e74 avformat: Constify all muxer/demuxers
This is possible now that the next-API is gone.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 11:48:06 -03:00
James Almer
d422b2ed87 avcodec/packet_internal: make avpriv_packet_list_* functions use an internal struct
The next pointer is kept at the end for backwards compatability until the
major bump, when it should ideally be moved at the front.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 14:12:17 -03:00
James Almer
8a81820624 avcodec/packet: move AVPacketList definition and function helpers over from libavformat
And replace the flags parameter with a function callback that can be used to
copy the contents of the packet (e.g, av_packet_ref and av_packet_copy_props).

Signed-off-by: James Almer <jamrial@gmail.com>
2020-09-15 09:53:39 -03:00
Andreas Rheinhardt
dbacecd347 avformat/ttaenc: Defer freeing dynamic buffer
The TTA muxer writes a seektable in a dynamic buffer as it receives
packets and when writing the trailer, closes the dynamic buffer using
avio_close_dyn_buf(), writes the seektable and frees the buffer. But
the TTA muxer already has a deinit function which unconditionally
calls ffio_free_dyn_buf() on the dynamic buffer, so switching to
avio_get_dyn_buf() means that one can remove the code to free the
buffer; furthermore, it also might save an allocation if the seektable
is so small that it fits into the dynamic buffer's write buffer or if
adding the padding that avio_close_dyn_buf() adds necessitated
reallocating of the underlying buffer.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-05-21 05:30:26 +02:00
Marton Balint
c05d82fa92 avformat: remove unneeded avio_flush() calls from the end of write_trailer functions
The IO context is always flushed by libavformat/mux.c after write_trailer is
called, so this change should have no effect at all.
2020-01-07 21:51:45 +01:00
James Almer
b46cdd9d23 avformat/ttaenc: add a deinit function
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-10-21 17:20:20 -03:00
James Almer
15ca8311e6 avformat/ttaenc: use AVPacketList helper functions to queue packets
Simplifies code.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-04-04 00:15:38 -03:00
James Almer
fa4121507c avformat/ttaenc: add tta_init()
Signed-off-by: James Almer <jamrial@gmail.com>
2017-11-24 15:05:35 -03:00
James Almer
e97667c82f avformat/ttaenc: buffer packets directly
This is a bit more robust in case of OOM.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-11-24 15:05:35 -03:00
James Almer
376d4b3c0d avformat: add a TTA Muxer
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-08-04 16:25:40 -03:00