summaryrefslogtreecommitdiff
path: root/libavformat/flacenc.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/flacenc.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/flacenc.c')
-rw-r--r--libavformat/flacenc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
index e8f043729e..b267197ccc 100644
--- a/libavformat/flacenc.c
+++ b/libavformat/flacenc.c
@@ -40,7 +40,7 @@ typedef struct FlacMuxerContext {
int audio_stream_idx;
int waiting_pics;
/* audio packets are queued here until we get all the attached pictures */
- PacketList *queue, *queue_end;
+ PacketList queue;
/* updated streaminfo sent by the encoder at the end */
uint8_t streaminfo[FLAC_STREAMINFO_SIZE];
@@ -306,8 +306,8 @@ static int flac_queue_flush(AVFormatContext *s)
if (ret < 0)
write = 0;
- while (c->queue) {
- avpriv_packet_list_get(&c->queue, &c->queue_end, pkt);
+ while (c->queue.head) {
+ avpriv_packet_list_get(&c->queue, pkt);
if (write && (ret = flac_write_audio_packet(s, pkt)) < 0)
write = 0;
av_packet_unref(pkt);
@@ -347,7 +347,7 @@ static void flac_deinit(struct AVFormatContext *s)
{
FlacMuxerContext *c = s->priv_data;
- avpriv_packet_list_free(&c->queue, &c->queue_end);
+ avpriv_packet_list_free(&c->queue);
for (unsigned i = 0; i < s->nb_streams; i++)
av_packet_free((AVPacket **)&s->streams[i]->priv_data);
}
@@ -360,7 +360,7 @@ static int flac_write_packet(struct AVFormatContext *s, AVPacket *pkt)
if (pkt->stream_index == c->audio_stream_idx) {
if (c->waiting_pics) {
/* buffer audio packets until we get all the pictures */
- ret = avpriv_packet_list_put(&c->queue, &c->queue_end, pkt, NULL, 0);
+ ret = avpriv_packet_list_put(&c->queue, pkt, NULL, 0);
if (ret < 0) {
av_log(s, AV_LOG_ERROR, "Out of memory in packet queue; skipping attached pictures\n");
c->waiting_pics = 0;