30 #define GXF_AUDIO_PACKET_SIZE 65536
102 #define SERVER_PATH "EXT:/PDR/default/"
103 #define ES_NAME_PATTERN "EXT:/PDR/default/ES."
110 for (i = 0; i < 6; ++i) {
121 for (; to_pad > 0; to_pad--) {
169 int size, starting_line;
192 size = snprintf(buffer, 1024,
"Ver 1\nBr %.6f\nIpg 1\nPpi %d\nBpiop %d\n"
193 "Pix 0\nCf %d\nCg %d\nSl %d\nnl16 %d\nVi 1\nf1 1\n",
276 const char *filename = strrchr(s->
filename,
'/');
286 len = strlen(filename);
373 int fields_per_flt = (gxf->
nb_fields+1) / 1000 + 1;
374 int flt_entries = gxf->
nb_fields / fields_per_flt;
383 for (i = 0; i < flt_entries; i++)
387 for (; i < 1000; i++)
397 int timecode_base = gxf->
time_base.
den == 60000 ? 60 : 50;
398 int64_t timestamp = 0;
404 timestamp = s->timestamp;
412 gxf->
nb_fields / (timecode_base * 3600) % 24 << 24 |
413 gxf->
nb_fields / (timecode_base * 60) % 60 << 16 |
414 gxf->
nb_fields / timecode_base % 60 << 8 |
515 for (i = 0; i < 8; i++) {
554 int64_t startpos, curpos;
648 uint8_t tracks[255] = {0};
649 int i, media_info = 0;
656 gxf->
flags |= 0x00080000;
686 gxf->
flags |= 0x04000000;
697 gxf->
flags |= 0x00000080;
703 gxf->
flags |= 0x00000040;
707 "gxf muxer only accepts PAL or NTSC resolutions currently\n");
721 gxf->
flags |= 0x00004000;
733 gxf->
flags |= 0x00008000;
740 gxf->
flags |= 0x00002000;
744 gxf->
flags |= 0x00001000;
754 sc->
media_info = media_info<<8 | (
'0'+tracks[media_info]++);
762 gxf->
flags |= 0x200000;
818 for(i=0; i<size-4 && c!=0x100; i++){
823 return (buf[i+1]>>3)&7;
880 int packet_start_offset =
avio_tell(pb) / 1024;
884 padding = 4 - pkt->
size % 4;
924 for (i = 0; i < 2; i++) {
932 field_nb[i] = pkt[i]->
dts;
935 return field_nb[1] > field_nb[0] ||
936 (field_nb[1] == field_nb[0] && sc[1]->
order > sc[0]->
order);
void avio_wb64(AVIOContext *s, uint64_t val)
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush)
Interleave a packet per dts in an output media file.
void avio_wl16(AVIOContext *s, unsigned int val)
int64_t avio_size(AVIOContext *s)
Get the filesize.
static int gxf_write_header(AVFormatContext *s)
static int gxf_write_umf_media_dv(AVIOContext *pb, GXFStreamContext *sc)
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 int64_t updatePacketSize(AVIOContext *pb, int64_t pos)
static int gxf_write_umf_media_mpeg(AVIOContext *pb, AVStream *st)
static const int GXF_samples_per_frame[]
int index
stream index in AVFormatContext
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
static const AVCodecTag gxf_media_types[]
static av_always_inline uint64_t av_double2int(double f)
Reinterpret a double as a 64-bit integer.
int b_per_i_or_p
number of B frames per I frame or P frame
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
GXFStreamContext timecode_track
AVDictionaryEntry * av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
uint32_t umf_start_offset
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
AVOutputFormat ff_gxf_muxer
void avio_wl32(AVIOContext *s, unsigned int val)
uint32_t umf_track_offset
int ff_audio_interleave_init(AVFormatContext *s, const int *samples_per_frame, AVRational time_base)
AudioInterleaveContext aic
static void gxf_init_timecode_track(GXFStreamContext *sc, GXFStreamContext *vsc)
static int gxf_write_timecode_auxiliary(AVIOContext *pb, GXFStreamContext *sc)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
static int gxf_find_lines_index(AVStream *st)
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
static int gxf_compare_field_nb(AVFormatContext *s, AVPacket *next, AVPacket *cur)
void avio_wl64(AVIOContext *s, uint64_t val)
preferred ID for MPEG-1/2 video decoding
static int64_t updateSize(AVIOContext *pb, int64_t pos)
static const struct @77 gxf_lines_tab[]
int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush, int(*get_packet)(AVFormatContext *, AVPacket *, AVPacket *, int), int(*compare_ts)(AVFormatContext *, AVPacket *, AVPacket *))
Rechunk audio PCM packets per AudioInterleaveContext->samples_per_frame and interleave them correctly...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
struct GXFStreamContext GXFStreamContext
static void gxf_write_padding(AVIOContext *pb, int64_t to_pad)
uint32_t umf_media_offset
static int gxf_write_umf_media_audio(AVIOContext *pb, GXFStreamContext *sc)
void av_log(void *avcl, int level, const char *fmt,...)
struct GXFContext GXFContext
static int gxf_write_umf_payload(AVFormatContext *s)
static int gxf_write_umf_material_description(AVFormatContext *s)
AVCodecContext * codec
codec context
static int gxf_write_umf_media_timecode(AVIOContext *pb, GXFStreamContext *sc)
unsigned int nb_streams
A list of all streams in the file.
struct AVRational AVRational
rational number numerator/denominator
static int gxf_write_media_preamble(AVFormatContext *s, AVPacket *pkt, int size)
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
int bit_rate
the average bitrate
int void avio_flush(AVIOContext *s)
static int gxf_parse_mpeg_frame(GXFStreamContext *sc, const uint8_t *buf, int size)
static int gxf_interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush)
char filename[1024]
input or output filename
void avio_wb24(AVIOContext *s, unsigned int val)
internal header for RIFF based (de)muxers do NOT include this in end user applications ...
#define GXF_AUDIO_PACKET_SIZE
static int gxf_write_map_packet(AVFormatContext *s, int rewrite)
unsigned order
interleaving order
static int gxf_write_material_data_section(AVFormatContext *s)
unsigned * flt_entries
offsets of packets /1024, starts after 2nd video field
enum AVMediaType codec_type
int sample_rate
samples per second
void avio_w8(AVIOContext *s, int b)
static int gxf_write_track_description_section(AVFormatContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int gxf_write_eos_packet(AVIOContext *pb)
rational number numerator/denominator
static int gxf_write_trailer(AVFormatContext *s)
static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc, int index)
void avio_wb16(AVIOContext *s, unsigned int val)
unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum CodecID id)
static void gxf_write_packet_header(AVIOContext *pb, GXFPktType type)
static int gxf_write_flt_packet(AVFormatContext *s)
void ff_audio_interleave_close(AVFormatContext *s)
uint64_t * map_offsets
offset of map packets
static av_cold void flush(AVCodecContext *avctx)
Flush (reset) the frame ID after seeking.
static int gxf_write_umf_track_description(AVFormatContext *s)
int channels
number of audio channels
void * priv_data
Format private data.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
void avio_wb32(AVIOContext *s, unsigned int val)
static int gxf_write_umf_packet(AVFormatContext *s)
static int gxf_write_umf_media_description(AVFormatContext *s)
static int gxf_write_mpeg_auxiliary(AVIOContext *pb, AVStream *st)
static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt)