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
acaffdca
Commit
acaffdca
authored
Nov 09, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mss1: use the AVFrame API properly.
parent
508b3755
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
13 deletions
+16
-13
mss1.c
libavcodec/mss1.c
+16
-13
No files found.
libavcodec/mss1.c
View file @
acaffdca
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
typedef
struct
MSS1Context
{
typedef
struct
MSS1Context
{
MSS12Context
ctx
;
MSS12Context
ctx
;
AVFrame
pic
;
AVFrame
*
pic
;
SliceContext
sc
;
SliceContext
sc
;
}
MSS1Context
;
}
MSS1Context
;
...
@@ -151,34 +151,34 @@ static int mss1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -151,34 +151,34 @@ static int mss1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
init_get_bits
(
&
gb
,
buf
,
buf_size
*
8
);
init_get_bits
(
&
gb
,
buf
,
buf_size
*
8
);
arith_init
(
&
acoder
,
&
gb
);
arith_init
(
&
acoder
,
&
gb
);
if
((
ret
=
ff_reget_buffer
(
avctx
,
&
ctx
->
pic
))
<
0
)
{
if
((
ret
=
ff_reget_buffer
(
avctx
,
ctx
->
pic
))
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"reget_buffer() failed
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"reget_buffer() failed
\n
"
);
return
ret
;
return
ret
;
}
}
c
->
pal_pic
=
ctx
->
pic
.
data
[
0
]
+
ctx
->
pic
.
linesize
[
0
]
*
(
avctx
->
height
-
1
);
c
->
pal_pic
=
ctx
->
pic
->
data
[
0
]
+
ctx
->
pic
->
linesize
[
0
]
*
(
avctx
->
height
-
1
);
c
->
pal_stride
=
-
ctx
->
pic
.
linesize
[
0
];
c
->
pal_stride
=
-
ctx
->
pic
->
linesize
[
0
];
c
->
keyframe
=
!
arith_get_bit
(
&
acoder
);
c
->
keyframe
=
!
arith_get_bit
(
&
acoder
);
if
(
c
->
keyframe
)
{
if
(
c
->
keyframe
)
{
c
->
corrupted
=
0
;
c
->
corrupted
=
0
;
ff_mss12_slicecontext_reset
(
&
ctx
->
sc
);
ff_mss12_slicecontext_reset
(
&
ctx
->
sc
);
pal_changed
=
decode_pal
(
c
,
&
acoder
);
pal_changed
=
decode_pal
(
c
,
&
acoder
);
ctx
->
pic
.
key_frame
=
1
;
ctx
->
pic
->
key_frame
=
1
;
ctx
->
pic
.
pict_type
=
AV_PICTURE_TYPE_I
;
ctx
->
pic
->
pict_type
=
AV_PICTURE_TYPE_I
;
}
else
{
}
else
{
if
(
c
->
corrupted
)
if
(
c
->
corrupted
)
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
ctx
->
pic
.
key_frame
=
0
;
ctx
->
pic
->
key_frame
=
0
;
ctx
->
pic
.
pict_type
=
AV_PICTURE_TYPE_P
;
ctx
->
pic
->
pict_type
=
AV_PICTURE_TYPE_P
;
}
}
c
->
corrupted
=
ff_mss12_decode_rect
(
&
ctx
->
sc
,
&
acoder
,
0
,
0
,
c
->
corrupted
=
ff_mss12_decode_rect
(
&
ctx
->
sc
,
&
acoder
,
0
,
0
,
avctx
->
width
,
avctx
->
height
);
avctx
->
width
,
avctx
->
height
);
if
(
c
->
corrupted
)
if
(
c
->
corrupted
)
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
memcpy
(
ctx
->
pic
.
data
[
1
],
c
->
pal
,
AVPALETTE_SIZE
);
memcpy
(
ctx
->
pic
->
data
[
1
],
c
->
pal
,
AVPALETTE_SIZE
);
ctx
->
pic
.
palette_has_changed
=
pal_changed
;
ctx
->
pic
->
palette_has_changed
=
pal_changed
;
if
((
ret
=
av_frame_ref
(
data
,
&
ctx
->
pic
))
<
0
)
if
((
ret
=
av_frame_ref
(
data
,
ctx
->
pic
))
<
0
)
return
ret
;
return
ret
;
*
got_frame
=
1
;
*
got_frame
=
1
;
...
@@ -193,7 +193,10 @@ static av_cold int mss1_decode_init(AVCodecContext *avctx)
...
@@ -193,7 +193,10 @@ static av_cold int mss1_decode_init(AVCodecContext *avctx)
int
ret
;
int
ret
;
c
->
ctx
.
avctx
=
avctx
;
c
->
ctx
.
avctx
=
avctx
;
avctx
->
coded_frame
=
&
c
->
pic
;
c
->
pic
=
av_frame_alloc
();
if
(
!
c
->
pic
)
return
AVERROR
(
ENOMEM
);
ret
=
ff_mss12_decode_init
(
&
c
->
ctx
,
0
,
&
c
->
sc
,
NULL
);
ret
=
ff_mss12_decode_init
(
&
c
->
ctx
,
0
,
&
c
->
sc
,
NULL
);
...
@@ -206,7 +209,7 @@ static av_cold int mss1_decode_end(AVCodecContext *avctx)
...
@@ -206,7 +209,7 @@ static av_cold int mss1_decode_end(AVCodecContext *avctx)
{
{
MSS1Context
*
const
ctx
=
avctx
->
priv_data
;
MSS1Context
*
const
ctx
=
avctx
->
priv_data
;
av_frame_
unref
(
&
ctx
->
pic
);
av_frame_
free
(
&
ctx
->
pic
);
ff_mss12_decode_end
(
&
ctx
->
ctx
);
ff_mss12_decode_end
(
&
ctx
->
ctx
);
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