summaryrefslogtreecommitdiff
path: root/libs/ffvpx/libavcodec/vp9_superframe_split_bsf.c
diff options
context:
space:
mode:
authortrav90 <travawine@palemoon.org>2022-05-30 14:44:19 -0500
committerMatt A. Tobin <email@mattatobin.com>2022-05-30 14:49:22 -0500
commit8510f335c3ff39c207d8cb906da3eb91cd73d75a (patch)
tree88bc89f66bc6b15e27dab678d34c43aaad75de80 /libs/ffvpx/libavcodec/vp9_superframe_split_bsf.c
parentf11b40c3ab4a5a766b0b71ab1e9a6199b23bbfeb (diff)
downloadaura-central-8510f335c3ff39c207d8cb906da3eb91cd73d75a.tar.gz
[Libs:ffvpx] Update FFVPX to version 4.2.7
Diffstat (limited to 'libs/ffvpx/libavcodec/vp9_superframe_split_bsf.c')
-rw-r--r--libs/ffvpx/libavcodec/vp9_superframe_split_bsf.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/libs/ffvpx/libavcodec/vp9_superframe_split_bsf.c b/libs/ffvpx/libavcodec/vp9_superframe_split_bsf.c
index 9c4aa33dc..13e85c3ca 100644
--- a/libs/ffvpx/libavcodec/vp9_superframe_split_bsf.c
+++ b/libs/ffvpx/libavcodec/vp9_superframe_split_bsf.c
@@ -30,7 +30,7 @@
#include "get_bits.h"
typedef struct VP9SFSplitContext {
- AVPacket buffer_pkt;
+ AVPacket *buffer_pkt;
int nb_frames;
int next_frame;
@@ -43,13 +43,13 @@ static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out)
VP9SFSplitContext *s = ctx->priv_data;
AVPacket *in;
int i, j, ret, marker;
- int is_superframe = !!s->buffer_pkt.data;
+ int is_superframe = !!s->buffer_pkt->data;
- if (!s->buffer_pkt.data) {
- ret = ff_bsf_get_packet_ref(ctx, &s->buffer_pkt);
+ if (!s->buffer_pkt->data) {
+ ret = ff_bsf_get_packet_ref(ctx, s->buffer_pkt);
if (ret < 0)
return ret;
- in = &s->buffer_pkt;
+ in = s->buffer_pkt;
marker = in->data[in->size - 1];
if ((marker & 0xe0) == 0xc0) {
@@ -90,7 +90,7 @@ static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out)
GetBitContext gb;
int profile, invisible = 0;
- ret = av_packet_ref(out, &s->buffer_pkt);
+ ret = av_packet_ref(out, s->buffer_pkt);
if (ret < 0)
goto fail;
@@ -101,7 +101,7 @@ static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out)
s->next_frame++;
if (s->next_frame >= s->nb_frames)
- av_packet_unref(&s->buffer_pkt);
+ av_packet_unref(s->buffer_pkt);
ret = init_get_bits8(&gb, out->data, out->size);
if (ret < 0)
@@ -121,26 +121,45 @@ static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out)
out->pts = AV_NOPTS_VALUE;
} else {
- av_packet_move_ref(out, &s->buffer_pkt);
+ av_packet_move_ref(out, s->buffer_pkt);
}
return 0;
fail:
if (ret < 0)
av_packet_unref(out);
- av_packet_unref(&s->buffer_pkt);
+ av_packet_unref(s->buffer_pkt);
return ret;
}
+static int vp9_superframe_split_init(AVBSFContext *ctx)
+{
+ VP9SFSplitContext *s = ctx->priv_data;
+
+ s->buffer_pkt = av_packet_alloc();
+ if (!s->buffer_pkt)
+ return AVERROR(ENOMEM);
+
+ return 0;
+}
+
+static void vp9_superframe_split_flush(AVBSFContext *ctx)
+{
+ VP9SFSplitContext *s = ctx->priv_data;
+ av_packet_unref(s->buffer_pkt);
+}
+
static void vp9_superframe_split_uninit(AVBSFContext *ctx)
{
VP9SFSplitContext *s = ctx->priv_data;
- av_packet_unref(&s->buffer_pkt);
+ av_packet_free(&s->buffer_pkt);
}
const AVBitStreamFilter ff_vp9_superframe_split_bsf = {
.name = "vp9_superframe_split",
.priv_data_size = sizeof(VP9SFSplitContext),
+ .init = vp9_superframe_split_init,
+ .flush = vp9_superframe_split_flush,
.close = vp9_superframe_split_uninit,
.filter = vp9_superframe_split_filter,
.codec_ids = (const enum AVCodecID []){ AV_CODEC_ID_VP9, AV_CODEC_ID_NONE },