Go to the documentation of this file.
31 #define GXF_SAMPLES_PER_FRAME 32768
32 #define GXF_AUDIO_PACKET_SIZE 65536
34 #define GXF_TIMECODE(c, d, h, m, s, f) \
35 ((c) << 30 | (d) << 29 | (h) << 24 | (m) << 16 | (s) << 8 | (f))
118 #define SERVER_PATH "EXT:/PDR/default/"
119 #define ES_NAME_PATTERN "EXT:/PDR/default/ES."
126 for (
i = 0;
i < 6; ++
i) {
183 int size, starting_line;
207 "Pix 0\nCf %d\nCg %d\nSl %d\nnl16 %d\nVi 1\nf1 1\n",
220 int64_t track_aux_data = 0;
225 track_aux_data |= 0x01;
226 track_aux_data |= 0x40000000;
312 const char *filename = strrchr(
s->url,
'/');
322 len = strlen(filename);
366 for (
i = 0;
i <
s->nb_streams; ++
i)
411 int fields_per_flt = (gxf->
nb_fields+1) / 1000 + 1;
412 int flt_entries = gxf->
nb_fields / fields_per_flt;
421 for (
i = 0;
i < flt_entries;
i++)
434 int timecode_base = gxf->
time_base.
den == 60000 ? 60 : 50;
435 int64_t timestamp = 0;
437 uint32_t timecode_in;
438 uint32_t timecode_out;
447 gxf->
tc.
hh * (timecode_base * 3600) +
448 gxf->
tc.
mm * (timecode_base * 60) +
449 gxf->
tc.
ss * timecode_base +
453 nb_fields / (timecode_base * 3600) % 24,
454 nb_fields / (timecode_base * 60) % 60,
455 nb_fields / timecode_base % 60,
456 nb_fields % timecode_base);
504 for (
i = 0;
i <
s->nb_streams; ++
i) {
576 for (
unsigned i = 0;
i <=
s->nb_streams; ++
i) {
578 int64_t startpos, curpos;
580 if (
i ==
s->nb_streams)
583 sc =
s->streams[
i]->priv_data;
668 if (sscanf(tcstr,
"%d:%d:%d%c%d", &
tc->hh, &
tc->mm, &
tc->ss, &
c, &
tc->ff) != 5) {
670 "syntax: hh:mm:ss[:;.]ff\n");
688 uint8_t tracks[255] = {0};
689 int i, media_info = 0;
698 gxf->
flags |= 0x00080000;
699 for (
i = 0;
i <
s->nb_streams; ++
i) {
731 gxf->
flags |= 0x04000000;
742 gxf->
flags |= 0x00000080;
748 gxf->
flags |= 0x00000040;
752 "gxf muxer only accepts PAL or NTSC resolutions currently\n");
768 gxf->
flags |= 0x00004000;
780 gxf->
flags |= 0x00008000;
787 gxf->
flags |= 0x00002000;
791 gxf->
flags |= 0x00001000;
801 sc->
media_info = media_info<<8 | (
'0'+tracks[media_info]++);
809 gxf->
flags |= 0x200000;
869 for(
i=0;
i<
size-4 &&
c!=0x100;
i++){
874 return (buf[
i+1]>>3)&7;
931 unsigned packet_start_offset =
avio_tell(pb) / 1024;
979 for (
i = 0;
i < 2;
i++) {
990 return field_nb[1] > field_nb[0] ||
991 (field_nb[1] == field_nb[0] && sc[1]->
order > sc[0]->
order);
995 int flush,
int has_packet)
1015 .extensions =
"gxf",
static int gxf_write_dv_auxiliary(AVIOContext *pb, AVStream *st)
static int gxf_write_timecode_auxiliary(AVIOContext *pb, GXFContext *gxf)
static int gxf_write_mpeg_auxiliary(AVIOContext *pb, AVStream *st)
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.
static int gxf_write_umf_media_dv(AVIOContext *pb, GXFStreamContext *sc, AVStream *st)
static void deinit(AVFormatContext *s)
uint64_t * map_offsets
offset of map packets
int ff_parse_creation_time_metadata(AVFormatContext *s, int64_t *timestamp, int return_seconds)
Parse creation_time in AVFormatContext metadata if exists and warn if the parsing fails.
void avio_wl64(AVIOContext *s, uint64_t val)
static int gxf_write_umf_media_mpeg(AVIOContext *pb, AVStream *st)
int nb_channels
Number of channels in this layout.
static int gxf_write_umf_packet(AVFormatContext *s)
static const AVCodecTag gxf_media_types[]
int64_t avio_size(AVIOContext *s)
Get the filesize.
static int gxf_write_header(AVFormatContext *s)
void avio_wl16(AVIOContext *s, unsigned int val)
static const struct @263 gxf_lines_tab[]
int b_per_i_or_p
number of B-frames per I-frame or P-frame
static int gxf_parse_mpeg_frame(GXFStreamContext *sc, const uint8_t *buf, int size)
const AVOutputFormat ff_gxf_muxer
static int64_t updatePacketSize(AVIOContext *pb, int64_t pos)
static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt)
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
static int gxf_find_lines_index(AVStream *st)
@ AV_ROUND_UP
Round toward +infinity.
static void gxf_init_timecode_track(GXFStreamContext *sc, GXFStreamContext *vsc)
int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *pkt, int flush, int has_packet)
Interleave an AVPacket per dts so it can be muxed.
static int gxf_write_map_packet(AVFormatContext *s, int rewrite)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
static int gxf_write_umf_media_audio(AVIOContext *pb, GXFStreamContext *sc)
uint32_t umf_track_offset
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static void gxf_write_padding(AVIOContext *pb, int64_t to_pad)
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static int64_t updateSize(AVIOContext *pb, int64_t pos)
the definition of that something depends on the semantic of the filter The callback must examine the status of the filter s links and proceed accordingly The status of output links is stored in the status_in and status_out fields and tested by the then the processing requires a frame on this link and the filter is expected to make efforts in that direction The status of input links is stored by the fifo and status_out fields
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Describe the class of an AVClass context structure.
static void flush(AVCodecContext *avctx)
static int write_trailer(AVFormatContext *s1)
int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, int(*compare)(AVFormatContext *, const AVPacket *, const AVPacket *))
Add packet to an AVFormatContext's packet_buffer list, determining its interleaved position using com...
Rational number (pair of numerator and denominator).
@ AV_PICTURE_TYPE_I
Intra.
void avio_w8(AVIOContext *s, int b)
void ffio_fill(AVIOContext *s, int b, int64_t count)
AVChannelLayout ch_layout
Audio only.
static int gxf_write_umf_material_description(AVFormatContext *s)
#define GXF_TIMECODE(c, d, h, m, s, f)
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
int sample_rate
Audio only.
static int gxf_write_material_data_section(AVFormatContext *s)
static int gxf_write_umf_media_timecode(AVIOContext *pb, int drop)
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd)
Rescale a 64-bit integer with specified rounding.
static int gxf_interleave_packet(AVFormatContext *s, AVPacket *pkt, int flush, int has_packet)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int gxf_write_trailer(AVFormatContext *s)
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
static int gxf_write_track_description_section(AVFormatContext *s)
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
#define GXF_AUDIO_PACKET_SIZE
void avio_wb32(AVIOContext *s, unsigned int val)
int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate an array through a pointer to a pointer.
void avio_wl32(AVIOContext *s, unsigned int val)
static int gxf_init_timecode(AVFormatContext *s, GXFTimecode *tc, const char *tcstr, int fields)
uint32_t umf_media_offset
#define GXF_SAMPLES_PER_FRAME
static int gxf_write_media_preamble(AVFormatContext *s, AVPacket *pkt, int size)
GXFStreamContext timecode_track
static av_always_inline uint64_t av_double2int(double f)
Reinterpret a double as a 64-bit integer.
uint32_t umf_start_offset
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
static int gxf_write_umf_payload(AVFormatContext *s)
static int gxf_write_eos_packet(AVIOContext *pb)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
unsigned order
interleaving order
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
static void gxf_deinit(AVFormatContext *s)
static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc, int index)
int index
stream index in AVFormatContext
int ff_stream_add_bitstream_filter(AVStream *st, const char *name, const char *args)
Add a bitstream filter to a stream.
static int gxf_write_umf_media_description(AVFormatContext *s)
unsigned * flt_entries
offsets of packets /1024, starts after 2nd video field
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
static int gxf_write_flt_packet(AVFormatContext *s)
static void gxf_write_packet_header(AVIOContext *pb, GXFPktType type)
static int gxf_write_umf_track_description(AVFormatContext *s)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
void avio_wb24(AVIOContext *s, unsigned int val)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
void avio_wb16(AVIOContext *s, unsigned int val)
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
static int gxf_compare_field_nb(AVFormatContext *s, const AVPacket *next, const AVPacket *cur)
static int write_packet(AVFormatContext *s1, AVPacket *pkt)
static void write_header(FFV1Context *f)
@ AV_CODEC_ID_MPEG2VIDEO
preferred ID for MPEG-1/2 video decoding