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
ef2a99c7
Commit
ef2a99c7
authored
Nov 09, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvideo1: use the AVFrame API properly.
parent
a639ea7f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
msvideo1.c
libavcodec/msvideo1.c
+13
-11
No files found.
libavcodec/msvideo1.c
View file @
ef2a99c7
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
typedef
struct
Msvideo1Context
{
typedef
struct
Msvideo1Context
{
AVCodecContext
*
avctx
;
AVCodecContext
*
avctx
;
AVFrame
frame
;
AVFrame
*
frame
;
const
unsigned
char
*
buf
;
const
unsigned
char
*
buf
;
int
size
;
int
size
;
...
@@ -72,7 +72,9 @@ static av_cold int msvideo1_decode_init(AVCodecContext *avctx)
...
@@ -72,7 +72,9 @@ static av_cold int msvideo1_decode_init(AVCodecContext *avctx)
avctx
->
pix_fmt
=
AV_PIX_FMT_RGB555
;
avctx
->
pix_fmt
=
AV_PIX_FMT_RGB555
;
}
}
avcodec_get_frame_defaults
(
&
s
->
frame
);
s
->
frame
=
av_frame_alloc
();
if
(
!
s
->
frame
)
return
AVERROR
(
ENOMEM
);
return
0
;
return
0
;
}
}
...
@@ -93,8 +95,8 @@ static void msvideo1_decode_8bit(Msvideo1Context *s)
...
@@ -93,8 +95,8 @@ static void msvideo1_decode_8bit(Msvideo1Context *s)
unsigned
short
flags
;
unsigned
short
flags
;
int
skip_blocks
;
int
skip_blocks
;
unsigned
char
colors
[
8
];
unsigned
char
colors
[
8
];
unsigned
char
*
pixels
=
s
->
frame
.
data
[
0
];
unsigned
char
*
pixels
=
s
->
frame
->
data
[
0
];
int
stride
=
s
->
frame
.
linesize
[
0
];
int
stride
=
s
->
frame
->
linesize
[
0
];
stream_ptr
=
0
;
stream_ptr
=
0
;
skip_blocks
=
0
;
skip_blocks
=
0
;
...
@@ -174,7 +176,7 @@ static void msvideo1_decode_8bit(Msvideo1Context *s)
...
@@ -174,7 +176,7 @@ static void msvideo1_decode_8bit(Msvideo1Context *s)
/* make the palette available on the way out */
/* make the palette available on the way out */
if
(
s
->
avctx
->
pix_fmt
==
AV_PIX_FMT_PAL8
)
if
(
s
->
avctx
->
pix_fmt
==
AV_PIX_FMT_PAL8
)
memcpy
(
s
->
frame
.
data
[
1
],
s
->
pal
,
AVPALETTE_SIZE
);
memcpy
(
s
->
frame
->
data
[
1
],
s
->
pal
,
AVPALETTE_SIZE
);
}
}
static
void
msvideo1_decode_16bit
(
Msvideo1Context
*
s
)
static
void
msvideo1_decode_16bit
(
Msvideo1Context
*
s
)
...
@@ -193,8 +195,8 @@ static void msvideo1_decode_16bit(Msvideo1Context *s)
...
@@ -193,8 +195,8 @@ static void msvideo1_decode_16bit(Msvideo1Context *s)
unsigned
short
flags
;
unsigned
short
flags
;
int
skip_blocks
;
int
skip_blocks
;
unsigned
short
colors
[
8
];
unsigned
short
colors
[
8
];
unsigned
short
*
pixels
=
(
unsigned
short
*
)
s
->
frame
.
data
[
0
];
unsigned
short
*
pixels
=
(
unsigned
short
*
)
s
->
frame
->
data
[
0
];
int
stride
=
s
->
frame
.
linesize
[
0
]
/
2
;
int
stride
=
s
->
frame
->
linesize
[
0
]
/
2
;
stream_ptr
=
0
;
stream_ptr
=
0
;
skip_blocks
=
0
;
skip_blocks
=
0
;
...
@@ -298,7 +300,7 @@ static int msvideo1_decode_frame(AVCodecContext *avctx,
...
@@ -298,7 +300,7 @@ static int msvideo1_decode_frame(AVCodecContext *avctx,
s
->
buf
=
buf
;
s
->
buf
=
buf
;
s
->
size
=
buf_size
;
s
->
size
=
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
"
);
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"reget_buffer() failed
\n
"
);
return
ret
;
return
ret
;
}
}
...
@@ -308,7 +310,7 @@ static int msvideo1_decode_frame(AVCodecContext *avctx,
...
@@ -308,7 +310,7 @@ static int msvideo1_decode_frame(AVCodecContext *avctx,
if
(
pal
)
{
if
(
pal
)
{
memcpy
(
s
->
pal
,
pal
,
AVPALETTE_SIZE
);
memcpy
(
s
->
pal
,
pal
,
AVPALETTE_SIZE
);
s
->
frame
.
palette_has_changed
=
1
;
s
->
frame
->
palette_has_changed
=
1
;
}
}
}
}
...
@@ -317,7 +319,7 @@ static int msvideo1_decode_frame(AVCodecContext *avctx,
...
@@ -317,7 +319,7 @@ static int msvideo1_decode_frame(AVCodecContext *avctx,
else
else
msvideo1_decode_16bit
(
s
);
msvideo1_decode_16bit
(
s
);
if
((
ret
=
av_frame_ref
(
data
,
&
s
->
frame
))
<
0
)
if
((
ret
=
av_frame_ref
(
data
,
s
->
frame
))
<
0
)
return
ret
;
return
ret
;
*
got_frame
=
1
;
*
got_frame
=
1
;
...
@@ -330,7 +332,7 @@ static av_cold int msvideo1_decode_end(AVCodecContext *avctx)
...
@@ -330,7 +332,7 @@ static av_cold int msvideo1_decode_end(AVCodecContext *avctx)
{
{
Msvideo1Context
*
s
=
avctx
->
priv_data
;
Msvideo1Context
*
s
=
avctx
->
priv_data
;
av_frame_
unref
(
&
s
->
frame
);
av_frame_
free
(
&
s
->
frame
);
return
0
;
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