diff mbox

[FFmpeg-devel,03/37] avformat/matroskadec: Compactify structure

Message ID 20190516223018.30827-4-andreas.rheinhardt@gmail.com
State Accepted
Commit 410a0824f07ac4a526f633409cf893a897d2269c
Headers show

Commit Message

Andreas Rheinhardt May 16, 2019, 10:29 p.m. UTC
Matroska EBML IDs can be only four bytes long maximally, so it is
natural to use uint32_t for them. By doing this and rearranging the
elements of the MatroskaLevel1Element structure, one can reduce the size
of said structure.

Notice that this field is not read via the generic reading process for
EBML_UINT, so one is not forced to use an uint64_t for it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/matroskadec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer June 7, 2019, 7:30 p.m. UTC | #1
On Fri, May 17, 2019 at 12:29:47AM +0200, Andreas Rheinhardt wrote:
> Matroska EBML IDs can be only four bytes long maximally, so it is
> natural to use uint32_t for them. By doing this and rearranging the
> elements of the MatroskaLevel1Element structure, one can reduce the size
> of said structure.
> 
> Notice that this field is not read via the generic reading process for
> EBML_UINT, so one is not forced to use an uint64_t for it.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavformat/matroskadec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

thx

[...]
diff mbox

Patch

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 6da9b15d79..3b8ddc5ecb 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -310,8 +310,8 @@  typedef struct MatroskaCluster {
 } MatroskaCluster;
 
 typedef struct MatroskaLevel1Element {
-    uint64_t id;
     uint64_t pos;
+    uint32_t id;
     int parsed;
 } MatroskaLevel1Element;