34 lseek(fd, 8, SEEK_SET);
35 if (read(fd, buf, 8) != 8)
46 buf[i] = (pos >> (56 - i * 8)) & 0xff;
47 lseek(fd, 8, SEEK_SET);
48 if (write(fd, buf, 8) != 8)
59 #endif // CONFIG_AVSERVER
64 int64_t pos, avail_size;
79 }
else if (pos < ffm->write_index) {
86 if (size <= avail_size)
107 uint8_t *buf,
int size,
int header)
111 int len, fill_size, size1, frame_offset,
id;
178 av_dlog(s,
"seek to %"PRIx64
" -> %"PRIx64
"\n", pos1, pos);
190 av_dlog(s,
"dts=%0.6f\n", dts / 1000000.0);
200 int64_t pos_min, pos_max;
208 pts_start =
get_dts(s, pos_min);
212 if (pts - 100000 > pts_start)
217 pts_start =
get_dts(s, pos_min);
221 if (pts - 100000 <= pts_start) {
228 if (newpos == pos_min)
233 if (newpts - 100000 <= pts) {
273 if (tag !=
MKTAG(
'F',
'F',
'M',
'1'))
285 ffm->
file_size = (UINT64_C(1) << 63) - 1;
291 for(i=0;i<nb_streams;i++) {
323 avio_get_str(pb, INT_MAX, rc_eq_buf,
sizeof(rc_eq_buf));
405 av_dlog(s,
"pos=%08"PRIx64
" spos=%"PRIx64
", write_index=%"PRIx64
" size=%"PRIx64
"\n",
457 int64_t pos_min, pos_max, pos;
458 int64_t pts_min, pts_max, pts;
461 av_dlog(s,
"wanted_pts=%0.6f\n", wanted_pts / 1000000.0);
466 while (pos_min <= pos_max) {
470 pos1 = (double)(pos_max - pos_min) * (double)(wanted_pts - pts_min) /
471 (double)(pts_max - pts_min);
475 else if (pos >= pos_max)
479 if (pts == wanted_pts) {
481 }
else if (pts > wanted_pts) {
504 p->
buf[0] ==
'F' && p->
buf[1] ==
'F' && p->
buf[2] ==
'M' &&
#define FRAME_HEADER_SIZE
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
int64_t avio_size(AVIOContext *s)
Get the filesize.
struct FFMContext FFMContext
int mpeg_quant
0-> h263 quant 1-> mpeg quant
AV_WL32 AV_WL24 AV_WL16 AV_RB32
int dct_algo
DCT algorithm, see FF_DCT_* below.
float qblur
amount of qscale smoothing over time (0.0-1.0)
int64_t pos
byte position in stream, -1 if unknown
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
int chroma_elim_threshold
chroma single coeff elimination threshold
int max_b_frames
maximum number of B-frames between non-B-frames Note: The output will be delayed by max_b_frames+1 re...
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
unsigned int avio_rb16(AVIOContext *s)
int frame_skip_cmp
frame skip comparison function
static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt)
static int ffm_read_data(AVFormatContext *s, uint8_t *buf, int size, int header)
float i_quant_offset
qscale offset between P and I-frames
int scenechange_threshold
scene change detection threshold 0 is default, larger means fewer detected scene changes.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
static int ffm_resync(AVFormatContext *s, int state)
int bit_rate_tolerance
number of bits the bitstream is allowed to diverge from the reference.
enum AVSampleFormat sample_fmt
audio sample format
static av_always_inline double av_int2double(uint64_t i)
Reinterpret a 64-bit integer as a double.
static int64_t get_dts(AVFormatContext *s, int64_t pos)
int me_range
maximum motion estimation search range in subpel units If 0 then no limit.
unsigned int avio_rb32(AVIOContext *s)
float b_quant_factor
qscale factor between IP and B-frames If > 0 then the last P-frame quantizer will be used (q= lastp_q...
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
int me_cmp
motion estimation comparison function
static int read_header(FFV1Context *f)
static int ffm_is_avail_data(AVFormatContext *s, int size)
void av_free_packet(AVPacket *pkt)
Free a packet.
#define AVERROR_EOF
End of file.
static av_cold int read_close(AVFormatContext *ctx)
uint64_t avio_rb64(AVIOContext *s)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
static void adjust_write_index(AVFormatContext *s)
unsigned int avio_rl32(AVIOContext *s)
int qmax
maximum quantizer
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
int rc_max_rate
maximum bitrate
void av_log(void *avcl, int level, const char *fmt,...)
AVStream * avformat_new_stream(AVFormatContext *s, AVCodec *c)
Add a new stream to a media file.
float i_quant_factor
qscale factor between P and I-frames If > 0 then the last p frame quantizer will be used (q= lastp_q*...
const char * rc_eq
rate control equation
static int ffm_probe(AVProbeData *p)
int ffm_write_write_index(int fd, int64_t pos)
int flags
A combination of AV_PKT_FLAG values.
int avio_r8(AVIOContext *s)
AVCodecContext * codec
codec context
int rc_buffer_size
decoder bitstream buffer size
int intra_dc_precision
precision of the intra DC coefficient - 8
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
unsigned int nb_streams
A list of all streams in the file.
int refs
number of reference frames
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
int bit_rate
the average bitrate
int width
picture width / height.
int64_t ffm_read_write_index(int fd)
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
static int read_probe(AVProbeData *p)
uint8_t header[FRAME_HEADER_SIZE+4]
int mb_decision
macroblock decision mode
int max_qdiff
maximum quantizer difference between frames
#define av_dlog(pctx,...)
av_dlog macros Useful to print debug messages that shouldn't get compiled in normally.
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
int frame_size
Samples per packet, initialized when calling 'init'.
static int ffm_close(AVFormatContext *s)
enum AVMediaType codec_type
char * av_strdup(const char *s)
Duplicate the string s.
int sample_rate
samples per second
main external API structure.
int qmin
minimum quantizer
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
#define CODEC_FLAG_GLOBAL_HEADER
Place global headers in extradata instead of every keyframe.
float rc_buffer_aggressivity
static void ffm_seek1(AVFormatContext *s, int64_t pos1)
float b_quant_offset
qscale offset between IP and B-frames
This structure contains the data a format has to probe a file.
float qcompress
amount of qscale change between easy & hard scenes (0.0-1.0)
AVInputFormat ff_ffm_demuxer
AV_WL32 AV_WL24 AV_WL16 AV_WB32 AV_RB24
int gop_size
the number of pictures in a group of pictures, or 0 for intra_only
unsigned int avio_rl16(AVIOContext *s)
uint8_t packet[FFM_PACKET_SIZE]
int64_t pos
position in the file of the current buffer
static int ffm_seek(AVFormatContext *s, int stream_index, int64_t wanted_pts, int flags)
int eof_reached
true if eof reached
void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size)
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...
int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen)
Read a string from pb into buf.
int me_method
Motion estimation algorithm used for video coding.
int rc_min_rate
minimum bitrate
#define MKTAG(a, b, c, d)
int me_subpel_quality
subpel ME quality
int strict_std_compliance
strictly follow the standard (MPEG4, ...).
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int luma_elim_threshold
luma single coefficient elimination threshold
int keyint_min
minimum GOP size