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
1bd6b0c9
Commit
1bd6b0c9
authored
Sep 06, 2012
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/flvenc: return meaningful error codes
parent
40112e7b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
flvenc.c
libavformat/flvenc.c
+11
-11
No files found.
libavformat/flvenc.c
View file @
1bd6b0c9
...
...
@@ -81,11 +81,11 @@ static int get_audio_flags(AVFormatContext *s, AVCodecContext *enc)
if
(
enc
->
sample_rate
!=
16000
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"flv only supports wideband (16kHz) Speex audio
\n
"
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
if
(
enc
->
channels
!=
1
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"flv only supports mono Speex audio
\n
"
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
return
FLV_CODECID_SPEEX
|
FLV_SAMPLERATE_11025HZ
|
FLV_SAMPLESSIZE_16BIT
;
}
else
{
...
...
@@ -110,7 +110,7 @@ static int get_audio_flags(AVFormatContext *s, AVCodecContext *enc)
av_log
(
s
,
AV_LOG_ERROR
,
"flv does not support that sample rate, "
"choose from (44100, 22050, 11025).
\n
"
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
}
...
...
@@ -152,7 +152,7 @@ static int get_audio_flags(AVFormatContext *s, AVCodecContext *enc)
break
;
default:
av_log
(
s
,
AV_LOG_ERROR
,
"codec not compatible with flv
\n
"
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
return
flags
;
...
...
@@ -214,7 +214,7 @@ static int flv_write_header(AVFormatContext *s)
video_enc
=
enc
;
if
(
enc
->
codec_tag
==
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"video codec not compatible with flv
\n
"
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
break
;
case
AVMEDIA_TYPE_AUDIO
:
...
...
@@ -231,7 +231,7 @@ static int flv_write_header(AVFormatContext *s)
break
;
default:
av_log
(
s
,
AV_LOG_ERROR
,
"codec not compatible with flv
\n
"
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
avpriv_set_pts_info
(
s
->
streams
[
i
],
32
,
1
,
1000
);
/* 32 bit pts in ms */
...
...
@@ -440,7 +440,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
unsigned
ts
;
int
size
=
pkt
->
size
;
uint8_t
*
data
=
NULL
;
int
flags
=
-
1
,
flags_size
;
int
flags
=
-
1
,
flags_size
,
ret
;
// av_log(s, AV_LOG_DEBUG, "type:%d pts: %"PRId64" size:%d\n",
// enc->codec_type, timestamp, size);
...
...
@@ -462,7 +462,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
av_log
(
s
,
AV_LOG_ERROR
,
"video codec %s not compatible with flv
\n
"
,
avcodec_get_name
(
enc
->
codec_id
));
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
flags
|=
pkt
->
flags
&
AV_PKT_FLAG_KEY
?
FLV_FRAME_KEY
:
FLV_FRAME_INTER
;
...
...
@@ -484,12 +484,12 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
if
(
enc
->
codec_id
==
AV_CODEC_ID_H264
||
enc
->
codec_id
==
AV_CODEC_ID_MPEG4
)
{
/* check if extradata looks like mp4 formated */
if
(
enc
->
extradata_size
>
0
&&
*
(
uint8_t
*
)
enc
->
extradata
!=
1
)
if
(
ff_avc_parse_nal_units_buf
(
pkt
->
data
,
&
data
,
&
size
)
<
0
)
return
-
1
;
if
(
(
ret
=
ff_avc_parse_nal_units_buf
(
pkt
->
data
,
&
data
,
&
size
)
)
<
0
)
return
ret
;
}
else
if
(
enc
->
codec_id
==
AV_CODEC_ID_AAC
&&
pkt
->
size
>
2
&&
(
AV_RB16
(
pkt
->
data
)
&
0xfff0
)
==
0xfff0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"malformated aac bitstream, use -absf aac_adtstoasc
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
if
(
flv
->
delay
==
AV_NOPTS_VALUE
)
...
...
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