summaryrefslogtreecommitdiffstats
path: root/media/ffvpx/libavcodec/avpacket.c
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-10-02 00:21:32 +0200
committerGitHub <noreply@github.com>2018-10-02 00:21:32 +0200
commit69d83c8fbe47b89d1d14f75ee99e638cbfb5dc31 (patch)
treece4b486ac8e13e1f5a8a918e532826c3ae09415d /media/ffvpx/libavcodec/avpacket.c
parent8e8fcee4a55de171303ebe526d3cf051522111bf (diff)
parent41ccd52bfd7f3604d3ad3917af5f030994e13762 (diff)
downloadUXP-69d83c8fbe47b89d1d14f75ee99e638cbfb5dc31.tar
UXP-69d83c8fbe47b89d1d14f75ee99e638cbfb5dc31.tar.gz
UXP-69d83c8fbe47b89d1d14f75ee99e638cbfb5dc31.tar.lz
UXP-69d83c8fbe47b89d1d14f75ee99e638cbfb5dc31.tar.xz
UXP-69d83c8fbe47b89d1d14f75ee99e638cbfb5dc31.zip
Merge pull request #806 from trav90/ffvpx-resync
Update ffvpx code to 4.0.2 (take 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)