Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
9e28e003
Commit
9e28e003
authored
Dec 31, 2012
by
Nicolas George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc/flacenc: improve error return.
Use meaningful error codes and add log messages.
parent
11ab2c25
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
flacenc.c
libavcodec/flacenc.c
+14
-10
No files found.
libavcodec/flacenc.c
View file @
9e28e003
...
...
@@ -248,8 +248,11 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
break
;
}
if
(
channels
<
1
||
channels
>
FLAC_MAX_CHANNELS
)
return
-
1
;
if
(
channels
<
1
||
channels
>
FLAC_MAX_CHANNELS
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"%d channels not supported (max %d)
\n
"
,
channels
,
FLAC_MAX_CHANNELS
);
return
AVERROR
(
EINVAL
);
}
s
->
channels
=
channels
;
/* find samplerate in table */
...
...
@@ -275,7 +278,8 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
s
->
sr_code
[
0
]
=
13
;
s
->
sr_code
[
1
]
=
freq
;
}
else
{
return
-
1
;
av_log
(
avctx
,
AV_LOG_ERROR
,
"%d Hz not supported
\n
"
,
freq
);
return
AVERROR
(
EINVAL
);
}
s
->
samplerate
=
freq
;
}
...
...
@@ -290,7 +294,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
if
(
level
>
12
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid compression level: %d
\n
"
,
s
->
options
.
compression_level
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
s
->
options
.
block_time_ms
=
((
int
[]){
27
,
27
,
27
,
105
,
105
,
105
,
105
,
105
,
105
,
105
,
105
,
105
,
105
})[
level
];
...
...
@@ -329,13 +333,13 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
if
(
avctx
->
min_prediction_order
>
MAX_FIXED_ORDER
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid min prediction order: %d
\n
"
,
avctx
->
min_prediction_order
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
}
else
if
(
avctx
->
min_prediction_order
<
MIN_LPC_ORDER
||
avctx
->
min_prediction_order
>
MAX_LPC_ORDER
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid min prediction order: %d
\n
"
,
avctx
->
min_prediction_order
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
s
->
options
.
min_prediction_order
=
avctx
->
min_prediction_order
;
}
...
...
@@ -346,20 +350,20 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
if
(
avctx
->
max_prediction_order
>
MAX_FIXED_ORDER
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid max prediction order: %d
\n
"
,
avctx
->
max_prediction_order
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
}
else
if
(
avctx
->
max_prediction_order
<
MIN_LPC_ORDER
||
avctx
->
max_prediction_order
>
MAX_LPC_ORDER
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid max prediction order: %d
\n
"
,
avctx
->
max_prediction_order
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
s
->
options
.
max_prediction_order
=
avctx
->
max_prediction_order
;
}
if
(
s
->
options
.
max_prediction_order
<
s
->
options
.
min_prediction_order
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid prediction orders: min=%d max=%d
\n
"
,
s
->
options
.
min_prediction_order
,
s
->
options
.
max_prediction_order
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
if
(
avctx
->
frame_size
>
0
)
{
...
...
@@ -367,7 +371,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
avctx
->
frame_size
>
FLAC_MAX_BLOCKSIZE
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid block size: %d
\n
"
,
avctx
->
frame_size
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
}
else
{
s
->
avctx
->
frame_size
=
select_blocksize
(
s
->
samplerate
,
s
->
options
.
block_time_ms
);
...
...
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