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
d2287740
Commit
d2287740
authored
Nov 09, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libx264: use the AVFrame API properly.
parent
394ef4d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
libx264.c
libavcodec/libx264.c
+9
-6
No files found.
libavcodec/libx264.c
View file @
d2287740
...
@@ -44,7 +44,6 @@ typedef struct X264Context {
...
@@ -44,7 +44,6 @@ typedef struct X264Context {
x264_picture_t
pic
;
x264_picture_t
pic
;
uint8_t
*
sei
;
uint8_t
*
sei
;
int
sei_size
;
int
sei_size
;
AVFrame
out_pic
;
char
*
preset
;
char
*
preset
;
char
*
tune
;
char
*
tune
;
char
*
profile
;
char
*
profile
;
...
@@ -181,20 +180,20 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
...
@@ -181,20 +180,20 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
switch
(
pic_out
.
i_type
)
{
switch
(
pic_out
.
i_type
)
{
case
X264_TYPE_IDR
:
case
X264_TYPE_IDR
:
case
X264_TYPE_I
:
case
X264_TYPE_I
:
x4
->
out_pic
.
pict_type
=
AV_PICTURE_TYPE_I
;
ctx
->
coded_frame
->
pict_type
=
AV_PICTURE_TYPE_I
;
break
;
break
;
case
X264_TYPE_P
:
case
X264_TYPE_P
:
x4
->
out_pic
.
pict_type
=
AV_PICTURE_TYPE_P
;
ctx
->
coded_frame
->
pict_type
=
AV_PICTURE_TYPE_P
;
break
;
break
;
case
X264_TYPE_B
:
case
X264_TYPE_B
:
case
X264_TYPE_BREF
:
case
X264_TYPE_BREF
:
x4
->
out_pic
.
pict_type
=
AV_PICTURE_TYPE_B
;
ctx
->
coded_frame
->
pict_type
=
AV_PICTURE_TYPE_B
;
break
;
break
;
}
}
pkt
->
flags
|=
AV_PKT_FLAG_KEY
*
pic_out
.
b_keyframe
;
pkt
->
flags
|=
AV_PKT_FLAG_KEY
*
pic_out
.
b_keyframe
;
if
(
ret
)
if
(
ret
)
x4
->
out_pic
.
quality
=
(
pic_out
.
i_qpplus1
-
1
)
*
FF_QP2LAMBDA
;
ctx
->
coded_frame
->
quality
=
(
pic_out
.
i_qpplus1
-
1
)
*
FF_QP2LAMBDA
;
*
got_packet
=
ret
;
*
got_packet
=
ret
;
return
0
;
return
0
;
...
@@ -210,6 +209,8 @@ static av_cold int X264_close(AVCodecContext *avctx)
...
@@ -210,6 +209,8 @@ static av_cold int X264_close(AVCodecContext *avctx)
if
(
x4
->
enc
)
if
(
x4
->
enc
)
x264_encoder_close
(
x4
->
enc
);
x264_encoder_close
(
x4
->
enc
);
av_frame_free
(
&
avctx
->
coded_frame
);
return
0
;
return
0
;
}
}
...
@@ -450,7 +451,9 @@ static av_cold int X264_init(AVCodecContext *avctx)
...
@@ -450,7 +451,9 @@ static av_cold int X264_init(AVCodecContext *avctx)
if
(
!
x4
->
enc
)
if
(
!
x4
->
enc
)
return
-
1
;
return
-
1
;
avctx
->
coded_frame
=
&
x4
->
out_pic
;
avctx
->
coded_frame
=
av_frame_alloc
();
if
(
!
avctx
->
coded_frame
)
return
AVERROR
(
ENOMEM
);
if
(
avctx
->
flags
&
CODEC_FLAG_GLOBAL_HEADER
)
{
if
(
avctx
->
flags
&
CODEC_FLAG_GLOBAL_HEADER
)
{
x264_nal_t
*
nal
;
x264_nal_t
*
nal
;
...
...
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