summaryrefslogtreecommitdiff
path: root/libavformat/yuv4mpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2003-10-20 20:23:46 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-10-20 20:23:46 +0000
commit5ff85f1d8b5721a9e7f0ca6e03f61f5d3a4c3664 (patch)
tree710ea001d862c7bdb29dd0e707f9dd9eee3f2c72 /libavformat/yuv4mpeg.c
parent9dad924e22dc0e1a09013b588b43051b5baf428d (diff)
downloadffmpeg-5ff85f1d8b5721a9e7f0ca6e03f61f5d3a4c3664.tar.gz
AVRational
sample_aspect_ratio aspect ratio in JPEG JFIF is SAR not DAR ! removed nonsense SAR guessing code various related cleanups bugs? Originally committed as revision 2403 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/yuv4mpeg.c')
-rw-r--r--libavformat/yuv4mpeg.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c
index e9f08c8343..25eef070fe 100644
--- a/libavformat/yuv4mpeg.c
+++ b/libavformat/yuv4mpeg.c
@@ -24,18 +24,11 @@
#ifdef CONFIG_ENCODERS
-
-static struct { int n; int d;} SAR[] = {{10, 11}, /* 4:3 NTSC */
- {59, 54}, /* 4:3 PAL */
- {40, 33}, /* 16:9 NTSC */
- {118, 81}, /* 16:9 PAL */
- { 1, 1}};/* should always be the last */
-
static int yuv4_generate_header(AVFormatContext *s, char* buf)
{
AVStream *st;
int width, height;
- int raten, rated, aspectn, aspectd, n, i;
+ int raten, rated, aspectn, aspectd, n;
char inter;
st = s->streams[0];
@@ -44,13 +37,8 @@ static int yuv4_generate_header(AVFormatContext *s, char* buf)
av_reduce(&raten, &rated, st->codec.frame_rate, st->codec.frame_rate_base, (1UL<<31)-1);
- for (i=0; i<sizeof(SAR)/sizeof(SAR[0])-1; i++) {
- if (ABS(st->codec.aspect_ratio -
- (float)SAR[i].n/SAR[i].d * (float)width/height) < 0.05)
- break;
- }
- aspectn = SAR[i].n;
- aspectd = SAR[i].d;
+ aspectn = st->codec.sample_aspect_ratio.num;
+ aspectd = st->codec.sample_aspect_ratio.den;
inter = 'p'; /* progressive is the default */
if (st->codec.coded_frame && st->codec.coded_frame->interlaced_frame) {
@@ -200,6 +188,7 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec.pix_fmt = PIX_FMT_YUV420P;
st->codec.codec_type = CODEC_TYPE_VIDEO;
st->codec.codec_id = CODEC_ID_RAWVIDEO;
+ st->codec.sample_aspect_ratio= (AVRational){aspectn, aspectd};
return 0;
}