Mercurial > libavformat.hg
comparison yuv4mpeg.c @ 178:d1290621cc6a libavformat
removed warnings
author | bellard |
---|---|
date | Thu, 17 Jul 2003 10:26:02 +0000 |
parents | 25062c9b1f86 |
children | 2438e76dde67 |
comparison
equal
deleted
inserted
replaced
177:16c4e43f34e5 | 178:d1290621cc6a |
---|---|
24 | 24 |
25 static int yuv4_write_header(AVFormatContext *s) | 25 static int yuv4_write_header(AVFormatContext *s) |
26 { | 26 { |
27 AVStream *st; | 27 AVStream *st; |
28 int width, height; | 28 int width, height; |
29 int raten, rated, aspectn, aspectd, fps, fps1, n, gcd; | 29 int raten, rated, aspectn, aspectd, n; |
30 char buf[Y4M_LINE_MAX+1]; | 30 char buf[Y4M_LINE_MAX+1]; |
31 | 31 |
32 if (s->nb_streams != 1) | 32 if (s->nb_streams != 1) |
33 return -EIO; | 33 return -EIO; |
34 | 34 |
38 | 38 |
39 #if 1 | 39 #if 1 |
40 //this is identical to the code below for exact fps | 40 //this is identical to the code below for exact fps |
41 av_reduce(&raten, &rated, st->codec.frame_rate, st->codec.frame_rate_base, (1UL<<31)-1); | 41 av_reduce(&raten, &rated, st->codec.frame_rate, st->codec.frame_rate_base, (1UL<<31)-1); |
42 #else | 42 #else |
43 fps = st->codec.frame_rate; | 43 { |
44 fps1 = (((float)fps / st->codec.frame_rate_base) * 1000); | 44 int gcd, fps, fps1; |
45 | 45 |
46 /* Sorry about this messy code, but mpeg2enc is very picky about | 46 fps = st->codec.frame_rate; |
47 * the framerates it accepts. */ | 47 fps1 = (((float)fps / st->codec.frame_rate_base) * 1000); |
48 switch(fps1) { | 48 |
49 case 23976: | 49 /* Sorry about this messy code, but mpeg2enc is very picky about |
50 raten = 24000; /* turn the framerate into a ratio */ | 50 * the framerates it accepts. */ |
51 rated = 1001; | 51 switch(fps1) { |
52 break; | 52 case 23976: |
53 case 29970: | 53 raten = 24000; /* turn the framerate into a ratio */ |
54 raten = 30000; | 54 rated = 1001; |
55 rated = 1001; | 55 break; |
56 break; | 56 case 29970: |
57 case 25000: | 57 raten = 30000; |
58 raten = 25; | 58 rated = 1001; |
59 rated = 1; | 59 break; |
60 break; | 60 case 25000: |
61 case 30000: | 61 raten = 25; |
62 raten = 30; | 62 rated = 1; |
63 rated = 1; | 63 break; |
64 break; | 64 case 30000: |
65 case 24000: | 65 raten = 30; |
66 raten = 24; | 66 rated = 1; |
67 rated = 1; | 67 break; |
68 break; | 68 case 24000: |
69 case 50000: | 69 raten = 24; |
70 raten = 50; | 70 rated = 1; |
71 rated = 1; | 71 break; |
72 break; | 72 case 50000: |
73 case 59940: | 73 raten = 50; |
74 raten = 60000; | 74 rated = 1; |
75 rated = 1001; | 75 break; |
76 break; | 76 case 59940: |
77 case 60000: | 77 raten = 60000; |
78 raten = 60; | 78 rated = 1001; |
79 rated = 1; | 79 break; |
80 break; | 80 case 60000: |
81 default: | 81 raten = 60; |
82 raten = st->codec.frame_rate; /* this setting should work, but often doesn't */ | 82 rated = 1; |
83 rated = st->codec.frame_rate_base; | 83 break; |
84 gcd= av_gcd(raten, rated); | 84 default: |
85 raten /= gcd; | 85 raten = st->codec.frame_rate; /* this setting should work, but often doesn't */ |
86 rated /= gcd; | 86 rated = st->codec.frame_rate_base; |
87 break; | 87 gcd= av_gcd(raten, rated); |
88 raten /= gcd; | |
89 rated /= gcd; | |
90 break; | |
91 } | |
88 } | 92 } |
89 #endif | 93 #endif |
90 | 94 |
91 aspectn = 1; | 95 aspectn = 1; |
92 aspectd = 1; /* ffmpeg always uses a 1:1 aspect ratio */ //FIXME not true anymore | 96 aspectd = 1; /* ffmpeg always uses a 1:1 aspect ratio */ //FIXME not true anymore |