diff options
Diffstat (limited to 'src/libmpeg2/header.c')
-rw-r--r-- | src/libmpeg2/header.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/libmpeg2/header.c b/src/libmpeg2/header.c index e021b2f8e..013393da4 100644 --- a/src/libmpeg2/header.c +++ b/src/libmpeg2/header.c @@ -22,6 +22,7 @@ #include "config.h" #include <inttypes.h> +#include <stdio.h> #include "mpeg2_internal.h" #include "attributes.h" @@ -94,6 +95,39 @@ int header_process_sequence_header (picture_t * picture, uint8_t * buffer) /* this is not used by the decoder */ picture->aspect_ratio_information = buffer[3] >> 4; picture->frame_rate_code = buffer[3] & 15; + + switch (picture->frame_rate_code) { + case 1: /* 23.976 fps */ + picture->frame_duration = 3913; + break; + case 2: /* 24 fps */ + picture->frame_duration = 3750; + break; + case 3: /* 25 fps */ + picture->frame_duration = 3600; + break; + case 4: /* 29.97 fps */ + picture->frame_duration = 3003; + break; + case 5: /* 30 fps */ + picture->frame_duration = 3000; + break; + case 6: /* 50 fps */ + picture->frame_duration = 1800; + break; + case 7: /* 59.94 fps */ + picture->frame_duration = 1525; + break; + case 8: /* 60 fps */ + picture->frame_duration = 1509; + break; + default: + printf ("invalid/unknown frame rate code : %d \n", + picture->frame_rate_code); + picture->frame_duration = 3000; + } + + picture->bitrate = (buffer[4]<<10)|(buffer[5]<<2)|(buffer[6]>>6); if (buffer[7] & 2) { |