[FFmpeg-devel] [PATCH 7/7] Make VideoFrameRateAbbr contain a rational rather than two int (for num and den). Simplify.
Stefano Sabatini
stefano.sabatini-lala
Sun Jul 25 13:52:10 CEST 2010
---
libavcore/parseutils.c | 21 ++++++++++-----------
1 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/libavcore/parseutils.c b/libavcore/parseutils.c
index 9e3ad81..18b3117 100644
--- a/libavcore/parseutils.c
+++ b/libavcore/parseutils.c
@@ -31,7 +31,7 @@ typedef struct {
typedef struct {
const char *abbr;
- int rate_num, rate_den;
+ AVRational rate;
} VideoFrameRateAbbr;
static const VideoFrameSizeAbbr video_frame_size_abbrs[] = {
@@ -75,14 +75,14 @@ static const VideoFrameSizeAbbr video_frame_size_abbrs[] = {
};
static const VideoFrameRateAbbr video_frame_rate_abbrs[]= {
- { "ntsc", 30000, 1001 },
- { "pal", 25, 1 },
- { "qntsc", 30000, 1001 }, /* VCD compliant NTSC */
- { "qpal", 25, 1 }, /* VCD compliant PAL */
- { "sntsc", 30000, 1001 }, /* square pixel NTSC */
- { "spal", 25, 1 }, /* square pixel PAL */
- { "film", 24, 1 },
- { "ntsc-film", 24000, 1001 },
+ { "ntsc", { 30000, 1001 } },
+ { "pal", { 25, 1 } },
+ { "qntsc", { 30000, 1001 } }, /* VCD compliant NTSC */
+ { "qpal", { 25, 1 } }, /* VCD compliant PAL */
+ { "sntsc", { 30000, 1001 } }, /* square pixel NTSC */
+ { "spal", { 25, 1 } }, /* square pixel PAL */
+ { "film", { 24, 1 } },
+ { "ntsc-film", { 24000, 1001 } },
};
int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str)
@@ -122,8 +122,7 @@ int av_parse_video_frame_rate(AVRational *frame_rate, const char *arg)
/* First, we check our abbreviation table */
for (i = 0; i < n; ++i)
if (!strcmp(video_frame_rate_abbrs[i].abbr, arg)) {
- frame_rate->num = video_frame_rate_abbrs[i].rate_num;
- frame_rate->den = video_frame_rate_abbrs[i].rate_den;
+ *frame_rate = video_frame_rate_abbrs[i].rate;
return 0;
}
--
1.7.0.4
More information about the ffmpeg-devel
mailing list