-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 {
- ret = av_packet_make_refcounted(pkt);
- if (ret < 0) {
- av_free(pktl);
- return ret;
- }
- av_packet_move_ref(&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;
-}
-