# HG changeset patch # User stefano # Date 1280185961 0 # Node ID af138a6c39246fc920a7ad141ead215943653071 # Parent b7595fe2d4a41f799e4700cc0aea5b7b289ae84a Remove reference to the "frame" term in variable names. Simpler and more consistent with the function names. diff -r b7595fe2d4a4 -r af138a6c3924 parseutils.c --- a/parseutils.c Mon Jul 26 23:12:38 2010 +0000 +++ b/parseutils.c Mon Jul 26 23:12:41 2010 +0000 @@ -27,14 +27,14 @@ typedef struct { const char *abbr; int width, height; -} VideoFrameSizeAbbr; +} VideoSizeAbbr; typedef struct { const char *abbr; int rate_num, rate_den; -} VideoFrameRateAbbr; +} VideoRateAbbr; -static const VideoFrameSizeAbbr video_frame_size_abbrs[] = { +static const VideoSizeAbbr video_size_abbrs[] = { { "ntsc", 720, 480 }, { "pal", 720, 576 }, { "qntsc", 352, 240 }, /* VCD compliant NTSC */ @@ -74,7 +74,7 @@ { "hd1080", 1920,1080 }, }; -static const VideoFrameRateAbbr video_frame_rate_abbrs[]= { +static const VideoRateAbbr video_rate_abbrs[]= { { "ntsc", 30000, 1001 }, { "pal", 25, 1 }, { "qntsc", 30000, 1001 }, /* VCD compliant NTSC */ @@ -88,42 +88,42 @@ int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str) { int i; - int n = FF_ARRAY_ELEMS(video_frame_size_abbrs); + int n = FF_ARRAY_ELEMS(video_size_abbrs); char *p; - int frame_width = 0, frame_height = 0; + int width = 0, height = 0; for (i = 0; i < n; i++) { - if (!strcmp(video_frame_size_abbrs[i].abbr, str)) { - frame_width = video_frame_size_abbrs[i].width; - frame_height = video_frame_size_abbrs[i].height; + if (!strcmp(video_size_abbrs[i].abbr, str)) { + width = video_size_abbrs[i].width; + height = video_size_abbrs[i].height; break; } } if (i == n) { p = str; - frame_width = strtol(p, &p, 10); + width = strtol(p, &p, 10); if (*p) p++; - frame_height = strtol(p, &p, 10); + height = strtol(p, &p, 10); } - if (frame_width <= 0 || frame_height <= 0) + if (width <= 0 || height <= 0) return AVERROR(EINVAL); - *width_ptr = frame_width; - *height_ptr = frame_height; + *width_ptr = width; + *height_ptr = height; return 0; } -int av_parse_video_rate(AVRational *frame_rate, const char *arg) +int av_parse_video_rate(AVRational *rate, const char *arg) { int i; - int n = FF_ARRAY_ELEMS(video_frame_rate_abbrs); + int n = FF_ARRAY_ELEMS(video_rate_abbrs); char *cp; /* 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; + if (!strcmp(video_rate_abbrs[i].abbr, arg)) { + rate->num = video_rate_abbrs[i].rate_num; + rate->den = video_rate_abbrs[i].rate_den; return 0; } @@ -133,18 +133,18 @@ cp = strchr(arg, ':'); if (cp) { char *cpp; - frame_rate->num = strtol(arg, &cpp, 10); + rate->num = strtol(arg, &cpp, 10); if (cpp != arg || cpp == cp) - frame_rate->den = strtol(cp+1, &cpp, 10); + rate->den = strtol(cp+1, &cpp, 10); else - frame_rate->num = 0; + rate->num = 0; } else { /* Finally we give up and parse it as double */ AVRational time_base = av_d2q(strtod(arg, 0), 1001000); - frame_rate->den = time_base.den; - frame_rate->num = time_base.num; + rate->den = time_base.den; + rate->num = time_base.num; } - if (frame_rate->num <= 0 || frame_rate->den <= 0) + if (rate->num <= 0 || rate->den <= 0) return AVERROR(EINVAL); return 0; } diff -r b7595fe2d4a4 -r af138a6c3924 parseutils.h --- a/parseutils.h Mon Jul 26 23:12:38 2010 +0000 +++ b/parseutils.h Mon Jul 26 23:12:41 2010 +0000 @@ -30,24 +30,24 @@ * Parse str and put in width_ptr and height_ptr the detected values. * * @param[in,out] width_ptr pointer to the variable which will contain the detected - * frame width value + * width value * @param[in,out] height_ptr pointer to the variable which will contain the detected - * frame height value + * height value * @param[in] str the string to parse: it has to be a string in the format - * width x height or a valid video frame size abbreviation. + * width x height or a valid video size abbreviation. * @return >= 0 on success, a negative error code otherwise */ int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str); /** - * Parse str and store the detected values in *frame_rate. + * Parse str and store the detected values in *rate. * - * @param[in,out] frame_rate pointer to the AVRational which will contain the detected + * @param[in,out] rate pointer to the AVRational which will contain the detected * frame rate * @param[in] str the string to parse: it has to be a string in the format - * frame_rate_num / frame_rate_den, a float number or a valid video rate abbreviation + * rate_num / rate_den, a float number or a valid video rate abbreviation * @return >= 0 on success, a negative error code otherwise */ -int av_parse_video_rate(AVRational *frame_rate, const char *str); +int av_parse_video_rate(AVRational *rate, const char *str); #endif /* AVCORE_PARSEUTILS_H */