Commit bc5c918e authored by Diego Biurrun's avatar Diego Biurrun

Remove offset_t typedef and use int64_t directly instead.

The name offset_t is easily confused with the standard off_t type and
*_t is POSIX reserved namespace if any POSIX header is included.

Originally committed as revision 15533 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 0c45cd07
......@@ -172,9 +172,9 @@ static unsigned int get_aiff_header(ByteIOContext *pb, AVCodecContext *codec,
#ifdef CONFIG_AIFF_MUXER
typedef struct {
offset_t form;
offset_t frames;
offset_t ssnd;
int64_t form;
int64_t frames;
int64_t ssnd;
} AIFFOutputContext;
static int aiff_write_header(AVFormatContext *s)
......@@ -265,7 +265,7 @@ static int aiff_write_trailer(AVFormatContext *s)
AVCodecContext *enc = s->streams[0]->codec;
/* Chunks sizes must be even */
offset_t file_size, end_size;
int64_t file_size, end_size;
end_size = file_size = url_ftell(pb);
if (file_size & 1) {
put_byte(pb, 0);
......@@ -312,7 +312,7 @@ static int aiff_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
int size, filesize;
offset_t offset = 0;
int64_t offset = 0;
uint32_t tag;
unsigned version = AIFF_C_VERSION1;
ByteIOContext *pb = s->pb;
......
......@@ -88,7 +88,7 @@ static int au_write_packet(AVFormatContext *s, AVPacket *pkt)
static int au_write_trailer(AVFormatContext *s)
{
ByteIOContext *pb = s->pb;
offset_t file_size;
int64_t file_size;
if (!url_is_streamed(s->pb)) {
......
......@@ -1065,9 +1065,9 @@ int64_t av_gettime(void);
/* ffm-specific for ffserver */
#define FFM_PACKET_SIZE 4096
offset_t ffm_read_write_index(int fd);
void ffm_write_write_index(int fd, offset_t pos);
void ffm_set_write_index(AVFormatContext *s, offset_t pos, offset_t file_size);
int64_t ffm_read_write_index(int fd);
void ffm_write_write_index(int fd, int64_t pos);
void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size);
/**
* Attempts to find a specific tag in a URL.
......
......@@ -51,7 +51,7 @@ typedef struct {
int64_t riff_end;
int64_t movi_end;
int64_t fsize;
offset_t movi_list;
int64_t movi_list;
int index_loaded;
int is_odml;
int non_interleaved;
......@@ -217,7 +217,7 @@ static void clean_index(AVFormatContext *s){
static int avi_read_tag(ByteIOContext *pb, char *buf, int maxlen, unsigned int size)
{
offset_t i = url_ftell(pb);
int64_t i = url_ftell(pb);
size += (size & 1);
get_strz(pb, buf, maxlen);
url_fseek(pb, i+size, SEEK_SET);
......@@ -619,7 +619,7 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
AVIContext *avi = s->priv_data;
ByteIOContext *pb = s->pb;
int n, d[8], size;
offset_t i, sync;
int64_t i, sync;
void* dstr;
if (ENABLE_DV_DEMUXER && avi->dv_demux) {
......@@ -937,7 +937,7 @@ static int avi_load_index(AVFormatContext *s)
AVIContext *avi = s->priv_data;
ByteIOContext *pb = s->pb;
uint32_t tag, size;
offset_t pos= url_ftell(pb);
int64_t pos= url_ftell(pb);
url_fseek(pb, avi->movi_end, SEEK_SET);
#ifdef DEBUG_SEEK
......
......@@ -35,15 +35,15 @@ typedef struct AVIIentry {
#define AVI_INDEX_CLUSTER_SIZE 16384
typedef struct AVIIndex {
offset_t indx_start;
int64_t indx_start;
int entry;
int ents_allocated;
AVIIentry** cluster;
} AVIIndex;
typedef struct {
offset_t riff_start, movi_list, odml_list;
offset_t frames_hdr_all, frames_hdr_strm[MAX_STREAMS];
int64_t riff_start, movi_list, odml_list;
int64_t frames_hdr_all, frames_hdr_strm[MAX_STREAMS];
int audio_strm_length[MAX_STREAMS];
int riff_id;
int packet_count[MAX_STREAMS];
......@@ -58,10 +58,10 @@ static inline AVIIentry* avi_get_ientry(AVIIndex* idx, int ent_id)
return &idx->cluster[cl][id];
}
static offset_t avi_start_new_riff(AVIContext *avi, ByteIOContext *pb,
const char* riff_tag, const char* list_tag)
static int64_t avi_start_new_riff(AVIContext *avi, ByteIOContext *pb,
const char* riff_tag, const char* list_tag)
{
offset_t loff;
int64_t loff;
int i;
avi->riff_id++;
......@@ -108,7 +108,7 @@ static int avi_write_counters(AVFormatContext* s, int riff_id)
ByteIOContext *pb = s->pb;
AVIContext *avi = s->priv_data;
int n, au_byterate, au_ssize, au_scale, nb_frames = 0;
offset_t file_size;
int64_t file_size;
AVCodecContext* stream;
file_size = url_ftell(pb);
......@@ -141,7 +141,7 @@ static int avi_write_header(AVFormatContext *s)
ByteIOContext *pb = s->pb;
int bitrate, n, i, nb_frames, au_byterate, au_ssize, au_scale;
AVCodecContext *stream, *video_enc;
offset_t list1, list2, strh, strf;
int64_t list1, list2, strh, strf;
/* header list */
avi->riff_id = 0;
......@@ -375,7 +375,7 @@ static int avi_write_ix(AVFormatContext *s)
return -1;
for (i=0;i<s->nb_streams;i++) {
offset_t ix, pos;
int64_t ix, pos;
avi_stream2fourcc(&tag[0], i, s->streams[i]->codec->codec_type);
ix_tag[3] = '0' + i;
......@@ -422,7 +422,7 @@ static int avi_write_idx1(AVFormatContext *s)
{
ByteIOContext *pb = s->pb;
AVIContext *avi = s->priv_data;
offset_t idx_chunk;
int64_t idx_chunk;
int i;
char tag[5];
......@@ -543,7 +543,7 @@ static int avi_write_trailer(AVFormatContext *s)
ByteIOContext *pb = s->pb;
int res = 0;
int i, j, n, nb_frames;
offset_t file_size;
int64_t file_size;
if (!url_is_streamed(pb)){
if (avi->riff_id == 1) {
......
......@@ -153,9 +153,9 @@ int url_write(URLContext *h, unsigned char *buf, int size)
return ret;
}
offset_t url_seek(URLContext *h, offset_t pos, int whence)
int64_t url_seek(URLContext *h, int64_t pos, int whence)
{
offset_t ret;
int64_t ret;
if (!h->prot->url_seek)
return AVERROR(EPIPE);
......@@ -183,9 +183,9 @@ int url_exist(const char *filename)
return 1;
}
offset_t url_filesize(URLContext *h)
int64_t url_filesize(URLContext *h)
{
offset_t pos, size;
int64_t pos, size;
size= url_seek(h, 0, AVSEEK_SIZE);
if(size<0){
......@@ -228,7 +228,7 @@ int av_url_read_pause(URLContext *h, int pause)
return h->prot->url_read_pause(h, pause);
}
offset_t av_url_read_seek(URLContext *h,
int64_t av_url_read_seek(URLContext *h,
int stream_index, int64_t timestamp, int flags)
{
if (!h->prot->url_read_seek)
......
......@@ -23,10 +23,6 @@
#include <stdint.h>
/* output byte stream handling */
typedef int64_t offset_t;
/* unbuffered I/O */
/**
......@@ -67,10 +63,10 @@ int url_open_protocol (URLContext **puc, struct URLProtocol *up,
int url_open(URLContext **h, const char *filename, int flags);
int url_read(URLContext *h, unsigned char *buf, int size);
int url_write(URLContext *h, unsigned char *buf, int size);
offset_t url_seek(URLContext *h, offset_t pos, int whence);
int64_t url_seek(URLContext *h, int64_t pos, int whence);
int url_close(URLContext *h);
int url_exist(const char *filename);
offset_t url_filesize(URLContext *h);
int64_t url_filesize(URLContext *h);
/**
* Return the maximum packet size associated to packetized file
......@@ -118,7 +114,7 @@ int av_url_read_pause(URLContext *h, int pause);
* @return >= 0 on success
* @see AVInputFormat::read_seek
*/
offset_t av_url_read_seek(URLContext *h,
int64_t av_url_read_seek(URLContext *h,
int stream_index, int64_t timestamp, int flags);
/**
......@@ -133,11 +129,11 @@ typedef struct URLProtocol {
int (*url_open)(URLContext *h, const char *filename, int flags);
int (*url_read)(URLContext *h, unsigned char *buf, int size);
int (*url_write)(URLContext *h, unsigned char *buf, int size);
offset_t (*url_seek)(URLContext *h, offset_t pos, int whence);
int64_t (*url_seek)(URLContext *h, int64_t pos, int whence);
int (*url_close)(URLContext *h);
struct URLProtocol *next;
int (*url_read_pause)(URLContext *h, int pause);
offset_t (*url_read_seek)(URLContext *h,
int64_t (*url_read_seek)(URLContext *h,
int stream_index, int64_t timestamp, int flags);
} URLProtocol;
......@@ -162,8 +158,8 @@ typedef struct {
void *opaque;
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size);
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size);
offset_t (*seek)(void *opaque, offset_t offset, int whence);
offset_t pos; /**< position in the file of the current buffer */
int64_t (*seek)(void *opaque, int64_t offset, int whence);
int64_t pos; /**< position in the file of the current buffer */
int must_flush; /**< true if the next seek should flush */
int eof_reached; /**< true if eof reached */
int write_flag; /**< true if open for writing */
......@@ -174,7 +170,7 @@ typedef struct {
unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size);
int error; ///< contains the error code or 0 if no error happened
int (*read_pause)(void *opaque, int pause);
offset_t (*read_seek)(void *opaque,
int64_t (*read_seek)(void *opaque,
int stream_index, int64_t timestamp, int flags);
} ByteIOContext;
......@@ -185,7 +181,7 @@ int init_put_byte(ByteIOContext *s,
void *opaque,
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
offset_t (*seek)(void *opaque, offset_t offset, int whence));
int64_t (*seek)(void *opaque, int64_t offset, int whence));
ByteIOContext *av_alloc_put_byte(
unsigned char *buffer,
int buffer_size,
......@@ -193,7 +189,7 @@ ByteIOContext *av_alloc_put_byte(
void *opaque,
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
offset_t (*seek)(void *opaque, offset_t offset, int whence));
int64_t (*seek)(void *opaque, int64_t offset, int whence));
void put_byte(ByteIOContext *s, int b);
void put_buffer(ByteIOContext *s, const unsigned char *buf, int size);
......@@ -213,25 +209,25 @@ void put_strz(ByteIOContext *s, const char *buf);
* fseek() equivalent for ByteIOContext.
* @return new position or AVERROR.
*/
offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence);
int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence);
/**
* Skip given number of bytes forward.
* @param offset number of bytes
*/
void url_fskip(ByteIOContext *s, offset_t offset);
void url_fskip(ByteIOContext *s, int64_t offset);
/**
* ftell() equivalent for ByteIOContext.
* @return position or AVERROR.
*/
offset_t url_ftell(ByteIOContext *s);
int64_t url_ftell(ByteIOContext *s);
/**
* Gets the filesize.
* @return filesize or AVERROR
*/
offset_t url_fsize(ByteIOContext *s);
int64_t url_fsize(ByteIOContext *s);
/**
* feof() equivalent for ByteIOContext.
......@@ -242,7 +238,7 @@ int url_feof(ByteIOContext *s);
int url_ferror(ByteIOContext *s);
int av_url_read_fpause(ByteIOContext *h, int pause);
offset_t av_url_read_fseek(ByteIOContext *h,
int64_t av_url_read_fseek(ByteIOContext *h,
int stream_index, int64_t timestamp, int flags);
#define URL_EOF (-1)
......
......@@ -35,7 +35,7 @@ int init_put_byte(ByteIOContext *s,
void *opaque,
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
offset_t (*seek)(void *opaque, offset_t offset, int whence))
int64_t (*seek)(void *opaque, int64_t offset, int whence))
{
s->buffer = buffer;
s->buffer_size = buffer_size;
......@@ -68,7 +68,7 @@ ByteIOContext *av_alloc_put_byte(
void *opaque,
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
offset_t (*seek)(void *opaque, offset_t offset, int whence)) {
int64_t (*seek)(void *opaque, int64_t offset, int whence)) {
ByteIOContext *s = av_mallocz(sizeof(ByteIOContext));
init_put_byte(s, buffer, buffer_size, write_flag, opaque,
read_packet, write_packet, seek);
......@@ -125,10 +125,10 @@ void put_flush_packet(ByteIOContext *s)
s->must_flush = 0;
}
offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence)
int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence)
{
offset_t offset1;
offset_t pos;
int64_t offset1;
int64_t pos;
if(!s)
return AVERROR(EINVAL);
......@@ -157,7 +157,7 @@ offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence)
return AVERROR(EPIPE);
s->buf_ptr = s->buf_end + offset - s->pos;
} else {
offset_t res = AVERROR(EPIPE);
int64_t res = AVERROR(EPIPE);
#if defined(CONFIG_MUXERS) || defined(CONFIG_NETWORK)
if (s->write_flag) {
......@@ -176,19 +176,19 @@ offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence)
return offset;
}
void url_fskip(ByteIOContext *s, offset_t offset)
void url_fskip(ByteIOContext *s, int64_t offset)
{
url_fseek(s, offset, SEEK_CUR);
}
offset_t url_ftell(ByteIOContext *s)
int64_t url_ftell(ByteIOContext *s)
{
return url_fseek(s, 0, SEEK_CUR);
}
offset_t url_fsize(ByteIOContext *s)
int64_t url_fsize(ByteIOContext *s)
{
offset_t size;
int64_t size;
if(!s)
return AVERROR(EINVAL);
......@@ -546,7 +546,7 @@ int url_fdopen(ByteIOContext **s, URLContext *h)
(*s)->max_packet_size = max_packet_size;
if(h->prot) {
(*s)->read_pause = (int (*)(void *, int))h->prot->url_read_pause;
(*s)->read_seek = (offset_t (*)(void *, int, int64_t, int))h->prot->url_read_seek;
(*s)->read_seek = (int64_t (*)(void *, int, int64_t, int))h->prot->url_read_seek;
}
return 0;
}
......@@ -660,11 +660,11 @@ int av_url_read_fpause(ByteIOContext *s, int pause)
return s->read_pause(s->opaque, pause);
}
offset_t av_url_read_fseek(ByteIOContext *s,
int64_t av_url_read_fseek(ByteIOContext *s,
int stream_index, int64_t timestamp, int flags)
{
URLContext *h = s->opaque;
offset_t ret;
int64_t ret;
if (!s->read_seek)
return AVERROR(ENOSYS);
ret = s->read_seek(h, stream_index, timestamp, flags);
......@@ -756,7 +756,7 @@ static int dyn_packet_buf_write(void *opaque, uint8_t *buf, int buf_size)
return dyn_buf_write(opaque, buf, buf_size);
}
static offset_t dyn_buf_seek(void *opaque, offset_t offset, int whence)
static int64_t dyn_buf_seek(void *opaque, int64_t offset, int whence)
{
DynBuffer *d = opaque;
......
......@@ -42,7 +42,7 @@ enum {
typedef struct FFMContext {
/* only reading mode */
offset_t write_index, file_size;
int64_t write_index, file_size;
int read_state;
uint8_t header[FRAME_HEADER_SIZE+4];
......
......@@ -24,7 +24,7 @@
#ifdef CONFIG_FFSERVER
#include <unistd.h>
offset_t ffm_read_write_index(int fd)
int64_t ffm_read_write_index(int fd)
{
uint8_t buf[8];
......@@ -33,7 +33,7 @@ offset_t ffm_read_write_index(int fd)
return AV_RB64(buf);
}
void ffm_write_write_index(int fd, offset_t pos)
void ffm_write_write_index(int fd, int64_t pos)
{
uint8_t buf[8];
int i;
......@@ -44,7 +44,7 @@ void ffm_write_write_index(int fd, offset_t pos)
write(fd, buf, 8);
}
void ffm_set_write_index(AVFormatContext *s, offset_t pos, offset_t file_size)
void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size)
{
FFMContext *ffm = s->priv_data;
ffm->write_index = pos;
......@@ -55,7 +55,7 @@ void ffm_set_write_index(AVFormatContext *s, offset_t pos, offset_t file_size)
static int ffm_is_avail_data(AVFormatContext *s, int size)
{
FFMContext *ffm = s->priv_data;
offset_t pos, avail_size;
int64_t pos, avail_size;
int len;
len = ffm->packet_end - ffm->packet_ptr;
......@@ -141,11 +141,11 @@ static int ffm_read_data(AVFormatContext *s,
/* pos is between 0 and file_size - FFM_PACKET_SIZE. It is translated
by the write position inside this function */
static void ffm_seek1(AVFormatContext *s, offset_t pos1)
static void ffm_seek1(AVFormatContext *s, int64_t pos1)
{
FFMContext *ffm = s->priv_data;
ByteIOContext *pb = s->pb;
offset_t pos;
int64_t pos;
pos = pos1 + ffm->write_index;
if (pos >= ffm->file_size)
......@@ -156,7 +156,7 @@ static void ffm_seek1(AVFormatContext *s, offset_t pos1)
url_fseek(pb, pos, SEEK_SET);
}
static int64_t get_dts(AVFormatContext *s, offset_t pos)
static int64_t get_dts(AVFormatContext *s, int64_t pos)
{
ByteIOContext *pb = s->pb;
int64_t dts;
......@@ -175,10 +175,10 @@ static void adjust_write_index(AVFormatContext *s)
FFMContext *ffm = s->priv_data;
ByteIOContext *pb = s->pb;
int64_t pts;
//offset_t orig_write_index = ffm->write_index;
offset_t pos_min, pos_max;
//int64_t orig_write_index = ffm->write_index;
int64_t pos_min, pos_max;
int64_t pts_start;
offset_t ptr = url_ftell(pb);
int64_t ptr = url_ftell(pb);
pos_min = 0;
......@@ -199,7 +199,7 @@ static void adjust_write_index(AVFormatContext *s)
if (pts - 100000 <= pts_start) {
while (1) {
offset_t newpos;
int64_t newpos;
int64_t newpts;
newpos = ((pos_max + pos_min) / (2 * FFM_PACKET_SIZE)) * FFM_PACKET_SIZE;
......@@ -419,7 +419,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt)
static int ffm_seek(AVFormatContext *s, int stream_index, int64_t wanted_pts, int flags)
{
FFMContext *ffm = s->priv_data;
offset_t pos_min, pos_max, pos;
int64_t pos_min, pos_max, pos;
int64_t pts_min, pts_max, pts;
double pos1;
......
......@@ -67,7 +67,7 @@ static int file_write(URLContext *h, unsigned char *buf, int size)
}
/* XXX: use llseek */
static offset_t file_seek(URLContext *h, offset_t pos, int whence)
static int64_t file_seek(URLContext *h, int64_t pos, int whence)
{
int fd = (size_t)h->priv_data;
return lseek(fd, pos, whence);
......
......@@ -48,8 +48,8 @@ static const AVCodecTag flv_audio_codec_ids[] = {
typedef struct FLVContext {
int reserved;
offset_t duration_offset;
offset_t filesize_offset;
int64_t duration_offset;
int64_t filesize_offset;
int64_t duration;
int delay; ///< first dts delay for AVC
} FLVContext;
......@@ -250,7 +250,7 @@ static int flv_write_header(AVFormatContext *s)
for (i = 0; i < s->nb_streams; i++) {
AVCodecContext *enc = s->streams[i]->codec;
if (enc->codec_id == CODEC_ID_AAC || enc->codec_id == CODEC_ID_H264) {
offset_t pos;
int64_t pos;
put_byte(pb, enc->codec_type == CODEC_TYPE_VIDEO ?
FLV_TAG_TYPE_VIDEO : FLV_TAG_TYPE_AUDIO);
put_be24(pb, 0); // size patched later
......
......@@ -120,16 +120,16 @@ static int gxf_find_lines_index(GXFStreamContext *ctx)
return -1;
}
static void gxf_write_padding(ByteIOContext *pb, offset_t to_pad)
static void gxf_write_padding(ByteIOContext *pb, int64_t to_pad)
{
for (; to_pad > 0; to_pad--) {
put_byte(pb, 0);
}
}
static offset_t updatePacketSize(ByteIOContext *pb, offset_t pos)
static int64_t updatePacketSize(ByteIOContext *pb, int64_t pos)
{
offset_t curpos;
int64_t curpos;
int size;
size = url_ftell(pb) - pos;
......@@ -144,9 +144,9 @@ static offset_t updatePacketSize(ByteIOContext *pb, offset_t pos)
return curpos - pos;
}
static offset_t updateSize(ByteIOContext *pb, offset_t pos)
static int64_t updateSize(ByteIOContext *pb, int64_t pos)
{
offset_t curpos;
int64_t curpos;
curpos = url_ftell(pb);
url_fseek(pb, pos, SEEK_SET);
......@@ -207,7 +207,7 @@ static int gxf_write_timecode_auxiliary(ByteIOContext *pb, GXFStreamContext *ctx
static int gxf_write_track_description(ByteIOContext *pb, GXFStreamContext *stream)
{
offset_t pos;
int64_t pos;
/* track description section */
put_byte(pb, stream->media_type + 0x80);
......@@ -261,7 +261,7 @@ static int gxf_write_track_description(ByteIOContext *pb, GXFStreamContext *stre
static int gxf_write_material_data_section(ByteIOContext *pb, GXFContext *ctx)
{
offset_t pos;
int64_t pos;
const char *filename = strrchr(ctx->fc->filename, '/');
pos = url_ftell(pb);
......@@ -307,7 +307,7 @@ static int gxf_write_material_data_section(ByteIOContext *pb, GXFContext *ctx)
static int gxf_write_track_description_section(ByteIOContext *pb, GXFContext *ctx)
{
offset_t pos;
int64_t pos;
int i;
pos = url_ftell(pb);
......@@ -319,7 +319,7 @@ static int gxf_write_track_description_section(ByteIOContext *pb, GXFContext *ct
static int gxf_write_map_packet(ByteIOContext *pb, GXFContext *ctx)
{
offset_t pos = url_ftell(pb);
int64_t pos = url_ftell(pb);
gxf_write_packet_header(pb, PKT_MAP);
......@@ -336,7 +336,7 @@ static int gxf_write_map_packet(ByteIOContext *pb, GXFContext *ctx)
#if 0
static int gxf_write_flt_packet(ByteIOContext *pb, GXFContext *ctx)
{
offset_t pos = url_ftell(pb);
int64_t pos = url_ftell(pb);
int i;
gxf_write_packet_header(pb, PKT_FLT);
......@@ -390,7 +390,7 @@ static int gxf_write_umf_payload(ByteIOContext *pb, GXFContext *ctx)
static int gxf_write_umf_track_description(ByteIOContext *pb, GXFContext *ctx)
{
offset_t pos = url_ftell(pb);
int64_t pos = url_ftell(pb);
int tracks[255]={0};
int i;
......@@ -486,7 +486,7 @@ static int gxf_write_umf_media_mjpeg(ByteIOContext *pb, GXFStreamContext *track)
static int gxf_write_umf_media_description(ByteIOContext *pb, GXFContext *ctx)
{
offset_t pos;
int64_t pos;
int i;
pos = url_ftell(pb);
......@@ -494,7 +494,7 @@ static int gxf_write_umf_media_description(ByteIOContext *pb, GXFContext *ctx)
for (i = 0; i < ctx->fc->nb_streams; ++i) {
GXFStreamContext *sc = &ctx->streams[i];
char buffer[88];
offset_t startpos, curpos;
int64_t startpos, curpos;
int path_size = strlen(ES_NAME_PATTERN);
memset(buffer, 0, 88);
......@@ -538,7 +538,7 @@ static int gxf_write_umf_media_description(ByteIOContext *pb, GXFContext *ctx)
static int gxf_write_umf_user_data(ByteIOContext *pb, GXFContext *ctx)
{
offset_t pos = url_ftell(pb);
int64_t pos = url_ftell(pb);
ctx->umf_user_data_offset = pos - ctx->umf_start_offset;
put_le32(pb, 20);
put_le32(pb, 0);
......@@ -554,7 +554,7 @@ static int gxf_write_umf_user_data(ByteIOContext *pb, GXFContext *ctx)
static int gxf_write_umf_packet(ByteIOContext *pb, GXFContext *ctx)
{
offset_t pos = url_ftell(pb);
int64_t pos = url_ftell(pb);
gxf_write_packet_header(pb, PKT_UMF);
......@@ -663,7 +663,7 @@ static int gxf_write_header(AVFormatContext *s)
static int gxf_write_eos_packet(ByteIOContext *pb, GXFContext *ctx)
{
offset_t pos = url_ftell(pb);
int64_t pos = url_ftell(pb);
gxf_write_packet_header(pb, PKT_EOS);
return updatePacketSize(pb, pos);
......@@ -673,7 +673,7 @@ static int gxf_write_trailer(AVFormatContext *s)
{
ByteIOContext *pb = s->pb;
GXFContext *gxf = s->priv_data;
offset_t end;
int64_t end;
int i;
for (i = 0; i < s->nb_streams; ++i) {
......@@ -745,7 +745,7 @@ static int gxf_write_media_preamble(ByteIOContext *pb, GXFContext *ctx, AVPacket
static int gxf_write_media_packet(ByteIOContext *pb, GXFContext *ctx, AVPacket *pkt)
{
GXFStreamContext *sc = &ctx->streams[pkt->stream_index];
offset_t pos = url_ftell(pb);
int64_t pos = url_ftell(pb);
int padding = 0;
gxf_write_packet_header(pb, PKT_MEDIA);
......
......@@ -41,7 +41,7 @@ typedef struct {
unsigned char buffer[BUFFER_SIZE], *buf_ptr, *buf_end;
int line_count;
int http_code;
offset_t off, filesize;
int64_t off, filesize;
char location[URL_SIZE];
} HTTPContext;
......@@ -213,7 +213,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr,
char line[1024], *q;
char *auth_b64;
int auth_b64_len = strlen(auth)* 4 / 3 + 12;
offset_t off = s->off;
int64_t off = s->off;
/* send http header */
......@@ -316,11 +316,11 @@ static int http_close(URLContext *h)
return 0;
}
static offset_t http_seek(URLContext *h, offset_t off, int whence)
static int64_t http_seek(URLContext *h, int64_t off, int whence)
{
HTTPContext *s = h->priv_data;
URLContext *old_hd = s->hd;
offset_t old_off = s->off;
int64_t old_off = s->off;
if (whence == AVSEEK_SIZE)
return s->filesize;
......
......@@ -181,7 +181,7 @@ static int roq_read_packet(AVFormatContext *s,
unsigned int codebook_size;
unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE];
int packet_read = 0;
offset_t codebook_offset;
int64_t codebook_offset;
while (!packet_read) {
......
......@@ -107,14 +107,14 @@ typedef struct IPMVEContext {
int video_stream_index;
int audio_stream_index;
offset_t audio_chunk_offset;
int64_t audio_chunk_offset;
int audio_chunk_size;
offset_t video_chunk_offset;
int64_t video_chunk_offset;
int video_chunk_size;
offset_t decode_map_chunk_offset;
int64_t decode_map_chunk_offset;
int decode_map_chunk_size;
offset_t next_chunk_offset;
int64_t next_chunk_offset;
AVPaletteControl palette_control;
......
......@@ -200,7 +200,7 @@ typedef struct {
EbmlList seekhead;
/* byte position of the segment inside the stream */
offset_t segment_start;
int64_t segment_start;
/* the packet queue */
AVPacket **packets;
......@@ -495,7 +495,7 @@ const struct {
static int ebml_level_end(MatroskaDemuxContext *matroska)
{
ByteIOContext *pb = matroska->ctx->pb;
offset_t pos = url_ftell(pb);
int64_t pos = url_ftell(pb);
if (matroska->num_levels > 0) {
MatroskaLevel *level = &matroska->levels[matroska->num_levels - 1];
......@@ -527,7 +527,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, ByteIOContext *pb,
if (!(total = get_byte(pb))) {
/* we might encounter EOS here */
if (!url_feof(pb)) {
offset_t pos = url_ftell(pb);
int64_t pos = url_ftell(pb);
av_log(matroska->ctx, AV_LOG_ERROR,
"Read error at pos. %"PRIu64" (0x%"PRIx64")\n",
pos, pos);
......@@ -541,7 +541,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, ByteIOContext *pb,
len_mask >>= 1;
}
if (read > max_size) {
offset_t pos = url_ftell(pb) - 1;
int64_t pos = url_ftell(pb) - 1;
av_log(matroska->ctx, AV_LOG_ERROR,
"Invalid EBML number size tag 0x%02x at pos %"PRIu64" (0x%"PRIx64")\n",
(uint8_t) total, pos, pos);
......@@ -1000,12 +1000,12 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska)
EbmlList *seekhead_list = &matroska->seekhead;
MatroskaSeekhead *seekhead = seekhead_list->elem;
uint32_t level_up = matroska->level_up;
offset_t before_pos = url_ftell(matroska->ctx->pb);
int64_t before_pos = url_ftell(matroska->ctx->pb);
MatroskaLevel level;
int i;
for (i=0; i<seekhead_list->nb_elem; i++) {
offset_t offset = seekhead[i].pos + matroska->segment_start;
int64_t offset = seekhead[i].pos + matroska->segment_start;
if (seekhead[i].pos <= before_pos
|| seekhead[i].id == MATROSKA_ID_SEEKHEAD
......@@ -1666,7 +1666,7 @@ static int matroska_parse_cluster(MatroskaDemuxContext *matroska)
EbmlList *blocks_list;
MatroskaBlock *blocks;
int i, res;
offset_t pos = url_ftell(matroska->ctx->pb);
int64_t pos = url_ftell(matroska->ctx->pb);
matroska->prev_pkt = NULL;
if (matroska->has_cluster_id){
/* For the first cluster we parse, its ID was already read as
......
......@@ -29,7 +29,7 @@
#include "libavcodec/mpeg4audio.h"
typedef struct ebml_master {
offset_t pos; ///< absolute offset in the file where the master's elements start
int64_t pos; ///< absolute offset in the file where the master's elements start
int sizebytes; ///< how many bytes were reserved for the size
} ebml_master;
......@@ -39,8 +39,8 @@ typedef struct mkv_seekhead_entry {
} mkv_seekhead_entry;
typedef struct mkv_seekhead {
offset_t filepos;
offset_t segment_offset; ///< the file offset to the beginning of the segment
int64_t filepos;
int64_t segment_offset; ///< the file offset to the beginning of the segment
int reserved_size; ///< -1 if appending to file
int max_entries;
mkv_seekhead_entry *entries;
......@@ -50,23 +50,23 @@ typedef struct mkv_seekhead {
typedef struct {
uint64_t pts;
int tracknum;
offset_t cluster_pos; ///< file offset of the cluster containing the block
int64_t cluster_pos; ///< file offset of the cluster containing the block
} mkv_cuepoint;
typedef struct {
offset_t segment_offset;
int64_t segment_offset;
mkv_cuepoint *entries;
int num_entries;
} mkv_cues;
typedef struct MatroskaMuxContext {
ebml_master segment;
offset_t segment_offset;
offset_t segment_uid;
int64_t segment_offset;
int64_t segment_uid;
ebml_master cluster;
offset_t cluster_pos; ///< file offset of the current cluster
int64_t cluster_pos; ///< file offset of the current cluster
uint64_t cluster_pts;
offset_t duration_offset;
int64_t duration_offset;
uint64_t duration;
mkv_seekhead *main_seekhead;
mkv_seekhead *cluster_seekhead;
......@@ -188,7 +188,7 @@ static void put_ebml_string(ByteIOContext *pb, unsigned int elementid, const cha
*/
static void put_ebml_void(ByteIOContext *pb, uint64_t size)
{
offset_t currentpos = url_ftell(pb);
int64_t currentpos = url_ftell(pb);
assert(size >= 2);
......@@ -214,7 +214,7 @@ static ebml_master start_ebml_master(ByteIOContext *pb, unsigned int elementid,
static void end_ebml_master(ByteIOContext *pb, ebml_master master)
{
offset_t pos = url_ftell(pb);
int64_t pos = url_ftell(pb);
// leave the unknown size for masters when streaming
if (url_is_streamed(pb))
......@@ -244,7 +244,7 @@ static void put_xiph_size(ByteIOContext *pb, int size)
* @param numelements The maximum number of elements that will be indexed
* by this seek head, 0 if unlimited.
*/
static mkv_seekhead * mkv_start_seekhead(ByteIOContext *pb, offset_t segment_offset, int numelements)
static mkv_seekhead * mkv_start_seekhead(ByteIOContext *pb, int64_t segment_offset, int numelements)
{
mkv_seekhead *new_seekhead = av_mallocz(sizeof(mkv_seekhead));
if (new_seekhead == NULL)
......@@ -291,10 +291,10 @@ static int mkv_add_seekhead_entry(mkv_seekhead *seekhead, unsigned int elementid
*
* @return The file offset where the seekhead was written.
*/
static offset_t mkv_write_seekhead(ByteIOContext *pb, mkv_seekhead *seekhead)
static int64_t mkv_write_seekhead(ByteIOContext *pb, mkv_seekhead *seekhead)
{
ebml_master metaseek, seekentry;
offset_t currentpos;
int64_t currentpos;
int i;
currentpos = url_ftell(pb);
......@@ -330,7 +330,7 @@ static offset_t mkv_write_seekhead(ByteIOContext *pb, mkv_seekhead *seekhead)
return currentpos;
}
static mkv_cues * mkv_start_cues(offset_t segment_offset)
static mkv_cues * mkv_start_cues(int64_t segment_offset)
{
mkv_cues *cues = av_mallocz(sizeof(mkv_cues));
if (cues == NULL)
......@@ -340,7 +340,7 @@ static mkv_cues * mkv_start_cues(offset_t segment_offset)
return cues;
}
static int mkv_add_cuepoint(mkv_cues *cues, AVPacket *pkt, offset_t cluster_pos)
static int mkv_add_cuepoint(mkv_cues *cues, AVPacket *pkt, int64_t cluster_pos)
{
mkv_cuepoint *entries = cues->entries;
......@@ -356,10 +356,10 @@ static int mkv_add_cuepoint(mkv_cues *cues, AVPacket *pkt, offset_t cluster_pos)
return 0;
}
static offset_t mkv_write_cues(ByteIOContext *pb, mkv_cues *cues, int num_tracks)
static int64_t mkv_write_cues(ByteIOContext *pb, mkv_cues *cues, int num_tracks)
{
ebml_master cues_element;
offset_t currentpos;
int64_t currentpos;
int i, j;
currentpos = url_ftell(pb);
......@@ -801,7 +801,7 @@ static int mkv_write_trailer(AVFormatContext *s)
{
MatroskaMuxContext *mkv = s->priv_data;
ByteIOContext *pb = s->pb;
offset_t currentpos, second_seekhead, cuespos;
int64_t currentpos, second_seekhead, cuespos;
int ret;
end_ebml_master(pb, mkv->cluster);
......
......@@ -23,8 +23,8 @@
#include "riff.h"
typedef struct {
offset_t atrpos, atsqpos, awapos;
offset_t data_size;
int64_t atrpos, atsqpos, awapos;
int64_t data_size;
} MMFContext;
static const int mmf_rates[] = { 4000, 8000, 11025, 22050, 44100 };
......@@ -47,9 +47,9 @@ static int mmf_rate_code(int rate)
}
/* Copy of end_tag() from avienc.c, but for big-endian chunk size */
static void end_tag_be(ByteIOContext *pb, offset_t start)
static void end_tag_be(ByteIOContext *pb, int64_t start)
{
offset_t pos;
int64_t pos;
pos = url_ftell(pb);
url_fseek(pb, start - 4, SEEK_SET);
......@@ -61,7 +61,7 @@ static int mmf_write_header(AVFormatContext *s)
{
MMFContext *mmf = s->priv_data;
ByteIOContext *pb = s->pb;
offset_t pos;
int64_t pos;
int rate;
rate = mmf_rate_code(s->streams[0]->codec->sample_rate);
......@@ -129,7 +129,7 @@ static int mmf_write_trailer(AVFormatContext *s)
{
ByteIOContext *pb = s->pb;
MMFContext *mmf = s->priv_data;
offset_t pos, size;
int64_t pos, size;
int gatetime;
if (!url_is_streamed(s->pb)) {
......@@ -185,7 +185,7 @@ static int mmf_read_header(AVFormatContext *s,
unsigned int tag;
ByteIOContext *pb = s->pb;
AVStream *st;
offset_t file_size, size;
int64_t file_size, size;
int rate, params;
tag = get_le32(pb);
......
......@@ -211,7 +211,7 @@ static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
if (mov_default_parse_table[i].type == 0) { /* skip leaf atoms data */
url_fskip(pb, a.size);
} else {
offset_t start_pos = url_ftell(pb);
int64_t start_pos = url_ftell(pb);
int64_t left;
err = mov_default_parse_table[i].parse(c, pb, a);
if (url_is_streamed(pb) && c->found_moov && c->found_mdat)
......@@ -247,7 +247,7 @@ static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
for (i = 0; i < sc->drefs_count; i++) {
MOV_dref_t *dref = &sc->drefs[i];
uint32_t size = get_be32(pb);
offset_t next = url_ftell(pb) + size - 4;
int64_t next = url_ftell(pb) + size - 4;
dref->type = get_le32(pb);
get_be32(pb); // version + flags
......@@ -723,7 +723,7 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
enum CodecID id;
int dref_id;
MOV_atom_t a = { 0, 0, 0 };
offset_t start_pos = url_ftell(pb);
int64_t start_pos = url_ftell(pb);
int size = get_be32(pb); /* size */
uint32_t format = get_le32(pb); /* data format */
......@@ -1181,7 +1181,7 @@ static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
static void mov_build_index(MOVContext *mov, AVStream *st)
{
MOVStreamContext *sc = st->priv_data;
offset_t current_offset;
int64_t current_offset;
int64_t current_dts = 0;
unsigned int stts_index = 0;
unsigned int stsc_index = 0;
......
This diff is collapsed.
......@@ -224,7 +224,7 @@ static void id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t fl
{
int isv34, tlen;
uint32_t tag;
offset_t next;
int64_t next;
char tmp[16];
int taghdrlen;
const char *reason;
......@@ -402,11 +402,11 @@ static int mp3_read_probe(AVProbeData *p)
/**
* Try to find Xing/Info/VBRI tags and compute duration from info therein
*/
static void mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, offset_t base)
static void mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
{
uint32_t v, spf;
int frames = -1; /* Total number of frames in file */
const offset_t xing_offtbl[2][2] = {{32, 17}, {17,9}};
const int64_t xing_offtbl[2][2] = {{32, 17}, {17,9}};
MPADecodeContext c;
v = get_be32(s->pb);
......@@ -452,7 +452,7 @@ static int mp3_read_header(AVFormatContext *s,
AVStream *st;
uint8_t buf[ID3v1_TAG_SIZE];
int len, ret, filesize;
offset_t off;
int64_t off;
st = av_new_stream(s, 0);
if (!st)
......
......@@ -46,7 +46,7 @@ enum MXFMetadataSetType {
typedef struct {
UID key;
offset_t offset;
int64_t offset;
uint64_t length;
} KLVPacket;
......
......@@ -238,7 +238,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
static const uint8_t checkv[16] = {0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b};
MXFContext *mxf = s->priv_data;
ByteIOContext *pb = s->pb;
offset_t end = url_ftell(pb) + klv->length;
int64_t end = url_ftell(pb) + klv->length;
uint64_t size;
uint64_t orig_size;
uint64_t plaintext_size;
......
......@@ -438,7 +438,7 @@ ogg_get_length (AVFormatContext * s)
{
ogg_t *ogg = s->priv_data;
int idx = -1, i;
offset_t size, end;
int64_t size, end;
if(url_is_streamed(s->pb))
return 0;
......
......@@ -36,9 +36,9 @@ typedef struct {
int eos;
} OGGStreamContext;
static void ogg_update_checksum(AVFormatContext *s, offset_t crc_offset)
static void ogg_update_checksum(AVFormatContext *s, int64_t crc_offset)
{
offset_t pos = url_ftell(s->pb);
int64_t pos = url_ftell(s->pb);
uint32_t checksum = get_checksum(s->pb);
url_fseek(s->pb, crc_offset, SEEK_SET);
put_be32(s->pb, checksum);
......@@ -49,7 +49,7 @@ static int ogg_write_page(AVFormatContext *s, const uint8_t *data, int size,
int64_t granule, int stream_index, int flags)
{
OGGStreamContext *oggstream = s->streams[stream_index]->priv_data;
offset_t crc_offset;
int64_t crc_offset;
int page_segments, i;
if (size >= 255*255) {
......
......@@ -48,7 +48,7 @@ static int flac_write_trailer(struct AVFormatContext *s)
ByteIOContext *pb = s->pb;
uint8_t *streaminfo = s->streams[0]->codec->extradata;
int len = s->streams[0]->codec->extradata_size;
offset_t file_size;
int64_t file_size;
if (streaminfo && len > 0 && !url_is_streamed(s->pb)) {
file_size = url_ftell(pb);
......
......@@ -215,16 +215,16 @@ const AVCodecTag codec_wav_tags[] = {
};
#ifdef CONFIG_MUXERS
offset_t start_tag(ByteIOContext *pb, const char *tag)
int64_t start_tag(ByteIOContext *pb, const char *tag)
{
put_tag(pb, tag);
put_le32(pb, 0);
return url_ftell(pb);
}
void end_tag(ByteIOContext *pb, offset_t start)
void end_tag(ByteIOContext *pb, int64_t start)
{
offset_t pos;
int64_t pos;
pos = url_ftell(pb);
url_fseek(pb, start - 4, SEEK_SET);
......
......@@ -31,8 +31,8 @@
#include "libavcodec/avcodec.h"
#include "avio.h"
offset_t start_tag(ByteIOContext *pb, const char *tag);
void end_tag(ByteIOContext *pb, offset_t start);
int64_t start_tag(ByteIOContext *pb, const char *tag);
void end_tag(ByteIOContext *pb, int64_t start);
typedef struct AVCodecTag {
int id;
......
......@@ -36,7 +36,7 @@
typedef struct {
int stream;
offset_t sample_offset;
int64_t sample_offset;
unsigned int sample_size;
int64_t pts;
int keyframe;
......
......@@ -34,7 +34,7 @@
typedef struct {
int stream_index;
offset_t frame_offset;
int64_t frame_offset;
unsigned int frame_size;
int64_t pts;
int keyframe;
......@@ -77,7 +77,7 @@ static int vmd_read_header(AVFormatContext *s,
unsigned int toc_offset;
unsigned char *raw_frame_table;
int raw_frame_table_size;
offset_t current_offset;
int64_t current_offset;
int i, j;
unsigned int total_frames;
int64_t pts_inc = 1;
......
......@@ -64,7 +64,7 @@ typedef struct SmackerContext {
int buf_sizes[7];
int stream_id[7];
int curstream;
offset_t nextpos;
int64_t nextpos;
int64_t aud_pts[7];
} SmackerContext;
......
......@@ -66,9 +66,9 @@
typedef struct {
int audio_stream_index;
offset_t duration_pos;
offset_t tag_pos;
offset_t vframes_pos;
int64_t duration_pos;
int64_t tag_pos;
int64_t vframes_pos;
int samples_per_frame;
int sound_samples;
int swf_frame_number;
......
......@@ -44,7 +44,7 @@ static void put_swf_end_tag(AVFormatContext *s)
{
SWFContext *swf = s->priv_data;
ByteIOContext *pb = s->pb;
offset_t pos;
int64_t pos;
int tag_len, tag;
pos = url_ftell(pb);
......
......@@ -1701,7 +1701,7 @@ static void av_estimate_timings_from_bit_rate(AVFormatContext *ic)
#define DURATION_MAX_READ_SIZE 250000
/* only usable for MPEG-PS streams */
static void av_estimate_timings_from_pts(AVFormatContext *ic, offset_t old_offset)
static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
{
AVPacket pkt1, *pkt = &pkt1;
AVStream *st;
......@@ -1794,7 +1794,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, offset_t old_offse
}
}
static void av_estimate_timings(AVFormatContext *ic, offset_t old_offset)
static void av_estimate_timings(AVFormatContext *ic, int64_t old_offset)
{
int64_t file_size;
......@@ -2003,7 +2003,7 @@ int av_find_stream_info(AVFormatContext *ic)
int64_t last_dts[MAX_STREAMS];
int duration_count[MAX_STREAMS]={0};
double (*duration_error)[MAX_STD_TIMEBASES];
offset_t old_offset = url_ftell(ic->pb);
int64_t old_offset = url_ftell(ic->pb);
int64_t codec_info_duration[MAX_STREAMS]={0};
int codec_info_nb_frames[MAX_STREAMS]={0};
......
......@@ -23,8 +23,8 @@
#include "riff.h"
typedef struct {
offset_t data;
offset_t data_end;
int64_t data;
int64_t data_end;
int64_t minpts;
int64_t maxpts;
int last_duration;
......@@ -35,7 +35,7 @@ static int wav_write_header(AVFormatContext *s)
{
WAVContext *wav = s->priv_data;
ByteIOContext *pb = s->pb;
offset_t fmt, fact;
int64_t fmt, fact;
put_tag(pb, "RIFF");
put_le32(pb, 0); /* file length */
......@@ -88,7 +88,7 @@ static int wav_write_trailer(AVFormatContext *s)
{
ByteIOContext *pb = s->pb;
WAVContext *wav = s->priv_data;
offset_t file_size;
int64_t file_size;
if (!url_is_streamed(s->pb)) {
end_tag(pb, wav->data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment