FFmpeg
|
gxfenc.c
Go to the documentation of this file.
3 * Copyright (c) 2006 SmartJog S.A., Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
658 static int gxf_init_timecode(AVFormatContext *s, GXFTimecode *tc, const char *tcstr, int fields)
923 if (st->codec->codec_id == AV_CODEC_ID_MPEG2VIDEO && pkt->size % 4) /* MPEG-2 frames must be padded */
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Definition: mem.c:205
Definition: libavcodec/avcodec.h:100
Definition: dict.h:80
static int gxf_write_umf_media_dv(AVIOContext *pb, GXFStreamContext *sc)
Definition: gxfenc.c:537
Definition: gxf.h:35
Definition: gxfenc.c:46
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.
Definition: mathematics.c:60
void * av_realloc_f(void *ptr, size_t nelem, size_t elsize)
Allocate or reallocate a block of memory.
Definition: mem.c:168
Definition: gxf.h:46
void avpriv_set_pts_info(AVStream *s, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den)
Set the time base and wrapping info for a given stream.
Definition: libavformat/utils.c:3952
static int64_t updatePacketSize(AVIOContext *pb, int64_t pos)
Definition: gxfenc.c:142
static int write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: libavformat/assenc.c:63
static int gxf_write_umf_media_mpeg(AVIOContext *pb, AVStream *st)
Definition: gxfenc.c:501
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:199
static av_always_inline uint64_t av_double2int(double f)
Reinterpret a double as a 64-bit integer.
Definition: intfloat.h:70
struct GXFTimecode GXFTimecode
Definition: gxfenc.c:37
unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id)
Definition: libavformat/utils.c:2604
Timecode helpers header.
Definition: gxf.h:43
AVDictionaryEntry * av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
Definition: dict.c:39
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
Definition: mem.c:198
AVOptions.
int ff_audio_interleave_init(AVFormatContext *s, const int *samples_per_frame, AVRational time_base)
Definition: audiointerleave.c:41
Definition: libavformat/internal.h:35
int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush)
Interleave a packet per dts in an output media file.
Definition: mux.c:625
static void gxf_init_timecode_track(GXFStreamContext *sc, GXFStreamContext *vsc)
Definition: gxfenc.c:643
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:248
Definition: libavcodec/avcodec.h:110
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
Definition: aviobuf.c:173
static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, int flush)
Interleave an AVPacket correctly so it can be muxed.
Definition: mux.c:715
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: libavcodec/avcodec.h:1073
static int gxf_compare_field_nb(AVFormatContext *s, AVPacket *next, AVPacket *cur)
Definition: gxfenc.c:956
Definition: libavcodec/avcodec.h:127
Definition: libavcodec/avcodec.h:103
Definition: gxf.h:48
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...
Definition: audiointerleave.c:103
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: libavutil/internal.h:123
struct GXFStreamContext GXFStreamContext
static void gxf_write_padding(AVIOContext *pb, int64_t to_pad)
Definition: gxfenc.c:135
Definition: audiointerleave.h:29
static int gxf_write_umf_media_audio(AVIOContext *pb, GXFStreamContext *sc)
Definition: gxfenc.c:547
Definition: avutil.h:144
simple assert() macros that are a bit more flexible than ISO C assert().
struct GXFContext GXFContext
static int gxf_write_umf_material_description(AVFormatContext *s)
Definition: gxfenc.c:413
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:72
static int gxf_write_media_preamble(AVFormatContext *s, AVPacket *pkt, int size)
Definition: gxfenc.c:866
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
Definition: avio.h:117
int void avio_flush(AVIOContext *s)
Force flushing of buffered data to the output s.
Definition: aviobuf.c:193
static int gxf_parse_mpeg_frame(GXFStreamContext *sc, const uint8_t *buf, int size)
Definition: gxfenc.c:854
static int gxf_interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush)
Definition: gxfenc.c:978
int64_t ff_iso8601_to_unix_time(const char *datestr)
Convert a date string in ISO8601 format to Unix timestamp.
Definition: libavformat/utils.c:4170
Definition: gxfenc.c:65
static int gxf_init_timecode(AVFormatContext *s, GXFTimecode *tc, const char *tcstr, int fields)
Definition: gxfenc.c:658
static int gxf_write_map_packet(AVFormatContext *s, int rewrite)
Definition: gxfenc.c:357
static int gxf_write_material_data_section(AVFormatContext *s)
Definition: gxfenc.c:289
unsigned * flt_entries
offsets of packets /1024, starts after 2nd video field
Definition: gxfenc.c:80
Definition: libavcodec/avcodec.h:384
static int gxf_write_track_description_section(AVFormatContext *s)
Definition: gxfenc.c:340
Definition: gxf.h:37
Definition: libavcodec/avcodec.h:311
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFilterBuffer 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.Buffer references ownership and permissions
#define type
static int gxf_write_timecode_auxiliary(AVIOContext *pb, GXFContext *gxf)
Definition: gxfenc.c:220
static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc, int index)
Definition: gxfenc.c:232
static void gxf_write_packet_header(AVIOContext *pb, GXFPktType type)
Definition: gxfenc.c:170
Main libavformat public API header.
static int gxf_write_umf_media_timecode(AVIOContext *pb, int drop)
Definition: gxfenc.c:524
void ff_audio_interleave_close(AVFormatContext *s)
Definition: audiointerleave.c:29
Definition: libavcodec/avcodec.h:299
the buffer and buffer 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 AVFilterBuffer structures They must not be accessed but through references stored in AVFilterBufferRef structures Several references can point to the same buffer
Definition: filter_design.txt:45
static int gxf_write_umf_track_description(AVFormatContext *s)
Definition: gxfenc.c:481
Definition: avformat.h:377
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
Definition: libavcodec/avcodec.h:1050
static const struct @141 gxf_lines_tab[]
Definition: avutil.h:143
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31))))#define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac){}void ff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map){AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);return NULL;}return ac;}in_planar=av_sample_fmt_is_planar(in_fmt);out_planar=av_sample_fmt_is_planar(out_fmt);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;}int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){int use_generic=1;int len=in->nb_samples;int p;if(ac->dc){av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> out
Definition: audio_convert.c:194
Definition: gxf.h:36
static int gxf_write_umf_media_description(AVFormatContext *s)
Definition: gxfenc.c:558
Definition: gxf.h:38
static int gxf_write_mpeg_auxiliary(AVIOContext *pb, AVStream *st)
Definition: gxfenc.c:181
static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: gxfenc.c:913
Generated on Sat Feb 1 2025 06:52:23 for FFmpeg by 1.8.11