Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
233351e9
Commit
233351e9
authored
Sep 27, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec: inline ffmpeg_NewPictBuf()
parent
1bb171da
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
20 deletions
+25
-20
modules/codec/avcodec/video.c
modules/codec/avcodec/video.c
+25
-20
No files found.
modules/codec/avcodec/video.c
View file @
233351e9
...
...
@@ -199,17 +199,6 @@ static int lavc_UpdateVideoFormat( decoder_t *p_dec, AVCodecContext *p_context,
return
decoder_UpdateVideoFormat
(
p_dec
);
}
/* Returns a new picture buffer */
static
inline
picture_t
*
ffmpeg_NewPictBuf
(
decoder_t
*
p_dec
,
AVCodecContext
*
p_context
)
{
bool
hwaccel
=
p_dec
->
p_sys
->
p_va
!=
NULL
;
if
(
lavc_UpdateVideoFormat
(
p_dec
,
p_context
,
hwaccel
))
return
NULL
;
return
decoder_NewPicture
(
p_dec
);
}
/**
* Copies a picture from the libavcodec-allocate buffer to a picture_t.
* This is used when not in direct rendering mode.
...
...
@@ -772,10 +761,13 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
picture_t
*
p_pic
=
frame
->
opaque
;
if
(
p_pic
==
NULL
)
{
/* Get a new picture */
if
(
p_sys
->
p_va
==
NULL
)
p_pic
=
ffmpeg_NewPictBuf
(
p_dec
,
p_context
);
{
/* When direct rendering is not used, get_format() and get_buffer()
* might not be called. The output video format must be set here
* then picture buffer can be allocated. */
if
(
p_sys
->
p_va
==
NULL
&&
lavc_UpdateVideoFormat
(
p_dec
,
p_context
,
false
)
==
0
)
p_pic
=
decoder_NewPicture
(
p_dec
);
if
(
!
p_pic
)
{
av_frame_free
(
&
frame
);
...
...
@@ -1052,14 +1044,27 @@ static int lavc_GetFrame(struct AVCodecContext *ctx, AVFrame *frame, int flags)
frame
->
opaque
=
NULL
;
wait_mt
(
sys
);
if
(
sys
->
p_va
==
NULL
&&
!
sys
->
b_direct_rendering
)
if
(
sys
->
p_va
==
NULL
)
{
if
(
!
sys
->
b_direct_rendering
)
{
post_mt
(
sys
);
return
avcodec_default_get_buffer2
(
ctx
,
frame
,
flags
);
}
/* The semaphore protects updates to fmt_out */
pic
=
ffmpeg_NewPictBuf
(
dec
,
ctx
);
/* Most unaccelerated decoders do not call get_format(), so we need to
* update the output video format here. The MT semaphore must be held
* to protect p_dec->fmt_out. */
if
(
lavc_UpdateVideoFormat
(
dec
,
ctx
,
false
))
{
post_mt
(
sys
);
return
-
1
;
}
}
/* FIXME: The core forces an extra output format update here, so the
* semaphore is still needed. */
pic
=
decoder_NewPicture
(
dec
);
post_mt
(
sys
);
if
(
pic
==
NULL
)
return
-
1
;
...
...
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