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
01de3c1d
Commit
01de3c1d
authored
Nov 09, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cin video: use the AVFrame API properly.
parent
ef2a99c7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
dsicinav.c
libavcodec/dsicinav.c
+10
-8
No files found.
libavcodec/dsicinav.c
View file @
01de3c1d
...
...
@@ -39,7 +39,7 @@ typedef enum CinVideoBitmapIndex {
typedef
struct
CinVideoContext
{
AVCodecContext
*
avctx
;
AVFrame
frame
;
AVFrame
*
frame
;
unsigned
int
bitmap_size
;
uint32_t
palette
[
256
];
uint8_t
*
bitmap_table
[
3
];
...
...
@@ -96,7 +96,9 @@ static av_cold int cinvideo_decode_init(AVCodecContext *avctx)
cin
->
avctx
=
avctx
;
avctx
->
pix_fmt
=
AV_PIX_FMT_PAL8
;
avcodec_get_frame_defaults
(
&
cin
->
frame
);
cin
->
frame
=
av_frame_alloc
();
if
(
!
cin
->
frame
)
return
AVERROR
(
ENOMEM
);
cin
->
bitmap_size
=
avctx
->
width
*
avctx
->
height
;
for
(
i
=
0
;
i
<
3
;
++
i
)
{
...
...
@@ -295,23 +297,23 @@ static int cinvideo_decode_frame(AVCodecContext *avctx,
break
;
}
if
((
res
=
ff_reget_buffer
(
avctx
,
&
cin
->
frame
))
<
0
)
{
if
((
res
=
ff_reget_buffer
(
avctx
,
cin
->
frame
))
<
0
)
{
av_log
(
cin
->
avctx
,
AV_LOG_ERROR
,
"delphinecinvideo: reget_buffer() failed to allocate a frame
\n
"
);
return
res
;
}
memcpy
(
cin
->
frame
.
data
[
1
],
cin
->
palette
,
sizeof
(
cin
->
palette
));
cin
->
frame
.
palette_has_changed
=
1
;
memcpy
(
cin
->
frame
->
data
[
1
],
cin
->
palette
,
sizeof
(
cin
->
palette
));
cin
->
frame
->
palette_has_changed
=
1
;
for
(
y
=
0
;
y
<
cin
->
avctx
->
height
;
++
y
)
memcpy
(
cin
->
frame
.
data
[
0
]
+
(
cin
->
avctx
->
height
-
1
-
y
)
*
cin
->
frame
.
linesize
[
0
],
memcpy
(
cin
->
frame
->
data
[
0
]
+
(
cin
->
avctx
->
height
-
1
-
y
)
*
cin
->
frame
->
linesize
[
0
],
cin
->
bitmap_table
[
CIN_CUR_BMP
]
+
y
*
cin
->
avctx
->
width
,
cin
->
avctx
->
width
);
FFSWAP
(
uint8_t
*
,
cin
->
bitmap_table
[
CIN_CUR_BMP
],
cin
->
bitmap_table
[
CIN_PRE_BMP
]);
if
((
res
=
av_frame_ref
(
data
,
&
cin
->
frame
))
<
0
)
if
((
res
=
av_frame_ref
(
data
,
cin
->
frame
))
<
0
)
return
res
;
*
got_frame
=
1
;
...
...
@@ -324,7 +326,7 @@ static av_cold int cinvideo_decode_end(AVCodecContext *avctx)
CinVideoContext
*
cin
=
avctx
->
priv_data
;
int
i
;
av_frame_
unref
(
&
cin
->
frame
);
av_frame_
free
(
&
cin
->
frame
);
for
(
i
=
0
;
i
<
3
;
++
i
)
av_free
(
cin
->
bitmap_table
[
i
]);
...
...
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