Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
70596d04
Commit
70596d04
authored
19 years ago
by
Michael Niedermayer
Browse files
Options
Downloads
Patches
Plain Diff
cleanup codec_id mapping (untested)
Originally committed as revision 5195 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
f444b977
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavformat/matroska.c
+49
-90
49 additions, 90 deletions
libavformat/matroska.c
with
49 additions
and
90 deletions
libavformat/matroska.c
+
49
−
90
View file @
70596d04
...
@@ -182,32 +182,46 @@ typedef enum {
...
@@ -182,32 +182,46 @@ typedef enum {
* Matroska Codec IDs. Strings.
* Matroska Codec IDs. Strings.
*/
*/
typedef
struct
CodecTags
{
char
*
str
;
enum
CodecID
id
;
}
CodecTags
;
#define MATROSKA_CODEC_ID_VIDEO_VFW_FOURCC "V_MS/VFW/FOURCC"
#define MATROSKA_CODEC_ID_VIDEO_VFW_FOURCC "V_MS/VFW/FOURCC"
#define MATROSKA_CODEC_ID_VIDEO_UNCOMPRESSED "V_UNCOMPRESSED"
#define MATROSKA_CODEC_ID_AUDIO_ACM "A_MS/ACM"
#define MATROSKA_CODEC_ID_VIDEO_MPEG4_SP "V_MPEG4/ISO/SP"
#define MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP "V_MPEG4/ISO/ASP"
CodecTags
codec_tags
[]
=
{
#define MATROSKA_CODEC_ID_VIDEO_MPEG4_AP "V_MPEG4/ISO/AP"
// {"V_MS/VFW/FOURCC" , CODEC_ID_NONE},
#define MATROSKA_CODEC_ID_VIDEO_MPEG4_AVC "V_MPEG4/ISO/AVC"
{
"V_UNCOMPRESSED"
,
CODEC_ID_RAWVIDEO
},
#define MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3 "V_MPEG4/MS/V3"
{
"V_MPEG4/ISO/SP"
,
CODEC_ID_MPEG4
},
#define MATROSKA_CODEC_ID_VIDEO_MPEG1 "V_MPEG1"
{
"V_MPEG4/ISO/ASP"
,
CODEC_ID_MPEG4
},
#define MATROSKA_CODEC_ID_VIDEO_MPEG2 "V_MPEG2"
{
"V_MPEG4/ISO/AP"
,
CODEC_ID_MPEG4
},
#define MATROSKA_CODEC_ID_VIDEO_MJPEG "V_MJPEG"
{
"V_MPEG4/ISO/AVC"
,
CODEC_ID_H264
},
{
"V_MPEG4/MS/V3"
,
CODEC_ID_MSMPEG4V3
},
{
"V_MPEG1"
,
CODEC_ID_MPEG1VIDEO
},
{
"V_MPEG2"
,
CODEC_ID_MPEG2VIDEO
},
{
"V_MJPEG"
,
CODEC_ID_MJPEG
},
{
"V_REAL/RV10"
,
CODEC_ID_RV10
},
{
"V_REAL/RV20"
,
CODEC_ID_RV20
},
{
"V_REAL/RV30"
,
CODEC_ID_RV30
},
{
"V_REAL/RV40"
,
CODEC_ID_RV40
},
/* TODO: Real/Quicktime */
/* TODO: Real/Quicktime */
#define MATROSKA_CODEC_ID_AUDIO_
ACM
"A_MS/ACM"
// {"A_MS/
ACM
"
, CODEC_ID_NONE},
#define MATROSKA_CODEC_ID_AUDIO_MPEG1_L1 "A_MPEG/L1"
{
"A_MPEG/L1"
,
CODEC_ID_MP3
},
#define MATROSKA_CODEC_ID_AUDIO_MPEG1_L2 "A_MPEG/L2"
{
"A_MPEG/L2"
,
CODEC_ID_MP3
},
#define MATROSKA_CODEC_ID_AUDIO
_MPEG
1_
L3
"A_MPEG/L3"
{
"A
_MPEG
/
L3
"
,
CODEC_ID_MP3
},
#define MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE
"A_PCM/INT/BIG"
{
"A_PCM/INT/BIG"
,
CODEC_ID_PCM_U16BE
},
#define MATROSKA_CODEC_ID_AUDIO_PCM_INT_LE
"A_PCM/INT/LIT"
{
"A_PCM/INT/LIT"
,
CODEC_ID_PCM_U16LE
},
#define MATROSKA_CODEC_ID_AUDIO_PCM_FLOAT
"A_PCM/FLOAT/IEEE"
//
{
"A_PCM/FLOAT/IEEE"
, CODEC_ID_NONE},
#define MATROSKA_CODEC_ID_AUDIO
_AC3
"A
_AC3
"
{
"A
_AC3
"
,
CODEC_ID
_AC3
},
#define MATROSKA_CODEC_ID_AUDIO
_DTS
"A
_DTS
"
{
"A
_DTS
"
,
CODEC_ID
_DTS
},
#define MATROSKA_CODEC_ID_AUDIO
_VORBIS
"A
_VORBIS
"
{
"A
_VORBIS
"
,
CODEC_ID
_VORBIS
},
#define MATROSKA_CODEC_ID_AUDIO_ACM "A_MS/ACM"
{
"A_AAC/MPEG2/"
,
CODEC_ID_AAC
},
#define MATROSKA_CODEC_ID_AUDIO_
MPEG
2
"A_AAC/MPEG2/"
{
"A_AAC/
MPEG
4/"
,
CODEC_ID_AAC
},
#define MATROSKA_CODEC_ID_AUDIO_MPEG4 "A_AAC/MPEG4/"
{
NULL
,
CODEC_ID_NONE
}
/* TODO: AC3-9/10 (?), Real, Musepack, Quicktime */
/* TODO: AC3-9/10 (?), Real, Musepack, Quicktime */
};
/* max. depth in the EBML tree structure */
/* max. depth in the EBML tree structure */
#define EBML_MAX_DEPTH 16
#define EBML_MAX_DEPTH 16
...
@@ -2125,14 +2139,14 @@ matroska_read_header (AVFormatContext *s,
...
@@ -2125,14 +2139,14 @@ matroska_read_header (AVFormatContext *s,
/* Have we found a cluster? */
/* Have we found a cluster? */
if
(
res
==
1
)
{
if
(
res
==
1
)
{
int
i
;
int
i
,
j
;
enum
CodecID
codec_id
;
enum
CodecID
codec_id
=
CODEC_ID_NONE
;
MatroskaTrack
*
track
;
MatroskaTrack
*
track
;
AVStream
*
st
;
AVStream
*
st
;
void
*
extradata
=
NULL
;
int
extradata_size
=
0
;
for
(
i
=
0
;
i
<
matroska
->
num_tracks
;
i
++
)
{
for
(
i
=
0
;
i
<
matroska
->
num_tracks
;
i
++
)
{
void
*
extradata
=
NULL
;
int
extradata_size
=
0
;
track
=
matroska
->
tracks
[
i
];
track
=
matroska
->
tracks
[
i
];
/* libavformat does not really support subtitles.
/* libavformat does not really support subtitles.
...
@@ -2141,6 +2155,13 @@ matroska_read_header (AVFormatContext *s,
...
@@ -2141,6 +2155,13 @@ matroska_read_header (AVFormatContext *s,
(
track
->
codec_id
==
NULL
))
(
track
->
codec_id
==
NULL
))
continue
;
continue
;
for
(
j
=
0
;
codec_tags
[
j
].
str
;
j
++
){
if
(
!
strcmp
(
codec_tags
[
j
].
str
,
track
->
codec_id
)){
codec_id
=
codec_tags
[
j
].
id
;
break
;
}
}
/* Set the FourCC from the CodecID. */
/* Set the FourCC from the CodecID. */
/* This is the MS compatibility mode which stores a
/* This is the MS compatibility mode which stores a
* BITMAPINFOHEADER in the CodecPrivate. */
* BITMAPINFOHEADER in the CodecPrivate. */
...
@@ -2156,27 +2177,7 @@ matroska_read_header (AVFormatContext *s,
...
@@ -2156,27 +2177,7 @@ matroska_read_header (AVFormatContext *s,
(
p
[
2
]
<<
16
)
|
(
p
[
1
]
<<
8
)
|
p
[
0
];
(
p
[
2
]
<<
16
)
|
(
p
[
1
]
<<
8
)
|
p
[
0
];
codec_id
=
codec_get_bmp_id
(((
MatroskaVideoTrack
*
)
track
)
->
fourcc
);
codec_id
=
codec_get_bmp_id
(((
MatroskaVideoTrack
*
)
track
)
->
fourcc
);
}
else
if
(
!
strcmp
(
track
->
codec_id
,
}
MATROSKA_CODEC_ID_VIDEO_MPEG4_SP
)
||
!
strcmp
(
track
->
codec_id
,
MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP
)
||
!
strcmp
(
track
->
codec_id
,
MATROSKA_CODEC_ID_VIDEO_MPEG4_AP
))
codec_id
=
CODEC_ID_MPEG4
;
else
if
(
!
strcmp
(
track
->
codec_id
,
MATROSKA_CODEC_ID_VIDEO_MPEG4_AVC
))
codec_id
=
CODEC_ID_H264
;
/* else if (!strcmp(track->codec_id, */
/* MATROSKA_CODEC_ID_VIDEO_UNCOMPRESSED)) */
/* codec_id = CODEC_ID_???; */
else
if
(
!
strcmp
(
track
->
codec_id
,
MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3
))
codec_id
=
CODEC_ID_MSMPEG4V3
;
else
if
(
!
strcmp
(
track
->
codec_id
,
MATROSKA_CODEC_ID_VIDEO_MPEG1
)
||
!
strcmp
(
track
->
codec_id
,
MATROSKA_CODEC_ID_VIDEO_MPEG2
))
codec_id
=
CODEC_ID_MPEG2VIDEO
;
/* This is the MS compatibility mode which stores a
/* This is the MS compatibility mode which stores a
* WAVEFORMATEX in the CodecPrivate. */
* WAVEFORMATEX in the CodecPrivate. */
...
@@ -2192,49 +2193,7 @@ matroska_read_header (AVFormatContext *s,
...
@@ -2192,49 +2193,7 @@ matroska_read_header (AVFormatContext *s,
tag
=
(
p
[
1
]
<<
8
)
|
p
[
0
];
tag
=
(
p
[
1
]
<<
8
)
|
p
[
0
];
codec_id
=
codec_get_wav_id
(
tag
);
codec_id
=
codec_get_wav_id
(
tag
);
}
else
if
(
!
strcmp
(
track
->
codec_id
,
}
MATROSKA_CODEC_ID_AUDIO_MPEG1_L1
)
||
!
strcmp
(
track
->
codec_id
,
MATROSKA_CODEC_ID_AUDIO_MPEG1_L2
)
||
!
strcmp
(
track
->
codec_id
,
MATROSKA_CODEC_ID_AUDIO_MPEG1_L3
))
codec_id
=
CODEC_ID_MP3
;
else
if
(
!
strcmp
(
track
->
codec_id
,
MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE
))
codec_id
=
CODEC_ID_PCM_U16BE
;
else
if
(
!
strcmp
(
track
->
codec_id
,
MATROSKA_CODEC_ID_AUDIO_PCM_INT_LE
))
codec_id
=
CODEC_ID_PCM_U16LE
;
/* else if (!strcmp(track->codec_id, */
/* MATROSKA_CODEC_ID_AUDIO_PCM_FLOAT)) */
/* codec_id = CODEC_ID_PCM_???; */
else
if
(
!
strcmp
(
track
->
codec_id
,
MATROSKA_CODEC_ID_AUDIO_AC3
))
codec_id
=
CODEC_ID_AC3
;
else
if
(
!
strcmp
(
track
->
codec_id
,
MATROSKA_CODEC_ID_AUDIO_DTS
))
codec_id
=
CODEC_ID_DTS
;
/* No such codec id so far. */
/* else if (!strcmp(track->codec_id, */
/* MATROSKA_CODEC_ID_AUDIO_DTS)) */
/* codec_id = CODEC_ID_DTS; */
else
if
(
!
strcmp
(
track
->
codec_id
,
MATROSKA_CODEC_ID_AUDIO_VORBIS
))
{
extradata_size
=
track
->
codec_priv_size
;
if
(
extradata_size
)
{
extradata
=
av_malloc
(
extradata_size
);
if
(
extradata
==
NULL
)
return
AVERROR_NOMEM
;
memcpy
(
extradata
,
track
->
codec_priv
,
extradata_size
);
}
codec_id
=
CODEC_ID_VORBIS
;
}
else
if
(
!
strcmp
(
track
->
codec_id
,
MATROSKA_CODEC_ID_AUDIO_MPEG2
)
||
!
strcmp
(
track
->
codec_id
,
MATROSKA_CODEC_ID_AUDIO_MPEG4
))
codec_id
=
CODEC_ID_AAC
;
else
codec_id
=
CODEC_ID_NONE
;
if
(
codec_id
==
CODEC_ID_NONE
)
{
if
(
codec_id
==
CODEC_ID_NONE
)
{
av_log
(
matroska
->
ctx
,
AV_LOG_INFO
,
av_log
(
matroska
->
ctx
,
AV_LOG_INFO
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment