Go to the documentation of this file.
45 int field = timecode & 0xff;
47 int second = (timecode >> 8) & 0xff;
48 int minute = (timecode >> 16) & 0xff;
49 int hour = (timecode >> 24) & 0x1f;
50 int drop = (timecode >> 29) & 1;
56 hour, minute, second, drop ?
';' :
':',
frame);
74 if ((*length >> 24) || *length < 16)
90 static const uint8_t startcode[] = {0, 0, 0, 0, 1, 0xbc};
91 static const uint8_t endcode[] = {0, 0, 0, 0, 0xe1, 0xe2};
92 if (!memcmp(p->
buf, startcode,
sizeof(startcode)) &&
93 !memcmp(&p->
buf[16 -
sizeof(endcode)], endcode,
sizeof(endcode)))
190 return s->nb_streams - 1;
237 if (fps < 1 || fps > 9) fps = 9;
247 static const AVRational map[] = {{50, 1}, {60000, 1001}, {24, 1},
248 {25, 1}, {30000, 1001}};
288 uint32_t fields_per_map, map_cnt;
300 if (map_cnt > 1000) {
302 "too many index entries %"PRIu32
" (%"PRIx32
")\n",
306 if (pkt_len < 4 * map_cnt) {
311 pkt_len -= 4 * map_cnt;
313 for (
i = 0;
i < map_cnt;
i++)
315 i * (uint64_t)fields_per_map + 1, 0, 0, 0);
353 int track_type, track_id, track_len;
361 if (!(track_type & 0x80)) {
366 if ((track_id & 0xc0) != 0xc0) {
373 if (track_type == 7 || track_type == 8 || track_type == 24) {
382 if (idx < 0)
continue;
383 st =
s->streams[idx];
384 if (!main_timebase.
num || !main_timebase.
den) {
414 if (!main_timebase.
num || !main_timebase.
den) {
416 " This might give wrong results.\n");
418 main_timebase.
num = fps.
den;
419 main_timebase.
den = fps.
num * 2;
437 if (!main_timebase.
num || !main_timebase.
den)
439 for (
i = 0;
i <
s->nb_streams;
i++) {
448 if (!max_interval-- || avio_feof(pb)) \
450 tmp = tmp << 8 | avio_r8(pb); \
463 uint64_t last_found_pos = 0;
480 if (
avio_seek(pb, last_pos, SEEK_SET) < 0)
488 if ((track >= 0 && track != cur_track) || (timestamp >= 0 && timestamp > cur_timestamp)) {
489 if (
avio_seek(pb, last_pos, SEEK_SET) >= 0)
495 return cur_timestamp;
506 int track_type, track_id,
ret;
507 int field_nr, field_info, skip = 0;
529 stream_index =
get_sindex(
s, track_id, track_type);
530 if (stream_index < 0)
532 st =
s->streams[stream_index];
540 int first = field_info >> 16;
541 int last = field_info & 0xffff;
543 if (
first <= last && last*
bps <= pkt_len) {
545 skip = pkt_len - last*
bps;
568 uint64_t maxlen = 100 * 1024 * 1024;
570 int64_t
start_time =
s->streams[stream_index]->start_time;
579 if (idx < st->nb_index_entries - 2)
581 maxlen =
FFMAX(maxlen, 200 * 1024);
586 if (
FFABS(found - timestamp) > 4)
592 int64_t *
pos, int64_t pos_limit) {
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
#define AV_LOG_WARNING
Something somehow does not look correct.
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.
enum AVMediaType codec_type
General type of the encoded data.
static const AVRational frame_rate_tab[]
#define AVERROR_EOF
End of file.
#define AV_CH_LAYOUT_MONO
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
static AVRational fps_umf2avr(uint32_t flags)
convert UMF attributes flags to AVRational fps
static int gxf_probe(const AVProbeData *p)
check if file starts with a PKT_MAP header
int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags)
Add an index entry into a sorted list.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
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
int64_t duration
Decoding: duration of the stream, in stream time base.
#define AV_CH_LAYOUT_STEREO
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But first
unsigned int avio_rb32(AVIOContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int parse_packet_header(AVIOContext *pb, GXFPktType *type, int *length)
parses a packet header, extracting type and length
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 format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
enum AVStreamParseType need_parsing
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 field
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
AVCodecParameters * codecpar
Codec parameters associated with this stream.
static int gxf_packet(AVFormatContext *s, AVPacket *pkt)
Rational number (pair of numerator and denominator).
This structure contains the data a format has to probe a file.
static AVRational fps_tag2avr(int32_t fps)
convert fps tag value to AVRational fps
static void gxf_track_tags(AVIOContext *pb, int *len, struct gxf_stream_info *si)
filters out interesting tags from track information.
int sample_rate
Audio only.
static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
unsigned int avio_rl32(AVIOContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int64_t start_time
#define AV_NOPTS_VALUE
Undefined timestamp value.
@ AVMEDIA_TYPE_UNKNOWN
Usually treated as AVMEDIA_TYPE_DATA.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
int avio_r8(AVIOContext *s)
#define AV_LOG_INFO
Standard information.
static void gxf_material_tags(AVIOContext *pb, int *len, struct gxf_stream_info *si)
filters out interesting tags from material information.
int block_align
Audio only.
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 value
static int64_t gxf_read_timestamp(AVFormatContext *s, int stream_index, int64_t *pos, int64_t pos_limit)
static void gxf_read_index(AVFormatContext *s, int pkt_len)
read index from FLT packet into stream 0 av_index
static int gxf_header(AVFormatContext *s)
static int get_sindex(AVFormatContext *s, int id, int format)
gets the stream index for the track with the specified id, creates new stream if not found
static int add_timecode_metadata(AVDictionary **pm, const char *key, uint32_t timecode, int fields_per_frame)
parse gxf timecode and add it to metadata
int id
Format-specific stream ID.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
unsigned int avio_rb16(AVIOContext *s)
int eof_reached
true if was unable to read due to error or eof
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
AVRational frames_per_second
int bits_per_coded_sample
The number of bits per sample in the codedwords.
const VDPAUPixFmtMap * map
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
uint64_t avio_rl64(AVIOContext *s)
uint64_t channel_layout
Audio only.
#define flags(name, subs,...)
AVInputFormat ff_gxf_demuxer
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
@ AV_CODEC_ID_MPEG2VIDEO
preferred ID for MPEG-1/2 video decoding
static int64_t gxf_resync_media(AVFormatContext *s, uint64_t max_interval, int track, int timestamp)
resync the stream on the next media packet with specified properties
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.