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