1cabdff1aSopenharmony_ci/*
2cabdff1aSopenharmony_ci * This file is part of FFmpeg.
3cabdff1aSopenharmony_ci *
4cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or
5cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public
6cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either
7cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version.
8cabdff1aSopenharmony_ci *
9cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful,
10cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
11cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12cabdff1aSopenharmony_ci * Lesser General Public License for more details.
13cabdff1aSopenharmony_ci *
14cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public
15cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software
16cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17cabdff1aSopenharmony_ci */
18cabdff1aSopenharmony_ci
19cabdff1aSopenharmony_ci#ifndef AVCODEC_PACKET_INTERNAL_H
20cabdff1aSopenharmony_ci#define AVCODEC_PACKET_INTERNAL_H
21cabdff1aSopenharmony_ci
22cabdff1aSopenharmony_ci#include <stdint.h>
23cabdff1aSopenharmony_ci
24cabdff1aSopenharmony_ci#include "packet.h"
25cabdff1aSopenharmony_ci
26cabdff1aSopenharmony_citypedef struct PacketListEntry {
27cabdff1aSopenharmony_ci    struct PacketListEntry *next;
28cabdff1aSopenharmony_ci    AVPacket pkt;
29cabdff1aSopenharmony_ci} PacketListEntry;
30cabdff1aSopenharmony_ci
31cabdff1aSopenharmony_citypedef struct PacketList {
32cabdff1aSopenharmony_ci    PacketListEntry *head, *tail;
33cabdff1aSopenharmony_ci} PacketList;
34cabdff1aSopenharmony_ci
35cabdff1aSopenharmony_ci/**
36cabdff1aSopenharmony_ci * Append an AVPacket to the list.
37cabdff1aSopenharmony_ci *
38cabdff1aSopenharmony_ci * @param list  A PacketList
39cabdff1aSopenharmony_ci * @param pkt   The packet being appended. The data described in it will
40cabdff1aSopenharmony_ci *              be made reference counted if it isn't already.
41cabdff1aSopenharmony_ci * @param copy  A callback to copy the contents of the packet to the list.
42cabdff1aSopenharmony_ci                May be null, in which case the packet's reference will be
43cabdff1aSopenharmony_ci                moved to the list.
44cabdff1aSopenharmony_ci * @return 0 on success, negative AVERROR value on failure. On failure,
45cabdff1aSopenharmony_ci           the packet and the list are unchanged.
46cabdff1aSopenharmony_ci */
47cabdff1aSopenharmony_ciint avpriv_packet_list_put(PacketList *list, AVPacket *pkt,
48cabdff1aSopenharmony_ci                           int (*copy)(AVPacket *dst, const AVPacket *src),
49cabdff1aSopenharmony_ci                           int flags);
50cabdff1aSopenharmony_ci
51cabdff1aSopenharmony_ci/**
52cabdff1aSopenharmony_ci * Remove the oldest AVPacket in the list and return it.
53cabdff1aSopenharmony_ci *
54cabdff1aSopenharmony_ci * @note The pkt will be overwritten completely on success. The caller
55cabdff1aSopenharmony_ci *       owns the packet and must unref it by itself.
56cabdff1aSopenharmony_ci *
57cabdff1aSopenharmony_ci * @param head A pointer to a PacketList struct
58cabdff1aSopenharmony_ci * @param pkt  Pointer to an AVPacket struct
59cabdff1aSopenharmony_ci * @return 0 on success, and a packet is returned. AVERROR(EAGAIN) if
60cabdff1aSopenharmony_ci *         the list was empty.
61cabdff1aSopenharmony_ci */
62cabdff1aSopenharmony_ciint avpriv_packet_list_get(PacketList *list, AVPacket *pkt);
63cabdff1aSopenharmony_ci
64cabdff1aSopenharmony_ci/**
65cabdff1aSopenharmony_ci * Wipe the list and unref all the packets in it.
66cabdff1aSopenharmony_ci */
67cabdff1aSopenharmony_civoid avpriv_packet_list_free(PacketList *list);
68cabdff1aSopenharmony_ci
69cabdff1aSopenharmony_ciint ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type);
70cabdff1aSopenharmony_ci
71cabdff1aSopenharmony_ciint ff_side_data_set_prft(AVPacket *pkt, int64_t timestamp);
72cabdff1aSopenharmony_ci
73cabdff1aSopenharmony_ci#endif // AVCODEC_PACKET_INTERNAL_H
74