]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/grab_bktr.c
stop if current sample is higher than sample count
[ffmpeg] / libavformat / grab_bktr.c
index 45027454b97ad1dbccb5057322ee311394fd9a03..eea221cdd623ec60a8982e319ccda6511ab8d07e 100644 (file)
@@ -7,33 +7,33 @@
  * and
  *           simple_grab.c Copyright (c) 1999 Roger Hardiman
  *
- * This library is free software; you can redistribute it and/or
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
  *
- * This library is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
-#if defined(__FreeBSD__)
-# if __FreeBSD__ >= 502100
-#  include <dev/bktr/ioctl_meteor.h>
-#  include <dev/bktr/ioctl_bt848.h>
-# else
-#  include <machine/ioctl_meteor.h>
-#  include <machine/ioctl_bt848.h>
-# endif
-#elif defined(__DragonFly__)
+#if defined (HAVE_DEV_BKTR_IOCTL_METEOR_H) && defined (HAVE_DEV_BKTR_IOCTL_BT848_H)
+# include <dev/bktr/ioctl_meteor.h>
+# include <dev/bktr/ioctl_bt848.h>
+#elif defined (HAVE_MACHINE_IOCTL_METEOR_H) && defined (HAVE_MACHINE_IOCTL_BT848_H)
+# include <machine/ioctl_meteor.h>
+# include <machine/ioctl_bt848.h>
+#elif defined (HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H) && defined (HAVE_DEV_VIDEO_METEOR_IOCTL_BT848_H)
 # include <dev/video/meteor/ioctl_meteor.h>
 # include <dev/video/bktr/ioctl_bt848.h>
-#else
+#elif HAVE_DEV_IC_BT8XX_H
 # include <dev/ic/bt8xx.h>
 #endif
 #include <unistd.h>
@@ -229,7 +229,7 @@ static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
 
     bktr_getframe(s->per_frame);
 
-    pkt->pts = av_gettime() & ((1LL << 48) - 1);
+    pkt->pts = av_gettime();
     memcpy(pkt->data, video_buf, video_buf_size);
 
     return video_buf_size;
@@ -245,7 +245,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
     int format = -1;
     const char *video_device;
 
-    if (!ap || ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0)
+    if (ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0)
         return -1;
 
     width = ap->width;
@@ -260,7 +260,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
     st = av_new_stream(s1, 0);
     if (!st)
         return -ENOMEM;
-    av_set_pts_info(st, 48, 1, 1000000); /* 48 bits pts in use */
+    av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in use */
 
     s->width = width;
     s->height = height;
@@ -313,7 +313,7 @@ static int grab_read_close(AVFormatContext *s1)
     return 0;
 }
 
-AVInputFormat video_grab_device_format = {
+AVInputFormat video_grab_device_demuxer = {
     "bktr",
     "video grab",
      sizeof(VideoData),
@@ -323,9 +323,3 @@ AVInputFormat video_grab_device_format = {
     grab_read_close,
     .flags = AVFMT_NOFILE,
 };
-
-int video_grab_init(void)
-{
-    av_register_input_format(&video_grab_device_format);
-    return 0;
-}