FFmpeg
Data Structures | Macros | Functions | Variables
gxfenc.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/intfloat.h"
#include "libavutil/mathematics.h"
#include "libavutil/mem.h"
#include "avformat.h"
#include "avio_internal.h"
#include "internal.h"
#include "gxf.h"
#include "mux.h"

Go to the source code of this file.

Data Structures

struct  GXFTimecode
 
struct  GXFStreamContext
 
struct  GXFContext
 

Macros

#define GXF_SAMPLES_PER_FRAME   32768
 
#define GXF_AUDIO_PACKET_SIZE   65536
 
#define GXF_TIMECODE(c, d, h, m, s, f)   ((c) << 30 | (d) << 29 | (h) << 24 | (m) << 16 | (s) << 8 | (f))
 
#define SERVER_PATH   "EXT:/PDR/default/"
 
#define ES_NAME_PATTERN   "EXT:/PDR/default/ES."
 

Functions

static int gxf_find_lines_index (AVStream *st)
 
static void gxf_write_padding (AVIOContext *pb, int64_t to_pad)
 
static int64_t update_packet_size (AVIOContext *pb, int64_t pos)
 
static int64_t update_size (AVIOContext *pb, int64_t pos)
 
static void gxf_write_packet_header (AVIOContext *pb, GXFPktType type)
 
static int gxf_write_mpeg_auxiliary (AVIOContext *pb, AVStream *st)
 
static int gxf_write_dv_auxiliary (AVIOContext *pb, AVStream *st)
 
static int gxf_write_timecode_auxiliary (AVIOContext *pb, GXFContext *gxf)
 
static int gxf_write_track_description (AVFormatContext *s, GXFStreamContext *sc, int index)
 
static int gxf_write_material_data_section (AVFormatContext *s)
 
static int gxf_write_track_description_section (AVFormatContext *s)
 
static int gxf_write_map_packet (AVFormatContext *s, int rewrite)
 
static int gxf_write_flt_packet (AVFormatContext *s)
 
static int gxf_write_umf_material_description (AVFormatContext *s)
 
static int gxf_write_umf_payload (AVFormatContext *s)
 
static int gxf_write_umf_track_description (AVFormatContext *s)
 
static int gxf_write_umf_media_mpeg (AVIOContext *pb, AVStream *st)
 
static int gxf_write_umf_media_timecode (AVIOContext *pb, int drop)
 
static int gxf_write_umf_media_dv (AVIOContext *pb, GXFStreamContext *sc, AVStream *st)
 
static int gxf_write_umf_media_audio (AVIOContext *pb, GXFStreamContext *sc)
 
static int gxf_write_umf_media_description (AVFormatContext *s)
 
static int gxf_write_umf_packet (AVFormatContext *s)
 
static void gxf_init_timecode_track (GXFStreamContext *sc, GXFStreamContext *vsc)
 
static int gxf_init_timecode (AVFormatContext *s, GXFTimecode *tc, const char *tcstr, int fields)
 
static int gxf_write_header (AVFormatContext *s)
 
static int gxf_write_eos_packet (AVIOContext *pb)
 
static int gxf_write_trailer (AVFormatContext *s)
 
static void gxf_deinit (AVFormatContext *s)
 
static int gxf_parse_mpeg_frame (GXFStreamContext *sc, const uint8_t *buf, int size)
 
static int gxf_write_media_preamble (AVFormatContext *s, AVPacket *pkt, int size)
 
static int gxf_write_packet (AVFormatContext *s, AVPacket *pkt)
 
static int gxf_compare_field_nb (AVFormatContext *s, const AVPacket *next, const AVPacket *cur)
 
static int gxf_interleave_packet (AVFormatContext *s, AVPacket *pkt, int flush, int has_packet)
 

Variables

struct {
   int   height
 
   int   index
 
gxf_lines_tab []
 
static const AVCodecTag gxf_media_types []
 
const FFOutputFormat ff_gxf_muxer
 

Macro Definition Documentation

◆ GXF_SAMPLES_PER_FRAME

#define GXF_SAMPLES_PER_FRAME   32768

Definition at line 32 of file gxfenc.c.

◆ GXF_AUDIO_PACKET_SIZE

#define GXF_AUDIO_PACKET_SIZE   65536

Definition at line 33 of file gxfenc.c.

◆ GXF_TIMECODE

#define GXF_TIMECODE (   c,
  d,
  h,
  m,
  s,
  f 
)    ((c) << 30 | (d) << 29 | (h) << 24 | (m) << 16 | (s) << 8 | (f))

Definition at line 35 of file gxfenc.c.

◆ SERVER_PATH

#define SERVER_PATH   "EXT:/PDR/default/"

Definition at line 119 of file gxfenc.c.

◆ ES_NAME_PATTERN

#define ES_NAME_PATTERN   "EXT:/PDR/default/ES."

Definition at line 120 of file gxfenc.c.

Function Documentation

◆ gxf_find_lines_index()

static int gxf_find_lines_index ( AVStream st)
static

Definition at line 122 of file gxfenc.c.

Referenced by gxf_write_header().

◆ gxf_write_padding()

static void gxf_write_padding ( AVIOContext pb,
int64_t  to_pad 
)
static

Definition at line 136 of file gxfenc.c.

Referenced by gxf_write_packet(), and update_packet_size().

◆ update_packet_size()

static int64_t update_packet_size ( AVIOContext pb,
int64_t  pos 
)
static

◆ update_size()

static int64_t update_size ( AVIOContext pb,
int64_t  pos 
)
static

◆ gxf_write_packet_header()

static void gxf_write_packet_header ( AVIOContext pb,
GXFPktType  type 
)
static

◆ gxf_write_mpeg_auxiliary()

static int gxf_write_mpeg_auxiliary ( AVIOContext pb,
AVStream st 
)
static

Definition at line 180 of file gxfenc.c.

Referenced by gxf_write_track_description().

◆ gxf_write_dv_auxiliary()

static int gxf_write_dv_auxiliary ( AVIOContext pb,
AVStream st 
)
static

Definition at line 219 of file gxfenc.c.

Referenced by gxf_write_track_description().

◆ gxf_write_timecode_auxiliary()

static int gxf_write_timecode_auxiliary ( AVIOContext pb,
GXFContext gxf 
)
static

Definition at line 232 of file gxfenc.c.

Referenced by gxf_write_track_description().

◆ gxf_write_track_description()

static int gxf_write_track_description ( AVFormatContext s,
GXFStreamContext sc,
int  index 
)
static

Definition at line 246 of file gxfenc.c.

Referenced by gxf_write_track_description_section().

◆ gxf_write_material_data_section()

static int gxf_write_material_data_section ( AVFormatContext s)
static

Definition at line 307 of file gxfenc.c.

Referenced by gxf_write_map_packet().

◆ gxf_write_track_description_section()

static int gxf_write_track_description_section ( AVFormatContext s)
static

Definition at line 358 of file gxfenc.c.

Referenced by gxf_write_map_packet().

◆ gxf_write_map_packet()

static int gxf_write_map_packet ( AVFormatContext s,
int  rewrite 
)
static

Definition at line 375 of file gxfenc.c.

Referenced by gxf_write_header(), gxf_write_packet(), and gxf_write_trailer().

◆ gxf_write_flt_packet()

static int gxf_write_flt_packet ( AVFormatContext s)
static

Definition at line 407 of file gxfenc.c.

Referenced by gxf_write_header(), and gxf_write_trailer().

◆ gxf_write_umf_material_description()

static int gxf_write_umf_material_description ( AVFormatContext s)
static

Definition at line 431 of file gxfenc.c.

Referenced by gxf_write_umf_packet().

◆ gxf_write_umf_payload()

static int gxf_write_umf_payload ( AVFormatContext s)
static

Definition at line 477 of file gxfenc.c.

Referenced by gxf_write_umf_packet().

◆ gxf_write_umf_track_description()

static int gxf_write_umf_track_description ( AVFormatContext s)
static

Definition at line 497 of file gxfenc.c.

Referenced by gxf_write_umf_packet().

◆ gxf_write_umf_media_mpeg()

static int gxf_write_umf_media_mpeg ( AVIOContext pb,
AVStream st 
)
static

Definition at line 517 of file gxfenc.c.

Referenced by gxf_write_umf_media_description().

◆ gxf_write_umf_media_timecode()

static int gxf_write_umf_media_timecode ( AVIOContext pb,
int  drop 
)
static

Definition at line 540 of file gxfenc.c.

Referenced by gxf_write_umf_media_description().

◆ gxf_write_umf_media_dv()

static int gxf_write_umf_media_dv ( AVIOContext pb,
GXFStreamContext sc,
AVStream st 
)
static

Definition at line 547 of file gxfenc.c.

Referenced by gxf_write_umf_media_description().

◆ gxf_write_umf_media_audio()

static int gxf_write_umf_media_audio ( AVIOContext pb,
GXFStreamContext sc 
)
static

Definition at line 558 of file gxfenc.c.

Referenced by gxf_write_umf_media_description().

◆ gxf_write_umf_media_description()

static int gxf_write_umf_media_description ( AVFormatContext s)
static

Definition at line 569 of file gxfenc.c.

Referenced by gxf_write_umf_packet().

◆ gxf_write_umf_packet()

static int gxf_write_umf_packet ( AVFormatContext s)
static

Definition at line 629 of file gxfenc.c.

Referenced by gxf_write_header(), and gxf_write_trailer().

◆ gxf_init_timecode_track()

static void gxf_init_timecode_track ( GXFStreamContext sc,
GXFStreamContext vsc 
)
static

Definition at line 650 of file gxfenc.c.

Referenced by gxf_write_header().

◆ gxf_init_timecode()

static int gxf_init_timecode ( AVFormatContext s,
GXFTimecode tc,
const char *  tcstr,
int  fields 
)
static

Definition at line 665 of file gxfenc.c.

Referenced by gxf_write_header().

◆ gxf_write_header()

static int gxf_write_header ( AVFormatContext s)
static

Definition at line 684 of file gxfenc.c.

◆ gxf_write_eos_packet()

static int gxf_write_eos_packet ( AVIOContext pb)
static

Definition at line 822 of file gxfenc.c.

Referenced by gxf_write_trailer().

◆ gxf_write_trailer()

static int gxf_write_trailer ( AVFormatContext s)
static

Definition at line 830 of file gxfenc.c.

◆ gxf_deinit()

static void gxf_deinit ( AVFormatContext s)
static

Definition at line 858 of file gxfenc.c.

◆ gxf_parse_mpeg_frame()

static int gxf_parse_mpeg_frame ( GXFStreamContext sc,
const uint8_t *  buf,
int  size 
)
static

Definition at line 866 of file gxfenc.c.

Referenced by gxf_write_media_preamble().

◆ gxf_write_media_preamble()

static int gxf_write_media_preamble ( AVFormatContext s,
AVPacket pkt,
int  size 
)
static

Definition at line 878 of file gxfenc.c.

Referenced by gxf_write_packet().

◆ gxf_write_packet()

static int gxf_write_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 925 of file gxfenc.c.

◆ gxf_compare_field_nb()

static int gxf_compare_field_nb ( AVFormatContext s,
const AVPacket next,
const AVPacket cur 
)
static

Definition at line 972 of file gxfenc.c.

Referenced by gxf_interleave_packet().

◆ gxf_interleave_packet()

static int gxf_interleave_packet ( AVFormatContext s,
AVPacket pkt,
int  flush,
int  has_packet 
)
static

Definition at line 995 of file gxfenc.c.

Variable Documentation

◆ height

int height

Definition at line 90 of file gxfenc.c.

◆ index

int index

Definition at line 90 of file gxfenc.c.

Referenced by ac3_decode_frame(), acb_search(), add_index_entry(), add_symbol(), add_tone(), adpcm_decode_frame(), adpcm_zork_expand_nibble(), aix_read_packet(), alac_linear_predictor(), alf_recon_coeff_and_clip(), alloc_mem(), alloc_table(), analyze_sample_buffer(), ape_read_seek(), apply_channel_coupling(), apply_dependent_coupling(), apply_independent_coupling(), apply_intensity_stereo(), asf_read_seek(), asf_write_index(), asv1_encode_block(), asv1_put_level(), asv2_encode_block(), asv2_get_vlc2(), asv2_put_level(), ath_init1(), av_channel_layout_channel_from_string(), av_dovi_get_ext(), av_dump_format(), av_parser_parse2(), av_shr_i(), avcodec_get_hw_config(), avf_read_header(), avformat_match_stream_specifier(), avi_read_idx1(), avi_read_packet(), avi_read_seek(), avi_stream2fourcc(), block_matching_multi(), buffer_pool_get(), build_basis(), build_canonical_huff(), build_def_list(), build_frame_code(), build_qp_table(), build_table(), callback(), categorize(), cdxl_decode_ham6(), cdxl_decode_ham8(), celt_encode_frame(), cfhd_encode_frame(), check_4block_inter(), check_block_inter(), check_idct_multiple(), codec2subblock(), comp_block(), comp_interp_index(), compare_decoding_params(), compute_coef(), compute_kernel(), compute_scale_factors(), config_output(), config_props(), construct_vector(), convolve_sobel(), copy_restart_frame_params(), copy_TMPL(), cqueue_peek(), create_augmented_vector(), create_iv(), d3d11va_transfer_data(), dat_read_packet(), dctcoef_get(), dctcoef_set(), dec_delay3_1st(), dec_delay3_2nd(), decode(), decode_alcd(), decode_avcf(), decode_bgr_1(), decode_cabac_luma_residual(), decode_cabac_residual_internal(), decode_envelope(), decode_fixed_sparse(), decode_frame(), decode_gain_info(), decode_i2_frame(), decode_init(), decode_luma_residual(), decode_mb_mode(), decode_p_block(), decode_palette(), decode_plane_bitstream(), decode_q_branch(), decode_significance_8x8_loongarch(), decode_significance_loongarch(), decode_vector(), decode_vectors(), del_tracked_method(), detect_clicks(), detect_clips(), detect_peak(), determine_bits(), dhav_read_seek(), direct_search(), dnxhd_init_vlc(), do_block_matching_multi(), dpcm_decode_frame(), draw_cursor(), draw_glyph(), dss_sp_unpack_coeffs(), dump_stream_format(), dump_stream_group(), dv_decode_ac(), encode_dc(), encode_q_branch(), encode_q_branch2(), ep_init_cabac_decoder(), estimate_pitch(), eval_expr(), execute_code(), fade_gain(), fcb_search(), ff_add_index_entry(), ff_amf_receive_packet(), ff_blend_mask(), ff_blend_rectangle(), ff_bufqueue_peek(), ff_dct_unquantize_h263_inter_msa(), ff_dct_unquantize_h263_intra_msa(), ff_dshow_meminputpin_Receive(), ff_ebur128_loudness_range_multiple(), ff_gmc_c(), ff_h261_reorder_mb_index(), ff_h264_build_ref_list(), ff_h264_decode_mb_cabac(), ff_h264_decode_mb_cavlc(), ff_h264_decode_ref_pic_list_reordering(), ff_init_ff_sine_windows(), ff_init_filters(), ff_interleave_bytes_lasx(), ff_mediacodec_dec_receive(), ff_mediacodec_dec_send(), ff_mjpeg_decode_dht(), ff_mjpeg_decode_dqt(), ff_mjpeg_decode_frame_from_buf(), ff_mjpeg_decode_sos(), ff_mlp_rematrix_channel(), ff_mov_init_hinting(), ff_mpeg1_decode_block_intra(), ff_opus_psy_celt_frame_init(), ff_opus_psy_celt_frame_process(), ff_seek_frame_binary(), ff_srtp_decrypt(), ff_srtp_encrypt(), ff_v4l2_buffer_initialize(), ff_vaapi_decode_make_slice_buffer(), ff_vk_alloc_mem(), fill_picture_entry(), fill_slice_long(), filter(), filter_channel(), filter_slice(), find_index(), find_prev_closest_index(), finish_file(), fix_frag_index_entries(), flac_seek(), format_name(), gain_dequantization(), gather_data_for_cel(), gaussian_filter(), gen_fcb_excitation(), get(), get_bits1(), get_block_bits(), get_block_rate(), get_channel_weights(), get_closest_codebook(), get_codebook(), get_dc(), get_frag_stream_info(), get_frag_time(), get_mvdata_interlaced(), get_prediction(), get_rl_index(), get_sample_rate(), get_surface(), gif_find_frame_end(), gxf_write_track_description(), handle_pac(), hds_flush(), heap_bubble_down(), heap_bubble_up(), hpel_motion_search(), hw_device_default_name(), idct_put(), ifv_read_seek(), img_read_seek(), imm5_decode_frame(), index_conv(), init_default_huffman_tables(), init_pass2(), init_uni_h263_rl_tab(), init_uni_mpeg4_rl_tab(), input_to_sample_buffer(), insert_mb_into_sb(), interpolate_delay(), interpolate_lsp(), interpolation(), iterative_me(), ivr_read_packet(), jpeg2000_decode_ctx_vlc(), lag_decode_line(), lin_calc(), lock_queue(), lsf_dequantization(), lsp2lpc(), mediacodec_get_input_index(), mediacodec_get_output_index(), mediacodec_ndk_onInputAvailable(), mediacodec_ndk_onOutputAvailable(), mediacodec_receive(), mediacodec_receive_frame(), mediacodec_send(), mediacodec_wrap_hw_buffer(), mediacodec_wrap_sw_audio_buffer(), mediacodec_wrap_sw_buffer(), mediacodec_wrap_sw_video_buffer(), mlp_encode_init(), mov_create_timecode_track(), mov_fix_index(), mov_free_encryption_index(), mov_get_stsc_samples(), mov_read_iprp(), mov_read_sidx(), mov_read_udta_string(), mov_seek_fragment(), mov_stsc_index_valid(), mov_switch_root(), mov_write_ipma_tag(), mov_write_stsc_tag(), mov_write_stss_tag(), mov_write_tfrf_tag(), mpc8_read_seek(), mpc_read_seek(), mpeg4_encode_block(), mpeg4_get_block_length(), mv_read_packet(), mxf_compute_ptses_fake_index(), mxf_decrypt_triplet(), mxf_edit_unit_absolute_offset(), mxf_read_packet(), nsv_read_seek(), nut_write_packet(), of_add_metadata(), on_input_available(), on_output_available(), open_filter_param(), output_client_manifest(), paf_video_decode(), parse_aux_data(), parse_coding_header(), parse_dmix_coeffs(), parse_ext(), parse_forced_key_frames(), parse_meta_type(), parse_subframe_audio(), pdv_read_seek(), pick_queue_family(), pick_video_queue_family(), predict_motion(), probe(), process_block(), process_command(), pseudocolor_filter(), pseudocolor_filter_10(), pseudocolor_filter_10d(), pseudocolor_filter_11(), pseudocolor_filter_11d(), pseudocolor_filter_16(), pseudocolor_filter_16_10(), pseudocolor_filter_16_10d(), pseudocolor_filter_16_11(), pseudocolor_filter_16_11d(), put_runcode(), qdm2_synthesis_filter(), qoi_decode_frame(), qoi_encode_frame(), qpel_motion_search(), qsv_fixed_pool_map_to(), quant_array_idx(), quantize(), read_ans_symbol(), read_dist_clustering(), read_packet(), read_seek(), read_tfra(), resample_common_TMPL(), resample_cubic(), resample_linear(), resample_linear_TMPL(), rka_read_seek(), rl2_read_seek(), rpza_decode_stream(), rtsp_send_reply(), run_channel_cwt(), sad_hpel_motion_search(), scalar_dequant_float(), scan_mmco_reset(), scd_read_track(), seek_frame_generic(), set(), set_best_codebook(), set_blocks(), set_major_params(), set_param(), shall_we_drop(), shift(), silk_decode_frame(), silk_decode_lpc(), silk_lsf2lpc(), small_diamond_search(), speedhq_init_static_data(), step_collect_psy_metrics(), store_table(), svq3_decode_block(), svq3_decode_mb(), synthfilt_build_sb_samples(), tak_parse(), thd_channel_layout_extract_channel(), timestamp_queue_peek(), true_peak_limiter(), truemotion1_decode_16bit(), truemotion1_decode_24bit(), tta_read_seek(), unlock_queue(), unpack_parse_unit(), update_frag_index(), update_model6_to_7(), update_palette_index(), update_stat(), vaapi_encode_av1_write_extra_header(), vaapi_encode_make_tile_slice(), vaapi_encode_mjpeg_write_extra_buffer(), vaapi_encode_vp8_write_quant_table(), value_string(), vc1_decode_ac_coeff(), vc1_decode_b_mb(), vc1_decode_p_mb(), voc_read_seek(), vqa_decode_frame_hicolor(), vqa_decode_frame_pal8(), wma_decode_block(), wrap_texture_buf(), write_abst(), write_manifest(), wv_unpack_dsd_fast(), xan_wc3_output_pixel_run(), and xpm_decode_frame().

◆ gxf_lines_tab

const { ... } gxf_lines_tab[]
Initial value:
= {
{ 480, 1 },
{ 512, 1 },
{ 576, 2 },
{ 608, 2 },
{ 1080, 4 },
{ 720, 6 },
}

Referenced by gxf_find_lines_index().

◆ gxf_media_types

const AVCodecTag gxf_media_types[]
static
Initial value:

Definition at line 100 of file gxfenc.c.

Referenced by gxf_write_header().

◆ ff_gxf_muxer

const FFOutputFormat ff_gxf_muxer
Initial value:
= {
.p.name = "gxf",
.p.long_name = NULL_IF_CONFIG_SMALL("GXF (General eXchange Format)"),
.p.extensions = "gxf",
.priv_data_size = sizeof(GXFContext),
.p.audio_codec = AV_CODEC_ID_PCM_S16LE,
.p.video_codec = AV_CODEC_ID_MPEG2VIDEO,
.write_header = gxf_write_header,
.write_packet = gxf_write_packet,
.write_trailer = gxf_write_trailer,
.deinit = gxf_deinit,
.interleave_packet = gxf_interleave_packet,
}

Definition at line 1013 of file gxfenc.c.

AV_CODEC_ID_PCM_S16LE
@ AV_CODEC_ID_PCM_S16LE
Definition: codec_id.h:334
AV_CODEC_ID_AC3
@ AV_CODEC_ID_AC3
Definition: codec_id.h:449
gxf_write_header
static int gxf_write_header(AVFormatContext *s)
Definition: gxfenc.c:684
gxf_write_packet
static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: gxfenc.c:925
AV_CODEC_ID_MPEG1VIDEO
@ AV_CODEC_ID_MPEG1VIDEO
Definition: codec_id.h:53
gxf_interleave_packet
static int gxf_interleave_packet(AVFormatContext *s, AVPacket *pkt, int flush, int has_packet)
Definition: gxfenc.c:995
AV_CODEC_ID_PCM_S24LE
@ AV_CODEC_ID_PCM_S24LE
Definition: codec_id.h:346
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:94
gxf_write_trailer
static int gxf_write_trailer(AVFormatContext *s)
Definition: gxfenc.c:830
AV_CODEC_ID_MJPEG
@ AV_CODEC_ID_MJPEG
Definition: codec_id.h:59
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:50
AV_CODEC_ID_DVVIDEO
@ AV_CODEC_ID_DVVIDEO
Definition: codec_id.h:76
GXFContext
Definition: gxfenc.c:66
gxf_deinit
static void gxf_deinit(AVFormatContext *s)
Definition: gxfenc.c:858
AV_CODEC_ID_MPEG2VIDEO
@ AV_CODEC_ID_MPEG2VIDEO
preferred ID for MPEG-1/2 video decoding
Definition: codec_id.h:54