diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-12-16 01:49:39 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-01-04 13:16:50 +0100 |
commit | d61240f8c95e9cf7a0aaef2bb4495960d3fec62c (patch) | |
tree | 52398ddaec0cbe4e02d0db54669ecd1532f1569e /libavformat/matroskadec.c | |
parent | b74e47c4ff5bca998936c0d8b9a0892104a7403d (diff) | |
download | ffmpeg-d61240f8c95e9cf7a0aaef2bb4495960d3fec62c.tar.gz |
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/matroskadec.c')
-rw-r--r-- | libavformat/matroskadec.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index e271916bf1..78e5a4a203 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -396,8 +396,7 @@ typedef struct MatroskaDemuxContext { AVPacket *pkt; /* the packet queue */ - PacketList *queue; - PacketList *queue_end; + PacketList queue; int done; @@ -3112,11 +3111,11 @@ static int matroska_read_header(AVFormatContext *s) static int matroska_deliver_packet(MatroskaDemuxContext *matroska, AVPacket *pkt) { - if (matroska->queue) { + if (matroska->queue.head) { MatroskaTrack *tracks = matroska->tracks.elem; MatroskaTrack *track; - avpriv_packet_list_get(&matroska->queue, &matroska->queue_end, pkt); + avpriv_packet_list_get(&matroska->queue, pkt); track = &tracks[pkt->stream_index]; if (track->has_palette) { uint8_t *pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE); @@ -3138,7 +3137,7 @@ static int matroska_deliver_packet(MatroskaDemuxContext *matroska, */ static void matroska_clear_queue(MatroskaDemuxContext *matroska) { - avpriv_packet_list_free(&matroska->queue, &matroska->queue_end); + avpriv_packet_list_free(&matroska->queue); } static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf, @@ -3304,7 +3303,7 @@ static int matroska_parse_rm_audio(MatroskaDemuxContext *matroska, track->audio.buf_timecode = AV_NOPTS_VALUE; pkt->pos = pos; pkt->stream_index = st->index; - ret = avpriv_packet_list_put(&matroska->queue, &matroska->queue_end, pkt, NULL, 0); + ret = avpriv_packet_list_put(&matroska->queue, pkt, NULL, 0); if (ret < 0) { av_packet_unref(pkt); return AVERROR(ENOMEM); @@ -3526,7 +3525,7 @@ static int matroska_parse_webvtt(MatroskaDemuxContext *matroska, pkt->duration = duration; pkt->pos = pos; - err = avpriv_packet_list_put(&matroska->queue, &matroska->queue_end, pkt, NULL, 0); + err = avpriv_packet_list_put(&matroska->queue, pkt, NULL, 0); if (err < 0) { av_packet_unref(pkt); return AVERROR(ENOMEM); @@ -3628,7 +3627,7 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska, pkt->pos = pos; pkt->duration = lace_duration; - res = avpriv_packet_list_put(&matroska->queue, &matroska->queue_end, pkt, NULL, 0); + res = avpriv_packet_list_put(&matroska->queue, pkt, NULL, 0); if (res < 0) { av_packet_unref(pkt); return AVERROR(ENOMEM); @@ -4030,10 +4029,10 @@ static int webm_clusters_start_with_keyframe(AVFormatContext *s) matroska_reset_status(matroska, 0, cluster_pos); matroska_clear_queue(matroska); if (matroska_parse_cluster(matroska) < 0 || - !matroska->queue) { + !matroska->queue.head) { break; } - pkt = &matroska->queue->pkt; + pkt = &matroska->queue.head->pkt; // 4 + read is the length of the cluster id and the cluster length field. cluster_pos += 4 + read + cluster_length; if (!(pkt->flags & AV_PKT_FLAG_KEY)) { |