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
bf985625
Commit
bf985625
authored
Aug 22, 2013
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mov: Refactor codec id selection in mov_codec_id
parent
ff9d57e7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
20 deletions
+32
-20
mov.c
libavformat/mov.c
+32
-20
No files found.
libavformat/mov.c
View file @
bf985625
...
...
@@ -1069,6 +1069,37 @@ enum AVCodecID ff_mov_get_lpcm_codec_id(int bps, int flags)
return
ff_get_pcm_codec_id
(
bps
,
flags
&
1
,
flags
&
2
,
flags
&
4
?
-
1
:
0
);
}
static
int
mov_codec_id
(
AVStream
*
st
,
uint32_t
format
)
{
int
id
=
ff_codec_get_id
(
ff_codec_movaudio_tags
,
format
);
if
(
id
<=
0
&&
((
format
&
0xFFFF
)
==
'm'
+
(
's'
<<
8
)
||
(
format
&
0xFFFF
)
==
'T'
+
(
'S'
<<
8
)))
id
=
ff_codec_get_id
(
ff_codec_wav_tags
,
av_bswap32
(
format
)
&
0xFFFF
);
if
(
st
->
codec
->
codec_type
!=
AVMEDIA_TYPE_VIDEO
&&
id
>
0
)
{
st
->
codec
->
codec_type
=
AVMEDIA_TYPE_AUDIO
;
}
else
if
(
st
->
codec
->
codec_type
!=
AVMEDIA_TYPE_AUDIO
&&
/* skip old asf mpeg4 tag */
format
&&
format
!=
MKTAG
(
'm'
,
'p'
,
'4'
,
's'
))
{
id
=
ff_codec_get_id
(
ff_codec_movvideo_tags
,
format
);
if
(
id
<=
0
)
id
=
ff_codec_get_id
(
ff_codec_bmp_tags
,
format
);
if
(
id
>
0
)
st
->
codec
->
codec_type
=
AVMEDIA_TYPE_VIDEO
;
else
if
(
st
->
codec
->
codec_type
==
AVMEDIA_TYPE_DATA
)
{
id
=
ff_codec_get_id
(
ff_codec_movsubtitle_tags
,
format
);
if
(
id
>
0
)
st
->
codec
->
codec_type
=
AVMEDIA_TYPE_SUBTITLE
;
}
}
st
->
codec
->
codec_tag
=
format
;
return
id
;
}
int
ff_mov_read_stsd_entries
(
MOVContext
*
c
,
AVIOContext
*
pb
,
int
entries
)
{
AVStream
*
st
;
...
...
@@ -1119,26 +1150,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
sc
->
pseudo_stream_id
=
st
->
codec
->
codec_tag
?
-
1
:
pseudo_stream_id
;
sc
->
dref_id
=
dref_id
;
st
->
codec
->
codec_tag
=
format
;
id
=
ff_codec_get_id
(
ff_codec_movaudio_tags
,
format
);
if
(
id
<=
0
&&
((
format
&
0xFFFF
)
==
'm'
+
(
's'
<<
8
)
||
(
format
&
0xFFFF
)
==
'T'
+
(
'S'
<<
8
)))
id
=
ff_codec_get_id
(
ff_codec_wav_tags
,
av_bswap32
(
format
)
&
0xFFFF
);
if
(
st
->
codec
->
codec_type
!=
AVMEDIA_TYPE_VIDEO
&&
id
>
0
)
{
st
->
codec
->
codec_type
=
AVMEDIA_TYPE_AUDIO
;
}
else
if
(
st
->
codec
->
codec_type
!=
AVMEDIA_TYPE_AUDIO
&&
/* do not overwrite codec type */
format
&&
format
!=
MKTAG
(
'm'
,
'p'
,
'4'
,
's'
))
{
/* skip old asf mpeg4 tag */
id
=
ff_codec_get_id
(
ff_codec_movvideo_tags
,
format
);
if
(
id
<=
0
)
id
=
ff_codec_get_id
(
ff_codec_bmp_tags
,
format
);
if
(
id
>
0
)
st
->
codec
->
codec_type
=
AVMEDIA_TYPE_VIDEO
;
else
if
(
st
->
codec
->
codec_type
==
AVMEDIA_TYPE_DATA
){
id
=
ff_codec_get_id
(
ff_codec_movsubtitle_tags
,
format
);
if
(
id
>
0
)
st
->
codec
->
codec_type
=
AVMEDIA_TYPE_SUBTITLE
;
}
}
id
=
mov_codec_id
(
st
,
format
);
av_dlog
(
c
->
fc
,
"size=%d 4CC= %c%c%c%c codec_type=%d
\n
"
,
size
,
(
format
>>
0
)
&
0xff
,
(
format
>>
8
)
&
0xff
,
(
format
>>
16
)
&
0xff
,
...
...
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