Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
63e0846c
Commit
63e0846c
authored
Jul 26, 2018
by
James Almer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/vp9_superframe_split_bsf: implement a AVBSFContext.flush() callback
Signed-off-by:
James Almer
<
jamrial@gmail.com
>
parent
390f1564
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
10 deletions
+29
-10
vp9_superframe_split_bsf.c
libavcodec/vp9_superframe_split_bsf.c
+29
-10
No files found.
libavcodec/vp9_superframe_split_bsf.c
View file @
63e0846c
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
#include "get_bits.h"
#include "get_bits.h"
typedef
struct
VP9SFSplitContext
{
typedef
struct
VP9SFSplitContext
{
AVPacket
buffer_pkt
;
AVPacket
*
buffer_pkt
;
int
nb_frames
;
int
nb_frames
;
int
next_frame
;
int
next_frame
;
...
@@ -43,13 +43,13 @@ static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out)
...
@@ -43,13 +43,13 @@ static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out)
VP9SFSplitContext
*
s
=
ctx
->
priv_data
;
VP9SFSplitContext
*
s
=
ctx
->
priv_data
;
AVPacket
*
in
;
AVPacket
*
in
;
int
i
,
j
,
ret
,
marker
;
int
i
,
j
,
ret
,
marker
;
int
is_superframe
=
!!
s
->
buffer_pkt
.
data
;
int
is_superframe
=
!!
s
->
buffer_pkt
->
data
;
if
(
!
s
->
buffer_pkt
.
data
)
{
if
(
!
s
->
buffer_pkt
->
data
)
{
ret
=
ff_bsf_get_packet_ref
(
ctx
,
&
s
->
buffer_pkt
);
ret
=
ff_bsf_get_packet_ref
(
ctx
,
s
->
buffer_pkt
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
return
ret
;
in
=
&
s
->
buffer_pkt
;
in
=
s
->
buffer_pkt
;
marker
=
in
->
data
[
in
->
size
-
1
];
marker
=
in
->
data
[
in
->
size
-
1
];
if
((
marker
&
0xe0
)
==
0xc0
)
{
if
((
marker
&
0xe0
)
==
0xc0
)
{
...
@@ -90,7 +90,7 @@ static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out)
...
@@ -90,7 +90,7 @@ static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out)
GetBitContext
gb
;
GetBitContext
gb
;
int
profile
,
invisible
=
0
;
int
profile
,
invisible
=
0
;
ret
=
av_packet_ref
(
out
,
&
s
->
buffer_pkt
);
ret
=
av_packet_ref
(
out
,
s
->
buffer_pkt
);
if
(
ret
<
0
)
if
(
ret
<
0
)
goto
fail
;
goto
fail
;
...
@@ -101,7 +101,7 @@ static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out)
...
@@ -101,7 +101,7 @@ static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out)
s
->
next_frame
++
;
s
->
next_frame
++
;
if
(
s
->
next_frame
>=
s
->
nb_frames
)
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
);
ret
=
init_get_bits8
(
&
gb
,
out
->
data
,
out
->
size
);
if
(
ret
<
0
)
if
(
ret
<
0
)
...
@@ -121,26 +121,45 @@ static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out)
...
@@ -121,26 +121,45 @@ static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out)
out
->
pts
=
AV_NOPTS_VALUE
;
out
->
pts
=
AV_NOPTS_VALUE
;
}
else
{
}
else
{
av_packet_move_ref
(
out
,
&
s
->
buffer_pkt
);
av_packet_move_ref
(
out
,
s
->
buffer_pkt
);
}
}
return
0
;
return
0
;
fail:
fail:
if
(
ret
<
0
)
if
(
ret
<
0
)
av_packet_unref
(
out
);
av_packet_unref
(
out
);
av_packet_unref
(
&
s
->
buffer_pkt
);
av_packet_unref
(
s
->
buffer_pkt
);
return
ret
;
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
)
static
void
vp9_superframe_split_uninit
(
AVBSFContext
*
ctx
)
{
{
VP9SFSplitContext
*
s
=
ctx
->
priv_data
;
VP9SFSplitContext
*
s
=
ctx
->
priv_data
;
av_packet_
unref
(
&
s
->
buffer_pkt
);
av_packet_
free
(
&
s
->
buffer_pkt
);
}
}
const
AVBitStreamFilter
ff_vp9_superframe_split_bsf
=
{
const
AVBitStreamFilter
ff_vp9_superframe_split_bsf
=
{
.
name
=
"vp9_superframe_split"
,
.
name
=
"vp9_superframe_split"
,
.
priv_data_size
=
sizeof
(
VP9SFSplitContext
),
.
priv_data_size
=
sizeof
(
VP9SFSplitContext
),
.
init
=
vp9_superframe_split_init
,
.
flush
=
vp9_superframe_split_flush
,
.
close
=
vp9_superframe_split_uninit
,
.
close
=
vp9_superframe_split_uninit
,
.
filter
=
vp9_superframe_split_filter
,
.
filter
=
vp9_superframe_split_filter
,
.
codec_ids
=
(
const
enum
AVCodecID
[]){
AV_CODEC_ID_VP9
,
AV_CODEC_ID_NONE
},
.
codec_ids
=
(
const
enum
AVCodecID
[]){
AV_CODEC_ID_VP9
,
AV_CODEC_ID_NONE
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment