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 "config_components.h"
27 
28 #include <poll.h>
29 #include <libraw1394/raw1394.h>
30 #include <libavc1394/avc1394.h>
31 #include <libavc1394/rom1394.h>
32 #include <libiec61883/iec61883.h>
33 #include "libavformat/demux.h"
34 #include "libavformat/dv.h"
35 #include "libavformat/mpegts.h"
36 #include "libavutil/mem.h"
37 #include "libavutil/opt.h"
38 #include "avdevice.h"
39 
40 #define THREADS HAVE_PTHREADS
41 
42 #if THREADS
43 #include <pthread.h>
44 #endif
45 
46 #define MOTDCT_SPEC_ID 0x00005068
47 #define IEC61883_AUTO 0
48 #define IEC61883_DV 1
49 #define IEC61883_HDV 2
50 
51 /**
52  * For DV, one packet corresponds exactly to one frame.
53  * For HDV, these are MPEG2 transport stream packets.
54  * The queue is implemented as linked list.
55  */
56 typedef struct DVPacket {
57  uint8_t *buf; ///< actual buffer data
58  int len; ///< size of buffer allocated
59  struct DVPacket *next; ///< next DVPacket
60 } DVPacket;
61 
62 struct iec61883_data {
63  AVClass *class;
64  raw1394handle_t raw1394; ///< handle for libraw1394
65  iec61883_dv_fb_t iec61883_dv; ///< handle for libiec61883 when used with DV
66  iec61883_mpeg2_t iec61883_mpeg2; ///< handle for libiec61883 when used with HDV
67 
68  DVDemuxContext *dv_demux; ///< generic DV muxing/demuxing context
69  MpegTSContext *mpeg_demux; ///< generic HDV muxing/demuxing context
70 
71  DVPacket *queue_first; ///< first element of packet queue
72  DVPacket *queue_last; ///< last element of packet queue
73 
74  char *device_guid; ///< to select one of multiple DV devices
75 
76  int packets; ///< Number of packets queued
77  int max_packets; ///< Max. number of packets in queue
78 
79  int bandwidth; ///< returned by libiec61883
80  int channel; ///< returned by libiec61883
81  int input_port; ///< returned by libiec61883
82  int type; ///< Stream type, to distinguish DV/HDV
83  int node; ///< returned by libiec61883
84  int output_port; ///< returned by libiec61883
85  int thread_loop; ///< Condition for thread while-loop
86  int receiving; ///< True as soon data from device available
87  int receive_error; ///< Set in receive task in case of error
88  int eof; ///< True as soon as no more data available
89 
90  struct pollfd raw1394_poll; ///< to poll for new data from libraw1394
91 
92  /** Parse function for DV/HDV differs, so this is set before packets arrive */
93  int (*parse_queue)(struct iec61883_data *dv, AVPacket *pkt);
94 
95 #if THREADS
96  pthread_t receive_task_thread;
99 #endif
100 };
101 
102 static int iec61883_callback(unsigned char *data, int length,
103  int complete, void *callback_data)
104 {
105  struct iec61883_data *dv = callback_data;
106  DVPacket *packet;
107  int ret;
108 
109 #if THREADS
110  pthread_mutex_lock(&dv->mutex);
111 #endif
112 
113  if (dv->packets >= dv->max_packets) {
114  av_log(NULL, AV_LOG_ERROR, "DV packet queue overrun, dropping.\n");
115  ret = 0;
116  goto exit;
117  }
118 
119  packet = av_mallocz(sizeof(*packet));
120  if (!packet) {
121  ret = -1;
122  goto exit;
123  }
124 
125  packet->buf = av_malloc(length + AV_INPUT_BUFFER_PADDING_SIZE);
126  if (!packet->buf) {
127  av_free(packet);
128  ret = -1;
129  goto exit;
130  }
131  packet->len = length;
132 
133  memcpy(packet->buf, data, length);
134  memset(packet->buf + length, 0, AV_INPUT_BUFFER_PADDING_SIZE);
135 
136  if (dv->queue_first) {
137  dv->queue_last->next = packet;
138  dv->queue_last = packet;
139  } else {
140  dv->queue_first = packet;
141  dv->queue_last = packet;
142  }
143  dv->packets++;
144 
145  ret = 0;
146 
147 exit:
148 #if THREADS
149  pthread_cond_broadcast(&dv->cond);
150  pthread_mutex_unlock(&dv->mutex);
151 #endif
152  return ret;
153 }
154 
155 static void *iec61883_receive_task(void *opaque)
156 {
157  struct iec61883_data *dv = (struct iec61883_data *)opaque;
158  int result;
159 
160 #if THREADS
161  while (dv->thread_loop)
162 #endif
163  {
164  while ((result = poll(&dv->raw1394_poll, 1, 200)) < 0) {
165  if (!(errno == EAGAIN || errno == EINTR)) {
166  av_log(NULL, AV_LOG_ERROR, "Raw1394 poll error occurred.\n");
167  dv->receive_error = AVERROR(EIO);
168  return NULL;
169  }
170  }
171  if (result > 0 && ((dv->raw1394_poll.revents & POLLIN)
172  || (dv->raw1394_poll.revents & POLLPRI))) {
173  dv->receiving = 1;
174  raw1394_loop_iterate(dv->raw1394);
175  } else if (dv->receiving) {
176  av_log(NULL, AV_LOG_ERROR, "No more input data available\n");
177 #if THREADS
178  pthread_mutex_lock(&dv->mutex);
179  dv->eof = 1;
180  pthread_cond_broadcast(&dv->cond);
181  pthread_mutex_unlock(&dv->mutex);
182 #else
183  dv->eof = 1;
184 #endif
185  return NULL;
186  }
187  }
188 
189  return NULL;
190 }
191 
193 {
194  DVPacket *packet;
195  int size;
196 
198  if (size > 0)
199  return size;
200 
201  packet = dv->queue_first;
202  if (!packet)
203  return -1;
204 
206  packet->buf, packet->len, -1);
207  dv->queue_first = packet->next;
208  if (size < 0)
209  av_free(packet->buf);
210  av_free(packet);
211  dv->packets--;
212 
213  if (size < 0)
214  return -1;
215 
216  if (av_packet_from_data(pkt, pkt->data, pkt->size) < 0) {
217  av_freep(&pkt->data);
219  return -1;
220  }
221 
222  return size;
223 }
224 
226 {
227 #if CONFIG_MPEGTS_DEMUXER
228  DVPacket *packet;
229  int size;
230 
231  while (dv->queue_first) {
232  packet = dv->queue_first;
234  packet->len);
235  dv->queue_first = packet->next;
236  av_freep(&packet->buf);
237  av_freep(&packet);
238  dv->packets--;
239 
240  if (size > 0)
241  return size;
242  }
243 #endif
244  return -1;
245 }
246 
248 {
249  struct iec61883_data *dv = context->priv_data;
250  struct raw1394_portinfo pinf[16];
251  rom1394_directory rom_dir;
252  char *endptr;
253  int inport;
254  int nb_ports;
255  int port = -1;
256  int response;
257  int i, j = 0;
258  uint64_t guid = 0;
259 
260  dv->input_port = -1;
261  dv->output_port = -1;
262  dv->channel = -1;
263 
264  dv->raw1394 = raw1394_new_handle();
265 
266  if (!dv->raw1394) {
267  av_log(context, AV_LOG_ERROR, "Failed to open IEEE1394 interface.\n");
268  return AVERROR(EIO);
269  }
270 
271  if ((nb_ports = raw1394_get_port_info(dv->raw1394, pinf, 16)) < 0) {
272  av_log(context, AV_LOG_ERROR, "Failed to get number of IEEE1394 ports.\n");
273  goto fail;
274  }
275 
276  inport = strtol(context->url, &endptr, 10);
277  if (endptr != context->url && *endptr == '\0') {
278  av_log(context, AV_LOG_INFO, "Selecting IEEE1394 port: %d\n", inport);
279  j = inport;
280  nb_ports = inport + 1;
281  } else if (strcmp(context->url, "auto")) {
282  av_log(context, AV_LOG_ERROR, "Invalid input \"%s\", you should specify "
283  "\"auto\" for auto-detection, or the port number.\n", context->url);
284  goto fail;
285  }
286 
287  if (dv->device_guid) {
288  if (sscanf(dv->device_guid, "%"SCNu64, &guid) != 1) {
289  av_log(context, AV_LOG_INFO, "Invalid dvguid parameter: %s\n",
290  dv->device_guid);
291  goto fail;
292  }
293  }
294 
295  for (; j < nb_ports && port==-1; ++j) {
296  raw1394_destroy_handle(dv->raw1394);
297 
298  if (!(dv->raw1394 = raw1394_new_handle_on_port(j))) {
299  av_log(context, AV_LOG_ERROR, "Failed setting IEEE1394 port.\n");
300  goto fail;
301  }
302 
303  for (i=0; i<raw1394_get_nodecount(dv->raw1394); ++i) {
304 
305  /* Select device explicitly by GUID */
306 
307  if (guid > 1) {
308  if (guid == rom1394_get_guid(dv->raw1394, i)) {
309  dv->node = i;
310  port = j;
311  break;
312  }
313  } else {
314 
315  /* Select first AV/C tape recorder player node */
316 
317  if (rom1394_get_directory(dv->raw1394, i, &rom_dir) < 0)
318  continue;
319  if (((rom1394_get_node_type(&rom_dir) == ROM1394_NODE_TYPE_AVC) &&
320  avc1394_check_subunit_type(dv->raw1394, i, AVC1394_SUBUNIT_TYPE_VCR)) ||
321  (rom_dir.unit_spec_id == MOTDCT_SPEC_ID)) {
322  rom1394_free_directory(&rom_dir);
323  dv->node = i;
324  port = j;
325  break;
326  }
327  rom1394_free_directory(&rom_dir);
328  }
329  }
330  }
331 
332  if (port == -1) {
333  av_log(context, AV_LOG_ERROR, "No AV/C devices found.\n");
334  goto fail;
335  }
336 
337  /* Provide bus sanity for multiple connections */
338 
339  iec61883_cmp_normalize_output(dv->raw1394, 0xffc0 | dv->node);
340 
341  /* Find out if device is DV or HDV */
342 
343  if (dv->type == IEC61883_AUTO) {
344  response = avc1394_transaction(dv->raw1394, dv->node,
345  AVC1394_CTYPE_STATUS |
346  AVC1394_SUBUNIT_TYPE_TAPE_RECORDER |
347  AVC1394_SUBUNIT_ID_0 |
348  AVC1394_VCR_COMMAND_OUTPUT_SIGNAL_MODE |
349  0xFF, 2);
350  response = AVC1394_GET_OPERAND0(response);
351  dv->type = (response == 0x10 || response == 0x90 || response == 0x1A || response == 0x9A) ?
353  }
354 
355  /* Connect to device, and do initialization */
356 
357  dv->channel = iec61883_cmp_connect(dv->raw1394, dv->node, &dv->output_port,
358  raw1394_get_local_id(dv->raw1394),
359  &dv->input_port, &dv->bandwidth);
360 
361  if (dv->channel < 0)
362  dv->channel = 63;
363 
364  if (!dv->max_packets)
365  dv->max_packets = 100;
366 
367  if (CONFIG_MPEGTS_DEMUXER && dv->type == IEC61883_HDV) {
368 
369  /* Init HDV receive */
370 
372 
374  if (!dv->mpeg_demux)
375  goto fail;
376 
378 
379  dv->iec61883_mpeg2 = iec61883_mpeg2_recv_init(dv->raw1394,
380  (iec61883_mpeg2_recv_t)iec61883_callback,
381  dv);
382 
383  dv->max_packets *= 766;
384  } else {
385 
386  /* Init DV receive */
387 
389  if (!dv->dv_demux)
390  goto fail;
391 
393 
394  dv->iec61883_dv = iec61883_dv_fb_init(dv->raw1394, iec61883_callback, dv);
395  }
396 
397  dv->raw1394_poll.fd = raw1394_get_fd(dv->raw1394);
398  dv->raw1394_poll.events = POLLIN | POLLERR | POLLHUP | POLLPRI;
399 
400  /* Actually start receiving */
401 
402  if (dv->type == IEC61883_HDV)
403  iec61883_mpeg2_recv_start(dv->iec61883_mpeg2, dv->channel);
404  else
405  iec61883_dv_fb_start(dv->iec61883_dv, dv->channel);
406 
407 #if THREADS
408  dv->thread_loop = 1;
409  if (pthread_mutex_init(&dv->mutex, NULL))
410  goto fail;
411  if (pthread_cond_init(&dv->cond, NULL))
412  goto fail;
413  if (pthread_create(&dv->receive_task_thread, NULL, iec61883_receive_task, dv))
414  goto fail;
415 #endif
416 
417  return 0;
418 
419 fail:
420  raw1394_destroy_handle(dv->raw1394);
421  return AVERROR(EIO);
422 }
423 
425 {
426  struct iec61883_data *dv = context->priv_data;
427  int size;
428 
429  /**
430  * Try to parse frames from queue
431  */
432 
433 #if THREADS
434  pthread_mutex_lock(&dv->mutex);
435  while ((size = dv->parse_queue(dv, pkt)) == -1)
436  if (!dv->eof)
437  pthread_cond_wait(&dv->cond, &dv->mutex);
438  else
439  break;
440  pthread_mutex_unlock(&dv->mutex);
441 #else
442  int result;
443  while ((size = dv->parse_queue(dv, pkt)) == -1) {
444  iec61883_receive_task((void *)dv);
445  if (dv->receive_error)
446  return dv->receive_error;
447  }
448 #endif
449 
450  return size;
451 }
452 
454 {
455  struct iec61883_data *dv = context->priv_data;
456 
457 #if THREADS
458  dv->thread_loop = 0;
459  pthread_join(dv->receive_task_thread, NULL);
460  pthread_cond_destroy(&dv->cond);
461  pthread_mutex_destroy(&dv->mutex);
462 #endif
463 
464  if (CONFIG_MPEGTS_DEMUXER && dv->type == IEC61883_HDV) {
465  iec61883_mpeg2_recv_stop(dv->iec61883_mpeg2);
466  iec61883_mpeg2_close(dv->iec61883_mpeg2);
468  } else {
469  iec61883_dv_fb_stop(dv->iec61883_dv);
470  iec61883_dv_fb_close(dv->iec61883_dv);
471  av_freep(&dv->dv_demux);
472  }
473  while (dv->queue_first) {
474  DVPacket *packet = dv->queue_first;
475  dv->queue_first = packet->next;
476  av_freep(&packet->buf);
477  av_freep(&packet);
478  }
479 
480  iec61883_cmp_disconnect(dv->raw1394, dv->node, dv->output_port,
481  raw1394_get_local_id(dv->raw1394),
482  dv->input_port, dv->channel, dv->bandwidth);
483 
484  raw1394_destroy_handle(dv->raw1394);
485 
486  return 0;
487 }
488 
489 static const AVOption options[] = {
490  { "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, .unit = "dvtype" },
491  { "auto", "auto detect DV/HDV", 0, AV_OPT_TYPE_CONST, {.i64 = IEC61883_AUTO}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, .unit = "dvtype" },
492  { "dv", "force device being treated as DV device", 0, AV_OPT_TYPE_CONST, {.i64 = IEC61883_DV}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, .unit = "dvtype" },
493  { "hdv" , "force device being treated as HDV device", 0, AV_OPT_TYPE_CONST, {.i64 = IEC61883_HDV}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, .unit = "dvtype" },
494  { "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 },
495  { "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 },
496  { NULL },
497 };
498 
499 static const AVClass iec61883_class = {
500  .class_name = "iec61883 indev",
501  .item_name = av_default_item_name,
502  .option = options,
503  .version = LIBAVUTIL_VERSION_INT,
505 };
506 
508  .p.name = "iec61883",
509  .p.long_name = NULL_IF_CONFIG_SMALL("libiec61883 (new DV1394) A/V input device"),
510  .p.flags = AVFMT_NOFILE,
511  .p.priv_class = &iec61883_class,
512  .priv_data_size = sizeof(struct iec61883_data),
514  .read_packet = iec61883_read_packet,
515  .read_close = iec61883_close,
516 };
pthread_mutex_t
_fmutex pthread_mutex_t
Definition: os2threads.h:53
av_packet_unref
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: packet.c:429
pthread_join
static av_always_inline int pthread_join(pthread_t thread, void **value_ptr)
Definition: os2threads.h:94
ff_iec61883_demuxer
const FFInputFormat ff_iec61883_demuxer
Definition: iec61883.c:507
DVPacket::len
int len
size of buffer allocated
Definition: iec61883.c:58
iec61883_data::eof
int eof
True as soon as no more data available.
Definition: iec61883.c:88
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
iec61883_data::queue_last
DVPacket * queue_last
last element of packet queue
Definition: iec61883.c:72
iec61883_data::receive_error
int receive_error
Set in receive task in case of error.
Definition: iec61883.c:87
mpegts.h
avformat_new_stream
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
avpriv_mpegts_parse_packet
int avpriv_mpegts_parse_packet(MpegTSContext *ts, AVPacket *pkt, const uint8_t *buf, int len)
Definition: mpegts.c:3407
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:46
DVPacket
For DV, one packet corresponds exactly to one frame.
Definition: iec61883.c:56
AVPacket::data
uint8_t * data
Definition: packet.h:539
AVOption
AVOption.
Definition: opt.h:429
data
const char data[16]
Definition: mxf.c:149
iec61883_parse_queue_dv
static int iec61883_parse_queue_dv(struct iec61883_data *dv, AVPacket *pkt)
Definition: iec61883.c:192
iec61883_data::dv_demux
DVDemuxContext * dv_demux
generic DV muxing/demuxing context
Definition: iec61883.c:68
iec61883_data::input_port
int input_port
returned by libiec61883
Definition: iec61883.c:81
iec61883_data
Definition: iec61883.c:62
iec61883_data::max_packets
int max_packets
Max. number of packets in queue.
Definition: iec61883.c:77
DVDemuxContext
struct DVDemuxContext DVDemuxContext
Definition: dv.h:33
iec61883_data::channel
int channel
returned by libiec61883
Definition: iec61883.c:80
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:30
iec61883_parse_queue_hdv
static int iec61883_parse_queue_hdv(struct iec61883_data *dv, AVPacket *pkt)
Definition: iec61883.c:225
IEC61883_HDV
#define IEC61883_HDV
Definition: iec61883.c:49
iec61883_data::packets
int packets
Number of packets queued.
Definition: iec61883.c:76
IEC61883_AUTO
#define IEC61883_AUTO
Definition: iec61883.c:47
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:736
fail
#define fail()
Definition: checkasm.h:188
iec61883_callback
static int iec61883_callback(unsigned char *data, int length, int complete, void *callback_data)
Definition: iec61883.c:102
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:3432
pkt
AVPacket * pkt
Definition: movenc.c:60
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:209
iec61883_data::raw1394
raw1394handle_t raw1394
handle for libraw1394
Definition: iec61883.c:64
IEC61883_DV
#define IEC61883_DV
Definition: iec61883.c:48
AVInputFormat::name
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:553
iec61883_data::thread_loop
int thread_loop
Condition for thread while-loop.
Definition: iec61883.c:85
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:1300
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:540
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
avpriv_dv_get_packet
int avpriv_dv_get_packet(DVDemuxContext *c, AVPacket *pkt)
Definition: dv.c:731
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:237
DVPacket::next
struct DVPacket * next
next DVPacket
Definition: iec61883.c:59
AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT
@ AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT
Definition: log.h:41
pthread_mutex_unlock
#define pthread_mutex_unlock(a)
Definition: ffprobe.c:82
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: packet.c:172
AVPacket::size
int size
Definition: packet.h:540
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:94
MpegTSContext
Definition: mpegts.c:129
size
int size
Definition: twinvq_data.h:10344
iec61883_close
static int iec61883_close(AVFormatContext *context)
Definition: iec61883.c:453
AVFMT_NOFILE
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:468
iec61883_receive_task
static void * iec61883_receive_task(void *opaque)
Definition: iec61883.c:155
iec61883_data::receiving
int receiving
True as soon data from device available.
Definition: iec61883.c:86
avdevice.h
FFInputFormat::p
AVInputFormat p
The public AVInputFormat.
Definition: demux.h:46
options
static const AVOption options[]
Definition: iec61883.c:489
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:65
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:220
iec61883_data::bandwidth
int bandwidth
returned by libiec61883
Definition: iec61883.c:79
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:424
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
iec61883_data::mpeg_demux
MpegTSContext * mpeg_demux
generic HDV muxing/demuxing context
Definition: iec61883.c:69
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:256
demux.h
iec61883_data::iec61883_mpeg2
iec61883_mpeg2_t iec61883_mpeg2
handle for libiec61883 when used with HDV
Definition: iec61883.c:66
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:80
DVPacket::buf
uint8_t * buf
actual buffer data
Definition: iec61883.c:57
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: defs.h:40
iec61883_data::type
int type
Stream type, to distinguish DV/HDV.
Definition: iec61883.c:82
avpriv_dv_init_demux
DVDemuxContext * avpriv_dv_init_demux(AVFormatContext *s)
Definition: dv.c:726
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
iec61883_data::queue_first
DVPacket * queue_first
first element of packet queue
Definition: iec61883.c:71
avpriv_mpegts_parse_open
MpegTSContext * avpriv_mpegts_parse_open(AVFormatContext *s)
Definition: mpegts.c:3385
pthread_cond_wait
static av_always_inline int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
Definition: os2threads.h:192
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:356
iec61883_data::device_guid
char * device_guid
to select one of multiple DV devices
Definition: iec61883.c:74
iec61883_data::output_port
int output_port
returned by libiec61883
Definition: iec61883.c:84
mem.h
av_free
#define av_free(p)
Definition: tableprint_vlc.h:33
AVPacket
This structure stores compressed data.
Definition: packet.h:516
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
FFInputFormat
Definition: demux.h:42
iec61883_data::raw1394_poll
struct pollfd raw1394_poll
to poll for new data from libraw1394
Definition: iec61883.c:90
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
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
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276
iec61883_data::node
int node
returned by libiec61883
Definition: iec61883.c:83
iec61883_class
static const AVClass iec61883_class
Definition: iec61883.c:499
iec61883_read_header
static int iec61883_read_header(AVFormatContext *context)
Definition: iec61883.c:247
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
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:93
mutex
static AVMutex mutex
Definition: log.c:46
pthread_mutex_lock
#define pthread_mutex_lock(a)
Definition: ffprobe.c:78