diff --git a/libavformat/asf.c b/libavformat/asf.c index 0a22fad341..c267df225f 100644 --- a/libavformat/asf.c +++ b/libavformat/asf.c @@ -584,7 +584,7 @@ static void put_frame_header(AVFormatContext *s, ASFStream *stream, int timestam crap. They have misread the MPEG Systems spec ! */ static void put_frame(AVFormatContext *s, ASFStream *stream, int timestamp, - uint8_t *buf, int payload_size) + const uint8_t *buf, int payload_size) { ASFContext *asf = s->priv_data; int frag_pos, frag_len, frag_len1; @@ -617,7 +617,7 @@ static void put_frame(AVFormatContext *s, ASFStream *stream, int timestamp, static int asf_write_packet(AVFormatContext *s, int stream_index, - uint8_t *buf, int size, int timestamp) + const uint8_t *buf, int size, int64_t timestamp) { ASFContext *asf = s->priv_data; ASFStream *stream; diff --git a/libavformat/au.c b/libavformat/au.c index b560437d51..f0aef8abfb 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -72,7 +72,7 @@ static int au_write_header(AVFormatContext *s) } static int au_write_packet(AVFormatContext *s, int stream_index_ptr, - uint8_t *buf, int size, int force_pts) + const uint8_t *buf, int size, int64_t pts) { ByteIOContext *pb = &s->pb; put_buffer(pb, buf, size); diff --git a/libavformat/audio.c b/libavformat/audio.c index aea0942661..3662e458ff 100644 --- a/libavformat/audio.c +++ b/libavformat/audio.c @@ -165,7 +165,7 @@ static int audio_write_header(AVFormatContext *s1) } static int audio_write_packet(AVFormatContext *s1, int stream_index, - uint8_t *buf, int size, int force_pts) + const uint8_t *buf, int size, int64_t pts) { AudioData *s = s1->priv_data; int len, ret; diff --git a/libavformat/avformat.h b/libavformat/avformat.h index b36a0b6f4b..d1d0ba365f 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -7,8 +7,8 @@ extern "C" { #define LIBAVFORMAT_VERSION_INT 0x000408 #define LIBAVFORMAT_VERSION "0.4.8" -#define LIBAVFORMAT_BUILD 4607 -#define LIBAVFORMAT_BUILD_STR "4607" +#define LIBAVFORMAT_BUILD 4608 +#define LIBAVFORMAT_BUILD_STR "4608" #define LIBAVFORMAT_IDENT "FFmpeg" LIBAVFORMAT_VERSION "b" LIBAVFORMAT_BUILD_STR @@ -124,10 +124,9 @@ typedef struct AVOutputFormat { enum CodecID audio_codec; /* default audio codec */ enum CodecID video_codec; /* default video codec */ int (*write_header)(struct AVFormatContext *); - /* XXX: change prototype for 64 bit pts */ int (*write_packet)(struct AVFormatContext *, int stream_index, - unsigned char *buf, int size, int force_pts); + const uint8_t *buf, int size, int64_t pts); int (*write_trailer)(struct AVFormatContext *); /* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER */ int flags; diff --git a/libavformat/avienc.c b/libavformat/avienc.c index f5ecfa8ff6..ce31b21e52 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -590,7 +590,7 @@ static int avi_write_idx1(AVFormatContext *s) } static int avi_write_packet(AVFormatContext *s, int stream_index, - uint8_t *buf, int size, int force_pts) + const uint8_t *buf, int size, int64_t pts) { AVIContext *avi = s->priv_data; ByteIOContext *pb = &s->pb; diff --git a/libavformat/crc.c b/libavformat/crc.c index d130917d70..c9f8360a51 100644 --- a/libavformat/crc.c +++ b/libavformat/crc.c @@ -33,7 +33,7 @@ #define DO8(buf) DO4(buf); DO4(buf); #define DO16(buf) DO8(buf); DO8(buf); -static uint32_t adler32(uint32_t adler, uint8_t *buf, unsigned int len) +static uint32_t adler32(uint32_t adler, const uint8_t *buf, unsigned int len) { unsigned long s1 = adler & 0xffff; unsigned long s2 = (adler >> 16) & 0xffff; @@ -73,7 +73,7 @@ static int crc_write_header(struct AVFormatContext *s) static int crc_write_packet(struct AVFormatContext *s, int stream_index, - unsigned char *buf, int size, int force_pts) + const uint8_t *buf, int size, int64_t pts) { CRCState *crc = s->priv_data; crc->crcval = adler32(crc->crcval, buf, size); diff --git a/libavformat/dv.c b/libavformat/dv.c index d713acb580..e5f2d4703d 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -102,8 +102,8 @@ int dv_write_header(struct AVFormatContext *s) } int dv_write_packet(struct AVFormatContext *s, - int stream_index, - unsigned char *buf, int size, int force_pts) + int stream_index, + const uint8_t *buf, int size, int64_t pts) { DVMuxContext *c = s->priv_data; diff --git a/libavformat/dvcore.c b/libavformat/dvcore.c index c6d5ed6a95..9fc2b9abc7 100644 --- a/libavformat/dvcore.c +++ b/libavformat/dvcore.c @@ -418,7 +418,7 @@ void dv_format_frame(DVMuxContext *c, uint8_t* buf) } } -void dv_inject_audio(DVMuxContext *c, uint8_t* pcm, uint8_t* frame_ptr) +void dv_inject_audio(DVMuxContext *c, const uint8_t* pcm, uint8_t* frame_ptr) { int i, j, d, of; for (i = 0; i < c->sys->difseg_size; i++) { @@ -434,7 +434,7 @@ void dv_inject_audio(DVMuxContext *c, uint8_t* pcm, uint8_t* frame_ptr) } } -void dv_inject_video(DVMuxContext *c, uint8_t* video_data, uint8_t* frame_ptr) +void dv_inject_video(DVMuxContext *c, const uint8_t* video_data, uint8_t* frame_ptr) { int i, j; int ptr = 0; @@ -565,7 +565,7 @@ out: } /* FIXME: The following three functions could be underengineered ;-) */ -void dv_assemble_frame(DVMuxContext *c, uint8_t* video, uint8_t* audio, int asize) +void dv_assemble_frame(DVMuxContext *c, const uint8_t* video, const uint8_t* audio, int asize) { uint8_t pcm[8192]; uint8_t* frame = &c->frame_buf[0]; @@ -604,7 +604,7 @@ void dv_assemble_frame(DVMuxContext *c, uint8_t* video, uint8_t* audio, int asiz /* FIXME: we have to have more sensible approach than this one */ if (fifo_size(&c->audio_data, c->audio_data.rptr) + asize >= AVCODEC_MAX_AUDIO_FRAME_SIZE) fprintf(stderr, "Can't process DV frame #%d. Insufficient video data or severe sync problem.\n", c->frames); - fifo_write(&c->audio_data, audio, asize, &c->audio_data.wptr); + fifo_write(&c->audio_data, (uint8_t *)audio, asize, &c->audio_data.wptr); } } diff --git a/libavformat/dvcore.h b/libavformat/dvcore.h index 0b8df69a91..e47adbbe17 100644 --- a/libavformat/dvcore.h +++ b/libavformat/dvcore.h @@ -59,14 +59,14 @@ typedef struct DVMuxContext { } DVMuxContext; void dv_format_frame(DVMuxContext *, uint8_t*); -void dv_inject_audio(DVMuxContext *, uint8_t*, uint8_t*); -void dv_inject_video(DVMuxContext *, uint8_t*, uint8_t*); +void dv_inject_audio(DVMuxContext *, const uint8_t*, uint8_t*); +void dv_inject_video(DVMuxContext *, const uint8_t*, uint8_t*); int dv_extract_audio(uint8_t*, uint8_t*, AVCodecContext*); int dv_audio_frame_size(const DVprofile*, int); -void dv_assemble_frame(DVMuxContext *, uint8_t*, uint8_t*, int); +void dv_assemble_frame(DVMuxContext *c, const uint8_t*, const uint8_t*, int); int dv_core_init(DVMuxContext *, AVStream*[]); void dv_core_delete(DVMuxContext *); diff --git a/libavformat/ffm.c b/libavformat/ffm.c index 7eb3ca4e88..350da589b6 100644 --- a/libavformat/ffm.c +++ b/libavformat/ffm.c @@ -82,7 +82,7 @@ static void flush_packet(AVFormatContext *s) /* 'first' is true if first data of a frame */ static void ffm_write_data(AVFormatContext *s, - uint8_t *buf, int size, + const uint8_t *buf, int size, int64_t pts, int first) { FFMContext *ffm = s->priv_data; @@ -215,7 +215,7 @@ static int ffm_write_header(AVFormatContext *s) } static int ffm_write_packet(AVFormatContext *s, int stream_index, - uint8_t *buf, int size, int force_pts) + const uint8_t *buf, int size, int64_t force_pts) { AVStream *st = s->streams[stream_index]; FFMStream *fst = st->priv_data; diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 65bdf4b8d5..e6e3d7a011 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -242,7 +242,7 @@ static int flv_write_trailer(AVFormatContext *s) } static int flv_write_packet(AVFormatContext *s, int stream_index, - uint8_t *buf, int size, int timestamp) + const uint8_t *buf, int size, int64_t timestamp) { ByteIOContext *pb = &s->pb; AVCodecContext *enc = &s->streams[stream_index]->codec; diff --git a/libavformat/gif.c b/libavformat/gif.c index 1df8827a33..cd7cf9371f 100644 --- a/libavformat/gif.c +++ b/libavformat/gif.c @@ -220,12 +220,12 @@ static inline unsigned char gif_clut_index(uint8_t r, uint8_t g, uint8_t b) static int gif_image_write_image(ByteIOContext *pb, int x1, int y1, int width, int height, - uint8_t *buf, int linesize, int pix_fmt) + const uint8_t *buf, int linesize, int pix_fmt) { PutBitContext p; uint8_t buffer[200]; /* 100 * 9 / 8 = 113 */ int i, left, w, v; - uint8_t *ptr; + const uint8_t *ptr; /* image block */ put_byte(pb, 0x2c); @@ -331,7 +331,7 @@ static int gif_write_header(AVFormatContext *s) } static int gif_write_video(AVFormatContext *s, - AVCodecContext *enc, uint8_t *buf, int size) + AVCodecContext *enc, const uint8_t *buf, int size) { ByteIOContext *pb = &s->pb; GIFContext *gif = s->priv_data; @@ -366,7 +366,7 @@ static int gif_write_video(AVFormatContext *s, } static int gif_write_packet(AVFormatContext *s, int stream_index, - uint8_t *buf, int size, int force_pts) + const uint8_t *buf, int size, int64_t pts) { AVCodecContext *codec = &s->streams[stream_index]->codec; if (codec->codec_type == CODEC_TYPE_AUDIO) diff --git a/libavformat/img.c b/libavformat/img.c index 9048dabc90..0051271f62 100644 --- a/libavformat/img.c +++ b/libavformat/img.c @@ -301,7 +301,7 @@ static int img_write_header(AVFormatContext *s) } static int img_write_packet(AVFormatContext *s, int stream_index, - uint8_t *buf, int size, int force_pts) + const uint8_t *buf, int size, int64_t pts) { VideoData *img = s->priv_data; AVStream *st = s->streams[stream_index]; diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 2e9444d78f..e3e612ff6c 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -675,7 +675,7 @@ static int Timestamp() { } static int mov_write_packet(AVFormatContext *s, int stream_index, - uint8_t *buf, int size, int force_pts) + const uint8_t *buf, int size, int64_t pts) { MOVContext *mov = s->priv_data; ByteIOContext *pb = &s->pb; diff --git a/libavformat/mp3.c b/libavformat/mp3.c index fa27283fc9..cd515cf06f 100644 --- a/libavformat/mp3.c +++ b/libavformat/mp3.c @@ -323,7 +323,7 @@ static int mp3_write_header(struct AVFormatContext *s) } static int mp3_write_packet(struct AVFormatContext *s, int stream_index, - unsigned char *buf, int size, int force_pts) + const uint8_t *buf, int size, int64_t pts) { put_buffer(&s->pb, buf, size); put_flush_packet(&s->pb); diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 73f1b28622..d4af185d21 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -347,7 +347,7 @@ static void flush_packet(AVFormatContext *ctx, int stream_index, int last_pkt) } static int mpeg_mux_write_packet(AVFormatContext *ctx, int stream_index, - uint8_t *buf, int size, int pts) + const uint8_t *buf, int size, int64_t pts) { MpegMuxContext *s = ctx->priv_data; AVStream *st = ctx->streams[stream_index]; diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 60520de540..9b1d9d36b4 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -22,7 +22,7 @@ /* write DVB SI sections */ -static uint32_t crc_table[256] = { +static const uint32_t crc_table[256] = { 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7, @@ -454,7 +454,7 @@ static void retransmit_si_info(AVFormatContext *s) } static int mpegts_write_packet(AVFormatContext *s, int stream_index, - uint8_t *buf, int size, int pts1) + const uint8_t *buf, int size, int64_t pts1) { AVStream *st = s->streams[stream_index]; MpegTSWriteStream *ts_st = st->priv_data; diff --git a/libavformat/mpjpeg.c b/libavformat/mpjpeg.c index 62e2601aad..ab8166b16a 100644 --- a/libavformat/mpjpeg.c +++ b/libavformat/mpjpeg.c @@ -33,7 +33,7 @@ static int mpjpeg_write_header(AVFormatContext *s) } static int mpjpeg_write_packet(AVFormatContext *s, int stream_index, - uint8_t *buf, int size, int force_pts) + const uint8_t *buf, int size, int64_t pts) { uint8_t buf1[256]; @@ -75,7 +75,7 @@ static int single_jpeg_write_header(AVFormatContext *s) } static int single_jpeg_write_packet(AVFormatContext *s, int stream_index, - uint8_t *buf, int size, int force_pts) + const uint8_t *buf, int size, int64_t pts) { put_buffer(&s->pb, buf, size); put_flush_packet(&s->pb); diff --git a/libavformat/nut.c b/libavformat/nut.c index 9b9be7c37a..a1e98a20a4 100644 --- a/libavformat/nut.c +++ b/libavformat/nut.c @@ -344,7 +344,7 @@ static int nut_write_header(AVFormatContext *s) } static int nut_write_packet(AVFormatContext *s, int stream_index, - uint8_t *buf, int size, int force_pts) + const uint8_t *buf, int size, int64_t pts) { NUTContext *nut = s->priv_data; ByteIOContext *bc = &s->pb; @@ -372,7 +372,7 @@ static int nut_write_packet(AVFormatContext *s, int stream_index, put_packetheader(nut, bc, size+20); put_v(bc, stream_index); - put_s(bc, force_pts); /* lsb_timestamp */ + put_s(bc, pts); /* lsb_timestamp */ update_packetheader(nut, bc, size); put_buffer(bc, buf, size); diff --git a/libavformat/raw.c b/libavformat/raw.c index 00d9b784bd..1026a50bbd 100644 --- a/libavformat/raw.c +++ b/libavformat/raw.c @@ -25,7 +25,7 @@ static int raw_write_header(struct AVFormatContext *s) } static int raw_write_packet(struct AVFormatContext *s, int stream_index, - unsigned char *buf, int size, int force_pts) + const uint8_t *buf, int size, int64_t pts) { put_buffer(&s->pb, buf, size); put_flush_packet(&s->pb); @@ -459,7 +459,7 @@ AVOutputFormat rawvideo_oformat = { static int null_write_packet(struct AVFormatContext *s, int stream_index, - unsigned char *buf, int size, int force_pts) + const uint8_t *buf, int size, int64_t pts) { return 0; } diff --git a/libavformat/rm.c b/libavformat/rm.c index e99ae8c870..2dcd5ef577 100644 --- a/libavformat/rm.c +++ b/libavformat/rm.c @@ -323,7 +323,7 @@ static int rm_write_header(AVFormatContext *s) return 0; } -static int rm_write_audio(AVFormatContext *s, uint8_t *buf, int size) +static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size) { uint8_t *buf1; RMContext *rm = s->priv_data; @@ -348,7 +348,7 @@ static int rm_write_audio(AVFormatContext *s, uint8_t *buf, int size) return 0; } -static int rm_write_video(AVFormatContext *s, uint8_t *buf, int size) +static int rm_write_video(AVFormatContext *s, const uint8_t *buf, int size) { RMContext *rm = s->priv_data; ByteIOContext *pb = &s->pb; @@ -389,7 +389,7 @@ static int rm_write_video(AVFormatContext *s, uint8_t *buf, int size) } static int rm_write_packet(AVFormatContext *s, int stream_index, - uint8_t *buf, int size, int force_pts) + const uint8_t *buf, int size, int64_t pts) { if (s->streams[stream_index]->codec.codec_type == CODEC_TYPE_AUDIO) diff --git a/libavformat/rtp.c b/libavformat/rtp.c index 46e1fd88b4..113828475e 100644 --- a/libavformat/rtp.c +++ b/libavformat/rtp.c @@ -425,7 +425,7 @@ static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time) /* send an rtp packet. sequence number is incremented, but the caller must update the timestamp itself */ -static void rtp_send_data(AVFormatContext *s1, uint8_t *buf1, int len) +static void rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len) { RTPContext *s = s1->priv_data; @@ -451,7 +451,7 @@ static void rtp_send_data(AVFormatContext *s1, uint8_t *buf1, int len) /* send an integer number of samples and compute time stamp and fill the rtp send buffer before sending. */ static void rtp_send_samples(AVFormatContext *s1, - uint8_t *buf1, int size, int sample_size) + const uint8_t *buf1, int size, int sample_size) { RTPContext *s = s1->priv_data; int len, max_packet_size, n; @@ -484,7 +484,7 @@ static void rtp_send_samples(AVFormatContext *s1, /* NOTE: we suppose that exactly one frame is given as argument here */ /* XXX: test it */ static void rtp_send_mpegaudio(AVFormatContext *s1, - uint8_t *buf1, int size) + const uint8_t *buf1, int size) { RTPContext *s = s1->priv_data; AVStream *st = s1->streams[0]; @@ -540,7 +540,7 @@ static void rtp_send_mpegaudio(AVFormatContext *s1, /* NOTE: a single frame must be passed with sequence header if needed. XXX: use slices. */ static void rtp_send_mpegvideo(AVFormatContext *s1, - uint8_t *buf1, int size) + const uint8_t *buf1, int size) { RTPContext *s = s1->priv_data; AVStream *st = s1->streams[0]; @@ -587,7 +587,7 @@ static void rtp_send_mpegvideo(AVFormatContext *s1, } static void rtp_send_raw(AVFormatContext *s1, - uint8_t *buf1, int size) + const uint8_t *buf1, int size) { RTPContext *s = s1->priv_data; AVStream *st = s1->streams[0]; @@ -613,7 +613,7 @@ static void rtp_send_raw(AVFormatContext *s1, /* write an RTP packet. 'buf1' must contain a single specific frame. */ static int rtp_write_packet(AVFormatContext *s1, int stream_index, - uint8_t *buf1, int size, int force_pts) + const uint8_t *buf1, int size, int64_t pts) { RTPContext *s = s1->priv_data; AVStream *st = s1->streams[0]; @@ -630,7 +630,7 @@ static int rtp_write_packet(AVFormatContext *s1, int stream_index, if (s->first_packet || rtcp_bytes >= 28) { /* compute NTP time */ /* XXX: 90 kHz timestamp hardcoded */ - ntp_time = ((int64_t)force_pts << 28) / 5625; + ntp_time = (pts << 28) / 5625; rtcp_send_sr(s1, ntp_time); s->last_octet_count = s->octet_count; s->first_packet = 0; diff --git a/libavformat/swf.c b/libavformat/swf.c index 2e2201f960..5a93ae509a 100644 --- a/libavformat/swf.c +++ b/libavformat/swf.c @@ -318,7 +318,7 @@ static int swf_write_header(AVFormatContext *s) } static int swf_write_video(AVFormatContext *s, - AVCodecContext *enc, uint8_t *buf, int size) + AVCodecContext *enc, const uint8_t *buf, int size) { ByteIOContext *pb = &s->pb; static int tag_id = 0; @@ -366,7 +366,7 @@ static int swf_write_video(AVFormatContext *s, return 0; } -static int swf_write_audio(AVFormatContext *s, uint8_t *buf, int size) +static int swf_write_audio(AVFormatContext *s, const uint8_t *buf, int size) { ByteIOContext *pb = &s->pb; @@ -380,7 +380,7 @@ static int swf_write_audio(AVFormatContext *s, uint8_t *buf, int size) } static int swf_write_packet(AVFormatContext *s, int stream_index, - uint8_t *buf, int size, int force_pts) + const uint8_t *buf, int size, int64_t pts) { AVCodecContext *codec = &s->streams[stream_index]->codec; if (codec->codec_type == CODEC_TYPE_AUDIO) diff --git a/libavformat/wav.c b/libavformat/wav.c index f71dd55bc7..a75cd41f71 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -191,7 +191,7 @@ static int wav_write_header(AVFormatContext *s) } static int wav_write_packet(AVFormatContext *s, int stream_index_ptr, - uint8_t *buf, int size, int force_pts) + const uint8_t *buf, int size, int64_t pts) { ByteIOContext *pb = &s->pb; put_buffer(pb, buf, size); diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c index c898436ce2..1c6e74b071 100644 --- a/libavformat/yuv4mpeg.c +++ b/libavformat/yuv4mpeg.c @@ -113,7 +113,7 @@ static int yuv4_write_header(AVFormatContext *s) } static int yuv4_write_packet(AVFormatContext *s, int stream_index, - uint8_t *buf, int size, int force_pts) + const uint8_t *buf, int size, int64_t pts) { AVStream *st = s->streams[stream_index]; ByteIOContext *pb = &s->pb;