32#define GXF_SAMPLES_PER_FRAME 32768
33#define GXF_AUDIO_PACKET_SIZE 65536
35#define GXF_TIMECODE(c, d, h, m, s, f) \
36 ((c) << 30 | (d) << 29 | (h) << 24 | (m) << 16 | (s) << 8 | (f))
119#define SERVER_PATH "EXT:/PDR/default/"
120#define ES_NAME_PATTERN "EXT:/PDR/default/ES."
127 for (
i = 0;
i < 6; ++
i) {
184 int size, starting_line;
208 "Pix 0\nCf %d\nCg %d\nSl %d\nnl16 %d\nVi 1\nf1 1\n",
226 track_aux_data |= 0x01;
227 track_aux_data |= 0x40000000;
313 const char *filename = strrchr(
s->url,
'/');
323 len = strlen(filename);
367 for (
i = 0;
i <
s->nb_streams; ++
i)
412 int fields_per_flt = (gxf->
nb_fields+1) / 1000 + 1;
413 int flt_entries = gxf->
nb_fields / fields_per_flt;
422 for (
i = 0;
i < flt_entries;
i++)
435 int timecode_base = gxf->
time_base.
den == 60000 ? 60 : 50;
438 uint32_t timecode_in;
439 uint32_t timecode_out;
448 gxf->
tc.
hh * (timecode_base * 3600) +
449 gxf->
tc.
mm * (timecode_base * 60) +
450 gxf->
tc.
ss * timecode_base +
454 nb_fields / (timecode_base * 3600) % 24,
455 nb_fields / (timecode_base * 60) % 60,
456 nb_fields / timecode_base % 60,
457 nb_fields % timecode_base);
505 for (
i = 0;
i <
s->nb_streams; ++
i) {
577 for (
unsigned i = 0;
i <=
s->nb_streams; ++
i) {
581 if (
i ==
s->nb_streams)
584 sc =
s->streams[
i]->priv_data;
669 if (sscanf(tcstr,
"%d:%d:%d%c%d", &tc->
hh, &tc->
mm, &tc->
ss, &
c, &tc->
ff) != 5) {
671 "syntax: hh:mm:ss[:;.]ff\n");
675 if (tc->
hh > 31U || tc->
mm > 255U || tc->
ss > 255U || tc->
ff > (255U >> (fields == 2)))
692 uint8_t tracks[255] = {0};
693 int i, media_info = 0;
702 gxf->
flags |= 0x00080000;
703 for (
i = 0;
i <
s->nb_streams; ++
i) {
735 gxf->
flags |= 0x04000000;
746 gxf->
flags |= 0x00000080;
752 gxf->
flags |= 0x00000040;
756 "gxf muxer only accepts PAL or NTSC resolutions currently\n");
772 gxf->
flags |= 0x00004000;
784 gxf->
flags |= 0x00008000;
791 gxf->
flags |= 0x00002000;
795 gxf->
flags |= 0x00001000;
805 sc->
media_info = media_info<<8 | (
'0'+tracks[media_info]++);
816 gxf->
flags |= 0x200000;
876 for(
i=0;
i<
size-4 &&
c!=0x100;
i++){
881 return (buf[
i+1]>>3)&7;
938 unsigned packet_start_offset =
avio_tell(pb) / 1024;
943 padding = 4 -
pkt->size % 4;
986 for (
i = 0;
i < 2;
i++) {
994 field_nb[
i] =
pkt[
i]->dts;
997 return field_nb[1] > field_nb[0] ||
998 (field_nb[1] == field_nb[0] && sc[1]->
order > sc[0]->
order);
1002 int flush,
int has_packet)
1022 .p.extensions =
"gxf",
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
void avio_wl64(AVIOContext *s, uint64_t val)
void avio_wl32(AVIOContext *s, unsigned int val)
void avio_wl16(AVIOContext *s, unsigned int val)
void avio_w8(AVIOContext *s, int b)
void avio_wb32(AVIOContext *s, unsigned int val)
void avio_wb16(AVIOContext *s, unsigned int val)
int64_t avio_size(AVIOContext *s)
Get the filesize.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
void avio_wb24(AVIOContext *s, unsigned int val)
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
void ffio_fill(AVIOContext *s, int b, int64_t count)
#define i(width, name, range_min, range_max)
void(* flush)(AVBSFContext *ctx)
@ AV_CODEC_ID_MPEG2VIDEO
preferred ID for MPEG-1/2 video decoding
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
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.
@ AV_ROUND_UP
Round toward +infinity.
int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate an array through a pointer to a pointer.
@ AV_PICTURE_TYPE_I
Intra.
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
static int gxf_interleave_packet(AVFormatContext *s, AVPacket *pkt, int flush, int has_packet)
#define GXF_SAMPLES_PER_FRAME
static int gxf_write_eos_packet(AVIOContext *pb)
static void gxf_deinit(AVFormatContext *s)
static int gxf_write_header(AVFormatContext *s)
static const AVCodecTag gxf_media_types[]
static int gxf_init_timecode(AVFormatContext *s, GXFTimecode *tc, const char *tcstr, int fields)
static int gxf_write_flt_packet(AVFormatContext *s)
static int gxf_write_mpeg_auxiliary(AVIOContext *pb, AVStream *st)
static int gxf_write_map_packet(AVFormatContext *s, int rewrite)
static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt)
#define GXF_AUDIO_PACKET_SIZE
static int gxf_write_umf_media_description(AVFormatContext *s)
static int gxf_write_umf_media_timecode(AVIOContext *pb, int drop)
static const struct @245204121255110231221056270036157303047216147250 gxf_lines_tab[]
static int gxf_write_track_description_section(AVFormatContext *s)
static int gxf_write_umf_packet(AVFormatContext *s)
static int gxf_write_media_preamble(AVFormatContext *s, AVPacket *pkt, int size)
static int gxf_write_material_data_section(AVFormatContext *s)
static void gxf_init_timecode_track(GXFStreamContext *sc, GXFStreamContext *vsc)
static int64_t update_size(AVIOContext *pb, int64_t pos)
static int gxf_write_umf_payload(AVFormatContext *s)
static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc, int index)
#define GXF_TIMECODE(c, d, h, m, s, f)
static int gxf_write_dv_auxiliary(AVIOContext *pb, AVStream *st)
static int gxf_find_lines_index(AVStream *st)
static int gxf_write_umf_track_description(AVFormatContext *s)
static void gxf_write_packet_header(AVIOContext *pb, GXFPktType type)
static int gxf_compare_field_nb(AVFormatContext *s, const AVPacket *next, const AVPacket *cur)
static int64_t update_packet_size(AVIOContext *pb, int64_t pos)
static int gxf_write_umf_material_description(AVFormatContext *s)
static void gxf_write_padding(AVIOContext *pb, int64_t to_pad)
static int gxf_write_umf_media_mpeg(AVIOContext *pb, AVStream *st)
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_parse_mpeg_frame(GXFStreamContext *sc, const uint8_t *buf, int size)
static int gxf_write_timecode_auxiliary(AVIOContext *pb, GXFContext *gxf)
static int gxf_write_trailer(AVFormatContext *s)
static av_always_inline uint64_t av_double2int(double f)
Reinterpret a double as a 64-bit integer.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Memory handling functions.
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.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int nb_channels
Number of channels in this layout.
Describe the class of an AVClass context structure.
int height
The height of the video frame in pixels.
AVChannelLayout ch_layout
The channel layout and number of channels.
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
enum AVMediaType codec_type
General type of the encoded data.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int sample_rate
The number of audio samples per second.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
This structure stores compressed data.
Rational number (pair of numerator and denominator).
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int index
stream index in AVFormatContext
uint32_t umf_track_offset
uint32_t umf_media_offset
unsigned * flt_entries
offsets of packets /1024, starts after 2nd video field
GXFStreamContext timecode_track
uint64_t * map_offsets
offset of map packets
uint32_t umf_start_offset
unsigned order
interleaving order
int b_per_i_or_p
number of B-frames per I-frame or P-frame