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
11c9bd63
Commit
11c9bd63
authored
Oct 03, 2015
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libopenh264enc: export CPB props side data
parent
f0b769c1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
0 deletions
+40
-0
internal.h
libavcodec/internal.h
+5
-0
libopenh264enc.c
libavcodec/libopenh264enc.c
+9
-0
utils.c
libavcodec/utils.c
+26
-0
No files found.
libavcodec/internal.h
View file @
11c9bd63
...
...
@@ -240,4 +240,9 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt);
*/
int
ff_decode_frame_props
(
AVCodecContext
*
avctx
,
AVFrame
*
frame
);
/**
* Add a CPB properties side data to an encoding context.
*/
AVCPBProperties
*
ff_add_cpb_side_data
(
AVCodecContext
*
avctx
);
#endif
/* AVCODEC_INTERNAL_H */
libavcodec/libopenh264enc.c
View file @
11c9bd63
...
...
@@ -108,6 +108,7 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
int
err
=
AVERROR_UNKNOWN
;
int
log_level
;
WelsTraceCallback
callback_function
;
AVCPBProperties
*
props
;
// Mingw GCC < 4.7 on x86_32 uses an incorrect/buggy ABI for the WelsGetCodecVersion
// function (for functions returning larger structs), thus skip the check in those
...
...
@@ -223,6 +224,14 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
memcpy
(
avctx
->
extradata
,
fbi
.
sLayerInfo
[
0
].
pBsBuf
,
size
);
}
props
=
ff_add_cpb_side_data
(
avctx
);
if
(
!
props
)
{
err
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
props
->
max_bitrate
=
param
.
iMaxBitrate
;
props
->
avg_bitrate
=
param
.
iTargetBitrate
;
return
0
;
fail:
...
...
libavcodec/utils.c
View file @
11c9bd63
...
...
@@ -2383,3 +2383,29 @@ AVCPBProperties *av_cpb_properties_alloc(size_t *size)
return
props
;
}
AVCPBProperties
*
ff_add_cpb_side_data
(
AVCodecContext
*
avctx
)
{
AVPacketSideData
*
tmp
;
AVCPBProperties
*
props
;
size_t
size
;
props
=
av_cpb_properties_alloc
(
&
size
);
if
(
!
props
)
return
NULL
;
tmp
=
av_realloc_array
(
avctx
->
coded_side_data
,
avctx
->
nb_coded_side_data
+
1
,
sizeof
(
*
tmp
));
if
(
!
tmp
)
{
av_freep
(
&
props
);
return
NULL
;
}
avctx
->
coded_side_data
=
tmp
;
avctx
->
nb_coded_side_data
++
;
avctx
->
coded_side_data
[
avctx
->
nb_coded_side_data
-
1
].
type
=
AV_PKT_DATA_CPB_PROPERTIES
;
avctx
->
coded_side_data
[
avctx
->
nb_coded_side_data
-
1
].
data
=
(
uint8_t
*
)
props
;
avctx
->
coded_side_data
[
avctx
->
nb_coded_side_data
-
1
].
size
=
size
;
return
props
;
}
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