Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
a718d84e
Commit
a718d84e
authored
Jan 06, 2022
by
Anton Khirnov
Committed by
Andreas Rheinhardt
Feb 06, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc/libvorbisenc: switch to new FIFO API
parent
6eaf5cd0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
11 deletions
+9
-11
libvorbisenc.c
libavcodec/libvorbisenc.c
+9
-11
No files found.
libavcodec/libvorbisenc.c
View file @
a718d84e
...
...
@@ -46,7 +46,7 @@ typedef struct LibvorbisEncContext {
vorbis_info
vi
;
/**< vorbis_info used during init */
vorbis_dsp_state
vd
;
/**< DSP state used for analysis */
vorbis_block
vb
;
/**< vorbis_block used for analysis */
AVFifo
Buffer
*
pkt_fifo
;
/**< output packet buffer */
AVFifo
*
pkt_fifo
;
/**< output packet buffer */
int
eof
;
/**< end-of-file flag */
int
dsp_initialized
;
/**< vd has been initialized */
vorbis_comment
vc
;
/**< VorbisComment info */
...
...
@@ -196,7 +196,7 @@ static av_cold int libvorbis_encode_close(AVCodecContext *avctx)
vorbis_dsp_clear
(
&
s
->
vd
);
vorbis_info_clear
(
&
s
->
vi
);
av_fifo_freep
(
&
s
->
pkt_fifo
);
av_fifo_freep
2
(
&
s
->
pkt_fifo
);
ff_af_queue_close
(
&
s
->
afq
);
av_vorbis_parse_free
(
&
s
->
vp
);
...
...
@@ -271,7 +271,7 @@ static av_cold int libvorbis_encode_init(AVCodecContext *avctx)
avctx
->
frame_size
=
LIBVORBIS_FRAME_SIZE
;
ff_af_queue_init
(
avctx
,
&
s
->
afq
);
s
->
pkt_fifo
=
av_fifo_alloc
(
BUFFER_SIZE
);
s
->
pkt_fifo
=
av_fifo_alloc
2
(
BUFFER_SIZE
,
1
,
0
);
if
(
!
s
->
pkt_fifo
)
{
ret
=
AVERROR
(
ENOMEM
);
goto
error
;
...
...
@@ -327,12 +327,12 @@ static int libvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
/* add any available packets to the output packet buffer */
while
((
ret
=
vorbis_bitrate_flushpacket
(
&
s
->
vd
,
&
op
))
==
1
)
{
if
(
av_fifo_
spac
e
(
s
->
pkt_fifo
)
<
sizeof
(
ogg_packet
)
+
op
.
bytes
)
{
if
(
av_fifo_
can_writ
e
(
s
->
pkt_fifo
)
<
sizeof
(
ogg_packet
)
+
op
.
bytes
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"packet buffer is too small
\n
"
);
return
AVERROR_BUG
;
}
av_fifo_
generic_write
(
s
->
pkt_fifo
,
&
op
,
sizeof
(
ogg_packet
),
NULL
);
av_fifo_
generic_write
(
s
->
pkt_fifo
,
op
.
packet
,
op
.
bytes
,
NULL
);
av_fifo_
write
(
s
->
pkt_fifo
,
&
op
,
sizeof
(
ogg_packet
)
);
av_fifo_
write
(
s
->
pkt_fifo
,
op
.
packet
,
op
.
bytes
);
}
if
(
ret
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"error getting available packets
\n
"
);
...
...
@@ -344,15 +344,13 @@ static int libvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
return
vorbis_error_to_averror
(
ret
);
}
/*
check for available packets
*/
if
(
av_fifo_
size
(
s
->
pkt_fifo
)
<
sizeof
(
ogg_packet
)
)
/*
Read an available packet if possible
*/
if
(
av_fifo_
read
(
s
->
pkt_fifo
,
&
op
,
sizeof
(
ogg_packet
))
<
0
)
return
0
;
av_fifo_generic_read
(
s
->
pkt_fifo
,
&
op
,
sizeof
(
ogg_packet
),
NULL
);
if
((
ret
=
ff_get_encode_buffer
(
avctx
,
avpkt
,
op
.
bytes
,
0
))
<
0
)
return
ret
;
av_fifo_
generic_read
(
s
->
pkt_fifo
,
avpkt
->
data
,
op
.
bytes
,
NULL
);
av_fifo_
read
(
s
->
pkt_fifo
,
avpkt
->
data
,
op
.
bytes
);
avpkt
->
pts
=
ff_samples_to_time_base
(
avctx
,
op
.
granulepos
);
...
...
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