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
877a1d40
Commit
877a1d40
authored
Jan 30, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adpcmenc: return proper AVERROR codes instead of -1
parent
cb023d9a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
adpcmenc.c
libavcodec/adpcmenc.c
+13
-6
No files found.
libavcodec/adpcmenc.c
View file @
877a1d40
...
@@ -63,12 +63,16 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
...
@@ -63,12 +63,16 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
ADPCMEncodeContext
*
s
=
avctx
->
priv_data
;
ADPCMEncodeContext
*
s
=
avctx
->
priv_data
;
uint8_t
*
extradata
;
uint8_t
*
extradata
;
int
i
;
int
i
;
if
(
avctx
->
channels
>
2
)
int
ret
=
AVERROR
(
ENOMEM
);
return
-
1
;
/* only stereo or mono =) */
if
(
avctx
->
channels
>
2
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"only stereo or mono is supported
\n
"
);
return
AVERROR
(
EINVAL
);
}
if
(
avctx
->
trellis
&&
(
unsigned
)
avctx
->
trellis
>
16U
)
{
if
(
avctx
->
trellis
&&
(
unsigned
)
avctx
->
trellis
>
16U
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid trellis size
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid trellis size
\n
"
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
}
if
(
avctx
->
trellis
)
{
if
(
avctx
->
trellis
)
{
...
@@ -127,11 +131,13 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
...
@@ -127,11 +131,13 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
avctx
->
sample_rate
!=
44100
)
{
avctx
->
sample_rate
!=
44100
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Sample rate must be 11025, "
av_log
(
avctx
,
AV_LOG_ERROR
,
"Sample rate must be 11025, "
"22050 or 44100
\n
"
);
"22050 or 44100
\n
"
);
ret
=
AVERROR
(
EINVAL
);
goto
error
;
goto
error
;
}
}
avctx
->
frame_size
=
512
*
(
avctx
->
sample_rate
/
11025
);
avctx
->
frame_size
=
512
*
(
avctx
->
sample_rate
/
11025
);
break
;
break
;
default:
default:
ret
=
AVERROR
(
EINVAL
);
goto
error
;
goto
error
;
}
}
...
@@ -144,7 +150,7 @@ error:
...
@@ -144,7 +150,7 @@ error:
av_freep
(
&
s
->
node_buf
);
av_freep
(
&
s
->
node_buf
);
av_freep
(
&
s
->
nodep_buf
);
av_freep
(
&
s
->
nodep_buf
);
av_freep
(
&
s
->
trellis_hash
);
av_freep
(
&
s
->
trellis_hash
);
return
-
1
;
return
ret
;
}
}
static
av_cold
int
adpcm_encode_close
(
AVCodecContext
*
avctx
)
static
av_cold
int
adpcm_encode_close
(
AVCodecContext
*
avctx
)
...
@@ -688,10 +694,11 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
...
@@ -688,10 +694,11 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
}
}
break
;
break
;
default:
default:
error:
return
AVERROR
(
EINVAL
);
return
-
1
;
}
}
return
dst
-
frame
;
return
dst
-
frame
;
error:
return
AVERROR
(
ENOMEM
);
}
}
...
...
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