27 #include <libraw1394/raw1394.h>
28 #include <libavc1394/avc1394.h>
29 #include <libavc1394/rom1394.h>
30 #include <libiec61883/iec61883.h>
36 #define THREADS HAVE_PTHREADS
42 #define MOTDCT_SPEC_ID 0x00005068
43 #define IEC61883_AUTO 0
45 #define IEC61883_HDV 2
99 int complete,
void *callback_data)
128 memcpy(packet->
buf, data, length);
158 while ((result = poll(&dv->
raw1394_poll, 1, 200)) < 0) {
159 if (!(errno == EAGAIN || errno == EINTR)) {
168 raw1394_loop_iterate(dv->
raw1394);
200 packet->
buf, packet->
len, -1);
201 #if FF_API_DESTRUCT_PACKET
240 struct raw1394_portinfo pinf[16];
241 rom1394_directory rom_dir;
254 dv->
raw1394 = raw1394_new_handle();
261 if ((nb_ports = raw1394_get_port_info(dv->
raw1394, pinf, 16)) < 0) {
266 inport = strtol(context->
filename, &endptr, 10);
267 if (endptr != context->
filename && *endptr ==
'\0') {
270 nb_ports = inport + 1;
271 }
else if (strcmp(context->
filename,
"auto")) {
273 "\"auto\" for auto-detection, or the port number.\n", context->
filename);
278 if (sscanf(dv->
device_guid,
"%"SCNu64, &guid) != 1) {
285 for (; j < nb_ports && port==-1; ++j) {
286 raw1394_destroy_handle(dv->
raw1394);
288 if (!(dv->
raw1394 = raw1394_new_handle_on_port(j))) {
293 for (i=0; i<raw1394_get_nodecount(dv->
raw1394); ++i) {
298 if (guid == rom1394_get_guid(dv->
raw1394, i)) {
307 if (rom1394_get_directory(dv->
raw1394, i, &rom_dir) < 0)
309 if (((rom1394_get_node_type(&rom_dir) == ROM1394_NODE_TYPE_AVC) &&
310 avc1394_check_subunit_type(dv->
raw1394, i, AVC1394_SUBUNIT_TYPE_VCR)) ||
312 rom1394_free_directory(&rom_dir);
317 rom1394_free_directory(&rom_dir);
329 iec61883_cmp_normalize_output(dv->
raw1394, 0xffc0 | dv->
node);
334 response = avc1394_transaction(dv->
raw1394, dv->
node,
335 AVC1394_CTYPE_STATUS |
336 AVC1394_SUBUNIT_TYPE_TAPE_RECORDER |
337 AVC1394_SUBUNIT_ID_0 |
338 AVC1394_VCR_COMMAND_OUTPUT_SIGNAL_MODE |
340 response = AVC1394_GET_OPERAND0(response);
341 dv->
type = (response == 0x10 || response == 0x90 || response == 0x1A || response == 0x9A) ?
348 raw1394_get_local_id(dv->
raw1394),
388 dv->
raw1394_poll.events = POLLIN | POLLERR | POLLHUP | POLLPRI;
410 raw1394_destroy_handle(dv->
raw1394);
470 raw1394_get_local_id(dv->
raw1394),
473 raw1394_destroy_handle(dv->
raw1394);
479 {
"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" },
int bandwidth
returned by libiec61883
static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
int len
size of buffer allocated
static av_always_inline int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
ptrdiff_t const GLvoid * data
static int iec61883_parse_queue_hdv(struct iec61883_data *dv, AVPacket *pkt)
#define LIBAVUTIL_VERSION_INT
MpegTSContext * avpriv_mpegts_parse_open(AVFormatContext *s)
static const AVOption options[]
static int iec61883_read_packet(AVFormatContext *context, AVPacket *pkt)
int(* parse_queue)(struct iec61883_data *dv, AVPacket *pkt)
Parse function for DV/HDV differs, so this is set before packets arrive.
static const AVClass iec61883_class
DVPacket * queue_first
first element of packet queue
static av_always_inline int pthread_cond_destroy(pthread_cond_t *cond)
For DV, one packet corresponds exactly to one frame.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
int input_port
returned by libiec61883
struct DVPacket * next
next DVPacket
raw1394handle_t raw1394
handle for libraw1394
AVInputFormat ff_iec61883_demuxer
attribute_deprecated void(* destruct)(struct AVPacket *)
MpegTSContext * mpeg_demux
generic HDV muxing/demuxing context
struct pollfd raw1394_poll
to poll for new data from libraw1394
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
int packets
Number of packets queued.
int receive_error
Set in receive task in case of error.
iec61883_dv_fb_t iec61883_dv
handle for libiec61883 when used with DV
Main libavdevice API header.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void * iec61883_receive_task(void *opaque)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int iec61883_close(AVFormatContext *context)
static int iec61883_callback(unsigned char *data, int length, int complete, void *callback_data)
iec61883_mpeg2_t iec61883_mpeg2
handle for libiec61883 when used with HDV
char filename[1024]
input or output filename
char * device_guid
to select one of multiple DV devices
uint8_t * buf
actual buffer data
static av_always_inline int pthread_join(pthread_t thread, void **value_ptr)
static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
static pthread_mutex_t * mutex
static int iec61883_parse_queue_dv(struct iec61883_data *dv, AVPacket *pkt)
DVDemuxContext * dv_demux
generic DV muxing/demuxing context
static av_always_inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
attribute_deprecated void av_destruct_packet(AVPacket *pkt)
Default packet destructor.
#define AV_LOG_INFO
Standard information.
int node
returned by libiec61883
DVPacket * queue_last
last element of packet queue
Describe the class of an AVClass context structure.
int type
Stream type, to distinguish DV/HDV.
int receiving
True as soon data from device available.
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
int avpriv_mpegts_parse_packet(MpegTSContext *ts, AVPacket *pkt, const uint8_t *buf, int len)
static int iec61883_read_header(AVFormatContext *context)
int output_port
returned by libiec61883
#define FF_DISABLE_DEPRECATION_WARNINGS
static av_always_inline int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
int channel
returned by libiec61883
#define FF_ENABLE_DEPRECATION_WARNINGS
static av_always_inline int pthread_cond_broadcast(pthread_cond_t *cond)
static av_always_inline int pthread_mutex_unlock(pthread_mutex_t *mutex)
void * priv_data
Format private data.
static av_always_inline int pthread_mutex_lock(pthread_mutex_t *mutex)
int thread_loop
Condition for thread while-loop.
int max_packets
Max. number of packets in queue.
int eof
True as soon as no more data available.
void avpriv_mpegts_parse_close(MpegTSContext *ts)
This structure stores compressed data.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...