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
4a0f6651
Commit
4a0f6651
authored
Feb 19, 2014
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libavcodec: when decoding, copy replaygain side data to decoded frames
parent
5a7e35dd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
9 deletions
+43
-9
internal.h
libavcodec/internal.h
+5
-0
rawdec.c
libavcodec/rawdec.c
+4
-2
utils.c
libavcodec/utils.c
+34
-7
No files found.
libavcodec/internal.h
View file @
4a0f6651
...
...
@@ -186,4 +186,9 @@ int ff_set_dimensions(AVCodecContext *s, int width, int height);
int
ff_side_data_update_matrix_encoding
(
AVFrame
*
frame
,
enum
AVMatrixEncoding
matrix_encoding
);
/**
* Set various frame properties from the codec context / packet data.
*/
int
ff_decode_frame_props
(
AVCodecContext
*
avctx
,
AVFrame
*
frame
);
#endif
/* AVCODEC_INTERNAL_H */
libavcodec/rawdec.c
View file @
4a0f6651
...
...
@@ -150,8 +150,10 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
frame
->
pict_type
=
AV_PICTURE_TYPE_I
;
frame
->
key_frame
=
1
;
frame
->
reordered_opaque
=
avctx
->
reordered_opaque
;
frame
->
pkt_pts
=
avctx
->
internal
->
pkt
->
pts
;
res
=
ff_decode_frame_props
(
avctx
,
frame
);
if
(
res
<
0
)
return
res
;
if
(
buf_size
<
context
->
frame_size
-
(
avctx
->
pix_fmt
==
AV_PIX_FMT_PAL8
?
AVPALETTE_SIZE
:
0
))
...
...
libavcodec/utils.c
View file @
4a0f6651
...
...
@@ -572,6 +572,35 @@ static void compat_release_buffer(void *opaque, uint8_t *data)
FF_ENABLE_DEPRECATION_WARNINGS
#endif
int
ff_decode_frame_props
(
AVCodecContext
*
avctx
,
AVFrame
*
frame
)
{
AVPacket
*
pkt
=
avctx
->
internal
->
pkt
;
uint8_t
*
packet_sd
;
int
size
;
AVFrameSideData
*
frame_sd
;
frame
->
reordered_opaque
=
avctx
->
reordered_opaque
;
if
(
!
pkt
)
{
frame
->
pkt_pts
=
AV_NOPTS_VALUE
;
return
0
;
}
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
);
}
return
0
;
}
int
ff_get_buffer
(
AVCodecContext
*
avctx
,
AVFrame
*
frame
,
int
flags
)
{
int
override_dimensions
=
1
;
...
...
@@ -623,8 +652,9 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
default
:
return
AVERROR
(
EINVAL
);
}
frame
->
pkt_pts
=
avctx
->
internal
->
pkt
?
avctx
->
internal
->
pkt
->
pts
:
AV_NOPTS_VALUE
;
frame
->
reordered_opaque
=
avctx
->
reordered_opaque
;
ret
=
ff_decode_frame_props
(
avctx
,
frame
);
if
(
ret
<
0
)
return
ret
;
#if FF_API_GET_BUFFER
FF_DISABLE_DEPRECATION_WARNINGS
...
...
@@ -762,11 +792,8 @@ int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame)
if
(
!
frame
->
data
[
0
])
return
ff_get_buffer
(
avctx
,
frame
,
AV_GET_BUFFER_FLAG_REF
);
if
(
av_frame_is_writable
(
frame
))
{
frame
->
pkt_pts
=
avctx
->
internal
->
pkt
?
avctx
->
internal
->
pkt
->
pts
:
AV_NOPTS_VALUE
;
frame
->
reordered_opaque
=
avctx
->
reordered_opaque
;
return
0
;
}
if
(
av_frame_is_writable
(
frame
))
return
ff_decode_frame_props
(
avctx
,
frame
);
tmp
=
av_frame_alloc
();
if
(
!
tmp
)
...
...
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