- AVPacketList *pktl;
-
- while (pktl = tta->queue) {
- AVPacket *pkt = &pktl->pkt;
- avio_write(s->pb, pkt->data, pkt->size);
- av_packet_unref(pkt);
- tta->queue = pktl->next;
- av_free(pktl);
+ AVPacket pkt;
+
+ while (tta->queue) {
+ ff_packet_list_get(&tta->queue, &tta->queue_end, &pkt);
+ avio_write(s->pb, pkt.data, pkt.size);
+ av_packet_unref(&pkt);