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
b92c61e0
Commit
b92c61e0
authored
Jul 31, 2006
by
Baptiste Coudurier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify using function table
Originally committed as revision 5871 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
80d0ded2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
52 deletions
+38
-52
mxf.c
libavformat/mxf.c
+38
-52
No files found.
libavformat/mxf.c
View file @
b92c61e0
...
@@ -143,21 +143,10 @@ typedef struct MXFCodecUL {
...
@@ -143,21 +143,10 @@ typedef struct MXFCodecUL {
enum
CodecID
id
;
enum
CodecID
id
;
}
MXFCodecUL
;
}
MXFCodecUL
;
static
const
UID
mxf_metadata_preface_key
=
{
0x06
,
0x0e
,
0x2b
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x2F
,
0x00
};
typedef
struct
MXFMetadataReadTableEntry
{
static
const
UID
mxf_metadata_content_storage_key
=
{
0x06
,
0x0e
,
0x2b
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x18
,
0x00
};
const
UID
key
;
static
const
UID
mxf_metadata_source_package_key
=
{
0x06
,
0x0e
,
0x2b
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x37
,
0x00
};
int
(
*
read
)(
MXFContext
*
mxf
,
KLVPacket
*
klv
);
static
const
UID
mxf_metadata_material_package_key
=
{
0x06
,
0x0e
,
0x2b
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x36
,
0x00
};
}
MXFMetadataReadTableEntry
;
static
const
UID
mxf_metadata_sequence_key
=
{
0x06
,
0x0e
,
0x2b
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x0F
,
0x00
};
static
const
UID
mxf_metadata_source_clip_key
=
{
0x06
,
0x0e
,
0x2b
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x11
,
0x00
};
static
const
UID
mxf_metadata_multiple_descriptor_key
=
{
0x06
,
0x0e
,
0x2b
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x44
,
0x00
};
static
const
UID
mxf_metadata_generic_sound_descriptor_key
=
{
0x06
,
0x0e
,
0x2b
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x42
,
0x00
};
static
const
UID
mxf_metadata_cdci_descriptor_key
=
{
0x06
,
0x0e
,
0x2b
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x28
,
0x00
};
static
const
UID
mxf_metadata_rgba_descriptor_key
=
{
0x06
,
0x0e
,
0x2b
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x29
,
0x00
};
static
const
UID
mxf_metadata_mpegvideo_descriptor_key
=
{
0x06
,
0x0e
,
0x2b
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x51
,
0x00
};
static
const
UID
mxf_metadata_wave_descriptor_key
=
{
0x06
,
0x0e
,
0x2b
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x48
,
0x00
};
static
const
UID
mxf_metadata_aes3_descriptor_key
=
{
0x06
,
0x0e
,
0x2b
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x47
,
0x00
};
static
const
UID
mxf_metadata_static_track_key
=
{
0x06
,
0x0e
,
0x2b
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x3A
,
0x00
};
static
const
UID
mxf_metadata_track_key
=
{
0x06
,
0x0e
,
0x2b
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x3b
,
0x00
};
/* partial keys to match */
/* partial keys to match */
static
const
uint8_t
mxf_header_partition_pack_key
[]
=
{
0x06
,
0x0e
,
0x2b
,
0x34
,
0x02
,
0x05
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x02
,
0x01
,
0x01
,
0x02
};
static
const
uint8_t
mxf_header_partition_pack_key
[]
=
{
0x06
,
0x0e
,
0x2b
,
0x34
,
0x02
,
0x05
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x02
,
0x01
,
0x01
,
0x02
};
...
@@ -838,14 +827,34 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
...
@@ -838,14 +827,34 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
return
0
;
return
0
;
}
}
static
const
MXFMetadataReadTableEntry
mxf_metadata_read_table
[]
=
{
{
{
0x06
,
0x0E
,
0x2B
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x2F
,
0x00
},
mxf_read_metadata_preface
},
{
{
0x06
,
0x0E
,
0x2B
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x18
,
0x00
},
mxf_read_metadata_content_storage
},
{
{
0x06
,
0x0E
,
0x2B
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x37
,
0x00
},
mxf_read_metadata_source_package
},
{
{
0x06
,
0x0E
,
0x2B
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x36
,
0x00
},
mxf_read_metadata_material_package
},
{
{
0x06
,
0x0E
,
0x2B
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x0F
,
0x00
},
mxf_read_metadata_sequence
},
{
{
0x06
,
0x0E
,
0x2B
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x11
,
0x00
},
mxf_read_metadata_source_clip
},
{
{
0x06
,
0x0E
,
0x2B
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x44
,
0x00
},
mxf_read_metadata_multiple_descriptor
},
{
{
0x06
,
0x0E
,
0x2B
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x42
,
0x00
},
mxf_read_metadata_generic_descriptor
},
/* Generic Sound */
{
{
0x06
,
0x0E
,
0x2B
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x28
,
0x00
},
mxf_read_metadata_generic_descriptor
},
/* CDCI */
{
{
0x06
,
0x0E
,
0x2B
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x29
,
0x00
},
mxf_read_metadata_generic_descriptor
},
/* RGBA */
{
{
0x06
,
0x0E
,
0x2B
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x51
,
0x00
},
mxf_read_metadata_generic_descriptor
},
/* MPEG 2 Video */
{
{
0x06
,
0x0E
,
0x2B
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x48
,
0x00
},
mxf_read_metadata_generic_descriptor
},
/* Wave */
{
{
0x06
,
0x0E
,
0x2B
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x47
,
0x00
},
mxf_read_metadata_generic_descriptor
},
/* AES3 */
{
{
0x06
,
0x0E
,
0x2B
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x3A
,
0x00
},
mxf_read_metadata_track
},
/* Static Track */
{
{
0x06
,
0x0E
,
0x2B
,
0x34
,
0x02
,
0x53
,
0x01
,
0x01
,
0x0d
,
0x01
,
0x01
,
0x01
,
0x01
,
0x01
,
0x3B
,
0x00
},
mxf_read_metadata_track
},
/* Generic Track */
{
{
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
},
NULL
},
};
static
int
mxf_read_header
(
AVFormatContext
*
s
,
AVFormatParameters
*
ap
)
static
int
mxf_read_header
(
AVFormatContext
*
s
,
AVFormatParameters
*
ap
)
{
{
MXFContext
*
mxf
=
s
->
priv_data
;
MXFContext
*
mxf
=
s
->
priv_data
;
KLVPacket
klv
;
KLVPacket
klv
;
int
ret
=
0
;
mxf
->
fc
=
s
;
mxf
->
fc
=
s
;
while
(
!
url_feof
(
&
s
->
pb
))
{
while
(
!
url_feof
(
&
s
->
pb
))
{
const
MXFMetadataReadTableEntry
*
function
;
if
(
klv_read_packet
(
&
klv
,
&
s
->
pb
)
<
0
)
{
if
(
klv_read_packet
(
&
klv
,
&
s
->
pb
)
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"error reading KLV packet
\n
"
);
av_log
(
s
,
AV_LOG_ERROR
,
"error reading KLV packet
\n
"
);
return
-
1
;
return
-
1
;
...
@@ -853,46 +862,23 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
...
@@ -853,46 +862,23 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
#ifdef DEBUG
#ifdef DEBUG
PRINT_KEY
(
klv
.
key
);
PRINT_KEY
(
klv
.
key
);
#endif
#endif
if
(
IS_KLV_KEY
(
klv
.
key
,
mxf_metadata_track_key
))
if
(
IS_KLV_KEY
(
klv
.
key
,
mxf_essence_element_key
))
{
ret
=
mxf_read_metadata_track
(
mxf
,
&
klv
);
else
if
(
IS_KLV_KEY
(
klv
.
key
,
mxf_metadata_static_track_key
))
ret
=
mxf_read_metadata_track
(
mxf
,
&
klv
);
else
if
(
IS_KLV_KEY
(
klv
.
key
,
mxf_metadata_source_package_key
))
ret
=
mxf_read_metadata_source_package
(
mxf
,
&
klv
);
else
if
(
IS_KLV_KEY
(
klv
.
key
,
mxf_metadata_sequence_key
))
ret
=
mxf_read_metadata_sequence
(
mxf
,
&
klv
);
else
if
(
IS_KLV_KEY
(
klv
.
key
,
mxf_metadata_material_package_key
))
ret
=
mxf_read_metadata_material_package
(
mxf
,
&
klv
);
else
if
(
IS_KLV_KEY
(
klv
.
key
,
mxf_metadata_source_clip_key
))
ret
=
mxf_read_metadata_source_clip
(
mxf
,
&
klv
);
else
if
(
IS_KLV_KEY
(
klv
.
key
,
mxf_metadata_multiple_descriptor_key
))
ret
=
mxf_read_metadata_multiple_descriptor
(
mxf
,
&
klv
);
else
if
(
IS_KLV_KEY
(
klv
.
key
,
mxf_metadata_wave_descriptor_key
))
ret
=
mxf_read_metadata_generic_descriptor
(
mxf
,
&
klv
);
else
if
(
IS_KLV_KEY
(
klv
.
key
,
mxf_metadata_mpegvideo_descriptor_key
))
ret
=
mxf_read_metadata_generic_descriptor
(
mxf
,
&
klv
);
else
if
(
IS_KLV_KEY
(
klv
.
key
,
mxf_metadata_cdci_descriptor_key
))
ret
=
mxf_read_metadata_generic_descriptor
(
mxf
,
&
klv
);
else
if
(
IS_KLV_KEY
(
klv
.
key
,
mxf_metadata_rgba_descriptor_key
))
ret
=
mxf_read_metadata_generic_descriptor
(
mxf
,
&
klv
);
else
if
(
IS_KLV_KEY
(
klv
.
key
,
mxf_metadata_generic_sound_descriptor_key
))
ret
=
mxf_read_metadata_generic_descriptor
(
mxf
,
&
klv
);
else
if
(
IS_KLV_KEY
(
klv
.
key
,
mxf_metadata_aes3_descriptor_key
))
ret
=
mxf_read_metadata_generic_descriptor
(
mxf
,
&
klv
);
else
if
(
IS_KLV_KEY
(
klv
.
key
,
mxf_metadata_preface_key
))
ret
=
mxf_read_metadata_preface
(
mxf
,
&
klv
);
else
if
(
IS_KLV_KEY
(
klv
.
key
,
mxf_metadata_content_storage_key
))
ret
=
mxf_read_metadata_content_storage
(
mxf
,
&
klv
);
else
if
(
IS_KLV_KEY
(
klv
.
key
,
mxf_essence_element_key
))
{
/* FIXME avoid seek */
/* FIXME avoid seek */
url_fseek
(
&
s
->
pb
,
klv
.
offset
,
SEEK_SET
);
url_fseek
(
&
s
->
pb
,
klv
.
offset
,
SEEK_SET
);
break
;
break
;
}
else
url_fskip
(
&
s
->
pb
,
klv
.
length
);
if
(
ret
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"error reading header metadata
\n
"
);
return
ret
;
}
}
for
(
function
=
mxf_metadata_read_table
;
function
->
read
;
function
++
)
{
if
(
IS_KLV_KEY
(
klv
.
key
,
function
->
key
))
{
if
(
function
->
read
(
mxf
,
&
klv
)
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"error reading header metadata
\n
"
);
return
-
1
;
}
break
;
}
}
if
(
!
function
->
read
)
url_fskip
(
&
s
->
pb
,
klv
.
length
);
}
}
return
mxf_parse_structural_metadata
(
mxf
);
return
mxf_parse_structural_metadata
(
mxf
);
}
}
...
...
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