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
d2d7b713
Commit
d2d7b713
authored
Aug 17, 2011
by
Nicolas George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc: use av_get_media_type_string and avcodec_get_name in avcodec_string.
parent
b3be9f4a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
42 deletions
+20
-42
utils.c
libavcodec/utils.c
+20
-42
No files found.
libavcodec/utils.c
View file @
d2d7b713
...
...
@@ -1020,43 +1020,37 @@ size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_ta
void
avcodec_string
(
char
*
buf
,
int
buf_size
,
AVCodecContext
*
enc
,
int
encode
)
{
const
char
*
codec_type
;
const
char
*
codec_name
;
const
char
*
profile
=
NULL
;
AVCodec
*
p
;
char
buf1
[
32
];
int
bitrate
;
AVRational
display_aspect_ratio
;
if
(
encode
)
p
=
avcodec_find_encoder
(
enc
->
codec_id
);
else
p
=
avcodec_find_decoder
(
enc
->
codec_id
);
if
(
p
)
{
codec_name
=
p
->
name
;
profile
=
av_get_profile_name
(
p
,
enc
->
profile
);
}
else
if
(
enc
->
codec_id
==
CODEC_ID_MPEG2TS
)
{
/* fake mpeg2 transport stream codec (currently not
registered) */
codec_name
=
"mpeg2ts"
;
}
else
if
(
enc
->
codec_name
[
0
]
!=
'\0'
)
{
codec_name
=
enc
->
codec_name
;
}
else
{
/* output avi tags */
if
(
!
buf
||
buf_size
<=
0
)
return
;
codec_type
=
av_get_media_type_string
(
enc
->
codec_type
);
codec_name
=
avcodec_get_name
(
enc
->
codec_id
);
if
(
enc
->
profile
!=
FF_PROFILE_UNKNOWN
)
{
p
=
encode
?
avcodec_find_encoder
(
enc
->
codec_id
)
:
avcodec_find_decoder
(
enc
->
codec_id
);
if
(
p
)
profile
=
av_get_profile_name
(
p
,
enc
->
profile
);
}
snprintf
(
buf
,
buf_size
,
"%s: %s%s"
,
codec_type
?
codec_type
:
"unknown"
,
codec_name
,
enc
->
mb_decision
?
" (hq)"
:
""
);
buf
[
0
]
^=
'a'
^
'A'
;
/* first letter in uppercase */
if
(
profile
)
snprintf
(
buf
+
strlen
(
buf
),
buf_size
-
strlen
(
buf
),
" (%s)"
,
profile
);
if
(
enc
->
codec_tag
)
{
char
tag_buf
[
32
];
av_get_codec_tag_string
(
tag_buf
,
sizeof
(
tag_buf
),
enc
->
codec_tag
);
snprintf
(
buf
1
,
sizeof
(
buf1
),
"%s / 0x%04X"
,
tag_buf
,
enc
->
codec_tag
);
codec_name
=
buf1
;
snprintf
(
buf
+
strlen
(
buf
),
buf_size
-
strlen
(
buf
),
" (%s / 0x%04X)"
,
tag_buf
,
enc
->
codec_tag
)
;
}
switch
(
enc
->
codec_type
)
{
case
AVMEDIA_TYPE_VIDEO
:
snprintf
(
buf
,
buf_size
,
"Video: %s%s"
,
codec_name
,
enc
->
mb_decision
?
" (hq)"
:
""
);
if
(
profile
)
snprintf
(
buf
+
strlen
(
buf
),
buf_size
-
strlen
(
buf
),
" (%s)"
,
profile
);
if
(
enc
->
pix_fmt
!=
PIX_FMT_NONE
)
{
snprintf
(
buf
+
strlen
(
buf
),
buf_size
-
strlen
(
buf
),
", %s"
,
...
...
@@ -1089,12 +1083,6 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
}
break
;
case
AVMEDIA_TYPE_AUDIO
:
snprintf
(
buf
,
buf_size
,
"Audio: %s"
,
codec_name
);
if
(
profile
)
snprintf
(
buf
+
strlen
(
buf
),
buf_size
-
strlen
(
buf
),
" (%s)"
,
profile
);
if
(
enc
->
sample_rate
)
{
snprintf
(
buf
+
strlen
(
buf
),
buf_size
-
strlen
(
buf
),
", %d Hz"
,
enc
->
sample_rate
);
...
...
@@ -1106,17 +1094,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
", %s"
,
av_get_sample_fmt_name
(
enc
->
sample_fmt
));
}
break
;
case
AVMEDIA_TYPE_DATA
:
snprintf
(
buf
,
buf_size
,
"Data: %s"
,
codec_name
);
break
;
case
AVMEDIA_TYPE_SUBTITLE
:
snprintf
(
buf
,
buf_size
,
"Subtitle: %s"
,
codec_name
);
break
;
case
AVMEDIA_TYPE_ATTACHMENT
:
snprintf
(
buf
,
buf_size
,
"Attachment: %s"
,
codec_name
);
break
;
default
:
snprintf
(
buf
,
buf_size
,
"Invalid Codec type %d"
,
enc
->
codec_type
);
return
;
}
if
(
encode
)
{
...
...
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