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>
40 #define THREADS HAVE_PTHREADS
46 #define MOTDCT_SPEC_ID 0x00005068
47 #define IEC61883_AUTO 0
49 #define IEC61883_HDV 2
103 int complete,
void *callback_data)
131 packet->
len = length;
133 memcpy(packet->
buf,
data, length);
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" },
508 .
p.
name =
"iec61883",
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
static av_always_inline int pthread_join(pthread_t thread, void **value_ptr)
const FFInputFormat ff_iec61883_demuxer
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
DVPacket * queue_last
last element of packet queue
int receive_error
Set in receive task in case of error.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
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.
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)
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.
@ AV_OPT_TYPE_INT
Underlying C type is int.
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)
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
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)
@ 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...
int node
returned by libiec61883
static const AVClass iec61883_class
static int iec61883_read_header(AVFormatContext *context)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
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)