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
da2ea7c3
Commit
da2ea7c3
authored
Sep 06, 2012
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/flvenc: apply various log fixes/clarifications
Should improve user feedback in case of errors.
parent
1bd6b0c9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
11 deletions
+17
-11
flvenc.c
libavformat/flvenc.c
+17
-11
No files found.
libavformat/flvenc.c
View file @
da2ea7c3
...
@@ -80,11 +80,11 @@ static int get_audio_flags(AVFormatContext *s, AVCodecContext *enc)
...
@@ -80,11 +80,11 @@ static int get_audio_flags(AVFormatContext *s, AVCodecContext *enc)
else
if
(
enc
->
codec_id
==
AV_CODEC_ID_SPEEX
)
{
else
if
(
enc
->
codec_id
==
AV_CODEC_ID_SPEEX
)
{
if
(
enc
->
sample_rate
!=
16000
)
{
if
(
enc
->
sample_rate
!=
16000
)
{
av_log
(
s
,
AV_LOG_ERROR
,
av_log
(
s
,
AV_LOG_ERROR
,
"
flv
only supports wideband (16kHz) Speex audio
\n
"
);
"
FLV
only supports wideband (16kHz) Speex audio
\n
"
);
return
AVERROR
(
EINVAL
);
return
AVERROR
(
EINVAL
);
}
}
if
(
enc
->
channels
!=
1
)
{
if
(
enc
->
channels
!=
1
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"
flv
only supports mono Speex audio
\n
"
);
av_log
(
s
,
AV_LOG_ERROR
,
"
FLV
only supports mono Speex audio
\n
"
);
return
AVERROR
(
EINVAL
);
return
AVERROR
(
EINVAL
);
}
}
return
FLV_CODECID_SPEEX
|
FLV_SAMPLERATE_11025HZ
|
FLV_SAMPLESSIZE_16BIT
;
return
FLV_CODECID_SPEEX
|
FLV_SAMPLERATE_11025HZ
|
FLV_SAMPLESSIZE_16BIT
;
...
@@ -108,8 +108,8 @@ static int get_audio_flags(AVFormatContext *s, AVCodecContext *enc)
...
@@ -108,8 +108,8 @@ static int get_audio_flags(AVFormatContext *s, AVCodecContext *enc)
}
}
default:
default:
av_log
(
s
,
AV_LOG_ERROR
,
av_log
(
s
,
AV_LOG_ERROR
,
"
flv does not support that sample rate
, "
"
FLV does not support sample rate %d
, "
"choose from (44100, 22050, 11025)
.
\n
"
);
"choose from (44100, 22050, 11025)
\n
"
,
enc
->
sample_rate
);
return
AVERROR
(
EINVAL
);
return
AVERROR
(
EINVAL
);
}
}
}
}
...
@@ -151,7 +151,8 @@ static int get_audio_flags(AVFormatContext *s, AVCodecContext *enc)
...
@@ -151,7 +151,8 @@ static int get_audio_flags(AVFormatContext *s, AVCodecContext *enc)
flags
|=
enc
->
codec_tag
<<
4
;
flags
|=
enc
->
codec_tag
<<
4
;
break
;
break
;
default:
default:
av_log
(
s
,
AV_LOG_ERROR
,
"codec not compatible with flv
\n
"
);
av_log
(
s
,
AV_LOG_ERROR
,
"Audio codec '%s' not compatible with FLV
\n
"
,
avcodec_get_name
(
enc
->
codec_id
));
return
AVERROR
(
EINVAL
);
return
AVERROR
(
EINVAL
);
}
}
...
@@ -213,7 +214,8 @@ static int flv_write_header(AVFormatContext *s)
...
@@ -213,7 +214,8 @@ static int flv_write_header(AVFormatContext *s)
}
}
video_enc
=
enc
;
video_enc
=
enc
;
if
(
enc
->
codec_tag
==
0
)
{
if
(
enc
->
codec_tag
==
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"video codec not compatible with flv
\n
"
);
av_log
(
s
,
AV_LOG_ERROR
,
"Video codec '%s' for stream %d is not compatible with FLV
\n
"
,
avcodec_get_name
(
enc
->
codec_id
),
i
);
return
AVERROR
(
EINVAL
);
return
AVERROR
(
EINVAL
);
}
}
break
;
break
;
...
@@ -224,13 +226,15 @@ static int flv_write_header(AVFormatContext *s)
...
@@ -224,13 +226,15 @@ static int flv_write_header(AVFormatContext *s)
break
;
break
;
case
AVMEDIA_TYPE_DATA
:
case
AVMEDIA_TYPE_DATA
:
if
(
enc
->
codec_id
!=
AV_CODEC_ID_TEXT
)
{
if
(
enc
->
codec_id
!=
AV_CODEC_ID_TEXT
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"codec not compatible with flv
\n
"
);
av_log
(
s
,
AV_LOG_ERROR
,
"Data codec '%s' for stream %d is not compatible with FLV
\n
"
,
avcodec_get_name
(
enc
->
codec_id
),
i
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
data_enc
=
enc
;
data_enc
=
enc
;
break
;
break
;
default:
default:
av_log
(
s
,
AV_LOG_ERROR
,
"codec not compatible with flv
\n
"
);
av_log
(
s
,
AV_LOG_ERROR
,
"Codec type '%s' for stream %d is not compatible with FLV
\n
"
,
av_get_media_type_string
(
enc
->
codec_type
),
i
);
return
AVERROR
(
EINVAL
);
return
AVERROR
(
EINVAL
);
}
}
avpriv_set_pts_info
(
s
->
streams
[
i
],
32
,
1
,
1000
);
/* 32 bit pts in ms */
avpriv_set_pts_info
(
s
->
streams
[
i
],
32
,
1
,
1000
);
/* 32 bit pts in ms */
...
@@ -343,7 +347,7 @@ static int flv_write_header(AVFormatContext *s)
...
@@ -343,7 +347,7 @@ static int flv_write_header(AVFormatContext *s)
||!
strcmp
(
tag
->
key
,
"duration"
)
||!
strcmp
(
tag
->
key
,
"duration"
)
||!
strcmp
(
tag
->
key
,
"onMetaData"
)
||!
strcmp
(
tag
->
key
,
"onMetaData"
)
){
){
av_log
(
s
,
AV_LOG_DEBUG
,
"
i
gnoring metadata for %s
\n
"
,
tag
->
key
);
av_log
(
s
,
AV_LOG_DEBUG
,
"
I
gnoring metadata for %s
\n
"
,
tag
->
key
);
continue
;
continue
;
}
}
put_amf_string
(
pb
,
tag
->
key
);
put_amf_string
(
pb
,
tag
->
key
);
...
@@ -460,7 +464,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -460,7 +464,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
flags
=
enc
->
codec_tag
;
flags
=
enc
->
codec_tag
;
if
(
flags
==
0
)
{
if
(
flags
==
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
av_log
(
s
,
AV_LOG_ERROR
,
"
video codec %s not compatible with flv
\n
"
,
"
Video codec '%s' is not compatible with FLV
\n
"
,
avcodec_get_name
(
enc
->
codec_id
));
avcodec_get_name
(
enc
->
codec_id
));
return
AVERROR
(
EINVAL
);
return
AVERROR
(
EINVAL
);
}
}
...
@@ -488,7 +492,9 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -488,7 +492,9 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
return
ret
;
return
ret
;
}
else
if
(
enc
->
codec_id
==
AV_CODEC_ID_AAC
&&
pkt
->
size
>
2
&&
}
else
if
(
enc
->
codec_id
==
AV_CODEC_ID_AAC
&&
pkt
->
size
>
2
&&
(
AV_RB16
(
pkt
->
data
)
&
0xfff0
)
==
0xfff0
)
{
(
AV_RB16
(
pkt
->
data
)
&
0xfff0
)
==
0xfff0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"malformated aac bitstream, use -absf aac_adtstoasc
\n
"
);
av_log
(
s
,
AV_LOG_ERROR
,
"Malformed AAC bitstream detected: "
"use audio bistream filter 'aac_adtstoasc' to fix it "
"('-bsf:a aac_adtstoasc' option with ffmpeg)
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
...
...
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