diff options
-rw-r--r-- | tools/h264.c | 11 | ||||
-rw-r--r-- | tools/h264.h | 9 | ||||
-rw-r--r-- | tools/mpeg.h | 8 |
3 files changed, 12 insertions, 16 deletions
diff --git a/tools/h264.c b/tools/h264.c index 90a35e83..84c337a1 100644 --- a/tools/h264.c +++ b/tools/h264.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: h264.c,v 1.2 2008-05-20 11:00:42 phintuka Exp $ + * $Id: h264.c,v 1.3 2008-06-11 15:50:28 phintuka Exp $ * */ @@ -111,7 +111,7 @@ int h264_parse_sps(const uint8_t *buf, int len, h264_sps_data_t *sps) sps->pixel_aspect.den = br_get_u16(&br); /* sar_height */ LOGDBG("H.264 SPS: -> sar %dx%d", sps->pixel_aspect.num, sps->pixel_aspect.den); } else { - static const h264_rational_t aspect_ratios[] = + static const mpeg_rational_t aspect_ratios[] = { /* page 213: */ /* 0: unknown */ {0, 1}, @@ -121,7 +121,7 @@ int h264_parse_sps(const uint8_t *buf, int len, h264_sps_data_t *sps) }; if (aspect_ratio_idc < sizeof(aspect_ratios)/sizeof(aspect_ratios[0])) { - memcpy(&sps->pixel_aspect, &aspect_ratios[aspect_ratio_idc], sizeof(h264_rational_t)); + memcpy(&sps->pixel_aspect, &aspect_ratios[aspect_ratio_idc], sizeof(mpeg_rational_t)); LOGDBG("H.264 SPS: -> aspect ratio %d / %d", sps->pixel_aspect.num, sps->pixel_aspect.den); } else { LOGMSG("H.264 SPS: aspect_ratio_idc out of range !"); @@ -209,10 +209,7 @@ int h264_get_video_size(const uint8_t *buf, int len, video_size_t *size) if (h264_parse_sps(nal_data, nal_len, &sps)) { size->width = sps.width; size->height = sps.height; - if(sps.pixel_aspect.den) - size->pixel_aspect = (double)sps.pixel_aspect.num / (double)sps.pixel_aspect.den; - else - size->pixel_aspect = 0.0; + memcpy(&size->pixel_aspect, &sps.pixel_aspect, sizeof(mpeg_rational_t)); return 1; } LOGMSG("h264_get_video_size: not enough data ?"); diff --git a/tools/h264.h b/tools/h264.h index f3f32281..3cde1508 100644 --- a/tools/h264.h +++ b/tools/h264.h @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: h264.h,v 1.3 2008-05-20 11:00:42 phintuka Exp $ + * $Id: h264.h,v 1.4 2008-06-11 15:50:27 phintuka Exp $ * */ @@ -22,14 +22,9 @@ extern "C" { #define NAL_AUD 0x09 typedef struct { - int num; - int den; -} h264_rational_t; - -typedef struct { int width; int height; - h264_rational_t pixel_aspect; + mpeg_rational_t pixel_aspect; /* ... */ } h264_sps_data_t; diff --git a/tools/mpeg.h b/tools/mpeg.h index c17ee0ec..0ab207af 100644 --- a/tools/mpeg.h +++ b/tools/mpeg.h @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: mpeg.h,v 1.2 2008-03-16 22:12:56 phintuka Exp $ + * $Id: mpeg.h,v 1.3 2008-06-11 15:50:28 phintuka Exp $ * */ @@ -26,11 +26,15 @@ extern "C" { #define P_FRAME 2 #define B_FRAME 3 +typedef struct { + int num; + int den; +} mpeg_rational_t; typedef struct { int width; int height; - double pixel_aspect; + mpeg_rational_t pixel_aspect; } video_size_t; |