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
266e88a4
Commit
266e88a4
authored
Dec 04, 2012
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mmf: return meaningful error codes
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
b70251c0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
mmf.c
libavformat/mmf.c
+6
-6
No files found.
libavformat/mmf.c
View file @
266e88a4
...
@@ -71,7 +71,7 @@ static int mmf_write_header(AVFormatContext *s)
...
@@ -71,7 +71,7 @@ static int mmf_write_header(AVFormatContext *s)
rate
=
mmf_rate_code
(
s
->
streams
[
0
]
->
codec
->
sample_rate
);
rate
=
mmf_rate_code
(
s
->
streams
[
0
]
->
codec
->
sample_rate
);
if
(
rate
<
0
)
{
if
(
rate
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Unsupported sample rate %d, supported are 4000, 8000, 11025, 22050 and 44100
\n
"
,
s
->
streams
[
0
]
->
codec
->
sample_rate
);
av_log
(
s
,
AV_LOG_ERROR
,
"Unsupported sample rate %d, supported are 4000, 8000, 11025, 22050 and 44100
\n
"
,
s
->
streams
[
0
]
->
codec
->
sample_rate
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
}
ffio_wfourcc
(
pb
,
"MMMD"
);
ffio_wfourcc
(
pb
,
"MMMD"
);
...
@@ -193,7 +193,7 @@ static int mmf_read_header(AVFormatContext *s)
...
@@ -193,7 +193,7 @@ static int mmf_read_header(AVFormatContext *s)
tag
=
avio_rl32
(
pb
);
tag
=
avio_rl32
(
pb
);
if
(
tag
!=
MKTAG
(
'M'
,
'M'
,
'M'
,
'D'
))
if
(
tag
!=
MKTAG
(
'M'
,
'M'
,
'M'
,
'D'
))
return
-
1
;
return
AVERROR_INVALIDDATA
;
avio_skip
(
pb
,
4
);
/* file_size */
avio_skip
(
pb
,
4
);
/* file_size */
/* Skip some unused chunks that may or may not be present */
/* Skip some unused chunks that may or may not be present */
...
@@ -208,11 +208,11 @@ static int mmf_read_header(AVFormatContext *s)
...
@@ -208,11 +208,11 @@ static int mmf_read_header(AVFormatContext *s)
/* Tag = "ATRx", where "x" = track number */
/* Tag = "ATRx", where "x" = track number */
if
((
tag
&
0xffffff
)
==
MKTAG
(
'M'
,
'T'
,
'R'
,
0
))
{
if
((
tag
&
0xffffff
)
==
MKTAG
(
'M'
,
'T'
,
'R'
,
0
))
{
av_log
(
s
,
AV_LOG_ERROR
,
"MIDI like format found, unsupported
\n
"
);
av_log
(
s
,
AV_LOG_ERROR
,
"MIDI like format found, unsupported
\n
"
);
return
-
1
;
return
AVERROR_PATCHWELCOME
;
}
}
if
((
tag
&
0xffffff
)
!=
MKTAG
(
'A'
,
'T'
,
'R'
,
0
))
{
if
((
tag
&
0xffffff
)
!=
MKTAG
(
'A'
,
'T'
,
'R'
,
0
))
{
av_log
(
s
,
AV_LOG_ERROR
,
"Unsupported SMAF chunk %08x
\n
"
,
tag
);
av_log
(
s
,
AV_LOG_ERROR
,
"Unsupported SMAF chunk %08x
\n
"
,
tag
);
return
-
1
;
return
AVERROR_PATCHWELCOME
;
}
}
avio_r8
(
pb
);
/* format type */
avio_r8
(
pb
);
/* format type */
...
@@ -221,7 +221,7 @@ static int mmf_read_header(AVFormatContext *s)
...
@@ -221,7 +221,7 @@ static int mmf_read_header(AVFormatContext *s)
rate
=
mmf_rate
(
params
&
0x0f
);
rate
=
mmf_rate
(
params
&
0x0f
);
if
(
rate
<
0
)
{
if
(
rate
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Invalid sample rate
\n
"
);
av_log
(
s
,
AV_LOG_ERROR
,
"Invalid sample rate
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
avio_r8
(
pb
);
/* wave base bit */
avio_r8
(
pb
);
/* wave base bit */
avio_r8
(
pb
);
/* time base d */
avio_r8
(
pb
);
/* time base d */
...
@@ -239,7 +239,7 @@ static int mmf_read_header(AVFormatContext *s)
...
@@ -239,7 +239,7 @@ static int mmf_read_header(AVFormatContext *s)
/* Make sure it's followed by an Awa chunk, aka wave data */
/* Make sure it's followed by an Awa chunk, aka wave data */
if
((
tag
&
0xffffff
)
!=
MKTAG
(
'A'
,
'w'
,
'a'
,
0
))
{
if
((
tag
&
0xffffff
)
!=
MKTAG
(
'A'
,
'w'
,
'a'
,
0
))
{
av_log
(
s
,
AV_LOG_ERROR
,
"Unexpected SMAF chunk %08x
\n
"
,
tag
);
av_log
(
s
,
AV_LOG_ERROR
,
"Unexpected SMAF chunk %08x
\n
"
,
tag
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
mmf
->
data_size
=
size
;
mmf
->
data_size
=
size
;
...
...
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