Go to the documentation of this file.
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>
38 #define THREADS HAVE_PTHREADS
44 #define MOTDCT_SPEC_ID 0x00005068
45 #define IEC61883_AUTO 0
47 #define IEC61883_HDV 2
101 int complete,
void *callback_data)
129 packet->
len = length;
131 memcpy(packet->
buf,
data, length);
163 if (!(errno == EAGAIN || errno == EINTR)) {
172 raw1394_loop_iterate(dv->
raw1394);
204 packet->
buf, packet->
len, -1);
225 #if CONFIG_MPEGTS_DEMUXER
248 struct raw1394_portinfo pinf[16];
249 rom1394_directory rom_dir;
262 dv->
raw1394 = raw1394_new_handle();
269 if ((nb_ports = raw1394_get_port_info(dv->
raw1394, pinf, 16)) < 0) {
274 inport = strtol(
context->url, &endptr, 10);
275 if (endptr !=
context->url && *endptr ==
'\0') {
278 nb_ports = inport + 1;
279 }
else if (strcmp(
context->url,
"auto")) {
281 "\"auto\" for auto-detection, or the port number.\n",
context->url);
286 if (sscanf(dv->
device_guid,
"%"SCNu64, &guid) != 1) {
293 for (; j < nb_ports && port==-1; ++j) {
294 raw1394_destroy_handle(dv->
raw1394);
296 if (!(dv->
raw1394 = raw1394_new_handle_on_port(j))) {
301 for (
i=0;
i<raw1394_get_nodecount(dv->
raw1394); ++
i) {
306 if (guid == rom1394_get_guid(dv->
raw1394,
i)) {
315 if (rom1394_get_directory(dv->
raw1394,
i, &rom_dir) < 0)
317 if (((rom1394_get_node_type(&rom_dir) == ROM1394_NODE_TYPE_AVC) &&
318 avc1394_check_subunit_type(dv->
raw1394,
i, AVC1394_SUBUNIT_TYPE_VCR)) ||
320 rom1394_free_directory(&rom_dir);
325 rom1394_free_directory(&rom_dir);
337 iec61883_cmp_normalize_output(dv->
raw1394, 0xffc0 | dv->
node);
342 response = avc1394_transaction(dv->
raw1394, dv->
node,
343 AVC1394_CTYPE_STATUS |
344 AVC1394_SUBUNIT_TYPE_TAPE_RECORDER |
345 AVC1394_SUBUNIT_ID_0 |
346 AVC1394_VCR_COMMAND_OUTPUT_SIGNAL_MODE |
348 response = AVC1394_GET_OPERAND0(response);
349 dv->
type = (response == 0x10 || response == 0x90 || response == 0x1A || response == 0x9A) ?
356 raw1394_get_local_id(dv->
raw1394),
396 dv->
raw1394_poll.events = POLLIN | POLLERR | POLLHUP | POLLPRI;
418 raw1394_destroy_handle(dv->
raw1394);
443 if (dv->receive_error)
444 return dv->receive_error;
479 raw1394_get_local_id(dv->
raw1394),
482 raw1394_destroy_handle(dv->
raw1394);
488 {
"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" },
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
static av_always_inline int pthread_join(pthread_t thread, void **value_ptr)
int len
size of buffer allocated
int eof
True as soon as no more data available.
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
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
DVPacket * queue_last
last element of packet queue
int receive_error
Set in receive task in case of error.
int avpriv_mpegts_parse_packet(MpegTSContext *ts, AVPacket *pkt, const uint8_t *buf, int len)
static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
For DV, one packet corresponds exactly to one frame.
const AVInputFormat ff_iec61883_demuxer
static int iec61883_parse_queue_dv(struct iec61883_data *dv, AVPacket *pkt)
DVDemuxContext * dv_demux
generic DV muxing/demuxing context
int input_port
returned by libiec61883
int max_packets
Max. number of packets in queue.
int channel
returned by libiec61883
static int iec61883_parse_queue_hdv(struct iec61883_data *dv, AVPacket *pkt)
int packets
Number of packets queued.
static int iec61883_callback(unsigned char *data, int length, int complete, void *callback_data)
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
void avpriv_mpegts_parse_close(MpegTSContext *ts)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
raw1394handle_t raw1394
handle for libraw1394
int thread_loop
Condition for thread while-loop.
static av_always_inline int pthread_cond_broadcast(pthread_cond_t *cond)
static av_always_inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
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
#define LIBAVUTIL_VERSION_INT
static int read_header(FFV1Context *f)
Describe the class of an AVClass context structure.
and forward the result(frame or status change) to the corresponding input. If nothing is possible
const char * av_default_item_name(void *ptr)
Return the context name.
struct DVPacket * next
next DVPacket
@ AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT
#define pthread_mutex_unlock(a)
int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size)
Initialize a reference-counted packet from av_malloc()ed data.
#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 void * iec61883_receive_task(void *opaque)
int receiving
True as soon data from device available.
static const AVOption options[]
static av_always_inline int pthread_cond_destroy(pthread_cond_t *cond)
iec61883_dv_fb_t iec61883_dv
handle for libiec61883 when used with DV
#define AV_LOG_INFO
Standard information.
int bandwidth
returned by libiec61883
static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
static int iec61883_read_packet(AVFormatContext *context, AVPacket *pkt)
#define i(width, name, range_min, range_max)
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
MpegTSContext * mpeg_demux
generic HDV muxing/demuxing context
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
iec61883_mpeg2_t iec61883_mpeg2
handle for libiec61883 when used with HDV
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
uint8_t * buf
actual buffer data
#define AV_INPUT_BUFFER_PADDING_SIZE
int type
Stream type, to distinguish DV/HDV.
DVPacket * queue_first
first element of packet queue
MpegTSContext * avpriv_mpegts_parse_open(AVFormatContext *s)
static av_always_inline int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
char * device_guid
to select one of multiple DV devices
int output_port
returned by libiec61883
This structure stores compressed data.
struct pollfd raw1394_poll
to poll for new data from libraw1394
static av_always_inline int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
int node
returned by libiec61883
static const AVClass iec61883_class
static int iec61883_read_header(AVFormatContext *context)
int(* cond)(enum AVPixelFormat pix_fmt)
int(* parse_queue)(struct iec61883_data *dv, AVPacket *pkt)
Parse function for DV/HDV differs, so this is set before packets arrive.
#define pthread_mutex_lock(a)