FFmpeg
Data Structures | Macros | Functions | Variables
gxf.c File Reference
#include <inttypes.h>
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "avformat.h"
#include "demux.h"
#include "internal.h"
#include "gxf.h"

Go to the source code of this file.

Data Structures

struct  gxf_stream_info
 

Macros

#define READ_ONE()
 

Functions

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 More...
 
static int parse_packet_header (AVIOContext *pb, GXFPktType *type, int *length)
 parses a packet header, extracting type and length More...
 
static int gxf_probe (const AVProbeData *p)
 check if file starts with a PKT_MAP header More...
 
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 More...
 
static void gxf_material_tags (AVIOContext *pb, int *len, struct gxf_stream_info *si)
 filters out interesting tags from material information. More...
 
static AVRational fps_tag2avr (int32_t fps)
 convert fps tag value to AVRational fps More...
 
static AVRational fps_umf2avr (uint32_t flags)
 convert UMF attributes flags to AVRational fps More...
 
static void gxf_track_tags (AVIOContext *pb, int *len, struct gxf_stream_info *si)
 filters out interesting tags from track information. More...
 
static void gxf_read_index (AVFormatContext *s, int pkt_len)
 read index from FLT packet into stream 0 av_index More...
 
static int gxf_header (AVFormatContext *s)
 
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 More...
 
static int gxf_packet (AVFormatContext *s, AVPacket *pkt)
 
static int gxf_seek (AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
 
static int64_t gxf_read_timestamp (AVFormatContext *s, int stream_index, int64_t *pos, int64_t pos_limit)
 

Variables

static const AVRational frame_rate_tab []
 
const AVInputFormat ff_gxf_demuxer
 

Macro Definition Documentation

◆ READ_ONE

#define READ_ONE ( )
Value:
{ \
if (!max_interval-- || avio_feof(pb)) \
goto out; \
tmp = tmp << 8 | avio_r8(pb); \
}

Definition at line 445 of file gxf.c.

Function Documentation

◆ add_timecode_metadata()

static int add_timecode_metadata ( AVDictionary **  pm,
const char *  key,
uint32_t  timecode,
int  fields_per_frame 
)
static

parse gxf timecode and add it to metadata

Definition at line 42 of file gxf.c.

Referenced by gxf_header().

◆ parse_packet_header()

static int parse_packet_header ( AVIOContext pb,
GXFPktType type,
int length 
)
static

parses a packet header, extracting type and length

Parameters
pbAVIOContext to read header from
typedetected packet type is stored here
lengthdetected packet length, excluding header is stored here
Returns
0 if header not found or contains invalid data, 1 otherwise

Definition at line 67 of file gxf.c.

Referenced by gxf_header(), gxf_packet(), and gxf_resync_media().

◆ gxf_probe()

static int gxf_probe ( const AVProbeData p)
static

check if file starts with a PKT_MAP header

Definition at line 89 of file gxf.c.

◆ get_sindex()

static int get_sindex ( AVFormatContext s,
int  id,
int  format 
)
static

gets the stream index for the track with the specified id, creates new stream if not found

Parameters
idid of stream to find / add
formatstream format identifier

Definition at line 104 of file gxf.c.

Referenced by gxf_header(), and gxf_packet().

◆ gxf_material_tags()

static void gxf_material_tags ( AVIOContext pb,
int len,
struct gxf_stream_info si 
)
static

filters out interesting tags from material information.

Parameters
lenlength of tag section, will be adjusted to contain remaining bytes
sistruct to store collected information into

Definition at line 197 of file gxf.c.

Referenced by gxf_header().

◆ fps_tag2avr()

static AVRational fps_tag2avr ( int32_t  fps)
static

convert fps tag value to AVRational fps

Parameters
fpsfps value from tag
Returns
fps as AVRational, or 0 / 0 if unknown

Definition at line 235 of file gxf.c.

Referenced by gxf_track_tags().

◆ fps_umf2avr()

static AVRational fps_umf2avr ( uint32_t  flags)
static

convert UMF attributes flags to AVRational fps

Parameters
flagsUMF flags to convert
Returns
fps as AVRational, or 0 / 0 if unknown

Definition at line 245 of file gxf.c.

Referenced by gxf_header().

◆ gxf_track_tags()

static void gxf_track_tags ( AVIOContext pb,
int len,
struct gxf_stream_info si 
)
static

filters out interesting tags from track information.

Parameters
lenlength of tag section, will be adjusted to contain remaining bytes
sistruct to store collected information into

Definition at line 257 of file gxf.c.

Referenced by gxf_header().

◆ gxf_read_index()

static void gxf_read_index ( AVFormatContext s,
int  pkt_len 
)
static

read index from FLT packet into stream 0 av_index

Definition at line 284 of file gxf.c.

Referenced by gxf_header(), and gxf_packet().

◆ gxf_header()

static int gxf_header ( AVFormatContext s)
static

Definition at line 318 of file gxf.c.

◆ gxf_resync_media()

static int64_t gxf_resync_media ( AVFormatContext s,
uint64_t  max_interval,
int  track,
int  timestamp 
)
static

resync the stream on the next media packet with specified properties

Parameters
max_intervalhow many bytes to search for matching packet at most
tracktrack id the media packet must belong to, -1 for any
timestampminimum timestamp (== field number) the packet must have, -1 for any
Returns
timestamp of packet found

Definition at line 459 of file gxf.c.

Referenced by gxf_read_timestamp(), and gxf_seek().

◆ gxf_packet()

static int gxf_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 497 of file gxf.c.

◆ gxf_seek()

static int gxf_seek ( AVFormatContext s,
int  stream_index,
int64_t  timestamp,
int  flags 
)
static

Definition at line 564 of file gxf.c.

◆ gxf_read_timestamp()

static int64_t gxf_read_timestamp ( AVFormatContext s,
int  stream_index,
int64_t *  pos,
int64_t  pos_limit 
)
static

Definition at line 591 of file gxf.c.

Variable Documentation

◆ frame_rate_tab

const AVRational frame_rate_tab[]
static
Initial value:
= {
{ 60, 1},
{60000, 1001},
{ 50, 1},
{ 30, 1},
{30000, 1001},
{ 25, 1},
{ 24, 1},
{24000, 1001},
{ 0, 0},
}

Definition at line 218 of file gxf.c.

Referenced by fps_tag2avr().

◆ ff_gxf_demuxer

const AVInputFormat ff_gxf_demuxer
Initial value:
= {
.name = "gxf",
.long_name = NULL_IF_CONFIG_SMALL("GXF (General eXchange Format)"),
.priv_data_size = sizeof(struct gxf_stream_info),
.read_header = gxf_header,
.read_packet = gxf_packet,
.read_seek = gxf_seek,
.read_timestamp = gxf_read_timestamp,
}

Definition at line 602 of file gxf.c.

out
FILE * out
Definition: movenc.c:54
tmp
static uint8_t tmp[11]
Definition: aes_ctr.c:28
gxf_probe
static int gxf_probe(const AVProbeData *p)
check if file starts with a PKT_MAP header
Definition: gxf.c:89
gxf_stream_info
Definition: gxf.c:31
gxf_packet
static int gxf_packet(AVFormatContext *s, AVPacket *pkt)
Definition: gxf.c:497
read_probe
static int read_probe(const AVProbeData *pd)
Definition: jvdec.c:55
gxf_seek
static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Definition: gxf.c:564
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
avio_r8
int avio_r8(AVIOContext *s)
Definition: aviobuf.c:632
gxf_read_timestamp
static int64_t gxf_read_timestamp(AVFormatContext *s, int stream_index, int64_t *pos, int64_t pos_limit)
Definition: gxf.c:591
gxf_header
static int gxf_header(AVFormatContext *s)
Definition: gxf.c:318
avio_feof
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
Definition: aviobuf.c:375