Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ffmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Samuel Mira
ffmpeg
Commits
a0f2d3ff
Commit
a0f2d3ff
authored
12 years ago
by
Stefano Sabatini
Browse files
Options
Downloads
Patches
Plain Diff
lavf/avienc: return proper error codes, and provide some more feedback
parent
8ad9b48c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavformat/avienc.c
+16
-8
16 additions, 8 deletions
libavformat/avienc.c
with
16 additions
and
8 deletions
libavformat/avienc.c
+
16
−
8
View file @
a0f2d3ff
...
@@ -156,7 +156,7 @@ static int avi_write_header(AVFormatContext *s)
...
@@ -156,7 +156,7 @@ static int avi_write_header(AVFormatContext *s)
if
(
s
->
nb_streams
>
AVI_MAX_STREAM_COUNT
)
{
if
(
s
->
nb_streams
>
AVI_MAX_STREAM_COUNT
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"AVI does not support >%d streams
\n
"
,
av_log
(
s
,
AV_LOG_ERROR
,
"AVI does not support >%d streams
\n
"
,
AVI_MAX_STREAM_COUNT
);
AVI_MAX_STREAM_COUNT
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
}
for
(
n
=
0
;
n
<
s
->
nb_streams
;
n
++
)
{
for
(
n
=
0
;
n
<
s
->
nb_streams
;
n
++
)
{
...
@@ -282,6 +282,8 @@ static int avi_write_header(AVFormatContext *s)
...
@@ -282,6 +282,8 @@ static int avi_write_header(AVFormatContext *s)
ff_end_tag
(
pb
,
strh
);
ff_end_tag
(
pb
,
strh
);
if
(
stream
->
codec_type
!=
AVMEDIA_TYPE_DATA
){
if
(
stream
->
codec_type
!=
AVMEDIA_TYPE_DATA
){
int
ret
;
strf
=
ff_start_tag
(
pb
,
"strf"
);
strf
=
ff_start_tag
(
pb
,
"strf"
);
switch
(
stream
->
codec_type
)
{
switch
(
stream
->
codec_type
)
{
case
AVMEDIA_TYPE_SUBTITLE
:
case
AVMEDIA_TYPE_SUBTITLE
:
...
@@ -292,12 +294,15 @@ static int avi_write_header(AVFormatContext *s)
...
@@ -292,12 +294,15 @@ static int avi_write_header(AVFormatContext *s)
ff_put_bmp_header
(
pb
,
stream
,
ff_codec_bmp_tags
,
0
);
ff_put_bmp_header
(
pb
,
stream
,
ff_codec_bmp_tags
,
0
);
break
;
break
;
case
AVMEDIA_TYPE_AUDIO
:
case
AVMEDIA_TYPE_AUDIO
:
if
(
ff_put_wav_header
(
pb
,
stream
)
<
0
)
{
if
(
(
ret
=
ff_put_wav_header
(
pb
,
stream
)
)
<
0
)
{
return
-
1
;
return
ret
;
}
}
break
;
break
;
default:
default:
return
-
1
;
av_log
(
s
,
AV_LOG_ERROR
,
"Invalid or not supported codec type '%s' found in the input
\n
"
,
(
char
*
)
av_x_if_null
(
av_get_media_type_string
(
stream
->
codec_type
),
"?"
));
return
AVERROR
(
EINVAL
);
}
}
ff_end_tag
(
pb
,
strf
);
ff_end_tag
(
pb
,
strf
);
if
((
t
=
av_dict_get
(
s
->
streams
[
i
]
->
metadata
,
"title"
,
NULL
,
0
)))
{
if
((
t
=
av_dict_get
(
s
->
streams
[
i
]
->
metadata
,
"title"
,
NULL
,
0
)))
{
...
@@ -404,8 +409,11 @@ static int avi_write_ix(AVFormatContext *s)
...
@@ -404,8 +409,11 @@ static int avi_write_ix(AVFormatContext *s)
av_assert0
(
pb
->
seekable
);
av_assert0
(
pb
->
seekable
);
if
(
avi
->
riff_id
>
AVI_MASTER_INDEX_SIZE
)
if
(
avi
->
riff_id
>
AVI_MASTER_INDEX_SIZE
)
{
return
-
1
;
av_log
(
s
,
AV_LOG_ERROR
,
"Invalid riff index %d > %d
\n
"
,
avi
->
riff_id
,
AVI_MASTER_INDEX_SIZE
);
return
AVERROR
(
EINVAL
);
}
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
{
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
{
AVIStream
*
avist
=
s
->
streams
[
i
]
->
priv_data
;
AVIStream
*
avist
=
s
->
streams
[
i
]
->
priv_data
;
...
@@ -560,10 +568,10 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -560,10 +568,10 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
if
(
idx
->
ents_allocated
<=
idx
->
entry
)
{
if
(
idx
->
ents_allocated
<=
idx
->
entry
)
{
idx
->
cluster
=
av_realloc_f
(
idx
->
cluster
,
sizeof
(
void
*
),
cl
+
1
);
idx
->
cluster
=
av_realloc_f
(
idx
->
cluster
,
sizeof
(
void
*
),
cl
+
1
);
if
(
!
idx
->
cluster
)
if
(
!
idx
->
cluster
)
return
-
1
;
return
AVERROR
(
ENOMEM
)
;
idx
->
cluster
[
cl
]
=
av_malloc
(
AVI_INDEX_CLUSTER_SIZE
*
sizeof
(
AVIIentry
));
idx
->
cluster
[
cl
]
=
av_malloc
(
AVI_INDEX_CLUSTER_SIZE
*
sizeof
(
AVIIentry
));
if
(
!
idx
->
cluster
[
cl
])
if
(
!
idx
->
cluster
[
cl
])
return
-
1
;
return
AVERROR
(
ENOMEM
)
;
idx
->
ents_allocated
+=
AVI_INDEX_CLUSTER_SIZE
;
idx
->
ents_allocated
+=
AVI_INDEX_CLUSTER_SIZE
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment