Mercurial > libavformat.hg
comparison grab.c @ 743:af4e24d6310c libavformat
switch to native time bases
author | michael |
---|---|
date | Sat, 30 Apr 2005 21:43:59 +0000 |
parents | 0b52743104ac |
children | feca73904e67 |
comparison
equal
deleted
inserted
replaced
742:21c1ae78f041 | 743:af4e24d6310c |
---|---|
66 struct video_tuner tuner; | 66 struct video_tuner tuner; |
67 struct video_audio audio; | 67 struct video_audio audio; |
68 const char *video_device; | 68 const char *video_device; |
69 int j; | 69 int j; |
70 | 70 |
71 if (!ap || ap->width <= 0 || ap->height <= 0 || ap->frame_rate <= 0) | 71 if (!ap || ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0) |
72 return -1; | 72 return -1; |
73 | 73 |
74 width = ap->width; | 74 width = ap->width; |
75 height = ap->height; | 75 height = ap->height; |
76 frame_rate = ap->frame_rate; | 76 frame_rate = ap->time_base.den; |
77 frame_rate_base = ap->frame_rate_base; | 77 frame_rate_base = ap->time_base.num; |
78 | 78 |
79 if((unsigned)width > 32767 || (unsigned)height > 32767) | 79 if((unsigned)width > 32767 || (unsigned)height > 32767) |
80 return -1; | 80 return -1; |
81 | 81 |
82 st = av_new_stream(s1, 0); | 82 st = av_new_stream(s1, 0); |
263 | 263 |
264 st->codec.codec_type = CODEC_TYPE_VIDEO; | 264 st->codec.codec_type = CODEC_TYPE_VIDEO; |
265 st->codec.codec_id = CODEC_ID_RAWVIDEO; | 265 st->codec.codec_id = CODEC_ID_RAWVIDEO; |
266 st->codec.width = width; | 266 st->codec.width = width; |
267 st->codec.height = height; | 267 st->codec.height = height; |
268 st->codec.frame_rate = frame_rate; | 268 st->codec.time_base.den = frame_rate; |
269 st->codec.frame_rate_base = frame_rate_base; | 269 st->codec.time_base.num = frame_rate_base; |
270 | 270 |
271 return 0; | 271 return 0; |
272 fail: | 272 fail: |
273 if (video_fd >= 0) | 273 if (video_fd >= 0) |
274 close(video_fd); | 274 close(video_fd); |