summaryrefslogtreecommitdiffstats
path: root/media/ffvpx/libavcodec/avpacket.c
diff options
context:
space:
mode:
authortrav90 <travawine@protonmail.ch>2018-10-01 10:27:24 -0500
committertrav90 <travawine@protonmail.ch>2018-10-01 10:27:24 -0500
commitebc8d7e3ca8723d815904e6fee6c088c659d6784 (patch)
tree9e3115f44e9a09b9c71d40d72c7d5c939b2278e2 /media/ffvpx/libavcodec/avpacket.c
parent8e8fcee4a55de171303ebe526d3cf051522111bf (diff)
downloadUXP-ebc8d7e3ca8723d815904e6fee6c088c659d6784.tar
UXP-ebc8d7e3ca8723d815904e6fee6c088c659d6784.tar.gz
UXP-ebc8d7e3ca8723d815904e6fee6c088c659d6784.tar.lz
UXP-ebc8d7e3ca8723d815904e6fee6c088c659d6784.tar.xz
UXP-ebc8d7e3ca8723d815904e6fee6c088c659d6784.zip
[ffvpx] Update ffvp9/ffvp8 to release 4.0.2
Diffstat (limited to 'media/ffvpx/libavcodec/avpacket.c')
-rw-r--r--media/ffvpx/libavcodec/avpacket.c69
1 files changed, 41 insertions, 28 deletions
diff --git a/media/ffvpx/libavcodec/avpacket.c b/media/ffvpx/libavcodec/avpacket.c
index d1f4ea9eb..99a0c1383 100644
--- a/media/ffvpx/libavcodec/avpacket.c
+++ b/media/ffvpx/libavcodec/avpacket.c
@@ -479,34 +479,6 @@ int av_packet_split_side_data(AVPacket *pkt){
}
#endif
-#if FF_API_MERGE_SD
-int ff_packet_split_and_drop_side_data(AVPacket *pkt){
- if (!pkt->side_data_elems && pkt->size >12 && AV_RB64(pkt->data + pkt->size - 8) == FF_MERGE_MARKER){
- int i;
- unsigned int size;
- uint8_t *p;
-
- p = pkt->data + pkt->size - 8 - 5;
- for (i=1; ; i++){
- size = AV_RB32(p);
- if (size>INT_MAX - 5 || p - pkt->data < size)
- return 0;
- if (p[4]&128)
- break;
- if (p - pkt->data < size + 5)
- return 0;
- p-= size+5;
- if (i > AV_PKT_DATA_NB)
- return 0;
- }
- pkt->size = p - pkt->data - size;
- av_assert0(pkt->size >= 0);
- return 1;
- }
- return 0;
-}
-#endif
-
uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size)
{
AVDictionaryEntry *t = NULL;
@@ -599,6 +571,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
dst->flags = src->flags;
dst->stream_index = src->stream_index;
+ dst->side_data = NULL;
+ dst->side_data_elems = 0;
for (i = 0; i < src->side_data_elems; i++) {
enum AVPacketSideDataType type = src->side_data[i].type;
int size = src->side_data[i].size;
@@ -678,6 +652,45 @@ void av_packet_move_ref(AVPacket *dst, AVPacket *src)
src->size = 0;
}
+int av_packet_make_refcounted(AVPacket *pkt)
+{
+ int ret;
+
+ if (pkt->buf)
+ return 0;
+
+ ret = packet_alloc(&pkt->buf, pkt->size);
+ if (ret < 0)
+ return ret;
+ if (pkt->size)
+ memcpy(pkt->buf->data, pkt->data, pkt->size);
+
+ pkt->data = pkt->buf->data;
+
+ return 0;
+}
+
+int av_packet_make_writable(AVPacket *pkt)
+{
+ AVBufferRef *buf = NULL;
+ int ret;
+
+ if (pkt->buf && av_buffer_is_writable(pkt->buf))
+ return 0;
+
+ ret = packet_alloc(&buf, pkt->size);
+ if (ret < 0)
+ return ret;
+ if (pkt->size)
+ memcpy(buf->data, pkt->data, pkt->size);
+
+ av_buffer_unref(&pkt->buf);
+ pkt->buf = buf;
+ pkt->data = buf->data;
+
+ return 0;
+}
+
void av_packet_rescale_ts(AVPacket *pkt, AVRational src_tb, AVRational dst_tb)
{
if (pkt->pts != AV_NOPTS_VALUE)