]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/dc1394.c
fix -a^b which was interpreted as (-a)^b
[ffmpeg] / libavformat / dc1394.c
index 1c8de2a3eb670009b36111e1327e545462083369..5098c0fdfce9207a548c3aec218cfdf4ab043837 100644 (file)
@@ -2,19 +2,21 @@
  * IIDC1394 grab interface (uses libdc1394 and libraw1394)
  * Copyright (c) 2004 Roman Shaposhnik
  *
- * 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"
@@ -69,16 +71,16 @@ static int dc1394_read_header(AVFormatContext *c, AVFormatParameters * ap)
 
     for (fmt = dc1394_frame_formats; fmt->width; fmt++)
          if (fmt->pix_fmt == ap->pix_fmt && fmt->width == ap->width && fmt->height == ap->height)
-            break;
+             break;
 
     for (fps = dc1394_frame_rates; fps->frame_rate; fps++)
          if (fps->frame_rate == av_rescale(1000, ap->time_base.den, ap->time_base.num))
-            break;
+             break;
 
     /* create a video stream */
     vst = av_new_stream(c, 0);
     if (!vst)
-       return -1;
+        return -1;
     av_set_pts_info(vst, 64, 1, 1000);
     vst->codec->codec_type = CODEC_TYPE_VIDEO;
     vst->codec->codec_id = CODEC_ID_RAWVIDEO;
@@ -102,7 +104,7 @@ static int dc1394_read_header(AVFormatContext *c, AVFormatParameters * ap)
     /* Now lets prep the hardware */
     dc1394->handle = dc1394_create_handle(0); /* FIXME: gotta have ap->port */
     if (!dc1394->handle) {
-       av_log(c, AV_LOG_ERROR, "Can't acquire dc1394 handle on port %d\n", 0 /* ap->port */);
+        av_log(c, AV_LOG_ERROR, "Can't acquire dc1394 handle on port %d\n", 0 /* ap->port */);
         goto out;
     }
     camera_nodes = dc1394_get_camera_nodes(dc1394->handle, &res, 1);
@@ -111,23 +113,23 @@ static int dc1394_read_header(AVFormatContext *c, AVFormatParameters * ap)
         goto out_handle;
     }
     res = dc1394_dma_setup_capture(dc1394->handle, camera_nodes[ap->channel],
-                                  0,
-                                  FORMAT_VGA_NONCOMPRESSED,
-                                  fmt->frame_size_id,
-                                  SPEED_400,
-                                  fps->frame_rate_id, 8, 1,
-                                  ap->device,
-                                  &dc1394->camera);
+                                   0,
+                                   FORMAT_VGA_NONCOMPRESSED,
+                                   fmt->frame_size_id,
+                                   SPEED_400,
+                                   fps->frame_rate_id, 8, 1,
+                                   ap->device,
+                                   &dc1394->camera);
     dc1394_free_camera_nodes(camera_nodes);
     if (res != DC1394_SUCCESS) {
         av_log(c, AV_LOG_ERROR, "Can't prepare camera for the DMA capture\n");
-       goto out_handle;
+        goto out_handle;
     }
 
     res = dc1394_start_iso_transmission(dc1394->handle, dc1394->camera.node);
     if (res != DC1394_SUCCESS) {
         av_log(c, AV_LOG_ERROR, "Can't start isochronous transmission\n");
-       goto out_handle_dma;
+        goto out_handle_dma;
     }
 
     return 0;
@@ -148,7 +150,7 @@ static int dc1394_read_packet(AVFormatContext *c, AVPacket *pkt)
 
     /* discard stale frame */
     if (dc1394->current_frame++) {
-       if (dc1394_dma_done_with_buffer(&dc1394->camera) != DC1394_SUCCESS)
+        if (dc1394_dma_done_with_buffer(&dc1394->camera) != DC1394_SUCCESS)
             av_log(c, AV_LOG_ERROR, "failed to release %d frame\n", dc1394->current_frame);
     }
 
@@ -157,7 +159,7 @@ static int dc1394_read_packet(AVFormatContext *c, AVPacket *pkt)
     if (res == DC1394_SUCCESS) {
         dc1394->packet.data = (uint8_t *)(dc1394->camera.capture_buffer);
         dc1394->packet.pts = (dc1394->current_frame * 1000000) / dc1394->fps;
-       res = dc1394->packet.size;
+        res = dc1394->packet.size;
     } else {
         av_log(c, AV_LOG_ERROR, "DMA capture failed\n");
         dc1394->packet.data = NULL;
@@ -180,7 +182,7 @@ static int dc1394_close(AVFormatContext * context)
     return 0;
 }
 
-static AVInputFormat dc1394_format = {
+AVInputFormat dc1394_demuxer = {
     .name           = "dc1394",
     .long_name      = "dc1394 A/V grab",
     .priv_data_size = sizeof(struct dc1394_data),
@@ -189,9 +191,3 @@ static AVInputFormat dc1394_format = {
     .read_close     = dc1394_close,
     .flags          = AVFMT_NOFILE
 };
-
-int dc1394_init(void)
-{
-    av_register_input_format(&dc1394_format);
-    return 0;
-}