26#include "config_components.h"
29#include <libraw1394/raw1394.h>
30#include <libavc1394/avc1394.h>
31#include <libavc1394/rom1394.h>
32#include <libiec61883/iec61883.h>
40#define THREADS HAVE_PTHREADS
46#define MOTDCT_SPEC_ID 0x00005068
47#define IEC61883_AUTO 0
103 int complete,
void *callback_data)
131 packet->
len = length;
133 memcpy(packet->
buf,
data, length);
164 while ((result = poll(&dv->
raw1394_poll, 1, 200)) < 0) {
165 if (!(errno == EAGAIN || errno == EINTR)) {
174 raw1394_loop_iterate(dv->
raw1394);
206 packet->
buf, packet->
len, -1);
227#if CONFIG_MPEGTS_DEMUXER
250 struct raw1394_portinfo pinf[16];
251 rom1394_directory rom_dir;
264 dv->
raw1394 = raw1394_new_handle();
271 if ((nb_ports = raw1394_get_port_info(dv->
raw1394, pinf, 16)) < 0) {
276 inport = strtol(context->
url, &endptr, 10);
277 if (endptr != context->
url && *endptr ==
'\0') {
280 nb_ports = inport + 1;
281 }
else if (strcmp(context->
url,
"auto")) {
283 "\"auto\" for auto-detection, or the port number.\n", context->
url);
288 if (sscanf(dv->
device_guid,
"%"SCNu64, &guid) != 1) {
295 for (; j < nb_ports && port==-1; ++j) {
296 raw1394_destroy_handle(dv->
raw1394);
298 if (!(dv->
raw1394 = raw1394_new_handle_on_port(j))) {
303 for (
i=0;
i<raw1394_get_nodecount(dv->
raw1394); ++
i) {
308 if (guid == rom1394_get_guid(dv->
raw1394,
i)) {
317 if (rom1394_get_directory(dv->
raw1394,
i, &rom_dir) < 0)
319 if (((rom1394_get_node_type(&rom_dir) == ROM1394_NODE_TYPE_AVC) &&
320 avc1394_check_subunit_type(dv->
raw1394,
i, AVC1394_SUBUNIT_TYPE_VCR)) ||
322 rom1394_free_directory(&rom_dir);
327 rom1394_free_directory(&rom_dir);
339 iec61883_cmp_normalize_output(dv->
raw1394, 0xffc0 | dv->
node);
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 |
350 response = AVC1394_GET_OPERAND0(response);
351 dv->
type = (response == 0x10 || response == 0x90 || response == 0x1A || response == 0x9A) ?
358 raw1394_get_local_id(dv->
raw1394),
398 dv->
raw1394_poll.events = POLLIN | POLLERR | POLLHUP | POLLPRI;
420 raw1394_destroy_handle(dv->
raw1394);
445 if (dv->receive_error)
446 return dv->receive_error;
481 raw1394_get_local_id(dv->
raw1394),
484 raw1394_destroy_handle(dv->
raw1394);
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" },
500 .class_name =
"iec61883 indev",
508 .p.name =
"iec61883",
const FFInputFormat ff_iec61883_demuxer
Main libavdevice API header.
#define i(width, name, range_min, range_max)
static int read_header(FFV1Context *f, RangeCoder *c)
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ 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...
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size)
Initialize a reference-counted packet from av_malloc()ed data.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
#define LIBAVUTIL_VERSION_INT
static int iec61883_close(AVFormatContext *context)
static int iec61883_parse_queue_hdv(struct iec61883_data *dv, AVPacket *pkt)
static const AVClass iec61883_class
static int iec61883_read_header(AVFormatContext *context)
static void * iec61883_receive_task(void *opaque)
static int iec61883_read_packet(AVFormatContext *context, AVPacket *pkt)
static int iec61883_parse_queue_dv(struct iec61883_data *dv, AVPacket *pkt)
static int iec61883_callback(unsigned char *data, int length, int complete, void *callback_data)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
@ AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT
Memory handling functions.
void avpriv_mpegts_parse_close(MpegTSContext *ts)
MpegTSContext * avpriv_mpegts_parse_open(AVFormatContext *s)
int avpriv_mpegts_parse_packet(MpegTSContext *ts, AVPacket *pkt, const uint8_t *buf, int len)
static av_always_inline int pthread_cond_broadcast(pthread_cond_t *cond)
static av_always_inline int pthread_mutex_lock(pthread_mutex_t *mutex)
static av_always_inline int pthread_cond_destroy(pthread_cond_t *cond)
static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
static av_always_inline int pthread_join(pthread_t thread, void **value_ptr)
static av_always_inline int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
static av_always_inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
static av_always_inline int pthread_mutex_unlock(pthread_mutex_t *mutex)
static av_always_inline int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
int(* cond)(enum AVPixelFormat pix_fmt)
Describe the class of an AVClass context structure.
char * url
input or output URL.
void * priv_data
Format private data.
This structure stores compressed data.
For DV, one packet corresponds exactly to one frame.
uint8_t * buf
actual buffer data
struct DVPacket * next
next DVPacket
int len
size of buffer allocated
int(* parse_queue)(struct iec61883_data *dv, AVPacket *pkt)
Parse function for DV/HDV differs, so this is set before packets arrive.
int packets
Number of packets queued.
int type
Stream type, to distinguish DV/HDV.
int channel
returned by libiec61883
char * device_guid
to select one of multiple DV devices
int input_port
returned by libiec61883
DVPacket * queue_first
first element of packet queue
int bandwidth
returned by libiec61883
DVPacket * queue_last
last element of packet queue
DVDemuxContext * dv_demux
generic DV muxing/demuxing context
iec61883_dv_fb_t iec61883_dv
handle for libiec61883 when used with DV
int node
returned by libiec61883
struct pollfd raw1394_poll
to poll for new data from libraw1394
int max_packets
Max. number of packets in queue.
int receiving
True as soon data from device available.
int receive_error
Set in receive task in case of error.
iec61883_mpeg2_t iec61883_mpeg2
handle for libiec61883 when used with HDV
MpegTSContext * mpeg_demux
generic HDV muxing/demuxing context
int output_port
returned by libiec61883
int eof
True as soon as no more data available.
raw1394handle_t raw1394
handle for libraw1394
int thread_loop
Condition for thread while-loop.