FFmpeg
iec61883.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012 Georg Lippitsch <georg.lippitsch@gmx.at>
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /**
22  * @file
23  * libiec61883 interface
24  */
25 
26 #include <poll.h>
27 #include <libraw1394/raw1394.h>
28 #include <libavc1394/avc1394.h>
29 #include <libavc1394/rom1394.h>
30 #include <libiec61883/iec61883.h>
31 #include "libavformat/dv.h"
32 #include "libavformat/mpegts.h"
33 #include "libavutil/opt.h"
34 #include "avdevice.h"
35 
36 #define THREADS HAVE_PTHREADS
37 
38 #if THREADS
39 #include <pthread.h>
40 #endif
41 
42 #define MOTDCT_SPEC_ID 0x00005068
43 #define IEC61883_AUTO 0
44 #define IEC61883_DV 1
45 #define IEC61883_HDV 2
46 
47 /**
48  * For DV, one packet corresponds exactly to one frame.
49  * For HDV, these are MPEG2 transport stream packets.
50  * The queue is implemented as linked list.
51  */
52 typedef struct DVPacket {
53  uint8_t *buf; ///< actual buffer data
54  int len; ///< size of buffer allocated
55  struct DVPacket *next; ///< next DVPacket
56 } DVPacket;
57 
58 struct iec61883_data {
59  AVClass *class;
60  raw1394handle_t raw1394; ///< handle for libraw1394
61  iec61883_dv_fb_t iec61883_dv; ///< handle for libiec61883 when used with DV
62  iec61883_mpeg2_t iec61883_mpeg2; ///< handle for libiec61883 when used with HDV
63 
64  DVDemuxContext *dv_demux; ///< generic DV muxing/demuxing context
65  MpegTSContext *mpeg_demux; ///< generic HDV muxing/demuxing context
66 
67  DVPacket *queue_first; ///< first element of packet queue
68  DVPacket *queue_last; ///< last element of packet queue
69 
70  char *device_guid; ///< to select one of multiple DV devices
71 
72  int packets; ///< Number of packets queued
73  int max_packets; ///< Max. number of packets in queue
74 
75  int bandwidth; ///< returned by libiec61883
76  int channel; ///< returned by libiec61883
77  int input_port; ///< returned by libiec61883
78  int type; ///< Stream type, to distinguish DV/HDV
79  int node; ///< returned by libiec61883
80  int output_port; ///< returned by libiec61883
81  int thread_loop; ///< Condition for thread while-loop
82  int receiving; ///< True as soon data from device available
83  int receive_error; ///< Set in receive task in case of error
84  int eof; ///< True as soon as no more data available
85 
86  struct pollfd raw1394_poll; ///< to poll for new data from libraw1394
87 
88  /** Parse function for DV/HDV differs, so this is set before packets arrive */
90 
91 #if THREADS
92  pthread_t receive_task_thread;
95 #endif
96 };
97 
98 static int iec61883_callback(unsigned char *data, int length,
99  int complete, void *callback_data)
100 {
101  struct iec61883_data *dv = callback_data;
102  DVPacket *packet;
103  int ret;
104 
105 #if THREADS
106  pthread_mutex_lock(&dv->mutex);
107 #endif
108 
109  if (dv->packets >= dv->max_packets) {
110  av_log(NULL, AV_LOG_ERROR, "DV packet queue overrun, dropping.\n");
111  ret = 0;
112  goto exit;
113  }
114 
115  packet = av_mallocz(sizeof(*packet));
116  if (!packet) {
117  ret = -1;
118  goto exit;
119  }
120 
121  packet->buf = av_malloc(length + AV_INPUT_BUFFER_PADDING_SIZE);
122  if (!packet->buf) {
123  av_free(packet);
124  ret = -1;
125  goto exit;
126  }
127  packet->len = length;
128 
129  memcpy(packet->buf, data, length);
130  memset(packet->buf + length, 0, AV_INPUT_BUFFER_PADDING_SIZE);
131 
132  if (dv->queue_first) {
133  dv->queue_last->next = packet;
134  dv->queue_last = packet;
135  } else {
136  dv->queue_first = packet;
137  dv->queue_last = packet;
138  }
139  dv->packets++;
140 
141  ret = 0;
142 
143 exit:
144 #if THREADS
145  pthread_cond_broadcast(&dv->cond);
146  pthread_mutex_unlock(&dv->mutex);
147 #endif
148  return ret;
149 }
150 
151 static void *iec61883_receive_task(void *opaque)
152 {
153  struct iec61883_data *dv = (struct iec61883_data *)opaque;
154  int result;
155 
156 #if THREADS
157  while (dv->thread_loop)
158 #endif
159  {
160  while ((result = poll(&dv->raw1394_poll, 1, 200)) < 0) {
161  if (!(errno == EAGAIN || errno == EINTR)) {
162  av_log(NULL, AV_LOG_ERROR, "Raw1394 poll error occurred.\n");
163  dv->receive_error = AVERROR(EIO);
164  return NULL;
165  }
166  }
167  if (result > 0 && ((dv->raw1394_poll.revents & POLLIN)
168  || (dv->raw1394_poll.revents & POLLPRI))) {
169  dv->receiving = 1;
170  raw1394_loop_iterate(dv->raw1394);
171  } else if (dv->receiving) {
172  av_log(NULL, AV_LOG_ERROR, "No more input data available\n");
173 #if THREADS
174  pthread_mutex_lock(&dv->mutex);
175  dv->eof = 1;
176  pthread_cond_broadcast(&dv->cond);
177  pthread_mutex_unlock(&dv->mutex);
178 #else
179  dv->eof = 1;
180 #endif
181  return NULL;
182  }
183  }
184 
185  return NULL;
186 }
187 
189 {
190  DVPacket *packet;
191  int size;
192 
194  if (size > 0)
195  return size;
196 
197  packet = dv->queue_first;
198  if (!packet)
199  return -1;
200 
202  packet->buf, packet->len, -1);
203  dv->queue_first = packet->next;
204  if (size < 0)
205  av_free(packet->buf);
206  av_free(packet);
207  dv->packets--;
208 
209  if (size < 0)
210  return -1;
211 
212  if (av_packet_from_data(pkt, pkt->data, pkt->size) < 0) {
213  av_freep(&pkt->data);
215  return -1;
216  }
217 
218  return size;
219 }
220 
222 {
223  DVPacket *packet;
224  int size;
225 
226  while (dv->queue_first) {
227  packet = dv->queue_first;
229  packet->len);
230  dv->queue_first = packet->next;
231  av_freep(&packet->buf);
232  av_freep(&packet);
233  dv->packets--;
234 
235  if (size > 0)
236  return size;
237  }
238 
239  return -1;
240 }
241 
243 {
244  struct iec61883_data *dv = context->priv_data;
245  struct raw1394_portinfo pinf[16];
246  rom1394_directory rom_dir;
247  char *endptr;
248  int inport;
249  int nb_ports;
250  int port = -1;
251  int response;
252  int i, j = 0;
253  uint64_t guid = 0;
254 
255  dv->input_port = -1;
256  dv->output_port = -1;
257  dv->channel = -1;
258 
259  dv->raw1394 = raw1394_new_handle();
260 
261  if (!dv->raw1394) {
262  av_log(context, AV_LOG_ERROR, "Failed to open IEEE1394 interface.\n");
263  return AVERROR(EIO);
264  }
265 
266  if ((nb_ports = raw1394_get_port_info(dv->raw1394, pinf, 16)) < 0) {
267  av_log(context, AV_LOG_ERROR, "Failed to get number of IEEE1394 ports.\n");
268  goto fail;
269  }
270 
271  inport = strtol(context->url, &endptr, 10);
272  if (endptr != context->url && *endptr == '\0') {
273  av_log(context, AV_LOG_INFO, "Selecting IEEE1394 port: %d\n", inport);
274  j = inport;
275  nb_ports = inport + 1;
276  } else if (strcmp(context->url, "auto")) {
277  av_log(context, AV_LOG_ERROR, "Invalid input \"%s\", you should specify "
278  "\"auto\" for auto-detection, or the port number.\n", context->url);
279  goto fail;
280  }
281 
282  if (dv->device_guid) {
283  if (sscanf(dv->device_guid, "%"SCNu64, &guid) != 1) {
284  av_log(context, AV_LOG_INFO, "Invalid dvguid parameter: %s\n",
285  dv->device_guid);
286  goto fail;
287  }
288  }
289 
290  for (; j < nb_ports && port==-1; ++j) {
291  raw1394_destroy_handle(dv->raw1394);
292 
293  if (!(dv->raw1394 = raw1394_new_handle_on_port(j))) {
294  av_log(context, AV_LOG_ERROR, "Failed setting IEEE1394 port.\n");
295  goto fail;
296  }
297 
298  for (i=0; i<raw1394_get_nodecount(dv->raw1394); ++i) {
299 
300  /* Select device explicitly by GUID */
301 
302  if (guid > 1) {
303  if (guid == rom1394_get_guid(dv->raw1394, i)) {
304  dv->node = i;
305  port = j;
306  break;
307  }
308  } else {
309 
310  /* Select first AV/C tape recorder player node */
311 
312  if (rom1394_get_directory(dv->raw1394, i, &rom_dir) < 0)
313  continue;
314  if (((rom1394_get_node_type(&rom_dir) == ROM1394_NODE_TYPE_AVC) &&
315  avc1394_check_subunit_type(dv->raw1394, i, AVC1394_SUBUNIT_TYPE_VCR)) ||
316  (rom_dir.unit_spec_id == MOTDCT_SPEC_ID)) {
317  rom1394_free_directory(&rom_dir);
318  dv->node = i;
319  port = j;
320  break;
321  }
322  rom1394_free_directory(&rom_dir);
323  }
324  }
325  }
326 
327  if (port == -1) {
328  av_log(context, AV_LOG_ERROR, "No AV/C devices found.\n");
329  goto fail;
330  }
331 
332  /* Provide bus sanity for multiple connections */
333 
334  iec61883_cmp_normalize_output(dv->raw1394, 0xffc0 | dv->node);
335 
336  /* Find out if device is DV or HDV */
337 
338  if (dv->type == IEC61883_AUTO) {
339  response = avc1394_transaction(dv->raw1394, dv->node,
340  AVC1394_CTYPE_STATUS |
341  AVC1394_SUBUNIT_TYPE_TAPE_RECORDER |
342  AVC1394_SUBUNIT_ID_0 |
343  AVC1394_VCR_COMMAND_OUTPUT_SIGNAL_MODE |
344  0xFF, 2);
345  response = AVC1394_GET_OPERAND0(response);
346  dv->type = (response == 0x10 || response == 0x90 || response == 0x1A || response == 0x9A) ?
348  }
349 
350  /* Connect to device, and do initialization */
351 
352  dv->channel = iec61883_cmp_connect(dv->raw1394, dv->node, &dv->output_port,
353  raw1394_get_local_id(dv->raw1394),
354  &dv->input_port, &dv->bandwidth);
355 
356  if (dv->channel < 0)
357  dv->channel = 63;
358 
359  if (!dv->max_packets)
360  dv->max_packets = 100;
361 
362  if (CONFIG_MPEGTS_DEMUXER && dv->type == IEC61883_HDV) {
363 
364  /* Init HDV receive */
365 
367 
369  if (!dv->mpeg_demux)
370  goto fail;
371 
373 
374  dv->iec61883_mpeg2 = iec61883_mpeg2_recv_init(dv->raw1394,
375  (iec61883_mpeg2_recv_t)iec61883_callback,
376  dv);
377 
378  dv->max_packets *= 766;
379  } else {
380 
381  /* Init DV receive */
382 
384  if (!dv->dv_demux)
385  goto fail;
386 
388 
389  dv->iec61883_dv = iec61883_dv_fb_init(dv->raw1394, iec61883_callback, dv);
390  }
391 
392  dv->raw1394_poll.fd = raw1394_get_fd(dv->raw1394);
393  dv->raw1394_poll.events = POLLIN | POLLERR | POLLHUP | POLLPRI;
394 
395  /* Actually start receiving */
396 
397  if (dv->type == IEC61883_HDV)
398  iec61883_mpeg2_recv_start(dv->iec61883_mpeg2, dv->channel);
399  else
400  iec61883_dv_fb_start(dv->iec61883_dv, dv->channel);
401 
402 #if THREADS
403  dv->thread_loop = 1;
404  if (pthread_mutex_init(&dv->mutex, NULL))
405  goto fail;
406  if (pthread_cond_init(&dv->cond, NULL))
407  goto fail;
408  if (pthread_create(&dv->receive_task_thread, NULL, iec61883_receive_task, dv))
409  goto fail;
410 #endif
411 
412  return 0;
413 
414 fail:
415  raw1394_destroy_handle(dv->raw1394);
416  return AVERROR(EIO);
417 }
418 
420 {
421  struct iec61883_data *dv = context->priv_data;
422  int size;
423 
424  /**
425  * Try to parse frames from queue
426  */
427 
428 #if THREADS
429  pthread_mutex_lock(&dv->mutex);
430  while ((size = dv->parse_queue(dv, pkt)) == -1)
431  if (!dv->eof)
432  pthread_cond_wait(&dv->cond, &dv->mutex);
433  else
434  break;
435  pthread_mutex_unlock(&dv->mutex);
436 #else
437  int result;
438  while ((size = dv->parse_queue(dv, pkt)) == -1) {
439  iec61883_receive_task((void *)dv);
440  if (dv->receive_error)
441  return dv->receive_error;
442  }
443 #endif
444 
445  return size;
446 }
447 
449 {
450  struct iec61883_data *dv = context->priv_data;
451 
452 #if THREADS
453  dv->thread_loop = 0;
454  pthread_join(dv->receive_task_thread, NULL);
455  pthread_cond_destroy(&dv->cond);
456  pthread_mutex_destroy(&dv->mutex);
457 #endif
458 
459  if (CONFIG_MPEGTS_DEMUXER && dv->type == IEC61883_HDV) {
460  iec61883_mpeg2_recv_stop(dv->iec61883_mpeg2);
461  iec61883_mpeg2_close(dv->iec61883_mpeg2);
463  } else {
464  iec61883_dv_fb_stop(dv->iec61883_dv);
465  iec61883_dv_fb_close(dv->iec61883_dv);
466  av_freep(&dv->dv_demux);
467  }
468  while (dv->queue_first) {
469  DVPacket *packet = dv->queue_first;
470  dv->queue_first = packet->next;
471  av_freep(&packet->buf);
472  av_freep(&packet);
473  }
474 
475  iec61883_cmp_disconnect(dv->raw1394, dv->node, dv->output_port,
476  raw1394_get_local_id(dv->raw1394),
477  dv->input_port, dv->channel, dv->bandwidth);
478 
479  raw1394_destroy_handle(dv->raw1394);
480 
481  return 0;
482 }
483 
484 static const AVOption options[] = {
485  { "dvtype", "override autodetection of DV/HDV", offsetof(struct iec61883_data, type), AV_OPT_TYPE_INT, {.i64 = IEC61883_AUTO}, IEC61883_AUTO, IEC61883_HDV, AV_OPT_FLAG_DECODING_PARAM, "dvtype" },
486  { "auto", "auto detect DV/HDV", 0, AV_OPT_TYPE_CONST, {.i64 = IEC61883_AUTO}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "dvtype" },
487  { "dv", "force device being treated as DV device", 0, AV_OPT_TYPE_CONST, {.i64 = IEC61883_DV}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "dvtype" },
488  { "hdv" , "force device being treated as HDV device", 0, AV_OPT_TYPE_CONST, {.i64 = IEC61883_HDV}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "dvtype" },
489  { "dvbuffer", "set queue buffer size (in packets)", offsetof(struct iec61883_data, max_packets), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
490  { "dvguid", "select one of multiple DV devices by its GUID", offsetof(struct iec61883_data, device_guid), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
491  { NULL },
492 };
493 
494 static const AVClass iec61883_class = {
495  .class_name = "iec61883 indev",
496  .item_name = av_default_item_name,
497  .option = options,
498  .version = LIBAVUTIL_VERSION_INT,
500 };
501 
503  .name = "iec61883",
504  .long_name = NULL_IF_CONFIG_SMALL("libiec61883 (new DV1394) A/V input device"),
505  .priv_data_size = sizeof(struct iec61883_data),
507  .read_packet = iec61883_read_packet,
508  .read_close = iec61883_close,
509  .flags = AVFMT_NOFILE,
510  .priv_class = &iec61883_class,
511 };
pthread_mutex_t
_fmutex pthread_mutex_t
Definition: os2threads.h:53
av_packet_unref
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: avpacket.c:605
pthread_join
static av_always_inline int pthread_join(pthread_t thread, void **value_ptr)
Definition: os2threads.h:94
DVPacket::len
int len
size of buffer allocated
Definition: iec61883.c:54
iec61883_data::eof
int eof
True as soon as no more data available.
Definition: iec61883.c:84
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
avformat_new_stream
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
Definition: utils.c:4526
iec61883_data::queue_last
DVPacket * queue_last
last element of packet queue
Definition: iec61883.c:68
ff_iec61883_demuxer
AVInputFormat ff_iec61883_demuxer
Definition: iec61883.c:502
iec61883_data::receive_error
int receive_error
Set in receive task in case of error.
Definition: iec61883.c:83
mpegts.h
avpriv_mpegts_parse_packet
int avpriv_mpegts_parse_packet(MpegTSContext *ts, AVPacket *pkt, const uint8_t *buf, int len)
Definition: mpegts.c:3343
pthread_mutex_init
static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
Definition: os2threads.h:104
MOTDCT_SPEC_ID
#define MOTDCT_SPEC_ID
Definition: iec61883.c:42
DVPacket
For DV, one packet corresponds exactly to one frame.
Definition: iec61883.c:52
AVPacket::data
uint8_t * data
Definition: packet.h:355
AVOption
AVOption.
Definition: opt.h:246
data
const char data[16]
Definition: mxf.c:91
iec61883_parse_queue_dv
static int iec61883_parse_queue_dv(struct iec61883_data *dv, AVPacket *pkt)
Definition: iec61883.c:188
iec61883_data::dv_demux
DVDemuxContext * dv_demux
generic DV muxing/demuxing context
Definition: iec61883.c:64
iec61883_data::input_port
int input_port
returned by libiec61883
Definition: iec61883.c:77
iec61883_data
Definition: iec61883.c:58
iec61883_data::max_packets
int max_packets
Max. number of packets in queue.
Definition: iec61883.c:73
iec61883_data::channel
int channel
returned by libiec61883
Definition: iec61883.c:76
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:31
iec61883_parse_queue_hdv
static int iec61883_parse_queue_hdv(struct iec61883_data *dv, AVPacket *pkt)
Definition: iec61883.c:221
IEC61883_HDV
#define IEC61883_HDV
Definition: iec61883.c:45
iec61883_data::packets
int packets
Number of packets queued.
Definition: iec61883.c:72
IEC61883_AUTO
#define IEC61883_AUTO
Definition: iec61883.c:43
avpriv_dv_produce_packet
int avpriv_dv_produce_packet(DVDemuxContext *c, AVPacket *pkt, uint8_t *buf, int buf_size, int64_t pos)
Definition: dv.c:364
fail
#define fail()
Definition: checkasm.h:123
iec61883_callback
static int iec61883_callback(unsigned char *data, int length, int complete, void *callback_data)
Definition: iec61883.c:98
dv.h
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
avpriv_mpegts_parse_close
void avpriv_mpegts_parse_close(MpegTSContext *ts)
Definition: mpegts.c:3368
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
AVInputFormat
Definition: avformat.h:636
iec61883_data::raw1394
raw1394handle_t raw1394
handle for libraw1394
Definition: iec61883.c:60
IEC61883_DV
#define IEC61883_DV
Definition: iec61883.c:44
AVInputFormat::name
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:641
iec61883_data::thread_loop
int thread_loop
Condition for thread while-loop.
Definition: iec61883.c:81
pthread_cond_broadcast
static av_always_inline int pthread_cond_broadcast(pthread_cond_t *cond)
Definition: os2threads.h:162
pthread_create
static av_always_inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
Definition: os2threads.h:80
context
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option keep it simple and lowercase description are in without and describe what they for example set the foo of the bar offset is the offset of the field in your context
Definition: writing_filters.txt:91
AVFormatContext
Format I/O context.
Definition: avformat.h:1335
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:527
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:67
avpriv_dv_get_packet
int avpriv_dv_get_packet(DVDemuxContext *c, AVPacket *pkt)
Definition: dv.c:347
result
and forward the result(frame or status change) to the corresponding input. If nothing is possible
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:235
DVPacket::next
struct DVPacket * next
next DVPacket
Definition: iec61883.c:55
AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT
@ AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT
Definition: log.h:42
pthread_mutex_unlock
#define pthread_mutex_unlock(a)
Definition: ffprobe.c:66
av_packet_from_data
int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size)
Initialize a reference-counted packet from av_malloc()ed data.
Definition: avpacket.c:155
AVPacket::size
int size
Definition: packet.h:356
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:188
MpegTSContext
Definition: mpegts.c:119
size
int size
Definition: twinvq_data.h:11134
iec61883_close
static int iec61883_close(AVFormatContext *context)
Definition: iec61883.c:448
AVFMT_NOFILE
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:458
iec61883_receive_task
static void * iec61883_receive_task(void *opaque)
Definition: iec61883.c:151
iec61883_data::receiving
int receiving
True as soon data from device available.
Definition: iec61883.c:82
avdevice.h
options
static const AVOption options[]
Definition: iec61883.c:484
DVDemuxContext
Definition: dv.c:43
pthread_t
Definition: os2threads.h:44
pthread_cond_destroy
static av_always_inline int pthread_cond_destroy(pthread_cond_t *cond)
Definition: os2threads.h:144
iec61883_data::iec61883_dv
iec61883_dv_fb_t iec61883_dv
handle for libiec61883 when used with DV
Definition: iec61883.c:61
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:187
iec61883_data::bandwidth
int bandwidth
returned by libiec61883
Definition: iec61883.c:75
pthread_mutex_destroy
static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
Definition: os2threads.h:112
iec61883_read_packet
static int iec61883_read_packet(AVFormatContext *context, AVPacket *pkt)
Definition: iec61883.c:419
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
AV_OPT_FLAG_DECODING_PARAM
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
Definition: opt.h:277
uint8_t
uint8_t
Definition: audio_convert.c:194
iec61883_data::mpeg_demux
MpegTSContext * mpeg_demux
generic HDV muxing/demuxing context
Definition: iec61883.c:65
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:237
iec61883_data::iec61883_mpeg2
iec61883_mpeg2_t iec61883_mpeg2
handle for libiec61883 when used with HDV
Definition: iec61883.c:62
pthread_cond_t
Definition: os2threads.h:58
ret
ret
Definition: filter_design.txt:187
AVClass::class_name
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:72
DVPacket::buf
uint8_t * buf
actual buffer data
Definition: iec61883.c:53
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: avcodec.h:215
iec61883_data::type
int type
Stream type, to distinguish DV/HDV.
Definition: iec61883.c:78
avpriv_dv_init_demux
DVDemuxContext * avpriv_dv_init_demux(AVFormatContext *s)
Definition: dv.c:324
pkt
static AVPacket pkt
Definition: demuxing_decoding.c:54
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
iec61883_data::queue_first
DVPacket * queue_first
first element of packet queue
Definition: iec61883.c:67
avpriv_mpegts_parse_open
MpegTSContext * avpriv_mpegts_parse_open(AVFormatContext *s)
Definition: mpegts.c:3322
pthread_cond_wait
static av_always_inline int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
Definition: os2threads.h:192
iec61883_data::device_guid
char * device_guid
to select one of multiple DV devices
Definition: iec61883.c:70
iec61883_data::output_port
int output_port
returned by libiec61883
Definition: iec61883.c:80
av_free
#define av_free(p)
Definition: tableprint_vlc.h:34
AVPacket
This structure stores compressed data.
Definition: packet.h:332
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
iec61883_data::raw1394_poll
struct pollfd raw1394_poll
to poll for new data from libraw1394
Definition: iec61883.c:86
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
pthread_cond_init
static av_always_inline int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
Definition: os2threads.h:133
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:227
iec61883_data::node
int node
returned by libiec61883
Definition: iec61883.c:79
int
int
Definition: ffmpeg_filter.c:192
iec61883_class
static const AVClass iec61883_class
Definition: iec61883.c:494
iec61883_read_header
static int iec61883_read_header(AVFormatContext *context)
Definition: iec61883.c:242
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:232
cond
int(* cond)(enum AVPixelFormat pix_fmt)
Definition: pixdesc_query.c:28
iec61883_data::parse_queue
int(* parse_queue)(struct iec61883_data *dv, AVPacket *pkt)
Parse function for DV/HDV differs, so this is set before packets arrive.
Definition: iec61883.c:89
mutex
static AVMutex mutex
Definition: log.c:44
pthread_mutex_lock
#define pthread_mutex_lock(a)
Definition: ffprobe.c:62