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
pull/126/head
Diego Biurrun 16 years ago
parent 0c45cd0720
commit bc5c918ea8
  1. 10
      libavformat/aiff.c
  2. 2
      libavformat/au.c
  3. 6
      libavformat/avformat.h
  4. 8
      libavformat/avidec.c
  5. 22
      libavformat/avienc.c
  6. 10
      libavformat/avio.c
  7. 34
      libavformat/avio.h
  8. 28
      libavformat/aviobuf.c
  9. 2
      libavformat/ffm.h
  10. 24
      libavformat/ffmdec.c
  11. 2
      libavformat/file.c
  12. 6
      libavformat/flvenc.c
  13. 36
      libavformat/gxfenc.c
  14. 8
      libavformat/http.c
  15. 2
      libavformat/idroq.c
  16. 8
      libavformat/ipmovie.c
  17. 14
      libavformat/matroskadec.c
  18. 38
      libavformat/matroskaenc.c
  19. 14
      libavformat/mmf.c
  20. 8
      libavformat/mov.c
  21. 68
      libavformat/movenc.c
  22. 8
      libavformat/mp3.c
  23. 2
      libavformat/mxf.h
  24. 2
      libavformat/mxfdec.c
  25. 2
      libavformat/oggdec.c
  26. 6
      libavformat/oggenc.c
  27. 2
      libavformat/raw.c
  28. 6
      libavformat/riff.c
  29. 4
      libavformat/riff.h
  30. 2
      libavformat/segafilm.c
  31. 4
      libavformat/sierravmd.c
  32. 2
      libavformat/smacker.c
  33. 6
      libavformat/swf.h
  34. 2
      libavformat/swfenc.c
  35. 6
      libavformat/utils.c
  36. 8
      libavformat/wav.c

@ -172,9 +172,9 @@ static unsigned int get_aiff_header(ByteIOContext *pb, AVCodecContext *codec,
#ifdef CONFIG_AIFF_MUXER #ifdef CONFIG_AIFF_MUXER
typedef struct { typedef struct {
offset_t form; int64_t form;
offset_t frames; int64_t frames;
offset_t ssnd; int64_t ssnd;
} AIFFOutputContext; } AIFFOutputContext;
static int aiff_write_header(AVFormatContext *s) static int aiff_write_header(AVFormatContext *s)
@ -265,7 +265,7 @@ static int aiff_write_trailer(AVFormatContext *s)
AVCodecContext *enc = s->streams[0]->codec; AVCodecContext *enc = s->streams[0]->codec;
/* Chunks sizes must be even */ /* Chunks sizes must be even */
offset_t file_size, end_size; int64_t file_size, end_size;
end_size = file_size = url_ftell(pb); end_size = file_size = url_ftell(pb);
if (file_size & 1) { if (file_size & 1) {
put_byte(pb, 0); put_byte(pb, 0);
@ -312,7 +312,7 @@ static int aiff_read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
{ {
int size, filesize; int size, filesize;
offset_t offset = 0; int64_t offset = 0;
uint32_t tag; uint32_t tag;
unsigned version = AIFF_C_VERSION1; unsigned version = AIFF_C_VERSION1;
ByteIOContext *pb = s->pb; ByteIOContext *pb = s->pb;

@ -88,7 +88,7 @@ static int au_write_packet(AVFormatContext *s, AVPacket *pkt)
static int au_write_trailer(AVFormatContext *s) static int au_write_trailer(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; ByteIOContext *pb = s->pb;
offset_t file_size; int64_t file_size;
if (!url_is_streamed(s->pb)) { if (!url_is_streamed(s->pb)) {

@ -1065,9 +1065,9 @@ int64_t av_gettime(void);
/* ffm-specific for ffserver */ /* ffm-specific for ffserver */
#define FFM_PACKET_SIZE 4096 #define FFM_PACKET_SIZE 4096
offset_t ffm_read_write_index(int fd); int64_t ffm_read_write_index(int fd);
void ffm_write_write_index(int fd, offset_t pos); void ffm_write_write_index(int fd, int64_t pos);
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);
/** /**
* Attempts to find a specific tag in a URL. * Attempts to find a specific tag in a URL.

@ -51,7 +51,7 @@ typedef struct {
int64_t riff_end; int64_t riff_end;
int64_t movi_end; int64_t movi_end;
int64_t fsize; int64_t fsize;
offset_t movi_list; int64_t movi_list;
int index_loaded; int index_loaded;
int is_odml; int is_odml;
int non_interleaved; 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) 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); size += (size & 1);
get_strz(pb, buf, maxlen); get_strz(pb, buf, maxlen);
url_fseek(pb, i+size, SEEK_SET); 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; AVIContext *avi = s->priv_data;
ByteIOContext *pb = s->pb; ByteIOContext *pb = s->pb;
int n, d[8], size; int n, d[8], size;
offset_t i, sync; int64_t i, sync;
void* dstr; void* dstr;
if (ENABLE_DV_DEMUXER && avi->dv_demux) { if (ENABLE_DV_DEMUXER && avi->dv_demux) {
@ -937,7 +937,7 @@ static int avi_load_index(AVFormatContext *s)
AVIContext *avi = s->priv_data; AVIContext *avi = s->priv_data;
ByteIOContext *pb = s->pb; ByteIOContext *pb = s->pb;
uint32_t tag, size; uint32_t tag, size;
offset_t pos= url_ftell(pb); int64_t pos= url_ftell(pb);
url_fseek(pb, avi->movi_end, SEEK_SET); url_fseek(pb, avi->movi_end, SEEK_SET);
#ifdef DEBUG_SEEK #ifdef DEBUG_SEEK

@ -35,15 +35,15 @@ typedef struct AVIIentry {
#define AVI_INDEX_CLUSTER_SIZE 16384 #define AVI_INDEX_CLUSTER_SIZE 16384
typedef struct AVIIndex { typedef struct AVIIndex {
offset_t indx_start; int64_t indx_start;
int entry; int entry;
int ents_allocated; int ents_allocated;
AVIIentry** cluster; AVIIentry** cluster;
} AVIIndex; } AVIIndex;
typedef struct { typedef struct {
offset_t riff_start, movi_list, odml_list; int64_t riff_start, movi_list, odml_list;
offset_t frames_hdr_all, frames_hdr_strm[MAX_STREAMS]; int64_t frames_hdr_all, frames_hdr_strm[MAX_STREAMS];
int audio_strm_length[MAX_STREAMS]; int audio_strm_length[MAX_STREAMS];
int riff_id; int riff_id;
int packet_count[MAX_STREAMS]; 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]; return &idx->cluster[cl][id];
} }
static offset_t avi_start_new_riff(AVIContext *avi, ByteIOContext *pb, static int64_t avi_start_new_riff(AVIContext *avi, ByteIOContext *pb,
const char* riff_tag, const char* list_tag) const char* riff_tag, const char* list_tag)
{ {
offset_t loff; int64_t loff;
int i; int i;
avi->riff_id++; avi->riff_id++;
@ -108,7 +108,7 @@ static int avi_write_counters(AVFormatContext* s, int riff_id)
ByteIOContext *pb = s->pb; ByteIOContext *pb = s->pb;
AVIContext *avi = s->priv_data; AVIContext *avi = s->priv_data;
int n, au_byterate, au_ssize, au_scale, nb_frames = 0; int n, au_byterate, au_ssize, au_scale, nb_frames = 0;
offset_t file_size; int64_t file_size;
AVCodecContext* stream; AVCodecContext* stream;
file_size = url_ftell(pb); file_size = url_ftell(pb);
@ -141,7 +141,7 @@ static int avi_write_header(AVFormatContext *s)
ByteIOContext *pb = s->pb; ByteIOContext *pb = s->pb;
int bitrate, n, i, nb_frames, au_byterate, au_ssize, au_scale; int bitrate, n, i, nb_frames, au_byterate, au_ssize, au_scale;
AVCodecContext *stream, *video_enc; AVCodecContext *stream, *video_enc;
offset_t list1, list2, strh, strf; int64_t list1, list2, strh, strf;
/* header list */ /* header list */
avi->riff_id = 0; avi->riff_id = 0;
@ -375,7 +375,7 @@ static int avi_write_ix(AVFormatContext *s)
return -1; return -1;
for (i=0;i<s->nb_streams;i++) { 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); avi_stream2fourcc(&tag[0], i, s->streams[i]->codec->codec_type);
ix_tag[3] = '0' + i; ix_tag[3] = '0' + i;
@ -422,7 +422,7 @@ static int avi_write_idx1(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; ByteIOContext *pb = s->pb;
AVIContext *avi = s->priv_data; AVIContext *avi = s->priv_data;
offset_t idx_chunk; int64_t idx_chunk;
int i; int i;
char tag[5]; char tag[5];
@ -543,7 +543,7 @@ static int avi_write_trailer(AVFormatContext *s)
ByteIOContext *pb = s->pb; ByteIOContext *pb = s->pb;
int res = 0; int res = 0;
int i, j, n, nb_frames; int i, j, n, nb_frames;
offset_t file_size; int64_t file_size;
if (!url_is_streamed(pb)){ if (!url_is_streamed(pb)){
if (avi->riff_id == 1) { if (avi->riff_id == 1) {

@ -153,9 +153,9 @@ int url_write(URLContext *h, unsigned char *buf, int size)
return ret; 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) if (!h->prot->url_seek)
return AVERROR(EPIPE); return AVERROR(EPIPE);
@ -183,9 +183,9 @@ int url_exist(const char *filename)
return 1; 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); size= url_seek(h, 0, AVSEEK_SIZE);
if(size<0){ if(size<0){
@ -228,7 +228,7 @@ int av_url_read_pause(URLContext *h, int pause)
return h->prot->url_read_pause(h, 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) int stream_index, int64_t timestamp, int flags)
{ {
if (!h->prot->url_read_seek) if (!h->prot->url_read_seek)

@ -23,10 +23,6 @@
#include <stdint.h> #include <stdint.h>
/* output byte stream handling */
typedef int64_t offset_t;
/* unbuffered I/O */ /* 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_open(URLContext **h, const char *filename, int flags);
int url_read(URLContext *h, unsigned char *buf, int size); int url_read(URLContext *h, unsigned char *buf, int size);
int url_write(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_close(URLContext *h);
int url_exist(const char *filename); 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 * 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 * @return >= 0 on success
* @see AVInputFormat::read_seek * @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); 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_open)(URLContext *h, const char *filename, int flags);
int (*url_read)(URLContext *h, unsigned char *buf, int size); int (*url_read)(URLContext *h, unsigned char *buf, int size);
int (*url_write)(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_close)(URLContext *h);
struct URLProtocol *next; struct URLProtocol *next;
int (*url_read_pause)(URLContext *h, int pause); 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); int stream_index, int64_t timestamp, int flags);
} URLProtocol; } URLProtocol;
@ -162,8 +158,8 @@ typedef struct {
void *opaque; void *opaque;
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); int (*read_packet)(void *opaque, uint8_t *buf, int buf_size);
int (*write_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);
offset_t pos; /**< position in the file of the current buffer */ int64_t pos; /**< position in the file of the current buffer */
int must_flush; /**< true if the next seek should flush */ int must_flush; /**< true if the next seek should flush */
int eof_reached; /**< true if eof reached */ int eof_reached; /**< true if eof reached */
int write_flag; /**< true if open for writing */ 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); 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 error; ///< contains the error code or 0 if no error happened
int (*read_pause)(void *opaque, int pause); 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); int stream_index, int64_t timestamp, int flags);
} ByteIOContext; } ByteIOContext;
@ -185,7 +181,7 @@ int init_put_byte(ByteIOContext *s,
void *opaque, void *opaque,
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
int (*write_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( ByteIOContext *av_alloc_put_byte(
unsigned char *buffer, unsigned char *buffer,
int buffer_size, int buffer_size,
@ -193,7 +189,7 @@ ByteIOContext *av_alloc_put_byte(
void *opaque, void *opaque,
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
int (*write_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_byte(ByteIOContext *s, int b);
void put_buffer(ByteIOContext *s, const unsigned char *buf, int size); 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. * fseek() equivalent for ByteIOContext.
* @return new position or AVERROR. * @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. * Skip given number of bytes forward.
* @param offset number of bytes * @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. * ftell() equivalent for ByteIOContext.
* @return position or AVERROR. * @return position or AVERROR.
*/ */
offset_t url_ftell(ByteIOContext *s); int64_t url_ftell(ByteIOContext *s);
/** /**
* Gets the filesize. * Gets the filesize.
* @return filesize or AVERROR * @return filesize or AVERROR
*/ */
offset_t url_fsize(ByteIOContext *s); int64_t url_fsize(ByteIOContext *s);
/** /**
* feof() equivalent for ByteIOContext. * feof() equivalent for ByteIOContext.
@ -242,7 +238,7 @@ int url_feof(ByteIOContext *s);
int url_ferror(ByteIOContext *s); int url_ferror(ByteIOContext *s);
int av_url_read_fpause(ByteIOContext *h, int pause); 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); int stream_index, int64_t timestamp, int flags);
#define URL_EOF (-1) #define URL_EOF (-1)

@ -35,7 +35,7 @@ int init_put_byte(ByteIOContext *s,
void *opaque, void *opaque,
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
int (*write_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 = buffer;
s->buffer_size = buffer_size; s->buffer_size = buffer_size;
@ -68,7 +68,7 @@ ByteIOContext *av_alloc_put_byte(
void *opaque, void *opaque,
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
int (*write_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)); ByteIOContext *s = av_mallocz(sizeof(ByteIOContext));
init_put_byte(s, buffer, buffer_size, write_flag, opaque, init_put_byte(s, buffer, buffer_size, write_flag, opaque,
read_packet, write_packet, seek); read_packet, write_packet, seek);
@ -125,10 +125,10 @@ void put_flush_packet(ByteIOContext *s)
s->must_flush = 0; 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; int64_t offset1;
offset_t pos; int64_t pos;
if(!s) if(!s)
return AVERROR(EINVAL); return AVERROR(EINVAL);
@ -157,7 +157,7 @@ offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence)
return AVERROR(EPIPE); return AVERROR(EPIPE);
s->buf_ptr = s->buf_end + offset - s->pos; s->buf_ptr = s->buf_end + offset - s->pos;
} else { } else {
offset_t res = AVERROR(EPIPE); int64_t res = AVERROR(EPIPE);
#if defined(CONFIG_MUXERS) || defined(CONFIG_NETWORK) #if defined(CONFIG_MUXERS) || defined(CONFIG_NETWORK)
if (s->write_flag) { if (s->write_flag) {
@ -176,19 +176,19 @@ offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence)
return offset; return offset;
} }
void url_fskip(ByteIOContext *s, offset_t offset) void url_fskip(ByteIOContext *s, int64_t offset)
{ {
url_fseek(s, offset, SEEK_CUR); 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); 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) if(!s)
return AVERROR(EINVAL); return AVERROR(EINVAL);
@ -546,7 +546,7 @@ int url_fdopen(ByteIOContext **s, URLContext *h)
(*s)->max_packet_size = max_packet_size; (*s)->max_packet_size = max_packet_size;
if(h->prot) { if(h->prot) {
(*s)->read_pause = (int (*)(void *, int))h->prot->url_read_pause; (*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; return 0;
} }
@ -660,11 +660,11 @@ int av_url_read_fpause(ByteIOContext *s, int pause)
return s->read_pause(s->opaque, 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) int stream_index, int64_t timestamp, int flags)
{ {
URLContext *h = s->opaque; URLContext *h = s->opaque;
offset_t ret; int64_t ret;
if (!s->read_seek) if (!s->read_seek)
return AVERROR(ENOSYS); return AVERROR(ENOSYS);
ret = s->read_seek(h, stream_index, timestamp, flags); 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); 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; DynBuffer *d = opaque;

@ -42,7 +42,7 @@ enum {
typedef struct FFMContext { typedef struct FFMContext {
/* only reading mode */ /* only reading mode */
offset_t write_index, file_size; int64_t write_index, file_size;
int read_state; int read_state;
uint8_t header[FRAME_HEADER_SIZE+4]; uint8_t header[FRAME_HEADER_SIZE+4];

@ -24,7 +24,7 @@
#ifdef CONFIG_FFSERVER #ifdef CONFIG_FFSERVER
#include <unistd.h> #include <unistd.h>
offset_t ffm_read_write_index(int fd) int64_t ffm_read_write_index(int fd)
{ {
uint8_t buf[8]; uint8_t buf[8];
@ -33,7 +33,7 @@ offset_t ffm_read_write_index(int fd)
return AV_RB64(buf); 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]; uint8_t buf[8];
int i; int i;
@ -44,7 +44,7 @@ void ffm_write_write_index(int fd, offset_t pos)
write(fd, buf, 8); 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; FFMContext *ffm = s->priv_data;
ffm->write_index = pos; 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) static int ffm_is_avail_data(AVFormatContext *s, int size)
{ {
FFMContext *ffm = s->priv_data; FFMContext *ffm = s->priv_data;
offset_t pos, avail_size; int64_t pos, avail_size;
int len; int len;
len = ffm->packet_end - ffm->packet_ptr; 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 /* pos is between 0 and file_size - FFM_PACKET_SIZE. It is translated
by the write position inside this function */ 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; FFMContext *ffm = s->priv_data;
ByteIOContext *pb = s->pb; ByteIOContext *pb = s->pb;
offset_t pos; int64_t pos;
pos = pos1 + ffm->write_index; pos = pos1 + ffm->write_index;
if (pos >= ffm->file_size) if (pos >= ffm->file_size)
@ -156,7 +156,7 @@ static void ffm_seek1(AVFormatContext *s, offset_t pos1)
url_fseek(pb, pos, SEEK_SET); 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; ByteIOContext *pb = s->pb;
int64_t dts; int64_t dts;
@ -175,10 +175,10 @@ static void adjust_write_index(AVFormatContext *s)
FFMContext *ffm = s->priv_data; FFMContext *ffm = s->priv_data;
ByteIOContext *pb = s->pb; ByteIOContext *pb = s->pb;
int64_t pts; int64_t pts;
//offset_t orig_write_index = ffm->write_index; //int64_t orig_write_index = ffm->write_index;
offset_t pos_min, pos_max; int64_t pos_min, pos_max;
int64_t pts_start; int64_t pts_start;
offset_t ptr = url_ftell(pb); int64_t ptr = url_ftell(pb);
pos_min = 0; pos_min = 0;
@ -199,7 +199,7 @@ static void adjust_write_index(AVFormatContext *s)
if (pts - 100000 <= pts_start) { if (pts - 100000 <= pts_start) {
while (1) { while (1) {
offset_t newpos; int64_t newpos;
int64_t newpts; int64_t newpts;
newpos = ((pos_max + pos_min) / (2 * FFM_PACKET_SIZE)) * FFM_PACKET_SIZE; 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) static int ffm_seek(AVFormatContext *s, int stream_index, int64_t wanted_pts, int flags)
{ {
FFMContext *ffm = s->priv_data; 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; int64_t pts_min, pts_max, pts;
double pos1; double pos1;

@ -67,7 +67,7 @@ static int file_write(URLContext *h, unsigned char *buf, int size)
} }
/* XXX: use llseek */ /* 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; int fd = (size_t)h->priv_data;
return lseek(fd, pos, whence); return lseek(fd, pos, whence);

@ -48,8 +48,8 @@ static const AVCodecTag flv_audio_codec_ids[] = {
typedef struct FLVContext { typedef struct FLVContext {
int reserved; int reserved;
offset_t duration_offset; int64_t duration_offset;
offset_t filesize_offset; int64_t filesize_offset;
int64_t duration; int64_t duration;
int delay; ///< first dts delay for AVC int delay; ///< first dts delay for AVC
} FLVContext; } FLVContext;
@ -250,7 +250,7 @@ static int flv_write_header(AVFormatContext *s)
for (i = 0; i < s->nb_streams; i++) { for (i = 0; i < s->nb_streams; i++) {
AVCodecContext *enc = s->streams[i]->codec; AVCodecContext *enc = s->streams[i]->codec;
if (enc->codec_id == CODEC_ID_AAC || enc->codec_id == CODEC_ID_H264) { 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 ? put_byte(pb, enc->codec_type == CODEC_TYPE_VIDEO ?
FLV_TAG_TYPE_VIDEO : FLV_TAG_TYPE_AUDIO); FLV_TAG_TYPE_VIDEO : FLV_TAG_TYPE_AUDIO);
put_be24(pb, 0); // size patched later put_be24(pb, 0); // size patched later

@ -120,16 +120,16 @@ static int gxf_find_lines_index(GXFStreamContext *ctx)
return -1; 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--) { for (; to_pad > 0; to_pad--) {
put_byte(pb, 0); 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; int size;
size = url_ftell(pb) - pos; size = url_ftell(pb) - pos;
@ -144,9 +144,9 @@ static offset_t updatePacketSize(ByteIOContext *pb, offset_t pos)
return curpos - 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); curpos = url_ftell(pb);
url_fseek(pb, pos, SEEK_SET); 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) static int gxf_write_track_description(ByteIOContext *pb, GXFStreamContext *stream)
{ {
offset_t pos; int64_t pos;
/* track description section */ /* track description section */
put_byte(pb, stream->media_type + 0x80); 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) static int gxf_write_material_data_section(ByteIOContext *pb, GXFContext *ctx)
{ {
offset_t pos; int64_t pos;
const char *filename = strrchr(ctx->fc->filename, '/'); const char *filename = strrchr(ctx->fc->filename, '/');
pos = url_ftell(pb); 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) static int gxf_write_track_description_section(ByteIOContext *pb, GXFContext *ctx)
{ {
offset_t pos; int64_t pos;
int i; int i;
pos = url_ftell(pb); 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) 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); gxf_write_packet_header(pb, PKT_MAP);
@ -336,7 +336,7 @@ static int gxf_write_map_packet(ByteIOContext *pb, GXFContext *ctx)
#if 0 #if 0
static int gxf_write_flt_packet(ByteIOContext *pb, GXFContext *ctx) static int gxf_write_flt_packet(ByteIOContext *pb, GXFContext *ctx)
{ {
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
int i; int i;
gxf_write_packet_header(pb, PKT_FLT); 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) 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 tracks[255]={0};
int i; 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) static int gxf_write_umf_media_description(ByteIOContext *pb, GXFContext *ctx)
{ {
offset_t pos; int64_t pos;
int i; int i;
pos = url_ftell(pb); 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) { for (i = 0; i < ctx->fc->nb_streams; ++i) {
GXFStreamContext *sc = &ctx->streams[i]; GXFStreamContext *sc = &ctx->streams[i];
char buffer[88]; char buffer[88];
offset_t startpos, curpos; int64_t startpos, curpos;
int path_size = strlen(ES_NAME_PATTERN); int path_size = strlen(ES_NAME_PATTERN);
memset(buffer, 0, 88); 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) 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; ctx->umf_user_data_offset = pos - ctx->umf_start_offset;
put_le32(pb, 20); put_le32(pb, 20);
put_le32(pb, 0); 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) 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); 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) 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); gxf_write_packet_header(pb, PKT_EOS);
return updatePacketSize(pb, pos); return updatePacketSize(pb, pos);
@ -673,7 +673,7 @@ static int gxf_write_trailer(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; ByteIOContext *pb = s->pb;
GXFContext *gxf = s->priv_data; GXFContext *gxf = s->priv_data;
offset_t end; int64_t end;
int i; int i;
for (i = 0; i < s->nb_streams; ++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) static int gxf_write_media_packet(ByteIOContext *pb, GXFContext *ctx, AVPacket *pkt)
{ {
GXFStreamContext *sc = &ctx->streams[pkt->stream_index]; GXFStreamContext *sc = &ctx->streams[pkt->stream_index];
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
int padding = 0; int padding = 0;
gxf_write_packet_header(pb, PKT_MEDIA); gxf_write_packet_header(pb, PKT_MEDIA);

@ -41,7 +41,7 @@ typedef struct {
unsigned char buffer[BUFFER_SIZE], *buf_ptr, *buf_end; unsigned char buffer[BUFFER_SIZE], *buf_ptr, *buf_end;
int line_count; int line_count;
int http_code; int http_code;
offset_t off, filesize; int64_t off, filesize;
char location[URL_SIZE]; char location[URL_SIZE];
} HTTPContext; } HTTPContext;
@ -213,7 +213,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr,
char line[1024], *q; char line[1024], *q;
char *auth_b64; char *auth_b64;
int auth_b64_len = strlen(auth)* 4 / 3 + 12; int auth_b64_len = strlen(auth)* 4 / 3 + 12;
offset_t off = s->off; int64_t off = s->off;
/* send http header */ /* send http header */
@ -316,11 +316,11 @@ static int http_close(URLContext *h)
return 0; 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; HTTPContext *s = h->priv_data;
URLContext *old_hd = s->hd; URLContext *old_hd = s->hd;
offset_t old_off = s->off; int64_t old_off = s->off;
if (whence == AVSEEK_SIZE) if (whence == AVSEEK_SIZE)
return s->filesize; return s->filesize;

@ -181,7 +181,7 @@ static int roq_read_packet(AVFormatContext *s,
unsigned int codebook_size; unsigned int codebook_size;
unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE]; unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE];
int packet_read = 0; int packet_read = 0;
offset_t codebook_offset; int64_t codebook_offset;
while (!packet_read) { while (!packet_read) {

@ -107,14 +107,14 @@ typedef struct IPMVEContext {
int video_stream_index; int video_stream_index;
int audio_stream_index; int audio_stream_index;
offset_t audio_chunk_offset; int64_t audio_chunk_offset;
int audio_chunk_size; int audio_chunk_size;
offset_t video_chunk_offset; int64_t video_chunk_offset;
int video_chunk_size; int video_chunk_size;
offset_t decode_map_chunk_offset; int64_t decode_map_chunk_offset;
int decode_map_chunk_size; int decode_map_chunk_size;
offset_t next_chunk_offset; int64_t next_chunk_offset;
AVPaletteControl palette_control; AVPaletteControl palette_control;

@ -200,7 +200,7 @@ typedef struct {
EbmlList seekhead; EbmlList seekhead;
/* byte position of the segment inside the stream */ /* byte position of the segment inside the stream */
offset_t segment_start; int64_t segment_start;
/* the packet queue */ /* the packet queue */
AVPacket **packets; AVPacket **packets;
@ -495,7 +495,7 @@ const struct {
static int ebml_level_end(MatroskaDemuxContext *matroska) static int ebml_level_end(MatroskaDemuxContext *matroska)
{ {
ByteIOContext *pb = matroska->ctx->pb; ByteIOContext *pb = matroska->ctx->pb;
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
if (matroska->num_levels > 0) { if (matroska->num_levels > 0) {
MatroskaLevel *level = &matroska->levels[matroska->num_levels - 1]; 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))) { if (!(total = get_byte(pb))) {
/* we might encounter EOS here */ /* we might encounter EOS here */
if (!url_feof(pb)) { if (!url_feof(pb)) {
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
av_log(matroska->ctx, AV_LOG_ERROR, av_log(matroska->ctx, AV_LOG_ERROR,
"Read error at pos. %"PRIu64" (0x%"PRIx64")\n", "Read error at pos. %"PRIu64" (0x%"PRIx64")\n",
pos, pos); pos, pos);
@ -541,7 +541,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, ByteIOContext *pb,
len_mask >>= 1; len_mask >>= 1;
} }
if (read > max_size) { 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, av_log(matroska->ctx, AV_LOG_ERROR,
"Invalid EBML number size tag 0x%02x at pos %"PRIu64" (0x%"PRIx64")\n", "Invalid EBML number size tag 0x%02x at pos %"PRIu64" (0x%"PRIx64")\n",
(uint8_t) total, pos, pos); (uint8_t) total, pos, pos);
@ -1000,12 +1000,12 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska)
EbmlList *seekhead_list = &matroska->seekhead; EbmlList *seekhead_list = &matroska->seekhead;
MatroskaSeekhead *seekhead = seekhead_list->elem; MatroskaSeekhead *seekhead = seekhead_list->elem;
uint32_t level_up = matroska->level_up; 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; MatroskaLevel level;
int i; int i;
for (i=0; i<seekhead_list->nb_elem; 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 if (seekhead[i].pos <= before_pos
|| seekhead[i].id == MATROSKA_ID_SEEKHEAD || seekhead[i].id == MATROSKA_ID_SEEKHEAD
@ -1666,7 +1666,7 @@ static int matroska_parse_cluster(MatroskaDemuxContext *matroska)
EbmlList *blocks_list; EbmlList *blocks_list;
MatroskaBlock *blocks; MatroskaBlock *blocks;
int i, res; int i, res;
offset_t pos = url_ftell(matroska->ctx->pb); int64_t pos = url_ftell(matroska->ctx->pb);
matroska->prev_pkt = NULL; matroska->prev_pkt = NULL;
if (matroska->has_cluster_id){ if (matroska->has_cluster_id){
/* For the first cluster we parse, its ID was already read as /* For the first cluster we parse, its ID was already read as

@ -29,7 +29,7 @@
#include "libavcodec/mpeg4audio.h" #include "libavcodec/mpeg4audio.h"
typedef struct ebml_master { 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 int sizebytes; ///< how many bytes were reserved for the size
} ebml_master; } ebml_master;
@ -39,8 +39,8 @@ typedef struct mkv_seekhead_entry {
} mkv_seekhead_entry; } mkv_seekhead_entry;
typedef struct mkv_seekhead { typedef struct mkv_seekhead {
offset_t filepos; int64_t filepos;
offset_t segment_offset; ///< the file offset to the beginning of the segment int64_t segment_offset; ///< the file offset to the beginning of the segment
int reserved_size; ///< -1 if appending to file int reserved_size; ///< -1 if appending to file
int max_entries; int max_entries;
mkv_seekhead_entry *entries; mkv_seekhead_entry *entries;
@ -50,23 +50,23 @@ typedef struct mkv_seekhead {
typedef struct { typedef struct {
uint64_t pts; uint64_t pts;
int tracknum; 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; } mkv_cuepoint;
typedef struct { typedef struct {
offset_t segment_offset; int64_t segment_offset;
mkv_cuepoint *entries; mkv_cuepoint *entries;
int num_entries; int num_entries;
} mkv_cues; } mkv_cues;
typedef struct MatroskaMuxContext { typedef struct MatroskaMuxContext {
ebml_master segment; ebml_master segment;
offset_t segment_offset; int64_t segment_offset;
offset_t segment_uid; int64_t segment_uid;
ebml_master cluster; 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; uint64_t cluster_pts;
offset_t duration_offset; int64_t duration_offset;
uint64_t duration; uint64_t duration;
mkv_seekhead *main_seekhead; mkv_seekhead *main_seekhead;
mkv_seekhead *cluster_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) 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); 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) 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 // leave the unknown size for masters when streaming
if (url_is_streamed(pb)) 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 * @param numelements The maximum number of elements that will be indexed
* by this seek head, 0 if unlimited. * 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)); mkv_seekhead *new_seekhead = av_mallocz(sizeof(mkv_seekhead));
if (new_seekhead == NULL) 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. * @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; ebml_master metaseek, seekentry;
offset_t currentpos; int64_t currentpos;
int i; int i;
currentpos = url_ftell(pb); currentpos = url_ftell(pb);
@ -330,7 +330,7 @@ static offset_t mkv_write_seekhead(ByteIOContext *pb, mkv_seekhead *seekhead)
return currentpos; 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)); mkv_cues *cues = av_mallocz(sizeof(mkv_cues));
if (cues == NULL) if (cues == NULL)
@ -340,7 +340,7 @@ static mkv_cues * mkv_start_cues(offset_t segment_offset)
return cues; 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; 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; 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; ebml_master cues_element;
offset_t currentpos; int64_t currentpos;
int i, j; int i, j;
currentpos = url_ftell(pb); currentpos = url_ftell(pb);
@ -801,7 +801,7 @@ static int mkv_write_trailer(AVFormatContext *s)
{ {
MatroskaMuxContext *mkv = s->priv_data; MatroskaMuxContext *mkv = s->priv_data;
ByteIOContext *pb = s->pb; ByteIOContext *pb = s->pb;
offset_t currentpos, second_seekhead, cuespos; int64_t currentpos, second_seekhead, cuespos;
int ret; int ret;
end_ebml_master(pb, mkv->cluster); end_ebml_master(pb, mkv->cluster);

@ -23,8 +23,8 @@
#include "riff.h" #include "riff.h"
typedef struct { typedef struct {
offset_t atrpos, atsqpos, awapos; int64_t atrpos, atsqpos, awapos;
offset_t data_size; int64_t data_size;
} MMFContext; } MMFContext;
static const int mmf_rates[] = { 4000, 8000, 11025, 22050, 44100 }; 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 */ /* 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); pos = url_ftell(pb);
url_fseek(pb, start - 4, SEEK_SET); url_fseek(pb, start - 4, SEEK_SET);
@ -61,7 +61,7 @@ static int mmf_write_header(AVFormatContext *s)
{ {
MMFContext *mmf = s->priv_data; MMFContext *mmf = s->priv_data;
ByteIOContext *pb = s->pb; ByteIOContext *pb = s->pb;
offset_t pos; int64_t pos;
int rate; int rate;
rate = mmf_rate_code(s->streams[0]->codec->sample_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; ByteIOContext *pb = s->pb;
MMFContext *mmf = s->priv_data; MMFContext *mmf = s->priv_data;
offset_t pos, size; int64_t pos, size;
int gatetime; int gatetime;
if (!url_is_streamed(s->pb)) { if (!url_is_streamed(s->pb)) {
@ -185,7 +185,7 @@ static int mmf_read_header(AVFormatContext *s,
unsigned int tag; unsigned int tag;
ByteIOContext *pb = s->pb; ByteIOContext *pb = s->pb;
AVStream *st; AVStream *st;
offset_t file_size, size; int64_t file_size, size;
int rate, params; int rate, params;
tag = get_le32(pb); 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 */ if (mov_default_parse_table[i].type == 0) { /* skip leaf atoms data */
url_fskip(pb, a.size); url_fskip(pb, a.size);
} else { } else {
offset_t start_pos = url_ftell(pb); int64_t start_pos = url_ftell(pb);
int64_t left; int64_t left;
err = mov_default_parse_table[i].parse(c, pb, a); err = mov_default_parse_table[i].parse(c, pb, a);
if (url_is_streamed(pb) && c->found_moov && c->found_mdat) 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++) { for (i = 0; i < sc->drefs_count; i++) {
MOV_dref_t *dref = &sc->drefs[i]; MOV_dref_t *dref = &sc->drefs[i];
uint32_t size = get_be32(pb); 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); dref->type = get_le32(pb);
get_be32(pb); // version + flags 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; enum CodecID id;
int dref_id; int dref_id;
MOV_atom_t a = { 0, 0, 0 }; 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 */ int size = get_be32(pb); /* size */
uint32_t format = get_le32(pb); /* data format */ 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) static void mov_build_index(MOVContext *mov, AVStream *st)
{ {
MOVStreamContext *sc = st->priv_data; MOVStreamContext *sc = st->priv_data;
offset_t current_offset; int64_t current_offset;
int64_t current_dts = 0; int64_t current_dts = 0;
unsigned int stts_index = 0; unsigned int stts_index = 0;
unsigned int stsc_index = 0; unsigned int stsc_index = 0;

@ -75,16 +75,16 @@ typedef struct MOVContext {
int mode; int mode;
int64_t time; int64_t time;
int nb_streams; int nb_streams;
offset_t mdat_pos; int64_t mdat_pos;
uint64_t mdat_size; uint64_t mdat_size;
long timescale; long timescale;
MOVTrack tracks[MAX_STREAMS]; MOVTrack tracks[MAX_STREAMS];
} MOVContext; } MOVContext;
//FIXME support 64 bit variant with wide placeholders //FIXME support 64 bit variant with wide placeholders
static offset_t updateSize(ByteIOContext *pb, offset_t pos) static int64_t updateSize(ByteIOContext *pb, int64_t pos)
{ {
offset_t curpos = url_ftell(pb); int64_t curpos = url_ftell(pb);
url_fseek(pb, pos, SEEK_SET); url_fseek(pb, pos, SEEK_SET);
put_be32(pb, curpos - pos); /* rewrite size */ put_be32(pb, curpos - pos); /* rewrite size */
url_fseek(pb, curpos, SEEK_SET); url_fseek(pb, curpos, SEEK_SET);
@ -97,7 +97,7 @@ static int mov_write_stco_tag(ByteIOContext *pb, MOVTrack *track)
{ {
int i; int i;
int mode64 = 0; // use 32 bit size variant if possible int mode64 = 0; // use 32 bit size variant if possible
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
if (pos > UINT32_MAX) { if (pos > UINT32_MAX) {
mode64 = 1; mode64 = 1;
@ -121,7 +121,7 @@ static int mov_write_stsz_tag(ByteIOContext *pb, MOVTrack *track)
int equalChunks = 1; int equalChunks = 1;
int i, j, entries = 0, tst = -1, oldtst = -1; int i, j, entries = 0, tst = -1, oldtst = -1;
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
put_tag(pb, "stsz"); put_tag(pb, "stsz");
put_be32(pb, 0); /* version & flags */ put_be32(pb, 0); /* version & flags */
@ -156,9 +156,9 @@ static int mov_write_stsz_tag(ByteIOContext *pb, MOVTrack *track)
static int mov_write_stsc_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_stsc_tag(ByteIOContext *pb, MOVTrack *track)
{ {
int index = 0, oldval = -1, i; int index = 0, oldval = -1, i;
offset_t entryPos, curpos; int64_t entryPos, curpos;
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
put_tag(pb, "stsc"); put_tag(pb, "stsc");
put_be32(pb, 0); // version & flags put_be32(pb, 0); // version & flags
@ -185,9 +185,9 @@ static int mov_write_stsc_tag(ByteIOContext *pb, MOVTrack *track)
/* Sync sample atom */ /* Sync sample atom */
static int mov_write_stss_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_stss_tag(ByteIOContext *pb, MOVTrack *track)
{ {
offset_t curpos, entryPos; int64_t curpos, entryPos;
int i, index = 0; int i, index = 0;
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); // size put_be32(pb, 0); // size
put_tag(pb, "stss"); put_tag(pb, "stss");
put_be32(pb, 0); // version & flags put_be32(pb, 0); // version & flags
@ -300,7 +300,7 @@ static void putDescr(ByteIOContext *pb, int tag, unsigned int size)
static int mov_write_esds_tag(ByteIOContext *pb, MOVTrack *track) // Basic static int mov_write_esds_tag(ByteIOContext *pb, MOVTrack *track) // Basic
{ {
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
int decoderSpecificInfoLen = track->vosLen ? descrLength(track->vosLen):0; int decoderSpecificInfoLen = track->vosLen ? descrLength(track->vosLen):0;
put_be32(pb, 0); // size put_be32(pb, 0); // size
@ -354,7 +354,7 @@ static int mov_write_esds_tag(ByteIOContext *pb, MOVTrack *track) // Basic
static int mov_write_wave_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_wave_tag(ByteIOContext *pb, MOVTrack *track)
{ {
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
put_tag(pb, "wave"); put_tag(pb, "wave");
@ -396,7 +396,7 @@ static int mov_write_glbl_tag(ByteIOContext *pb, MOVTrack *track)
static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack *track)
{ {
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
int version = track->mode == MODE_MOV && int version = track->mode == MODE_MOV &&
(track->audio_vbr || (track->audio_vbr ||
track->enc->codec_id == CODEC_ID_PCM_S32LE || track->enc->codec_id == CODEC_ID_PCM_S32LE ||
@ -487,7 +487,7 @@ static int mov_write_svq3_tag(ByteIOContext *pb)
static int mov_write_avcc_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_avcc_tag(ByteIOContext *pb, MOVTrack *track)
{ {
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); put_be32(pb, 0);
put_tag(pb, "avcC"); put_tag(pb, "avcC");
@ -645,7 +645,7 @@ static int mov_write_uuid_tag_ipod(ByteIOContext *pb)
static int mov_write_video_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_video_tag(ByteIOContext *pb, MOVTrack *track)
{ {
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
char compressor_name[32]; char compressor_name[32];
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
@ -709,7 +709,7 @@ static int mov_write_video_tag(ByteIOContext *pb, MOVTrack *track)
static int mov_write_stsd_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_stsd_tag(ByteIOContext *pb, MOVTrack *track)
{ {
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
put_tag(pb, "stsd"); put_tag(pb, "stsd");
put_be32(pb, 0); /* version & flags */ put_be32(pb, 0); /* version & flags */
@ -812,7 +812,7 @@ static int mov_write_dref_tag(ByteIOContext *pb)
static int mov_write_stbl_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_stbl_tag(ByteIOContext *pb, MOVTrack *track)
{ {
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
put_tag(pb, "stbl"); put_tag(pb, "stbl");
mov_write_stsd_tag(pb, track); mov_write_stsd_tag(pb, track);
@ -831,7 +831,7 @@ static int mov_write_stbl_tag(ByteIOContext *pb, MOVTrack *track)
static int mov_write_dinf_tag(ByteIOContext *pb) static int mov_write_dinf_tag(ByteIOContext *pb)
{ {
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
put_tag(pb, "dinf"); put_tag(pb, "dinf");
mov_write_dref_tag(pb); mov_write_dref_tag(pb);
@ -860,7 +860,7 @@ static int mov_write_vmhd_tag(ByteIOContext *pb)
static int mov_write_hdlr_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_hdlr_tag(ByteIOContext *pb, MOVTrack *track)
{ {
const char *descr, *hdlr, *hdlr_type; const char *descr, *hdlr, *hdlr_type;
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
if (!track) { /* no media --> data handler */ if (!track) { /* no media --> data handler */
hdlr = "dhlr"; hdlr = "dhlr";
@ -892,7 +892,7 @@ static int mov_write_hdlr_tag(ByteIOContext *pb, MOVTrack *track)
static int mov_write_minf_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_minf_tag(ByteIOContext *pb, MOVTrack *track)
{ {
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
put_tag(pb, "minf"); put_tag(pb, "minf");
if(track->enc->codec_type == CODEC_TYPE_VIDEO) if(track->enc->codec_type == CODEC_TYPE_VIDEO)
@ -938,7 +938,7 @@ static int mov_write_mdhd_tag(ByteIOContext *pb, MOVTrack *track)
static int mov_write_mdia_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_mdia_tag(ByteIOContext *pb, MOVTrack *track)
{ {
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
put_tag(pb, "mdia"); put_tag(pb, "mdia");
mov_write_mdhd_tag(pb, track); mov_write_mdhd_tag(pb, track);
@ -1040,7 +1040,7 @@ static int mov_write_uuid_tag_psp(ByteIOContext *pb, MOVTrack *mov)
static int mov_write_trak_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st) static int mov_write_trak_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st)
{ {
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
put_tag(pb, "trak"); put_tag(pb, "trak");
mov_write_tkhd_tag(pb, track, st); mov_write_tkhd_tag(pb, track, st);
@ -1129,7 +1129,7 @@ static int mov_write_mvhd_tag(ByteIOContext *pb, MOVContext *mov)
static int mov_write_itunes_hdlr_tag(ByteIOContext *pb, MOVContext *mov, static int mov_write_itunes_hdlr_tag(ByteIOContext *pb, MOVContext *mov,
AVFormatContext *s) AVFormatContext *s)
{ {
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
put_tag(pb, "hdlr"); put_tag(pb, "hdlr");
put_be32(pb, 0); put_be32(pb, 0);
@ -1146,7 +1146,7 @@ static int mov_write_itunes_hdlr_tag(ByteIOContext *pb, MOVContext *mov,
static int mov_write_string_data_tag(ByteIOContext *pb, const char *data, int long_style) static int mov_write_string_data_tag(ByteIOContext *pb, const char *data, int long_style)
{ {
if(long_style){ if(long_style){
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
put_tag(pb, "data"); put_tag(pb, "data");
put_be32(pb, 1); put_be32(pb, 1);
@ -1164,7 +1164,7 @@ static int mov_write_string_data_tag(ByteIOContext *pb, const char *data, int lo
static int mov_write_string_tag(ByteIOContext *pb, const char *name, const char *value, int long_style){ static int mov_write_string_tag(ByteIOContext *pb, const char *name, const char *value, int long_style){
int size = 0; int size = 0;
if (value && value[0]) { if (value && value[0]) {
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
put_tag(pb, name); put_tag(pb, name);
mov_write_string_data_tag(pb, value, long_style); mov_write_string_data_tag(pb, value, long_style);
@ -1190,11 +1190,11 @@ static int mov_write_trkn_tag(ByteIOContext *pb, MOVContext *mov,
{ {
int size = 0; int size = 0;
if (s->track) { if (s->track) {
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
put_tag(pb, "trkn"); put_tag(pb, "trkn");
{ {
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
put_tag(pb, "data"); put_tag(pb, "data");
put_be32(pb, 0); // 8 bytes empty put_be32(pb, 0); // 8 bytes empty
@ -1214,7 +1214,7 @@ static int mov_write_trkn_tag(ByteIOContext *pb, MOVContext *mov,
static int mov_write_ilst_tag(ByteIOContext *pb, MOVContext *mov, static int mov_write_ilst_tag(ByteIOContext *pb, MOVContext *mov,
AVFormatContext *s) AVFormatContext *s)
{ {
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
put_tag(pb, "ilst"); put_tag(pb, "ilst");
mov_write_string_tag(pb, "\251nam", s->title , 1); mov_write_string_tag(pb, "\251nam", s->title , 1);
@ -1239,7 +1239,7 @@ static int mov_write_meta_tag(ByteIOContext *pb, MOVContext *mov,
// only save meta tag if required // only save meta tag if required
if (s->title[0] || s->author[0] || s->album[0] || s->year || if (s->title[0] || s->author[0] || s->album[0] || s->year ||
s->comment[0] || s->genre[0] || s->track) { s->comment[0] || s->genre[0] || s->track) {
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
put_tag(pb, "meta"); put_tag(pb, "meta");
put_be32(pb, 0); put_be32(pb, 0);
@ -1280,7 +1280,7 @@ static uint16_t language_code(const char *str)
static int mov_write_3gp_udta_tag(ByteIOContext *pb, AVFormatContext *s, static int mov_write_3gp_udta_tag(ByteIOContext *pb, AVFormatContext *s,
const char *tag, const char *str) const char *tag, const char *str)
{ {
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
if (!utf8len(str)) if (!utf8len(str))
return 0; return 0;
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
@ -1311,7 +1311,7 @@ static int mov_write_udta_tag(ByteIOContext *pb, MOVContext *mov,
if (!bitexact && (s->title[0] || s->author[0] || s->album[0] || s->year || if (!bitexact && (s->title[0] || s->author[0] || s->album[0] || s->year ||
s->comment[0] || s->genre[0] || s->track)) { s->comment[0] || s->genre[0] || s->track)) {
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
put_tag(pb, "udta"); put_tag(pb, "udta");
@ -1358,7 +1358,7 @@ static void mov_write_psp_udta_tag(ByteIOContext *pb,
static int mov_write_uuidusmt_tag(ByteIOContext *pb, AVFormatContext *s) static int mov_write_uuidusmt_tag(ByteIOContext *pb, AVFormatContext *s)
{ {
offset_t pos, pos2; int64_t pos, pos2;
if (s->title[0]) { if (s->title[0]) {
pos = url_ftell(pb); pos = url_ftell(pb);
@ -1397,7 +1397,7 @@ static int mov_write_moov_tag(ByteIOContext *pb, MOVContext *mov,
AVFormatContext *s) AVFormatContext *s)
{ {
int i; int i;
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size placeholder*/ put_be32(pb, 0); /* size placeholder*/
put_tag(pb, "moov"); put_tag(pb, "moov");
mov->timescale = globalTimescale; mov->timescale = globalTimescale;
@ -1440,7 +1440,7 @@ static int mov_write_mdat_tag(ByteIOContext *pb, MOVContext *mov)
static int mov_write_ftyp_tag(ByteIOContext *pb, AVFormatContext *s) static int mov_write_ftyp_tag(ByteIOContext *pb, AVFormatContext *s)
{ {
MOVContext *mov = s->priv_data; MOVContext *mov = s->priv_data;
offset_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
int has_h264 = 0, has_video = 0; int has_h264 = 0, has_video = 0;
int minor = 0x200; int minor = 0x200;
int i; int i;
@ -1732,7 +1732,7 @@ static int mov_write_trailer(AVFormatContext *s)
int res = 0; int res = 0;
int i; int i;
offset_t moov_pos = url_ftell(pb); int64_t moov_pos = url_ftell(pb);
/* Write size of mdat tag */ /* Write size of mdat tag */
if (mov->mdat_size+8 <= UINT32_MAX) { if (mov->mdat_size+8 <= UINT32_MAX) {

@ -224,7 +224,7 @@ static void id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t fl
{ {
int isv34, tlen; int isv34, tlen;
uint32_t tag; uint32_t tag;
offset_t next; int64_t next;
char tmp[16]; char tmp[16];
int taghdrlen; int taghdrlen;
const char *reason; 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 * 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; uint32_t v, spf;
int frames = -1; /* Total number of frames in file */ 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; MPADecodeContext c;
v = get_be32(s->pb); v = get_be32(s->pb);
@ -452,7 +452,7 @@ static int mp3_read_header(AVFormatContext *s,
AVStream *st; AVStream *st;
uint8_t buf[ID3v1_TAG_SIZE]; uint8_t buf[ID3v1_TAG_SIZE];
int len, ret, filesize; int len, ret, filesize;
offset_t off; int64_t off;
st = av_new_stream(s, 0); st = av_new_stream(s, 0);
if (!st) if (!st)

@ -46,7 +46,7 @@ enum MXFMetadataSetType {
typedef struct { typedef struct {
UID key; UID key;
offset_t offset; int64_t offset;
uint64_t length; uint64_t length;
} KLVPacket; } 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}; 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; MXFContext *mxf = s->priv_data;
ByteIOContext *pb = s->pb; 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 size;
uint64_t orig_size; uint64_t orig_size;
uint64_t plaintext_size; uint64_t plaintext_size;

@ -438,7 +438,7 @@ ogg_get_length (AVFormatContext * s)
{ {
ogg_t *ogg = s->priv_data; ogg_t *ogg = s->priv_data;
int idx = -1, i; int idx = -1, i;
offset_t size, end; int64_t size, end;
if(url_is_streamed(s->pb)) if(url_is_streamed(s->pb))
return 0; return 0;

@ -36,9 +36,9 @@ typedef struct {
int eos; int eos;
} OGGStreamContext; } 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); uint32_t checksum = get_checksum(s->pb);
url_fseek(s->pb, crc_offset, SEEK_SET); url_fseek(s->pb, crc_offset, SEEK_SET);
put_be32(s->pb, checksum); 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) int64_t granule, int stream_index, int flags)
{ {
OGGStreamContext *oggstream = s->streams[stream_index]->priv_data; OGGStreamContext *oggstream = s->streams[stream_index]->priv_data;
offset_t crc_offset; int64_t crc_offset;
int page_segments, i; int page_segments, i;
if (size >= 255*255) { if (size >= 255*255) {

@ -48,7 +48,7 @@ static int flac_write_trailer(struct AVFormatContext *s)
ByteIOContext *pb = s->pb; ByteIOContext *pb = s->pb;
uint8_t *streaminfo = s->streams[0]->codec->extradata; uint8_t *streaminfo = s->streams[0]->codec->extradata;
int len = s->streams[0]->codec->extradata_size; 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)) { if (streaminfo && len > 0 && !url_is_streamed(s->pb)) {
file_size = url_ftell(pb); file_size = url_ftell(pb);

@ -215,16 +215,16 @@ const AVCodecTag codec_wav_tags[] = {
}; };
#ifdef CONFIG_MUXERS #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_tag(pb, tag);
put_le32(pb, 0); put_le32(pb, 0);
return url_ftell(pb); 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); pos = url_ftell(pb);
url_fseek(pb, start - 4, SEEK_SET); url_fseek(pb, start - 4, SEEK_SET);

@ -31,8 +31,8 @@
#include "libavcodec/avcodec.h" #include "libavcodec/avcodec.h"
#include "avio.h" #include "avio.h"
offset_t start_tag(ByteIOContext *pb, const char *tag); int64_t start_tag(ByteIOContext *pb, const char *tag);
void end_tag(ByteIOContext *pb, offset_t start); void end_tag(ByteIOContext *pb, int64_t start);
typedef struct AVCodecTag { typedef struct AVCodecTag {
int id; int id;

@ -36,7 +36,7 @@
typedef struct { typedef struct {
int stream; int stream;
offset_t sample_offset; int64_t sample_offset;
unsigned int sample_size; unsigned int sample_size;
int64_t pts; int64_t pts;
int keyframe; int keyframe;

@ -34,7 +34,7 @@
typedef struct { typedef struct {
int stream_index; int stream_index;
offset_t frame_offset; int64_t frame_offset;
unsigned int frame_size; unsigned int frame_size;
int64_t pts; int64_t pts;
int keyframe; int keyframe;
@ -77,7 +77,7 @@ static int vmd_read_header(AVFormatContext *s,
unsigned int toc_offset; unsigned int toc_offset;
unsigned char *raw_frame_table; unsigned char *raw_frame_table;
int raw_frame_table_size; int raw_frame_table_size;
offset_t current_offset; int64_t current_offset;
int i, j; int i, j;
unsigned int total_frames; unsigned int total_frames;
int64_t pts_inc = 1; int64_t pts_inc = 1;

@ -64,7 +64,7 @@ typedef struct SmackerContext {
int buf_sizes[7]; int buf_sizes[7];
int stream_id[7]; int stream_id[7];
int curstream; int curstream;
offset_t nextpos; int64_t nextpos;
int64_t aud_pts[7]; int64_t aud_pts[7];
} SmackerContext; } SmackerContext;

@ -66,9 +66,9 @@
typedef struct { typedef struct {
int audio_stream_index; int audio_stream_index;
offset_t duration_pos; int64_t duration_pos;
offset_t tag_pos; int64_t tag_pos;
offset_t vframes_pos; int64_t vframes_pos;
int samples_per_frame; int samples_per_frame;
int sound_samples; int sound_samples;
int swf_frame_number; int swf_frame_number;

@ -44,7 +44,7 @@ static void put_swf_end_tag(AVFormatContext *s)
{ {
SWFContext *swf = s->priv_data; SWFContext *swf = s->priv_data;
ByteIOContext *pb = s->pb; ByteIOContext *pb = s->pb;
offset_t pos; int64_t pos;
int tag_len, tag; int tag_len, tag;
pos = url_ftell(pb); pos = url_ftell(pb);

@ -1701,7 +1701,7 @@ static void av_estimate_timings_from_bit_rate(AVFormatContext *ic)
#define DURATION_MAX_READ_SIZE 250000 #define DURATION_MAX_READ_SIZE 250000
/* only usable for MPEG-PS streams */ /* 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; AVPacket pkt1, *pkt = &pkt1;
AVStream *st; 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; int64_t file_size;
@ -2003,7 +2003,7 @@ int av_find_stream_info(AVFormatContext *ic)
int64_t last_dts[MAX_STREAMS]; int64_t last_dts[MAX_STREAMS];
int duration_count[MAX_STREAMS]={0}; int duration_count[MAX_STREAMS]={0};
double (*duration_error)[MAX_STD_TIMEBASES]; 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}; int64_t codec_info_duration[MAX_STREAMS]={0};
int codec_info_nb_frames[MAX_STREAMS]={0}; int codec_info_nb_frames[MAX_STREAMS]={0};

@ -23,8 +23,8 @@
#include "riff.h" #include "riff.h"
typedef struct { typedef struct {
offset_t data; int64_t data;
offset_t data_end; int64_t data_end;
int64_t minpts; int64_t minpts;
int64_t maxpts; int64_t maxpts;
int last_duration; int last_duration;
@ -35,7 +35,7 @@ static int wav_write_header(AVFormatContext *s)
{ {
WAVContext *wav = s->priv_data; WAVContext *wav = s->priv_data;
ByteIOContext *pb = s->pb; ByteIOContext *pb = s->pb;
offset_t fmt, fact; int64_t fmt, fact;
put_tag(pb, "RIFF"); put_tag(pb, "RIFF");
put_le32(pb, 0); /* file length */ put_le32(pb, 0); /* file length */
@ -88,7 +88,7 @@ static int wav_write_trailer(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; ByteIOContext *pb = s->pb;
WAVContext *wav = s->priv_data; WAVContext *wav = s->priv_data;
offset_t file_size; int64_t file_size;
if (!url_is_streamed(s->pb)) { if (!url_is_streamed(s->pb)) {
end_tag(pb, wav->data); end_tag(pb, wav->data);

Loading…
Cancel
Save