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
90f2ee8c
Commit
90f2ee8c
authored
Feb 17, 2011
by
Tomas Härdin
Committed by
Anton Khirnov
Jul 13, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wav: Refactor the tag checking into a switch statement
Signed-off-by:
Anton Khirnov
<
anton@khirnov.net
>
parent
1cf18de9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
wav.c
libavformat/wav.c
+9
-4
No files found.
libavformat/wav.c
View file @
90f2ee8c
...
@@ -334,7 +334,8 @@ static int wav_read_header(AVFormatContext *s,
...
@@ -334,7 +334,8 @@ static int wav_read_header(AVFormatContext *s,
size
=
next_tag
(
pb
,
&
tag
);
size
=
next_tag
(
pb
,
&
tag
);
next_tag_ofs
=
avio_tell
(
pb
)
+
size
;
next_tag_ofs
=
avio_tell
(
pb
)
+
size
;
if
(
tag
==
MKTAG
(
'f'
,
'm'
,
't'
,
' '
))
{
switch
(
tag
)
{
case
MKTAG
(
'f'
,
'm'
,
't'
,
' '
):
/* only parse the first 'fmt ' tag found */
/* only parse the first 'fmt ' tag found */
if
(
!
got_fmt
&&
(
ret
=
wav_parse_fmt_tag
(
s
,
size
,
&
st
)
<
0
))
{
if
(
!
got_fmt
&&
(
ret
=
wav_parse_fmt_tag
(
s
,
size
,
&
st
)
<
0
))
{
return
ret
;
return
ret
;
...
@@ -342,18 +343,22 @@ static int wav_read_header(AVFormatContext *s,
...
@@ -342,18 +343,22 @@ static int wav_read_header(AVFormatContext *s,
av_log
(
s
,
AV_LOG_WARNING
,
"found more than one 'fmt ' tag
\n
"
);
av_log
(
s
,
AV_LOG_WARNING
,
"found more than one 'fmt ' tag
\n
"
);
got_fmt
=
1
;
got_fmt
=
1
;
}
else
if
(
tag
==
MKTAG
(
'd'
,
'a'
,
't'
,
'a'
))
{
break
;
case
MKTAG
(
'd'
,
'a'
,
't'
,
'a'
):
if
(
!
got_fmt
)
{
if
(
!
got_fmt
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"found no 'fmt ' tag before the 'data' tag
\n
"
);
av_log
(
s
,
AV_LOG_ERROR
,
"found no 'fmt ' tag before the 'data' tag
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
goto
break_loop
;
case
MKTAG
(
'f'
,
'a'
,
'c'
,
't'
):
if
(
!
sample_count
)
sample_count
=
avio_rl32
(
pb
);
break
;
break
;
}
else
if
(
tag
==
MKTAG
(
'f'
,
'a'
,
'c'
,
't'
)
&&
!
sample_count
){
sample_count
=
avio_rl32
(
pb
);
}
}
avio_seek
(
pb
,
next_tag_ofs
,
SEEK_SET
);
avio_seek
(
pb
,
next_tag_ofs
,
SEEK_SET
);
}
}
break_loop:
if
(
rf64
)
if
(
rf64
)
size
=
data_size
;
size
=
data_size
;
if
(
size
<
0
)
if
(
size
<
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