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 86 struct pollfd raw1394_poll;
99 int complete,
void *callback_data)
129 memcpy(packet->
buf, data, length);
160 while ((result = poll(&dv->
raw1394_poll, 1, 200)) < 0) {
161 if (!(errno == EAGAIN || errno == EINTR)) {
170 raw1394_loop_iterate(dv->
raw1394);
202 packet->
buf, packet->
len, -1);
245 struct raw1394_portinfo pinf[16];
246 rom1394_directory rom_dir;
259 dv->
raw1394 = raw1394_new_handle();
266 if ((nb_ports = raw1394_get_port_info(dv->
raw1394, pinf, 16)) < 0) {
271 inport = strtol(context->
url, &endptr, 10);
272 if (endptr != context->
url && *endptr ==
'\0') {
275 nb_ports = inport + 1;
276 }
else if (strcmp(context->
url,
"auto")) {
278 "\"auto\" for auto-detection, or the port number.\n", context->
url);
283 if (sscanf(dv->
device_guid,
"%"SCNu64, &guid) != 1) {
290 for (; j < nb_ports && port==-1; ++j) {
291 raw1394_destroy_handle(dv->
raw1394);
293 if (!(dv->
raw1394 = raw1394_new_handle_on_port(j))) {
298 for (i=0; i<raw1394_get_nodecount(dv->
raw1394); ++
i) {
303 if (guid == rom1394_get_guid(dv->
raw1394, i)) {
312 if (rom1394_get_directory(dv->
raw1394, i, &rom_dir) < 0)
314 if (((rom1394_get_node_type(&rom_dir) == ROM1394_NODE_TYPE_AVC) &&
315 avc1394_check_subunit_type(dv->
raw1394, i, AVC1394_SUBUNIT_TYPE_VCR)) ||
317 rom1394_free_directory(&rom_dir);
322 rom1394_free_directory(&rom_dir);
334 iec61883_cmp_normalize_output(dv->
raw1394, 0xffc0 | dv->
node);
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 |
345 response = AVC1394_GET_OPERAND0(response);
346 dv->
type = (response == 0x10 || response == 0x90 || response == 0x1A || response == 0x9A) ?
353 raw1394_get_local_id(dv->
raw1394),
393 dv->
raw1394_poll.events = POLLIN | POLLERR | POLLHUP | POLLPRI;
415 raw1394_destroy_handle(dv->
raw1394);
476 raw1394_get_local_id(dv->
raw1394),
479 raw1394_destroy_handle(dv->
raw1394);
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" },
int bandwidth
returned by libiec61883
static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
int len
size of buffer allocated
#define pthread_mutex_lock(a)
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[]
const char * av_default_item_name(void *ptr)
Return the context name.
static int iec61883_read_packet(AVFormatContext *context, AVPacket *pkt)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
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
MpegTSContext * mpeg_demux
generic HDV muxing/demuxing context
int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size)
Initialize a reference-counted packet from av_malloc()ed data.
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.
int(* parse_queue)(struct iec61883_data *dv, AVPacket *pkt)
Parse function for DV/HDV differs, so this is set before packets arrive.
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. ...
char * url
input or output URL.
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 * 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)
#define pthread_mutex_unlock(a)
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)
#define AV_LOG_INFO
Standard information.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
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
int(* cond)(enum AVPixelFormat pix_fmt)
static av_always_inline int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
int channel
returned by libiec61883
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
static av_always_inline int pthread_cond_broadcast(pthread_cond_t *cond)
void * priv_data
Format private data.
and forward the result(frame or status change) to the corresponding input.If nothing is possible
int thread_loop
Condition for thread while-loop.
int max_packets
Max. number of packets in queue.
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
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 local context
int eof
True as soon as no more data available.
void avpriv_mpegts_parse_close(MpegTSContext *ts)
This structure stores compressed data.