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
6a08d7fc
Commit
6a08d7fc
authored
11 years ago
by
Anton Khirnov
Browse files
Options
Downloads
Patches
Plain Diff
sgienc: use the AVFrame API properly.
parent
730bac7b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavcodec/sgienc.c
+13
-14
13 additions, 14 deletions
libavcodec/sgienc.c
with
13 additions
and
14 deletions
libavcodec/sgienc.c
+
13
−
14
View file @
6a08d7fc
...
@@ -28,16 +28,11 @@
...
@@ -28,16 +28,11 @@
#define SGI_SINGLE_CHAN 2
#define SGI_SINGLE_CHAN 2
#define SGI_MULTI_CHAN 3
#define SGI_MULTI_CHAN 3
typedef
struct
SgiContext
{
AVFrame
picture
;
}
SgiContext
;
static
av_cold
int
encode_init
(
AVCodecContext
*
avctx
)
static
av_cold
int
encode_init
(
AVCodecContext
*
avctx
)
{
{
SgiContext
*
s
=
avctx
->
priv_data
;
avctx
->
coded_frame
=
av_frame_alloc
();
if
(
!
avctx
->
coded_frame
)
avcodec_get_frame_defaults
(
&
s
->
picture
);
return
AVERROR
(
ENOMEM
);
avctx
->
coded_frame
=
&
s
->
picture
;
return
0
;
return
0
;
}
}
...
@@ -45,16 +40,14 @@ static av_cold int encode_init(AVCodecContext *avctx)
...
@@ -45,16 +40,14 @@ static av_cold int encode_init(AVCodecContext *avctx)
static
int
encode_frame
(
AVCodecContext
*
avctx
,
AVPacket
*
pkt
,
static
int
encode_frame
(
AVCodecContext
*
avctx
,
AVPacket
*
pkt
,
const
AVFrame
*
frame
,
int
*
got_packet
)
const
AVFrame
*
frame
,
int
*
got_packet
)
{
{
SgiContext
*
s
=
avctx
->
priv_data
;
const
AVFrame
*
const
p
=
frame
;
AVFrame
*
const
p
=
&
s
->
picture
;
uint8_t
*
offsettab
,
*
lengthtab
,
*
in_buf
,
*
encode_buf
,
*
buf
;
uint8_t
*
offsettab
,
*
lengthtab
,
*
in_buf
,
*
encode_buf
,
*
buf
;
int
x
,
y
,
z
,
length
,
tablesize
,
ret
;
int
x
,
y
,
z
,
length
,
tablesize
,
ret
;
unsigned
int
width
,
height
,
depth
,
dimension
;
unsigned
int
width
,
height
,
depth
,
dimension
;
unsigned
char
*
end_buf
;
unsigned
char
*
end_buf
;
*
p
=
*
frame
;
avctx
->
coded_frame
->
pict_type
=
AV_PICTURE_TYPE_I
;
p
->
pict_type
=
AV_PICTURE_TYPE_I
;
avctx
->
coded_frame
->
key_frame
=
1
;
p
->
key_frame
=
1
;
width
=
avctx
->
width
;
width
=
avctx
->
width
;
height
=
avctx
->
height
;
height
=
avctx
->
height
;
...
@@ -170,14 +163,20 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -170,14 +163,20 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
return
0
;
return
0
;
}
}
static
av_cold
int
encode_close
(
AVCodecContext
*
avctx
)
{
av_frame_free
(
&
avctx
->
coded_frame
);
return
0
;
}
AVCodec
ff_sgi_encoder
=
{
AVCodec
ff_sgi_encoder
=
{
.
name
=
"sgi"
,
.
name
=
"sgi"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"SGI image"
),
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"SGI image"
),
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
id
=
AV_CODEC_ID_SGI
,
.
id
=
AV_CODEC_ID_SGI
,
.
priv_data_size
=
sizeof
(
SgiContext
),
.
init
=
encode_init
,
.
init
=
encode_init
,
.
encode2
=
encode_frame
,
.
encode2
=
encode_frame
,
.
close
=
encode_close
,
.
pix_fmts
=
(
const
enum
AVPixelFormat
[]){
.
pix_fmts
=
(
const
enum
AVPixelFormat
[]){
AV_PIX_FMT_RGB24
,
AV_PIX_FMT_RGBA
,
AV_PIX_FMT_GRAY8
,
AV_PIX_FMT_NONE
AV_PIX_FMT_RGB24
,
AV_PIX_FMT_RGBA
,
AV_PIX_FMT_GRAY8
,
AV_PIX_FMT_NONE
},
},
...
...
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