Skip to content
Snippets Groups Projects
Commit c0ad72a7 authored by Stefano Sabatini's avatar Stefano Sabatini Committed by Benoit Fouet
Browse files

split frame rate and frame size abbreviation into two structures

patch by Stefano Sabatini: [stefano sabatini-lala poste it]

Originally committed as revision 9379 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 5965e1a9
Branches
Tags
No related merge requests found
...@@ -1349,61 +1349,76 @@ int av_tempfile(char *prefix, char **filename) { ...@@ -1349,61 +1349,76 @@ int av_tempfile(char *prefix, char **filename) {
} }
typedef struct { typedef struct {
const char *abv; const char *abbr;
int width, height; int width, height;
int frame_rate, frame_rate_base; } VideoFrameSizeAbbr;
} AbvEntry;
typedef struct {
static AbvEntry frame_abvs[] = { const char *abbr;
{ "ntsc", 720, 480, 30000, 1001 }, int rate_num, rate_den;
{ "pal", 720, 576, 25, 1 }, } VideoFrameRateAbbr;
{ "qntsc", 352, 240, 30000, 1001 }, /* VCD compliant NTSC */
{ "qpal", 352, 288, 25, 1 }, /* VCD compliant PAL */ static VideoFrameSizeAbbr video_frame_size_abbrs[] = {
{ "sntsc", 640, 480, 30000, 1001 }, /* square pixel NTSC */ { "ntsc", 720, 480 },
{ "spal", 768, 576, 25, 1 }, /* square pixel PAL */ { "pal", 720, 576 },
{ "film", 352, 240, 24, 1 }, { "qntsc", 352, 240 }, /* VCD compliant NTSC */
{ "ntsc-film", 352, 240, 24000, 1001 }, { "qpal", 352, 288 }, /* VCD compliant PAL */
{ "sqcif", 128, 96, 0, 0 }, { "sntsc", 640, 480 }, /* square pixel NTSC */
{ "qcif", 176, 144, 0, 0 }, { "spal", 768, 576 }, /* square pixel PAL */
{ "cif", 352, 288, 0, 0 }, { "film", 352, 240 },
{ "4cif", 704, 576, 0, 0 }, { "ntsc-film", 352, 240 },
{ "qqvga", 160, 120, 0, 0 }, { "sqcif", 128, 96 },
{ "qvga", 320, 240, 0, 0 }, { "qcif", 176, 144 },
{ "vga", 640, 480, 0, 0 }, { "cif", 352, 288 },
{ "svga", 800, 600, 0, 0 }, { "4cif", 704, 576 },
{ "xga", 1024, 768, 0, 0 }, { "qqvga", 160, 120 },
{ "uxga", 1600,1200, 0, 0 }, { "qvga", 320, 240 },
{ "qxga", 2048,1536, 0, 0 }, { "vga", 640, 480 },
{ "sxga", 1280,1024, 0, 0 }, { "svga", 800, 600 },
{ "qsxga", 2560,2048, 0, 0 }, { "xga", 1024, 768 },
{ "hsxga", 5120,4096, 0, 0 }, { "uxga", 1600,1200 },
{ "wvga", 852, 480, 0, 0 }, { "qxga", 2048,1536 },
{ "wxga", 1366, 768, 0, 0 }, { "sxga", 1280,1024 },
{ "wsxga", 1600,1024, 0, 0 }, { "qsxga", 2560,2048 },
{ "wuxga", 1920,1200, 0, 0 }, { "hsxga", 5120,4096 },
{ "woxga", 2560,1600, 0, 0 }, { "wvga", 852, 480 },
{ "wqsxga", 3200,2048, 0, 0 }, { "wxga", 1366, 768 },
{ "wquxga", 3840,2400, 0, 0 }, { "wsxga", 1600,1024 },
{ "whsxga", 6400,4096, 0, 0 }, { "wuxga", 1920,1200 },
{ "whuxga", 7680,4800, 0, 0 }, { "woxga", 2560,1600 },
{ "cga", 320, 200, 0, 0 }, { "wqsxga", 3200,2048 },
{ "ega", 640, 350, 0, 0 }, { "wquxga", 3840,2400 },
{ "hd480", 852, 480, 0, 0 }, { "whsxga", 6400,4096 },
{ "hd720", 1280, 720, 0, 0 }, { "whuxga", 7680,4800 },
{ "hd1080", 1920,1080, 0, 0 }, { "cga", 320, 200 },
{ "ega", 640, 350 },
{ "hd480", 852, 480 },
{ "hd720", 1280, 720 },
{ "hd1080", 1920,1080 },
};
static 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 },
}; };
int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str) int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str)
{ {
int i; int i;
int n = sizeof(frame_abvs) / sizeof(AbvEntry); int n = sizeof(video_frame_size_abbrs) / sizeof(VideoFrameSizeAbbr);
const char *p; const char *p;
int frame_width = 0, frame_height = 0; int frame_width = 0, frame_height = 0;
for(i=0;i<n;i++) { for(i=0;i<n;i++) {
if (!strcmp(frame_abvs[i].abv, str)) { if (!strcmp(video_frame_size_abbrs[i].abbr, str)) {
frame_width = frame_abvs[i].width; frame_width = video_frame_size_abbrs[i].width;
frame_height = frame_abvs[i].height; frame_height = video_frame_size_abbrs[i].height;
break; break;
} }
} }
...@@ -1424,13 +1439,14 @@ int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str) ...@@ -1424,13 +1439,14 @@ int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str)
int av_parse_video_frame_rate(AVRational *frame_rate, const char *arg) int av_parse_video_frame_rate(AVRational *frame_rate, const char *arg)
{ {
int i; int i;
int n = sizeof(video_frame_rate_abbrs) / sizeof(VideoFrameRateAbbr);
char* cp; char* cp;
/* First, we check our abbreviation table */ /* First, we check our abbreviation table */
for (i = 0; i < sizeof(frame_abvs)/sizeof(*frame_abvs); ++i) for (i = 0; i < n; ++i)
if (!strcmp(frame_abvs[i].abv, arg)) { if (!strcmp(video_frame_rate_abbrs[i].abbr, arg)) {
frame_rate->num = frame_abvs[i].frame_rate; frame_rate->num = video_frame_rate_abbrs[i].rate_num;
frame_rate->den = frame_abvs[i].frame_rate_base; frame_rate->den = video_frame_rate_abbrs[i].rate_den;
return 0; return 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment