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
263dbe9d
Commit
263dbe9d
authored
Jul 29, 2012
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpc: return more meaningful error codes.
parent
782e64fb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
mpc.c
libavformat/mpc.c
+8
-8
No files found.
libavformat/mpc.c
View file @
263dbe9d
...
...
@@ -59,17 +59,17 @@ static int mpc_read_header(AVFormatContext *s)
if
(
avio_rl24
(
s
->
pb
)
!=
MKTAG
(
'M'
,
'P'
,
'+'
,
0
)){
av_log
(
s
,
AV_LOG_ERROR
,
"Not a Musepack file
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
c
->
ver
=
avio_r8
(
s
->
pb
);
if
(
c
->
ver
!=
0x07
&&
c
->
ver
!=
0x17
){
av_log
(
s
,
AV_LOG_ERROR
,
"Can demux Musepack SV7, got version %02X
\n
"
,
c
->
ver
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
c
->
fcount
=
avio_rl32
(
s
->
pb
);
if
((
int64_t
)
c
->
fcount
*
sizeof
(
MPCFrame
)
>=
UINT_MAX
){
av_log
(
s
,
AV_LOG_ERROR
,
"Too many frames, seeking is not possible
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
if
(
c
->
fcount
){
c
->
frames
=
av_malloc
(
c
->
fcount
*
sizeof
(
MPCFrame
));
...
...
@@ -122,7 +122,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
int64_t
pos
;
if
(
c
->
curframe
>=
c
->
fcount
&&
c
->
fcount
)
return
-
1
;
return
AVERROR_EOF
;
if
(
c
->
curframe
!=
c
->
lastframe
+
1
){
avio_seek
(
s
->
pb
,
c
->
frames
[
c
->
curframe
].
pos
,
SEEK_SET
);
...
...
@@ -151,8 +151,8 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
}
c
->
curbits
=
(
curbits
+
size2
)
&
0x1F
;
if
(
av_new_packet
(
pkt
,
size
)
<
0
)
return
AVERROR
(
EIO
)
;
if
(
(
ret
=
av_new_packet
(
pkt
,
size
)
)
<
0
)
return
ret
;
pkt
->
data
[
0
]
=
curbits
;
pkt
->
data
[
1
]
=
(
c
->
curframe
>
c
->
fcount
)
&&
c
->
fcount
;
...
...
@@ -166,7 +166,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
avio_seek
(
s
->
pb
,
-
4
,
SEEK_CUR
);
if
(
ret
<
size
){
av_free_packet
(
pkt
);
return
AVERROR
(
EIO
);
return
ret
<
0
?
ret
:
AVERROR
(
EIO
);
}
pkt
->
size
=
ret
+
4
;
...
...
@@ -214,7 +214,7 @@ static int mpc_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
ret
=
av_read_frame
(
s
,
pkt
);
if
(
ret
<
0
){
c
->
curframe
=
lastframe
;
return
-
1
;
return
ret
;
}
av_free_packet
(
pkt
);
}
...
...
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