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
ad092de0
Commit
ad092de0
authored
Apr 21, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec: deindent, cleanup and fix comments
No functional changes.
parent
34537022
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
62 deletions
+56
-62
modules/codec/avcodec/video.c
modules/codec/avcodec/video.c
+56
-62
No files found.
modules/codec/avcodec/video.c
View file @
ad092de0
...
@@ -96,7 +96,6 @@ struct decoder_sys_t
...
@@ -96,7 +96,6 @@ struct decoder_sys_t
* Local prototypes
* Local prototypes
*****************************************************************************/
*****************************************************************************/
static
void
ffmpeg_InitCodec
(
decoder_t
*
);
static
void
ffmpeg_InitCodec
(
decoder_t
*
);
static
void
ffmpeg_CopyPicture
(
decoder_t
*
,
picture_t
*
,
AVFrame
*
);
#if LIBAVCODEC_VERSION_MAJOR >= 55
#if LIBAVCODEC_VERSION_MAJOR >= 55
static
int
lavc_GetFrame
(
struct
AVCodecContext
*
,
AVFrame
*
,
int
);
static
int
lavc_GetFrame
(
struct
AVCodecContext
*
,
AVFrame
*
,
int
);
#else
#else
...
@@ -206,6 +205,60 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec,
...
@@ -206,6 +205,60 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec,
return
decoder_NewPicture
(
p_dec
);
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.
*/
static
void
lavc_CopyPicture
(
decoder_t
*
dec
,
picture_t
*
pic
,
AVFrame
*
frame
)
{
decoder_sys_t
*
sys
=
dec
->
p_sys
;
if
(
sys
->
p_va
!=
NULL
)
{
vlc_va_Extract
(
sys
->
p_va
,
pic
,
frame
->
opaque
,
frame
->
data
[
3
]);
return
;
}
if
(
!
FindVlcChroma
(
sys
->
p_context
->
pix_fmt
))
{
const
char
*
name
=
av_get_pix_fmt_name
(
sys
->
p_context
->
pix_fmt
);
msg_Err
(
dec
,
"Unsupported decoded output format %d (%s)"
,
sys
->
p_context
->
pix_fmt
,
(
name
!=
NULL
)
?
name
:
"unknown"
);
dec
->
b_error
=
true
;
return
;
}
for
(
int
plane
=
0
;
plane
<
pic
->
i_planes
;
plane
++
)
{
const
uint8_t
*
src
=
frame
->
data
[
plane
];
uint8_t
*
dst
=
pic
->
p
[
plane
].
p_pixels
;
size_t
src_stride
=
frame
->
linesize
[
plane
];
size_t
dst_stride
=
pic
->
p
[
plane
].
i_pitch
;
size_t
size
=
__MIN
(
src_stride
,
dst_stride
);
for
(
int
line
=
0
;
line
<
pic
->
p
[
plane
].
i_visible_lines
;
line
++
)
{
memcpy
(
dst
,
src
,
size
);
src
+=
src_stride
;
dst
+=
dst_stride
;
}
}
if
(
unlikely
(
sys
->
p_context
->
pix_fmt
==
PIX_FMT_PAL8
))
{
if
(
pic
->
format
.
p_palette
==
NULL
)
pic
->
format
.
p_palette
=
calloc
(
1
,
sizeof
(
video_palette_t
));
if
(
likely
(
pic
->
format
.
p_palette
!=
NULL
))
{
pic
->
format
.
p_palette
->
i_entries
=
AVPALETTE_COUNT
;
memcpy
(
pic
->
format
.
p_palette
->
palette
,
frame
->
data
[
1
],
AVPALETTE_SIZE
);
}
}
}
static
int
OpenVideoCodec
(
decoder_t
*
p_dec
)
static
int
OpenVideoCodec
(
decoder_t
*
p_dec
)
{
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
...
@@ -762,9 +815,8 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
...
@@ -762,9 +815,8 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
return
NULL
;
return
NULL
;
}
}
/* Fill p_picture_t from AVVideoFrame and do chroma conversion
/* Fill picture_t from AVFrame */
* if needed */
lavc_CopyPicture
(
p_dec
,
p_pic
,
p_sys
->
p_ff_pic
);
ffmpeg_CopyPicture
(
p_dec
,
p_pic
,
p_sys
->
p_ff_pic
);
}
}
else
else
{
{
...
@@ -910,64 +962,6 @@ static void ffmpeg_InitCodec( decoder_t *p_dec )
...
@@ -910,64 +962,6 @@ static void ffmpeg_InitCodec( decoder_t *p_dec )
}
}
}
}
/*****************************************************************************
* ffmpeg_CopyPicture: copy a picture from ffmpeg internal buffers to a
* picture_t structure (when not in direct rendering mode).
*****************************************************************************/
static
void
ffmpeg_CopyPicture
(
decoder_t
*
p_dec
,
picture_t
*
p_pic
,
AVFrame
*
p_ff_pic
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
if
(
p_sys
->
p_va
)
{
vlc_va_Extract
(
p_sys
->
p_va
,
p_pic
,
p_ff_pic
->
opaque
,
p_ff_pic
->
data
[
3
]
);
}
else
if
(
FindVlcChroma
(
p_sys
->
p_context
->
pix_fmt
)
)
{
int
i_plane
,
i_size
,
i_line
;
uint8_t
*
p_dst
,
*
p_src
;
int
i_src_stride
,
i_dst_stride
;
if
(
p_sys
->
p_context
->
pix_fmt
==
PIX_FMT_PAL8
)
{
if
(
!
p_pic
->
format
.
p_palette
)
p_pic
->
format
.
p_palette
=
calloc
(
1
,
sizeof
(
video_palette_t
)
);
if
(
p_pic
->
format
.
p_palette
)
{
p_pic
->
format
.
p_palette
->
i_entries
=
AVPALETTE_COUNT
;
memcpy
(
p_pic
->
format
.
p_palette
->
palette
,
p_ff_pic
->
data
[
1
],
AVPALETTE_SIZE
);
}
}
for
(
i_plane
=
0
;
i_plane
<
p_pic
->
i_planes
;
i_plane
++
)
{
p_src
=
p_ff_pic
->
data
[
i_plane
];
p_dst
=
p_pic
->
p
[
i_plane
].
p_pixels
;
i_src_stride
=
p_ff_pic
->
linesize
[
i_plane
];
i_dst_stride
=
p_pic
->
p
[
i_plane
].
i_pitch
;
i_size
=
__MIN
(
i_src_stride
,
i_dst_stride
);
for
(
i_line
=
0
;
i_line
<
p_pic
->
p
[
i_plane
].
i_visible_lines
;
i_line
++
)
{
memcpy
(
p_dst
,
p_src
,
i_size
);
p_src
+=
i_src_stride
;
p_dst
+=
i_dst_stride
;
}
}
}
else
{
const
char
*
name
=
av_get_pix_fmt_name
(
p_sys
->
p_context
->
pix_fmt
);
msg_Err
(
p_dec
,
"Unsupported decoded output format %d (%s)"
,
p_sys
->
p_context
->
pix_fmt
,
name
?
name
:
"unknown"
);
p_dec
->
b_error
=
1
;
}
}
#if LIBAVCODEC_VERSION_MAJOR >= 55
#if LIBAVCODEC_VERSION_MAJOR >= 55
static
int
lavc_va_GetFrame
(
struct
AVCodecContext
*
ctx
,
AVFrame
*
frame
,
static
int
lavc_va_GetFrame
(
struct
AVCodecContext
*
ctx
,
AVFrame
*
frame
,
int
flags
)
int
flags
)
...
...
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