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
41fd6f07
Commit
41fd6f07
authored
Sep 29, 2013
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/dvdsubdec: factor out rectangles reset.
parent
c7fe2a37
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
18 deletions
+17
-18
dvdsubdec.c
libavcodec/dvdsubdec.c
+17
-18
No files found.
libavcodec/dvdsubdec.c
View file @
41fd6f07
...
@@ -184,6 +184,21 @@ static void guess_palette(DVDSubContext* ctx,
...
@@ -184,6 +184,21 @@ static void guess_palette(DVDSubContext* ctx,
}
}
}
}
static
void
reset_rects
(
AVSubtitle
*
sub_header
)
{
int
i
;
if
(
sub_header
->
rects
!=
NULL
)
{
for
(
i
=
0
;
i
<
sub_header
->
num_rects
;
i
++
)
{
av_freep
(
&
sub_header
->
rects
[
i
]
->
pict
.
data
[
0
]);
av_freep
(
&
sub_header
->
rects
[
i
]
->
pict
.
data
[
1
]);
av_freep
(
&
sub_header
->
rects
[
i
]);
}
av_freep
(
&
sub_header
->
rects
);
sub_header
->
num_rects
=
0
;
}
}
#define READ_OFFSET(a) (big_offsets ? AV_RB32(a) : AV_RB16(a))
#define READ_OFFSET(a) (big_offsets ? AV_RB32(a) : AV_RB16(a))
static
int
decode_dvd_subtitles
(
DVDSubContext
*
ctx
,
AVSubtitle
*
sub_header
,
static
int
decode_dvd_subtitles
(
DVDSubContext
*
ctx
,
AVSubtitle
*
sub_header
,
...
@@ -324,15 +339,7 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
...
@@ -324,15 +339,7 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
if
(
h
<
0
)
if
(
h
<
0
)
h
=
0
;
h
=
0
;
if
(
w
>
0
&&
h
>
0
)
{
if
(
w
>
0
&&
h
>
0
)
{
if
(
sub_header
->
rects
!=
NULL
)
{
reset_rects
(
sub_header
);
for
(
i
=
0
;
i
<
sub_header
->
num_rects
;
i
++
)
{
av_freep
(
&
sub_header
->
rects
[
i
]
->
pict
.
data
[
0
]);
av_freep
(
&
sub_header
->
rects
[
i
]
->
pict
.
data
[
1
]);
av_freep
(
&
sub_header
->
rects
[
i
]);
}
av_freep
(
&
sub_header
->
rects
);
sub_header
->
num_rects
=
0
;
}
bitmap
=
av_malloc
(
w
*
h
);
bitmap
=
av_malloc
(
w
*
h
);
sub_header
->
rects
=
av_mallocz
(
sizeof
(
*
sub_header
->
rects
));
sub_header
->
rects
=
av_mallocz
(
sizeof
(
*
sub_header
->
rects
));
...
@@ -374,15 +381,7 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
...
@@ -374,15 +381,7 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
if
(
sub_header
->
num_rects
>
0
)
if
(
sub_header
->
num_rects
>
0
)
return
is_menu
;
return
is_menu
;
fail:
fail:
if
(
sub_header
->
rects
!=
NULL
)
{
reset_rects
(
sub_header
);
for
(
i
=
0
;
i
<
sub_header
->
num_rects
;
i
++
)
{
av_freep
(
&
sub_header
->
rects
[
i
]
->
pict
.
data
[
0
]);
av_freep
(
&
sub_header
->
rects
[
i
]
->
pict
.
data
[
1
]);
av_freep
(
&
sub_header
->
rects
[
i
]);
}
av_freep
(
&
sub_header
->
rects
);
sub_header
->
num_rects
=
0
;
}
return
-
1
;
return
-
1
;
}
}
...
...
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