Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
b18c7c8d
Commit
b18c7c8d
authored
11 years ago
by
Anton Khirnov
Browse files
Options
Downloads
Patches
Plain Diff
libxavs: use the AVFrame API properly.
parent
5290e02a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavcodec/libxavs.c
+12
-8
12 additions, 8 deletions
libavcodec/libxavs.c
with
12 additions
and
8 deletions
libavcodec/libxavs.c
+
12
−
8
View file @
b18c7c8d
...
@@ -45,7 +45,6 @@ typedef struct XavsContext {
...
@@ -45,7 +45,6 @@ typedef struct XavsContext {
xavs_picture_t
pic
;
xavs_picture_t
pic
;
uint8_t
*
sei
;
uint8_t
*
sei
;
int
sei_size
;
int
sei_size
;
AVFrame
out_pic
;
int
end_of_stream
;
int
end_of_stream
;
float
crf
;
float
crf
;
int
cqp
;
int
cqp
;
...
@@ -161,7 +160,7 @@ static int XAVS_frame(AVCodecContext *ctx, AVPacket *pkt,
...
@@ -161,7 +160,7 @@ static int XAVS_frame(AVCodecContext *ctx, AVPacket *pkt,
return
0
;
return
0
;
}
}
x4
->
out_pic
.
pts
=
pic_out
.
i_pts
;
avctx
->
coded_frame
->
pts
=
pic_out
.
i_pts
;
pkt
->
pts
=
pic_out
.
i_pts
;
pkt
->
pts
=
pic_out
.
i_pts
;
if
(
ctx
->
has_b_frames
)
{
if
(
ctx
->
has_b_frames
)
{
if
(
!
x4
->
out_frame_count
)
if
(
!
x4
->
out_frame_count
)
...
@@ -174,25 +173,25 @@ static int XAVS_frame(AVCodecContext *ctx, AVPacket *pkt,
...
@@ -174,25 +173,25 @@ static int XAVS_frame(AVCodecContext *ctx, AVPacket *pkt,
switch
(
pic_out
.
i_type
)
{
switch
(
pic_out
.
i_type
)
{
case
XAVS_TYPE_IDR
:
case
XAVS_TYPE_IDR
:
case
XAVS_TYPE_I
:
case
XAVS_TYPE_I
:
x4
->
out_pic
.
pict_type
=
AV_PICTURE_TYPE_I
;
avctx
->
coded_frame
->
pict_type
=
AV_PICTURE_TYPE_I
;
break
;
break
;
case
XAVS_TYPE_P
:
case
XAVS_TYPE_P
:
x4
->
out_pic
.
pict_type
=
AV_PICTURE_TYPE_P
;
avctx
->
coded_frame
->
pict_type
=
AV_PICTURE_TYPE_P
;
break
;
break
;
case
XAVS_TYPE_B
:
case
XAVS_TYPE_B
:
case
XAVS_TYPE_BREF
:
case
XAVS_TYPE_BREF
:
x4
->
out_pic
.
pict_type
=
AV_PICTURE_TYPE_B
;
avctx
->
coded_frame
->
pict_type
=
AV_PICTURE_TYPE_B
;
break
;
break
;
}
}
/* There is no IDR frame in AVS JiZhun */
/* There is no IDR frame in AVS JiZhun */
/* Sequence header is used as a flag */
/* Sequence header is used as a flag */
if
(
pic_out
.
i_type
==
XAVS_TYPE_I
)
{
if
(
pic_out
.
i_type
==
XAVS_TYPE_I
)
{
x4
->
out_pic
.
key_frame
=
1
;
avctx
->
coded_frame
->
key_frame
=
1
;
pkt
->
flags
|=
AV_PKT_FLAG_KEY
;
pkt
->
flags
|=
AV_PKT_FLAG_KEY
;
}
}
x4
->
out_pic
.
quality
=
(
pic_out
.
i_qpplus1
-
1
)
*
FF_QP2LAMBDA
;
avctx
->
coded_frame
->
quality
=
(
pic_out
.
i_qpplus1
-
1
)
*
FF_QP2LAMBDA
;
x4
->
out_frame_count
++
;
x4
->
out_frame_count
++
;
*
got_packet
=
ret
;
*
got_packet
=
ret
;
...
@@ -210,6 +209,8 @@ static av_cold int XAVS_close(AVCodecContext *avctx)
...
@@ -210,6 +209,8 @@ static av_cold int XAVS_close(AVCodecContext *avctx)
if
(
x4
->
enc
)
if
(
x4
->
enc
)
xavs_encoder_close
(
x4
->
enc
);
xavs_encoder_close
(
x4
->
enc
);
av_frame_free
(
&
avctx
->
coded_frame
);
return
0
;
return
0
;
}
}
...
@@ -357,7 +358,10 @@ static av_cold int XAVS_init(AVCodecContext *avctx)
...
@@ -357,7 +358,10 @@ static av_cold int XAVS_init(AVCodecContext *avctx)
if
(
!
(
x4
->
pts_buffer
=
av_mallocz
((
avctx
->
max_b_frames
+
1
)
*
sizeof
(
*
x4
->
pts_buffer
))))
if
(
!
(
x4
->
pts_buffer
=
av_mallocz
((
avctx
->
max_b_frames
+
1
)
*
sizeof
(
*
x4
->
pts_buffer
))))
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
avctx
->
coded_frame
=
&
x4
->
out_pic
;
avctx
->
coded_frame
=
av_frame_alloc
();
if
(
!
avctx
->
coded_frame
)
return
AVERROR
(
ENOMEM
);
/* TAG: Do we have GLOBAL HEADER in AVS */
/* TAG: Do we have GLOBAL HEADER in AVS */
/* We Have PPS and SPS in AVS */
/* We Have PPS and SPS in AVS */
if
(
avctx
->
flags
&
CODEC_FLAG_GLOBAL_HEADER
)
{
if
(
avctx
->
flags
&
CODEC_FLAG_GLOBAL_HEADER
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment