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