annotate dc1394.c @ 694:50e07cfe1e4f libavformat

fix lib order and remove nonsense avcodec double linking
author michael
date Fri, 11 Mar 2005 11:34:31 +0000
parents 4a755492b90b
children 72f8690c3f37
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
1 /*
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
2 * IIDC1394 grab interface (uses libdc1394 and libraw1394)
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
3 * Copyright (c) 2004 Roman Shaposhnik
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
4 *
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
9 *
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
13 * Lesser General Public License for more details.
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
14 *
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
16 * License along with this library; if not, write to the Free Software
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
18 */
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
19
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
20 #include "avformat.h"
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
21
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
22 #include <libraw1394/raw1394.h>
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
23 #include <libdc1394/dc1394_control.h>
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
24
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
25 #undef free
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
26
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
27 typedef struct dc1394_data {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
28 raw1394handle_t handle;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
29 dc1394_cameracapture camera;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
30 int current_frame;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
31 int fps;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
32
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
33 AVPacket packet;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
34 } dc1394_data;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
35
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
36 struct dc1394_frame_format {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
37 int width;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
38 int height;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
39 enum PixelFormat pix_fmt;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
40 int frame_size_id;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
41 } dc1394_frame_formats[] = {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
42 { 320, 240, PIX_FMT_UYVY422, MODE_320x240_YUV422 },
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
43 { 640, 480, PIX_FMT_UYVY411, MODE_640x480_YUV411 },
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
44 { 640, 480, PIX_FMT_UYVY422, MODE_640x480_YUV422 },
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
45 { 0, 0, 0, MODE_320x240_YUV422 } /* default -- gotta be the last one */
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
46 };
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
47
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
48 struct dc1394_frame_rate {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
49 int frame_rate;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
50 int frame_rate_id;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
51 } dc1394_frame_rates[] = {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
52 { 1875, FRAMERATE_1_875 },
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
53 { 3750, FRAMERATE_3_75 },
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
54 { 7500, FRAMERATE_7_5 },
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
55 { 15000, FRAMERATE_15 },
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
56 { 30000, FRAMERATE_30 },
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
57 { 60000, FRAMERATE_60 },
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
58 { 0, FRAMERATE_30 } /* default -- gotta be the last one */
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
59 };
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
60
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
61 static int dc1394_read_header(AVFormatContext *c, AVFormatParameters * ap)
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
62 {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
63 dc1394_data* dc1394 = c->priv_data;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
64 AVStream* vst;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
65 nodeid_t* camera_nodes;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
66 int res;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
67 struct dc1394_frame_format *fmt;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
68 struct dc1394_frame_rate *fps;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
69
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
70 for (fmt = dc1394_frame_formats; fmt->width; fmt++)
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
71 if (fmt->pix_fmt == ap->pix_fmt && fmt->width == ap->width && fmt->height == ap->height)
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
72 break;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
73
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
74 for (fps = dc1394_frame_rates; fps->frame_rate; fps++)
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
75 if (fps->frame_rate == av_rescale(1000, ap->frame_rate, ap->frame_rate_base))
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
76 break;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
77
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
78 /* create a video stream */
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
79 vst = av_new_stream(c, 0);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
80 if (!vst)
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
81 return -1;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
82 av_set_pts_info(vst, 64, 1, 1000);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
83 vst->codec.codec_type = CODEC_TYPE_VIDEO;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
84 vst->codec.codec_id = CODEC_ID_RAWVIDEO;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
85 vst->codec.frame_rate = fps->frame_rate;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
86 vst->codec.frame_rate_base = 1000;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
87 vst->codec.width = fmt->width;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
88 vst->codec.height = fmt->height;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
89 vst->codec.pix_fmt = fmt->pix_fmt;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
90
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
91 /* packet init */
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
92 av_init_packet(&dc1394->packet);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
93 dc1394->packet.size = avpicture_get_size(fmt->pix_fmt, fmt->width, fmt->height);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
94 dc1394->packet.stream_index = vst->index;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
95 dc1394->packet.flags |= PKT_FLAG_KEY;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
96
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
97 dc1394->current_frame = 0;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
98 dc1394->fps = fps->frame_rate;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
99
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
100 vst->codec.bit_rate = av_rescale(dc1394->packet.size * 8, fps->frame_rate, 1000);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
101
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
102 /* Now lets prep the hardware */
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
103 dc1394->handle = dc1394_create_handle(0); /* FIXME: gotta have ap->port */
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
104 if (!dc1394->handle) {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
105 av_log(c, AV_LOG_ERROR, "Can't aquire dc1394 handle on port %d\n", 0 /* ap->port */);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
106 goto out;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
107 }
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
108 camera_nodes = dc1394_get_camera_nodes(dc1394->handle, &res, 1);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
109 if (!camera_nodes || camera_nodes[ap->channel] == DC1394_NO_CAMERA) {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
110 av_log(c, AV_LOG_ERROR, "There's no IIDC camera on the channel %d\n", ap->channel);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
111 goto out_handle;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
112 }
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
113 res = dc1394_dma_setup_capture(dc1394->handle, camera_nodes[ap->channel],
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
114 0,
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
115 FORMAT_VGA_NONCOMPRESSED,
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
116 fmt->frame_size_id,
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
117 SPEED_400,
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
118 fps->frame_rate_id, 8, 1,
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
119 ap->device,
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
120 &dc1394->camera);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
121 dc1394_free_camera_nodes(camera_nodes);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
122 if (res != DC1394_SUCCESS) {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
123 av_log(c, AV_LOG_ERROR, "Can't prepare camera for the DMA capture\n");
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
124 goto out_handle;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
125 }
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
126
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
127 res = dc1394_start_iso_transmission(dc1394->handle, dc1394->camera.node);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
128 if (res != DC1394_SUCCESS) {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
129 av_log(c, AV_LOG_ERROR, "Can't start isochronous transmission\n");
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
130 goto out_handle_dma;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
131 }
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
132
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
133 return 0;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
134
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
135 out_handle_dma:
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
136 dc1394_dma_unlisten(dc1394->handle, &dc1394->camera);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
137 dc1394_dma_release_camera(dc1394->handle, &dc1394->camera);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
138 out_handle:
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
139 dc1394_destroy_handle(dc1394->handle);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
140 out:
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
141 return -1;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
142 }
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
143
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
144 static int dc1394_read_packet(AVFormatContext *c, AVPacket *pkt)
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
145 {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
146 struct dc1394_data *dc1394 = c->priv_data;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
147 int res;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
148
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
149 /* discard stale frame */
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
150 if (dc1394->current_frame++) {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
151 if (dc1394_dma_done_with_buffer(&dc1394->camera) != DC1394_SUCCESS)
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
152 av_log(c, AV_LOG_ERROR, "failed to release %d frame\n", dc1394->current_frame);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
153 }
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
154
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
155 res = dc1394_dma_single_capture(&dc1394->camera);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
156
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
157 if (res == DC1394_SUCCESS) {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
158 dc1394->packet.data = (uint8_t *)(dc1394->camera.capture_buffer);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
159 dc1394->packet.pts = (dc1394->current_frame * 1000000) / dc1394->fps;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
160 res = dc1394->packet.size;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
161 } else {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
162 av_log(c, AV_LOG_ERROR, "DMA capture failed\n");
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
163 dc1394->packet.data = NULL;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
164 res = -1;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
165 }
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
166
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
167 *pkt = dc1394->packet;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
168 return res;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
169 }
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
170
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
171 static int dc1394_close(AVFormatContext * context)
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
172 {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
173 struct dc1394_data *dc1394 = context->priv_data;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
174
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
175 dc1394_stop_iso_transmission(dc1394->handle, dc1394->camera.node);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
176 dc1394_dma_unlisten(dc1394->handle, &dc1394->camera);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
177 dc1394_dma_release_camera(dc1394->handle, &dc1394->camera);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
178 dc1394_destroy_handle(dc1394->handle);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
179
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
180 return 0;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
181 }
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
182
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
183 static AVInputFormat dc1394_format = {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
184 .name = "dc1394",
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
185 .long_name = "dc1394 A/V grab",
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
186 .priv_data_size = sizeof(struct dc1394_data),
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
187 .read_header = dc1394_read_header,
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
188 .read_packet = dc1394_read_packet,
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
189 .read_close = dc1394_close,
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
190 .flags = AVFMT_NOFILE
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
191 };
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
192
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
193 int dc1394_init(void)
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
194 {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
195 av_register_input_format(&dc1394_format);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
196 return 0;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
197 }