summaryrefslogtreecommitdiff
path: root/libavformat/ttaenc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-12-16 01:49:39 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-01-04 13:16:50 +0100
commitd61240f8c95e9cf7a0aaef2bb4495960d3fec62c (patch)
tree52398ddaec0cbe4e02d0db54669ecd1532f1569e /libavformat/ttaenc.c
parentb74e47c4ff5bca998936c0d8b9a0892104a7403d (diff)
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>
Diffstat (limited to 'libavformat/ttaenc.c')
-rw-r--r--libavformat/ttaenc.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/libavformat/ttaenc.c b/libavformat/ttaenc.c
index 5f21fdc144..486f8bdd10 100644
--- a/libavformat/ttaenc.c
+++ b/libavformat/ttaenc.c
@@ -30,7 +30,7 @@
typedef struct TTAMuxContext {
AVIOContext *seek_table;
- PacketList *queue, *queue_end;
+ PacketList queue;
uint32_t nb_samples;
int frame_size;
int last_frame;
@@ -94,12 +94,11 @@ static int tta_write_packet(AVFormatContext *s, AVPacket *pkt)
TTAMuxContext *tta = s->priv_data;
int ret;
- ret = avpriv_packet_list_put(&tta->queue, &tta->queue_end, pkt,
- NULL, 0);
+ ret = avpriv_packet_list_put(&tta->queue, pkt, NULL, 0);
if (ret < 0) {
return ret;
}
- pkt = &tta->queue_end->pkt;
+ pkt = &tta->queue.tail->pkt;
avio_wl32(tta->seek_table, pkt->size);
tta->nb_samples += pkt->duration;
@@ -126,8 +125,8 @@ static void tta_queue_flush(AVFormatContext *s)
TTAMuxContext *tta = s->priv_data;
AVPacket *const pkt = ffformatcontext(s)->pkt;
- while (tta->queue) {
- avpriv_packet_list_get(&tta->queue, &tta->queue_end, pkt);
+ while (tta->queue.head) {
+ avpriv_packet_list_get(&tta->queue, pkt);
avio_write(s->pb, pkt->data, pkt->size);
av_packet_unref(pkt);
}
@@ -163,7 +162,7 @@ static void tta_deinit(AVFormatContext *s)
TTAMuxContext *tta = s->priv_data;
ffio_free_dyn_buf(&tta->seek_table);
- avpriv_packet_list_free(&tta->queue, &tta->queue_end);
+ avpriv_packet_list_free(&tta->queue);
}
const AVOutputFormat ff_tta_muxer = {