aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-07-16 19:40:35 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-07-16 19:43:35 +0200
commit15285d8fc528483aebf4ae7c522ea33c558f503c (patch)
tree0c6e05a3593224ab22b88d2ab5d979e4f608d8f6 /libavformat
parentc31a5b23b4cd566724743685e5ea158b0c818647 (diff)
parent8342a82680966055af8cbc48e0ad129411df7c44 (diff)
downloadffmpeg-15285d8fc528483aebf4ae7c522ea33c558f503c.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: (22 commits) arm: remove disabled function dct_unquantize_h263_inter_iwmmxt() Remove commented-out call to non-existing function print_pow1(). Do not decode RV30 files if the extradata is too small flashsv: split flashsv_decode_block() off from flashsv_decode_frame(). ppc: remove disabled code libspeexdec: Drop const qualifier to silence compiler warning. libopenjpeg: Drop const qualifier to silence compiler warning. alac: Remove unused dummy code. Remove unused structs and tables. vaapi: do not assert on value read from input bitstream flashsvenc: replace bitstream description by a link to the specification flashsvenc: drop unnecessary cast flashsvenc: improve some variable names and fix corresponding comments flashsvenc: merge two consecutive if-conditions flashsvenc: merge variable declarations and initializations flashsvenc: convert some debug av_log() to av_dlog() flashsvenc: whitespace cosmetics flashsvenc: drop some unnecessary parentheses flashsvenc: fix some comment typos aacps: skip some memcpy() if src and dst would be equal ... Conflicts: libavcodec/vaapi_mpeg2.c libavformat/aviobuf.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/aviobuf.c12
-rw-r--r--libavformat/utils.c60
2 files changed, 33 insertions, 39 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index aad0240d53..e943aacb32 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -847,19 +847,13 @@ int ffio_fdopen(AVIOContext **s, URLContext *h)
if (!buffer)
return AVERROR(ENOMEM);
- *s = av_mallocz(sizeof(AVIOContext));
- if(!*s) {
+ *s = avio_alloc_context(buffer, buffer_size, h->flags & AVIO_FLAG_WRITE, h,
+ ffurl_read, ffurl_write, ffurl_seek);
+ if (!*s) {
av_free(buffer);
return AVERROR(ENOMEM);
}
- if (ffio_init_context(*s, buffer, buffer_size,
- h->flags & AVIO_FLAG_WRITE, h,
- (void*)ffurl_read, (void*)ffurl_write, (void*)ffurl_seek) < 0) {
- av_free(buffer);
- av_freep(s);
- return AVERROR(EIO);
- }
#if FF_API_OLD_AVIO
(*s)->is_streamed = h->is_streamed;
#endif
diff --git a/libavformat/utils.c b/libavformat/utils.c
index b03615983f..7fee49cf4e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -80,7 +80,7 @@ const char *avformat_license(void)
* @param num must be >= 0
* @param den must be >= 1
*/
-static void av_frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den)
+static void frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den)
{
num += (den >> 1);
if (num >= den) {
@@ -98,7 +98,7 @@ static void av_frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den)
* @param f fractional number
* @param incr increment, can be positive or negative
*/
-static void av_frac_add(AVFrac *f, int64_t incr)
+static void frac_add(AVFrac *f, int64_t incr)
{
int64_t num, den;
@@ -1116,7 +1116,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
}
-static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
+static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
{
AVStream *st;
int len, ret, i;
@@ -1247,7 +1247,7 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
}
}
if(s->debug & FF_FDEBUG_TS)
- av_log(s, AV_LOG_DEBUG, "av_read_frame_internal stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d, duration=%d, flags=%d\n",
+ av_log(s, AV_LOG_DEBUG, "read_frame_internal stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d, duration=%d, flags=%d\n",
pkt->stream_index,
pkt->pts,
pkt->dts,
@@ -1293,7 +1293,7 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
}
}
if(genpts){
- int ret= av_read_frame_internal(s, pkt);
+ int ret= read_frame_internal(s, pkt);
if(ret<0){
if(pktl && ret != AVERROR(EAGAIN)){
eof=1;
@@ -1307,7 +1307,7 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
return AVERROR(ENOMEM);
}else{
assert(!s->packet_buffer);
- return av_read_frame_internal(s, pkt);
+ return read_frame_internal(s, pkt);
}
}
}
@@ -1679,7 +1679,7 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i
return pos;
}
-static int av_seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos, int flags){
+static int seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos, int flags){
int64_t pos_min, pos_max;
#if 0
AVStream *st;
@@ -1704,7 +1704,7 @@ static int av_seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos,
return 0;
}
-static int av_seek_frame_generic(AVFormatContext *s,
+static int seek_frame_generic(AVFormatContext *s,
int stream_index, int64_t timestamp, int flags)
{
int index;
@@ -1772,7 +1772,7 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int f
ff_read_frame_flush(s);
if(flags & AVSEEK_FLAG_BYTE)
- return av_seek_frame_byte(s, stream_index, timestamp, flags);
+ return seek_frame_byte(s, stream_index, timestamp, flags);
if(stream_index < 0){
stream_index= av_find_default_stream_index(s);
@@ -1796,7 +1796,7 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int f
if(s->iformat->read_timestamp && !(s->iformat->flags & AVFMT_NOBINSEARCH))
return av_seek_frame_binary(s, stream_index, timestamp, flags);
else if (!(s->iformat->flags & AVFMT_NOGENSEARCH))
- return av_seek_frame_generic(s, stream_index, timestamp, flags);
+ return seek_frame_generic(s, stream_index, timestamp, flags);
else
return -1;
}
@@ -1820,7 +1820,7 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int
if(s->iformat->read_seek || 1)
return av_seek_frame(s, stream_index, ts, flags | (ts - min_ts > (uint64_t)(max_ts - ts) ? AVSEEK_FLAG_BACKWARD : 0));
- // try some generic seek like av_seek_frame_generic() but with new ts semantics
+ // try some generic seek like seek_frame_generic() but with new ts semantics
}
/*******************************************************/
@@ -1830,7 +1830,7 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int
*
* @return TRUE if the stream has accurate duration for at least one component.
*/
-static int av_has_duration(AVFormatContext *ic)
+static int has_duration(AVFormatContext *ic)
{
int i;
AVStream *st;
@@ -1848,7 +1848,7 @@ static int av_has_duration(AVFormatContext *ic)
*
* Also computes the global bitrate if possible.
*/
-static void av_update_stream_timings(AVFormatContext *ic)
+static void update_stream_timings(AVFormatContext *ic)
{
int64_t start_time, start_time1, start_time_text, end_time, end_time1;
int64_t duration, duration1;
@@ -1906,7 +1906,7 @@ static void fill_all_stream_timings(AVFormatContext *ic)
int i;
AVStream *st;
- av_update_stream_timings(ic);
+ update_stream_timings(ic);
for(i = 0;i < ic->nb_streams; i++) {
st = ic->streams[i];
if (st->start_time == AV_NOPTS_VALUE) {
@@ -1918,7 +1918,7 @@ static void fill_all_stream_timings(AVFormatContext *ic)
}
}
-static void av_estimate_timings_from_bit_rate(AVFormatContext *ic)
+static void estimate_timings_from_bit_rate(AVFormatContext *ic)
{
int64_t filesize, duration;
int bit_rate, i;
@@ -1955,7 +1955,7 @@ static void av_estimate_timings_from_bit_rate(AVFormatContext *ic)
#define DURATION_MAX_RETRY 3
/* only usable for MPEG-PS streams */
-static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
+static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
{
AVPacket pkt1, *pkt = &pkt1;
AVStream *st;
@@ -1972,7 +1972,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset
for (i=0; i<ic->nb_streams; i++) {
st = ic->streams[i];
if (st->start_time == AV_NOPTS_VALUE && st->first_dts == AV_NOPTS_VALUE)
- av_log(st->codec, AV_LOG_WARNING, "start time is not set in av_estimate_timings_from_pts\n");
+ av_log(st->codec, AV_LOG_WARNING, "start time is not set in estimate_timings_from_pts\n");
if (st->parser) {
av_parser_close(st->parser);
@@ -2034,7 +2034,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset
}
}
-static void av_estimate_timings(AVFormatContext *ic, int64_t old_offset)
+static void estimate_timings(AVFormatContext *ic, int64_t old_offset)
{
int64_t file_size;
@@ -2052,17 +2052,17 @@ static void av_estimate_timings(AVFormatContext *ic, int64_t old_offset)
!strcmp(ic->iformat->name, "mpegts")) &&
file_size && ic->pb->seekable) {
/* get accurate estimate from the PTSes */
- av_estimate_timings_from_pts(ic, old_offset);
- } else if (av_has_duration(ic)) {
+ estimate_timings_from_pts(ic, old_offset);
+ } else if (has_duration(ic)) {
/* at least one component has timings - we use them for all
the components */
fill_all_stream_timings(ic);
} else {
av_log(ic, AV_LOG_WARNING, "Estimating duration from bitrate, this may be inaccurate\n");
/* less precise: use bitrate info */
- av_estimate_timings_from_bit_rate(ic);
+ estimate_timings_from_bit_rate(ic);
}
- av_update_stream_timings(ic);
+ update_stream_timings(ic);
#if 0
{
@@ -2359,7 +2359,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
/* NOTE: a new stream can be added there if no header in file
(AVFMTCTX_NOHEADER) */
- ret = av_read_frame_internal(ic, &pkt1);
+ ret = read_frame_internal(ic, &pkt1);
if (ret == AVERROR(EAGAIN))
continue;
@@ -2519,7 +2519,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
}
}
- av_estimate_timings(ic, old_offset);
+ estimate_timings(ic, old_offset);
compute_chapters_end(ic);
@@ -3039,7 +3039,7 @@ int avformat_write_header(AVFormatContext *s, AVDictionary **options)
ret = AVERROR_INVALIDDATA;
goto fail;
}
- av_frac_init(&st->pts, 0, 0, den);
+ frac_init(&st->pts, 0, 0, den);
}
}
@@ -3117,11 +3117,11 @@ static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt){
likely equal to the encoder delay, but it would be better if we
had the real timestamps from the encoder */
if (frame_size >= 0 && (pkt->size || st->pts.num!=st->pts.den>>1 || st->pts.val)) {
- av_frac_add(&st->pts, (int64_t)st->time_base.den * frame_size);
+ frac_add(&st->pts, (int64_t)st->time_base.den * frame_size);
}
break;
case AVMEDIA_TYPE_VIDEO:
- av_frac_add(&st->pts, (int64_t)st->time_base.den * st->codec->time_base.num);
+ frac_add(&st->pts, (int64_t)st->time_base.den * st->codec->time_base.num);
break;
default:
break;
@@ -3230,7 +3230,7 @@ int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pk
* @return 1 if a packet was output, 0 if no packet could be output,
* < 0 if an error occurred
*/
-static int av_interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, int flush){
+static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, int flush){
if(s->oformat->interleave_packet)
return s->oformat->interleave_packet(s, out, in, flush);
else
@@ -3255,7 +3255,7 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){
for(;;){
AVPacket opkt;
- int ret= av_interleave_packet(s, &opkt, pkt, 0);
+ int ret= interleave_packet(s, &opkt, pkt, 0);
if(ret<=0) //FIXME cleanup needed for ret<0 ?
return ret;
@@ -3279,7 +3279,7 @@ int av_write_trailer(AVFormatContext *s)
for(;;){
AVPacket pkt;
- ret= av_interleave_packet(s, &pkt, NULL, 1);
+ ret= interleave_packet(s, &pkt, NULL, 1);
if(ret<0) //FIXME cleanup needed for ret<0 ?
goto fail;
if(!ret)