-int ff_packet_list_put(AVPacketList **packet_buffer,
- AVPacketList **plast_pktl,
- AVPacket *pkt, int flags)
-{
- AVPacketList *pktl = av_mallocz(sizeof(AVPacketList));
- int ret;
-
- if (!pktl)
- return AVERROR(ENOMEM);
-
- if (flags & FF_PACKETLIST_FLAG_REF_PACKET) {
- if ((ret = av_packet_ref(&pktl->pkt, pkt)) < 0) {
- av_free(pktl);
- return ret;
- }
- } else {
- // TODO: Adapt callers in this file so the line below can use
- // av_packet_move_ref() to effectively move the reference
- // to the list.
- pktl->pkt = *pkt;
- }
-
- if (*packet_buffer)
- (*plast_pktl)->next = pktl;
- else
- *packet_buffer = pktl;
-
- /* Add the packet in the buffered packet list. */
- *plast_pktl = pktl;
- return 0;
-}
-