Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
68af7f54
Commit
68af7f54
authored
Nov 09, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
smc: use the AVFrame API properly.
parent
32f7cf9b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
smc.c
libavcodec/smc.c
+12
-10
No files found.
libavcodec/smc.c
View file @
68af7f54
...
...
@@ -46,7 +46,7 @@
typedef
struct
SmcContext
{
AVCodecContext
*
avctx
;
AVFrame
frame
;
AVFrame
*
frame
;
GetByteContext
gb
;
...
...
@@ -81,7 +81,7 @@ static void smc_decode_stream(SmcContext *s)
{
int
width
=
s
->
avctx
->
width
;
int
height
=
s
->
avctx
->
height
;
int
stride
=
s
->
frame
.
linesize
[
0
];
int
stride
=
s
->
frame
->
linesize
[
0
];
int
i
;
int
chunk_size
;
int
buf_size
=
(
int
)
(
s
->
gb
.
buffer_end
-
s
->
gb
.
buffer_start
);
...
...
@@ -92,9 +92,9 @@ static void smc_decode_stream(SmcContext *s)
unsigned
int
color_flags_b
;
unsigned
int
flag_mask
;
unsigned
char
*
pixels
=
s
->
frame
.
data
[
0
];
unsigned
char
*
pixels
=
s
->
frame
->
data
[
0
];
int
image_size
=
height
*
s
->
frame
.
linesize
[
0
];
int
image_size
=
height
*
s
->
frame
->
linesize
[
0
];
int
row_ptr
=
0
;
int
pixel_ptr
=
0
;
int
pixel_x
,
pixel_y
;
...
...
@@ -112,7 +112,7 @@ static void smc_decode_stream(SmcContext *s)
int
color_octet_index
=
0
;
/* make the palette available */
memcpy
(
s
->
frame
.
data
[
1
],
s
->
pal
,
AVPALETTE_SIZE
);
memcpy
(
s
->
frame
->
data
[
1
],
s
->
pal
,
AVPALETTE_SIZE
);
bytestream2_skip
(
&
s
->
gb
,
1
);
chunk_size
=
bytestream2_get_be24
(
&
s
->
gb
);
...
...
@@ -417,7 +417,9 @@ static av_cold int smc_decode_init(AVCodecContext *avctx)
s
->
avctx
=
avctx
;
avctx
->
pix_fmt
=
AV_PIX_FMT_PAL8
;
avcodec_get_frame_defaults
(
&
s
->
frame
);
s
->
frame
=
av_frame_alloc
();
if
(
!
s
->
frame
)
return
AVERROR
(
ENOMEM
);
return
0
;
}
...
...
@@ -434,20 +436,20 @@ static int smc_decode_frame(AVCodecContext *avctx,
bytestream2_init
(
&
s
->
gb
,
buf
,
buf_size
);
if
((
ret
=
ff_reget_buffer
(
avctx
,
&
s
->
frame
))
<
0
)
{
if
((
ret
=
ff_reget_buffer
(
avctx
,
s
->
frame
))
<
0
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"reget_buffer() failed
\n
"
);
return
ret
;
}
if
(
pal
)
{
s
->
frame
.
palette_has_changed
=
1
;
s
->
frame
->
palette_has_changed
=
1
;
memcpy
(
s
->
pal
,
pal
,
AVPALETTE_SIZE
);
}
smc_decode_stream
(
s
);
*
got_frame
=
1
;
if
((
ret
=
av_frame_ref
(
data
,
&
s
->
frame
))
<
0
)
if
((
ret
=
av_frame_ref
(
data
,
s
->
frame
))
<
0
)
return
ret
;
/* always report that the buffer was completely consumed */
...
...
@@ -458,7 +460,7 @@ static av_cold int smc_decode_end(AVCodecContext *avctx)
{
SmcContext
*
s
=
avctx
->
priv_data
;
av_frame_
unref
(
&
s
->
frame
);
av_frame_
free
(
&
s
->
frame
);
return
0
;
}
...
...
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