annotate dc1394.c @ 2491:51d707a515f2 libavformat

Clarify comments
author conrad
date Wed, 05 Sep 2007 00:25:04 +0000
parents 491a751cc58c
children ce70d4ec9e3a
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 *
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1169
diff changeset
5 * This file is part of FFmpeg.
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1169
diff changeset
6 *
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1169
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1169
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
11 *
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1169
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
15 * Lesser General Public License for more details.
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
16 *
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1169
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
896
edbe5c3717f9 Update licensing information: The FSF changed postal address.
diego
parents: 887
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
20 */
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
21
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
22 #include "avformat.h"
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
23
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
24 #include <libraw1394/raw1394.h>
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
25 #include <libdc1394/dc1394_control.h>
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
26
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
27 #undef free
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
28
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
29 typedef struct dc1394_data {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
30 raw1394handle_t handle;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
31 dc1394_cameracapture camera;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
32 int current_frame;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
33 int fps;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
34
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
35 AVPacket packet;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
36 } dc1394_data;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
37
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
38 struct dc1394_frame_format {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
39 int width;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
40 int height;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
41 enum PixelFormat pix_fmt;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
42 int frame_size_id;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
43 } dc1394_frame_formats[] = {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
44 { 320, 240, PIX_FMT_UYVY422, MODE_320x240_YUV422 },
1760
8cba5672faa4 Replace deprecated PIX_FMT names by the newer variants.
diego
parents: 1358
diff changeset
45 { 640, 480, PIX_FMT_UYYVYY411, MODE_640x480_YUV411 },
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
46 { 640, 480, PIX_FMT_UYVY422, MODE_640x480_YUV422 },
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
47 { 0, 0, 0, MODE_320x240_YUV422 } /* default -- gotta be the last one */
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
48 };
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
49
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
50 struct dc1394_frame_rate {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
51 int frame_rate;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
52 int frame_rate_id;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
53 } dc1394_frame_rates[] = {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
54 { 1875, FRAMERATE_1_875 },
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
55 { 3750, FRAMERATE_3_75 },
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
56 { 7500, FRAMERATE_7_5 },
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
57 { 15000, FRAMERATE_15 },
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
58 { 30000, FRAMERATE_30 },
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
59 { 60000, FRAMERATE_60 },
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
60 { 0, FRAMERATE_30 } /* default -- gotta be the last one */
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
61 };
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
62
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
63 static int dc1394_read_header(AVFormatContext *c, AVFormatParameters * ap)
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
64 {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
65 dc1394_data* dc1394 = c->priv_data;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
66 AVStream* vst;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
67 nodeid_t* camera_nodes;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
68 int res;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
69 struct dc1394_frame_format *fmt;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
70 struct dc1394_frame_rate *fps;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
71
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
72 for (fmt = dc1394_frame_formats; fmt->width; fmt++)
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
73 if (fmt->pix_fmt == ap->pix_fmt && fmt->width == ap->width && fmt->height == ap->height)
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
74 break;
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 833
diff changeset
75
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
76 for (fps = dc1394_frame_rates; fps->frame_rate; fps++)
743
af4e24d6310c switch to native time bases
michael
parents: 735
diff changeset
77 if (fps->frame_rate == av_rescale(1000, ap->time_base.den, ap->time_base.num))
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
78 break;
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 833
diff changeset
79
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
80 /* create a video stream */
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
81 vst = av_new_stream(c, 0);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
82 if (!vst)
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
83 return -1;
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
84 av_set_pts_info(vst, 64, 1, 1000);
833
c33bf4d10c4c minor compilation fix
michael
parents: 743
diff changeset
85 vst->codec->codec_type = CODEC_TYPE_VIDEO;
c33bf4d10c4c minor compilation fix
michael
parents: 743
diff changeset
86 vst->codec->codec_id = CODEC_ID_RAWVIDEO;
c33bf4d10c4c minor compilation fix
michael
parents: 743
diff changeset
87 vst->codec->time_base.den = fps->frame_rate;
c33bf4d10c4c minor compilation fix
michael
parents: 743
diff changeset
88 vst->codec->time_base.num = 1000;
c33bf4d10c4c minor compilation fix
michael
parents: 743
diff changeset
89 vst->codec->width = fmt->width;
c33bf4d10c4c minor compilation fix
michael
parents: 743
diff changeset
90 vst->codec->height = fmt->height;
c33bf4d10c4c minor compilation fix
michael
parents: 743
diff changeset
91 vst->codec->pix_fmt = fmt->pix_fmt;
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
92
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
93 /* packet init */
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
94 av_init_packet(&dc1394->packet);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
95 dc1394->packet.size = avpicture_get_size(fmt->pix_fmt, fmt->width, fmt->height);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
96 dc1394->packet.stream_index = vst->index;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
97 dc1394->packet.flags |= PKT_FLAG_KEY;
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 833
diff changeset
98
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
99 dc1394->current_frame = 0;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
100 dc1394->fps = fps->frame_rate;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
101
833
c33bf4d10c4c minor compilation fix
michael
parents: 743
diff changeset
102 vst->codec->bit_rate = av_rescale(dc1394->packet.size * 8, fps->frame_rate, 1000);
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 833
diff changeset
103
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
104 /* Now lets prep the hardware */
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
105 dc1394->handle = dc1394_create_handle(0); /* FIXME: gotta have ap->port */
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
106 if (!dc1394->handle) {
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
107 av_log(c, AV_LOG_ERROR, "Can't acquire dc1394 handle on port %d\n", 0 /* ap->port */);
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
108 goto out;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
109 }
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
110 camera_nodes = dc1394_get_camera_nodes(dc1394->handle, &res, 1);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
111 if (!camera_nodes || camera_nodes[ap->channel] == DC1394_NO_CAMERA) {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
112 av_log(c, AV_LOG_ERROR, "There's no IIDC camera on the channel %d\n", ap->channel);
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 833
diff changeset
113 goto out_handle;
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
114 }
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 833
diff changeset
115 res = dc1394_dma_setup_capture(dc1394->handle, camera_nodes[ap->channel],
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
116 0,
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
117 FORMAT_VGA_NONCOMPRESSED,
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
118 fmt->frame_size_id,
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
119 SPEED_400,
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
120 fps->frame_rate_id, 8, 1,
1795
62792a60f740 implement new grabbing interface, as described here:
gpoirier
parents: 1760
diff changeset
121 c->filename,
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
122 &dc1394->camera);
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
123 dc1394_free_camera_nodes(camera_nodes);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
124 if (res != DC1394_SUCCESS) {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
125 av_log(c, AV_LOG_ERROR, "Can't prepare camera for the DMA capture\n");
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
126 goto out_handle;
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
127 }
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
128
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
129 res = dc1394_start_iso_transmission(dc1394->handle, dc1394->camera.node);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
130 if (res != DC1394_SUCCESS) {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
131 av_log(c, AV_LOG_ERROR, "Can't start isochronous transmission\n");
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
132 goto out_handle_dma;
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
133 }
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 833
diff changeset
134
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
135 return 0;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
136
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
137 out_handle_dma:
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
138 dc1394_dma_unlisten(dc1394->handle, &dc1394->camera);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
139 dc1394_dma_release_camera(dc1394->handle, &dc1394->camera);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
140 out_handle:
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
141 dc1394_destroy_handle(dc1394->handle);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
142 out:
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
143 return -1;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
144 }
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
145
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
146 static int dc1394_read_packet(AVFormatContext *c, AVPacket *pkt)
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
147 {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
148 struct dc1394_data *dc1394 = c->priv_data;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
149 int res;
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 833
diff changeset
150
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
151 /* discard stale frame */
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
152 if (dc1394->current_frame++) {
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
153 if (dc1394_dma_done_with_buffer(&dc1394->camera) != DC1394_SUCCESS)
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
154 av_log(c, AV_LOG_ERROR, "failed to release %d frame\n", dc1394->current_frame);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
155 }
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 833
diff changeset
156
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
157 res = dc1394_dma_single_capture(&dc1394->camera);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
158
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
159 if (res == DC1394_SUCCESS) {
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 833
diff changeset
160 dc1394->packet.data = (uint8_t *)(dc1394->camera.capture_buffer);
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 833
diff changeset
161 dc1394->packet.pts = (dc1394->current_frame * 1000000) / dc1394->fps;
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
162 res = dc1394->packet.size;
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
163 } else {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
164 av_log(c, AV_LOG_ERROR, "DMA capture failed\n");
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
165 dc1394->packet.data = NULL;
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 833
diff changeset
166 res = -1;
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
167 }
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 833
diff changeset
168
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
169 *pkt = dc1394->packet;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
170 return res;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
171 }
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
172
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
173 static int dc1394_close(AVFormatContext * context)
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
174 {
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
175 struct dc1394_data *dc1394 = context->priv_data;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
176
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
177 dc1394_stop_iso_transmission(dc1394->handle, dc1394->camera.node);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
178 dc1394_dma_unlisten(dc1394->handle, &dc1394->camera);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
179 dc1394_dma_release_camera(dc1394->handle, &dc1394->camera);
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
180 dc1394_destroy_handle(dc1394->handle);
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 833
diff changeset
181
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
182 return 0;
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
183 }
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
184
2424
491a751cc58c Treat dc1394 as a library
ramiro
parents: 1795
diff changeset
185 AVInputFormat libdc1394_demuxer = {
571
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
186 .name = "dc1394",
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
187 .long_name = "dc1394 A/V grab",
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
188 .priv_data_size = sizeof(struct dc1394_data),
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
189 .read_header = dc1394_read_header,
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
190 .read_packet = dc1394_read_packet,
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
191 .read_close = dc1394_close,
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
192 .flags = AVFMT_NOFILE
4a755492b90b * Introducing IIDC1394 grabbing interface.
romansh
parents:
diff changeset
193 };