Mercurial > libavformat.hg
comparison grab_bktr.c @ 1787:eb16c64144ee libavformat
This fixes error handling for BeOS, removing the need for some ifdefs.
AVERROR_ defines are moved to avcodec.h as they are needed in there as well. Feel free to move that to avutil/common.h.
Bumped up avcodec/format version numbers as though it's binary compatible we will want to rebuild apps as error values changed.
Please from now on use return AVERROR(EFOO) instead of the ugly return -EFOO in your code.
This also removes the need for berrno.h.
author | mmu_man |
---|---|
date | Tue, 13 Feb 2007 18:26:14 +0000 |
parents | 42ac34a0ec1d |
children | 62792a60f740 |
comparison
equal
deleted
inserted
replaced
1786:8cc34fe98a3b | 1787:eb16c64144ee |
---|---|
223 static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt) | 223 static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt) |
224 { | 224 { |
225 VideoData *s = s1->priv_data; | 225 VideoData *s = s1->priv_data; |
226 | 226 |
227 if (av_new_packet(pkt, video_buf_size) < 0) | 227 if (av_new_packet(pkt, video_buf_size) < 0) |
228 return -EIO; | 228 return AVERROR(EIO); |
229 | 229 |
230 bktr_getframe(s->per_frame); | 230 bktr_getframe(s->per_frame); |
231 | 231 |
232 pkt->pts = av_gettime(); | 232 pkt->pts = av_gettime(); |
233 memcpy(pkt->data, video_buf, video_buf_size); | 233 memcpy(pkt->data, video_buf, video_buf_size); |
257 if (!video_device) | 257 if (!video_device) |
258 video_device = "/dev/bktr0"; | 258 video_device = "/dev/bktr0"; |
259 | 259 |
260 st = av_new_stream(s1, 0); | 260 st = av_new_stream(s1, 0); |
261 if (!st) | 261 if (!st) |
262 return -ENOMEM; | 262 return AVERROR(ENOMEM); |
263 av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in use */ | 263 av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in use */ |
264 | 264 |
265 s->width = width; | 265 s->width = width; |
266 s->height = height; | 266 s->height = height; |
267 s->frame_rate = frame_rate; | 267 s->frame_rate = frame_rate; |
285 format = NTSC; | 285 format = NTSC; |
286 } | 286 } |
287 | 287 |
288 if (bktr_init(video_device, width, height, format, | 288 if (bktr_init(video_device, width, height, format, |
289 &(s->video_fd), &(s->tuner_fd), -1, 0.0) < 0) | 289 &(s->video_fd), &(s->tuner_fd), -1, 0.0) < 0) |
290 return -EIO; | 290 return AVERROR(EIO); |
291 | 291 |
292 nsignals = 0; | 292 nsignals = 0; |
293 last_frame_time = 0; | 293 last_frame_time = 0; |
294 | 294 |
295 return 0; | 295 return 0; |