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)))
189 return s->nb_streams - 1;
236 if (fps < 1 || fps > 9) fps = 9;
246 static const AVRational map[] = {{50, 1}, {60000, 1001}, {24, 1},
247 {25, 1}, {30000, 1001}};
287 uint32_t fields_per_map, map_cnt;
299 if (map_cnt > 1000) {
301 "too many index entries %"PRIu32
" (%"PRIx32
")\n",
305 if (pkt_len < 4 * map_cnt) {
310 pkt_len -= 4 * map_cnt;
312 for (
i = 0;
i < map_cnt;
i++)
314 i * (uint64_t)fields_per_map + 1, 0, 0, 0);
352 int track_type, track_id, track_len;
360 if (!(track_type & 0x80)) {
365 if ((track_id & 0xc0) != 0xc0) {
372 if (track_type == 7 || track_type == 8 || track_type == 24) {
381 if (idx < 0)
continue;
382 st =
s->streams[idx];
383 if (!main_timebase.
num || !main_timebase.
den) {
413 if (!main_timebase.
num || !main_timebase.
den) {
415 " This might give wrong results.\n");
417 main_timebase.
num = fps.
den;
418 main_timebase.
den = fps.
num * 2;
436 if (!main_timebase.
num || !main_timebase.
den)
438 for (
i = 0;
i <
s->nb_streams;
i++) {
447 if (!max_interval-- || avio_feof(pb)) \
449 tmp = tmp << 8 | avio_r8(pb); \
462 uint64_t last_found_pos = 0;
479 if (
avio_seek(pb, last_pos, SEEK_SET) < 0)
487 if ((track >= 0 && track != cur_track) || (timestamp >= 0 && timestamp > cur_timestamp)) {
488 if (
avio_seek(pb, last_pos, SEEK_SET) >= 0)
494 return cur_timestamp;
505 int track_type, track_id,
ret;
506 int field_nr, field_info,
skip = 0;
528 stream_index =
get_sindex(
s, track_id, track_type);
529 if (stream_index < 0)
531 st =
s->streams[stream_index];
539 int first = field_info >> 16;
540 int last = field_info & 0xffff;
542 if (
first <= last && last*
bps <= pkt_len) {
567 uint64_t maxlen = 100 * 1024 * 1024;
570 int64_t
start_time =
s->streams[stream_index]->start_time;
579 if (idx < sti->nb_index_entries - 2)
581 maxlen =
FFMAX(maxlen, 200 * 1024);
586 if (
FFABS(found - timestamp) > 4)
592 int64_t *
pos, int64_t pos_limit) {
#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
enum AVMediaType codec_type
General type of the encoded data.
#define AV_CHANNEL_LAYOUT_STEREO
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
static const AVRational frame_rate_tab[]
#define AVERROR_EOF
End of file.
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.
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
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.
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 ...
enum AVStreamParseType need_parsing
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
AVChannelLayout ch_layout
Audio only.
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)
unsigned int avio_rl32(AVIOContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
An AVChannelLayout holds information about the channel layout of audio data.
static int64_t start_time
#define AV_NOPTS_VALUE
Undefined timestamp value.
@ AVMEDIA_TYPE_UNKNOWN
Usually treated as AVMEDIA_TYPE_DATA.
int ff_find_stream_index(const AVFormatContext *s, int id)
Find stream index based on format-specific stream ID.
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.
#define i(width, name, range_min, range_max)
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.
unsigned int avio_rb16(AVIOContext *s)
const AVInputFormat ff_gxf_demuxer
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
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
static int read_probe(const AVProbeData *p)
int bits_per_coded_sample
The number of bits per sample in the codedwords.
const VDPAUPixFmtMap * map
#define AV_CHANNEL_LAYOUT_MONO
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)
#define flags(name, subs,...)
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 void BS_FUNC() skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.
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.