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
e3e317e0
Commit
e3e317e0
authored
Nov 04, 2014
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc: Compact the side-data passthrough
parent
9a5ac36b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
29 deletions
+21
-29
utils.c
libavcodec/utils.c
+21
-29
No files found.
libavcodec/utils.c
View file @
e3e317e0
...
...
@@ -560,9 +560,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
int
ff_decode_frame_props
(
AVCodecContext
*
avctx
,
AVFrame
*
frame
)
{
AVPacket
*
pkt
=
avctx
->
internal
->
pkt
;
uint8_t
*
packet_sd
;
int
size
;
AVFrameSideData
*
frame_sd
;
int
i
;
struct
{
enum
AVPacketSideDataType
packet
;
enum
AVFrameSideDataType
frame
;
}
sd
[]
=
{
{
AV_PKT_DATA_REPLAYGAIN
,
AV_FRAME_DATA_REPLAYGAIN
},
{
AV_PKT_DATA_DISPLAYMATRIX
,
AV_FRAME_DATA_DISPLAYMATRIX
},
{
AV_PKT_DATA_STEREO3D
,
AV_FRAME_DATA_STEREO3D
},
};
frame
->
color_primaries
=
avctx
->
color_primaries
;
frame
->
color_trc
=
avctx
->
color_trc
;
...
...
@@ -578,32 +584,18 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
frame
->
pkt_pts
=
pkt
->
pts
;
/* copy the replaygain data to the output frame */
packet_sd
=
av_packet_get_side_data
(
pkt
,
AV_PKT_DATA_REPLAYGAIN
,
&
size
);
if
(
packet_sd
)
{
frame_sd
=
av_frame_new_side_data
(
frame
,
AV_FRAME_DATA_REPLAYGAIN
,
size
);
if
(
!
frame_sd
)
return
AVERROR
(
ENOMEM
);
memcpy
(
frame_sd
->
data
,
packet_sd
,
size
);
}
/* copy the displaymatrix to the output frame */
packet_sd
=
av_packet_get_side_data
(
pkt
,
AV_PKT_DATA_DISPLAYMATRIX
,
&
size
);
if
(
packet_sd
)
{
frame_sd
=
av_frame_new_side_data
(
frame
,
AV_FRAME_DATA_DISPLAYMATRIX
,
size
);
if
(
!
frame_sd
)
return
AVERROR
(
ENOMEM
);
memcpy
(
frame_sd
->
data
,
packet_sd
,
size
);
}
/* copy the stereo3d format to the output frame */
packet_sd
=
av_packet_get_side_data
(
pkt
,
AV_PKT_DATA_STEREO3D
,
&
size
);
if
(
packet_sd
)
{
frame_sd
=
av_frame_new_side_data
(
frame
,
AV_FRAME_DATA_STEREO3D
,
size
);
if
(
!
frame_sd
)
return
AVERROR
(
ENOMEM
);
memcpy
(
frame_sd
->
data
,
packet_sd
,
size
);
for
(
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
sd
);
i
++
)
{
int
size
;
uint8_t
*
packet_sd
=
av_packet_get_side_data
(
pkt
,
sd
[
i
].
packet
,
&
size
);
if
(
packet_sd
)
{
AVFrameSideData
*
frame_sd
=
av_frame_new_side_data
(
frame
,
sd
[
i
].
frame
,
size
);
if
(
!
frame_sd
)
return
AVERROR
(
ENOMEM
);
memcpy
(
frame_sd
->
data
,
packet_sd
,
size
);
}
}
return
0
;
...
...
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