mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-23 04:24:35 +02:00
avformat/matroskadec: Combine arrays
By including SimpleBlocks and BlockGroups twice in the same EbmlSyntax array (with different semantics), one can reduce the duplication of the other values. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
a9f051519e
commit
38255cdcf8
@ -716,26 +716,21 @@ static const EbmlSyntax matroska_blockgroup[] = {
|
|||||||
CHILD_OF(matroska_cluster_parsing)
|
CHILD_OF(matroska_cluster_parsing)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// The following array contains SimpleBlock and BlockGroup twice
|
||||||
|
// in order to reuse the other values for matroska_cluster_enter.
|
||||||
static const EbmlSyntax matroska_cluster_parsing[] = {
|
static const EbmlSyntax matroska_cluster_parsing[] = {
|
||||||
{ MATROSKA_ID_CLUSTERTIMECODE, EBML_UINT, 0, offsetof(MatroskaCluster, timecode) },
|
|
||||||
{ MATROSKA_ID_BLOCKGROUP, EBML_NEST, 0, 0, { .n = matroska_blockgroup } },
|
|
||||||
{ MATROSKA_ID_SIMPLEBLOCK, EBML_BIN, 0, offsetof(MatroskaBlock, bin) },
|
{ MATROSKA_ID_SIMPLEBLOCK, EBML_BIN, 0, offsetof(MatroskaBlock, bin) },
|
||||||
{ MATROSKA_ID_CLUSTERPOSITION, EBML_NONE },
|
{ MATROSKA_ID_BLOCKGROUP, EBML_NEST, 0, 0, { .n = matroska_blockgroup } },
|
||||||
{ MATROSKA_ID_CLUSTERPREVSIZE, EBML_NONE },
|
|
||||||
CHILD_OF(matroska_segment)
|
|
||||||
};
|
|
||||||
|
|
||||||
static const EbmlSyntax matroska_cluster_initial[] = {
|
|
||||||
{ MATROSKA_ID_CLUSTERTIMECODE, EBML_UINT, 0, offsetof(MatroskaCluster, timecode) },
|
{ MATROSKA_ID_CLUSTERTIMECODE, EBML_UINT, 0, offsetof(MatroskaCluster, timecode) },
|
||||||
{ MATROSKA_ID_BLOCKGROUP, EBML_STOP },
|
|
||||||
{ MATROSKA_ID_SIMPLEBLOCK, EBML_STOP },
|
{ MATROSKA_ID_SIMPLEBLOCK, EBML_STOP },
|
||||||
|
{ MATROSKA_ID_BLOCKGROUP, EBML_STOP },
|
||||||
{ MATROSKA_ID_CLUSTERPOSITION, EBML_NONE },
|
{ MATROSKA_ID_CLUSTERPOSITION, EBML_NONE },
|
||||||
{ MATROSKA_ID_CLUSTERPREVSIZE, EBML_NONE },
|
{ MATROSKA_ID_CLUSTERPREVSIZE, EBML_NONE },
|
||||||
CHILD_OF(matroska_segment)
|
CHILD_OF(matroska_segment)
|
||||||
};
|
};
|
||||||
|
|
||||||
static const EbmlSyntax matroska_cluster_enter[] = {
|
static const EbmlSyntax matroska_cluster_enter[] = {
|
||||||
{ MATROSKA_ID_CLUSTER, EBML_NEST, 0, 0, { .n = matroska_cluster_initial } },
|
{ MATROSKA_ID_CLUSTER, EBML_NEST, 0, 0, { .n = &matroska_cluster_parsing[2] } },
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1063,6 +1058,9 @@ static int ebml_parse(MatroskaDemuxContext *matroska,
|
|||||||
static EbmlSyntax *ebml_parse_id(EbmlSyntax *syntax, uint32_t id)
|
static EbmlSyntax *ebml_parse_id(EbmlSyntax *syntax, uint32_t id)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
// Whoever touches this should be aware of the duplication
|
||||||
|
// existing in matroska_cluster_parsing.
|
||||||
for (i = 0; syntax[i].id; i++)
|
for (i = 0; syntax[i].id; i++)
|
||||||
if (id == syntax[i].id)
|
if (id == syntax[i].id)
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user