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
0a3ad7ff
Commit
0a3ad7ff
authored
May 07, 2012
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flvenc: use AVFormatContext, not AVCodecContext for logging.
Encoder tag being used for muxer messages is confusing.
parent
455245ca
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
flvenc.c
libavformat/flvenc.c
+11
-10
No files found.
libavformat/flvenc.c
View file @
0a3ad7ff
...
...
@@ -64,18 +64,19 @@ typedef struct FLVStreamContext {
int64_t
last_ts
;
///< last timestamp for each stream
}
FLVStreamContext
;
static
int
get_audio_flags
(
AVCodecContext
*
enc
){
static
int
get_audio_flags
(
AVFormatContext
*
s
,
AVCodecContext
*
enc
)
{
int
flags
=
(
enc
->
bits_per_coded_sample
==
16
)
?
FLV_SAMPLESSIZE_16BIT
:
FLV_SAMPLESSIZE_8BIT
;
if
(
enc
->
codec_id
==
CODEC_ID_AAC
)
// specs force these parameters
return
FLV_CODECID_AAC
|
FLV_SAMPLERATE_44100HZ
|
FLV_SAMPLESSIZE_16BIT
|
FLV_STEREO
;
else
if
(
enc
->
codec_id
==
CODEC_ID_SPEEX
)
{
if
(
enc
->
sample_rate
!=
16000
)
{
av_log
(
enc
,
AV_LOG_ERROR
,
"flv only supports wideband (16kHz) Speex audio
\n
"
);
av_log
(
s
,
AV_LOG_ERROR
,
"flv only supports wideband (16kHz) Speex audio
\n
"
);
return
-
1
;
}
if
(
enc
->
channels
!=
1
)
{
av_log
(
enc
,
AV_LOG_ERROR
,
"flv only supports mono Speex audio
\n
"
);
av_log
(
s
,
AV_LOG_ERROR
,
"flv only supports mono Speex audio
\n
"
);
return
-
1
;
}
return
FLV_CODECID_SPEEX
|
FLV_SAMPLERATE_11025HZ
|
FLV_SAMPLESSIZE_16BIT
;
...
...
@@ -98,7 +99,7 @@ static int get_audio_flags(AVCodecContext *enc){
break
;
}
default:
av_log
(
enc
,
AV_LOG_ERROR
,
"flv does not support that sample rate, choose from (44100, 22050, 11025).
\n
"
);
av_log
(
s
,
AV_LOG_ERROR
,
"flv does not support that sample rate, choose from (44100, 22050, 11025).
\n
"
);
return
-
1
;
}
}
...
...
@@ -136,7 +137,7 @@ static int get_audio_flags(AVCodecContext *enc){
flags
|=
enc
->
codec_tag
<<
4
;
break
;
default:
av_log
(
enc
,
AV_LOG_ERROR
,
"codec not compatible with flv
\n
"
);
av_log
(
s
,
AV_LOG_ERROR
,
"codec not compatible with flv
\n
"
);
return
-
1
;
}
...
...
@@ -194,12 +195,12 @@ static int flv_write_header(AVFormatContext *s)
}
video_enc
=
enc
;
if
(
enc
->
codec_tag
==
0
)
{
av_log
(
enc
,
AV_LOG_ERROR
,
"video codec not compatible with flv
\n
"
);
av_log
(
s
,
AV_LOG_ERROR
,
"video codec not compatible with flv
\n
"
);
return
-
1
;
}
}
else
{
audio_enc
=
enc
;
if
(
get_audio_flags
(
enc
)
<
0
)
if
(
get_audio_flags
(
s
,
enc
)
<
0
)
return
-
1
;
}
avpriv_set_pts_info
(
s
->
streams
[
i
],
32
,
1
,
1000
);
/* 32 bit pts in ms */
...
...
@@ -324,7 +325,7 @@ static int flv_write_header(AVFormatContext *s)
avio_wb24
(
pb
,
0
);
// streamid
pos
=
avio_tell
(
pb
);
if
(
enc
->
codec_id
==
CODEC_ID_AAC
)
{
avio_w8
(
pb
,
get_audio_flags
(
enc
));
avio_w8
(
pb
,
get_audio_flags
(
s
,
enc
));
avio_w8
(
pb
,
0
);
// AAC sequence header
avio_write
(
pb
,
enc
->
extradata
,
enc
->
extradata_size
);
}
else
{
...
...
@@ -400,14 +401,14 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
flags
=
enc
->
codec_tag
;
if
(
flags
==
0
)
{
av_log
(
enc
,
AV_LOG_ERROR
,
"video codec %X not compatible with flv
\n
"
,
enc
->
codec_id
);
av_log
(
s
,
AV_LOG_ERROR
,
"video codec %X not compatible with flv
\n
"
,
enc
->
codec_id
);
return
-
1
;
}
flags
|=
pkt
->
flags
&
AV_PKT_FLAG_KEY
?
FLV_FRAME_KEY
:
FLV_FRAME_INTER
;
}
else
{
assert
(
enc
->
codec_type
==
AVMEDIA_TYPE_AUDIO
);
flags
=
get_audio_flags
(
enc
);
flags
=
get_audio_flags
(
s
,
enc
);
assert
(
size
);
...
...
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