diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-03-23 02:42:56 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-03-23 02:42:56 +0100 |
commit | 4fa0e24736bff7d7fbdfb36ed578a1db166817d4 (patch) | |
tree | 3e74e32f82b02ff498320e07424d330473f44fd3 /libavformat | |
parent | 4952afff75bc60df9c842bc248f1da8fe57e04a6 (diff) | |
parent | ee26abf2a4884bb56959bac8215758195776c553 (diff) | |
download | ffmpeg-4fa0e24736bff7d7fbdfb36ed578a1db166817d4.tar.gz |
Merge remote-tracking branch 'newdev/master'
* newdev/master: (33 commits)
Fix an infinite loop when RoQ encoded generated a frame with a size greater than the maximum valid size.
Add kbdwin.o to AC3 decoder
Detect byte-swapped AC-3 and support decoding it directly.
cosmetics: indentation
Always copy input data for AC3 decoder.
ac3enc: make sym_quant() branch-free
cosmetics: indentation
Add a CPU flag for the Atom processor.
id3v2: skip broken tags with invalid size
id3v2: don't explicitly skip padding
Make sure kbhit() is in conio.h
fate: update wmv8-drm reference
vc1: make P-frame deblock filter bit-exact.
configure: Add the -D parameter to the dlltool command
amr: Set the AVFMT_GENERIC_INDEX flag
amr: Set the pkt->pos field properly to the start of the packet
amr: Set the codec->bit_rate field based on the last packet
rtsp: Specify unicast for TCP interleaved streams, too
Set the correct target for mingw64 dlltool
applehttp: Change the variable for stream position in seconds into int64_t
...
Conflicts:
ffmpeg.c
ffplay.c
libavcodec/ac3dec.c
libavformat/avio.h
libavformat/id3v2.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/amr.c | 7 | ||||
-rw-r--r-- | libavformat/applehttp.c | 3 | ||||
-rw-r--r-- | libavformat/asfdec.c | 3 | ||||
-rw-r--r-- | libavformat/avio.h | 10 | ||||
-rw-r--r-- | libavformat/avio_internal.h | 5 | ||||
-rw-r--r-- | libavformat/aviobuf.c | 17 | ||||
-rw-r--r-- | libavformat/flvdec.c | 5 | ||||
-rw-r--r-- | libavformat/id3v2.c | 19 | ||||
-rw-r--r-- | libavformat/mp3dec.c | 2 | ||||
-rw-r--r-- | libavformat/rmenc.c | 2 | ||||
-rw-r--r-- | libavformat/rtsp.c | 2 | ||||
-rw-r--r-- | libavformat/utils.c | 4 | ||||
-rw-r--r-- | libavformat/wtv.c | 4 |
13 files changed, 51 insertions, 32 deletions
diff --git a/libavformat/amr.c b/libavformat/amr.c index 0459632b10..66763f3fa7 100644 --- a/libavformat/amr.c +++ b/libavformat/amr.c @@ -121,6 +121,7 @@ static int amr_read_packet(AVFormatContext *s, { AVCodecContext *enc = s->streams[0]->codec; int read, size = 0, toc, mode; + int64_t pos = avio_tell(s->pb); if (url_feof(s->pb)) { @@ -153,8 +154,11 @@ static int amr_read_packet(AVFormatContext *s, return AVERROR(EIO); } + /* Both AMR formats have 50 frames per second */ + s->streams[0]->codec->bit_rate = size*8*50; + pkt->stream_index = 0; - pkt->pos= avio_tell(s->pb); + pkt->pos = pos; pkt->data[0]=toc; pkt->duration= enc->codec_id == CODEC_ID_AMR_NB ? 160 : 320; read = avio_read(s->pb, pkt->data+1, size-1); @@ -177,6 +181,7 @@ AVInputFormat ff_amr_demuxer = { amr_read_header, amr_read_packet, NULL, + .flags = AVFMT_GENERIC_INDEX, }; #endif diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index 324494ad74..8a6b232e51 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -496,7 +496,8 @@ static int applehttp_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { AppleHTTPContext *c = s->priv_data; - int pos = 0, i; + int64_t pos = 0; + int i; struct variant *var = c->variants[0]; if ((flags & AVSEEK_FLAG_BYTE) || !c->finished) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 71f4e79fd5..aac52ee045 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -25,6 +25,7 @@ #include "libavutil/avstring.h" #include "libavcodec/mpegaudio.h" #include "avformat.h" +#include "avio_internal.h" #include "riff.h" #include "asf.h" #include "asfcrypt.h" @@ -1241,7 +1242,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int /* Try using the protocol's read_seek if available */ if(s->pb) { - int ret = av_url_read_fseek(s->pb, stream_index, pts, flags); + int ret = ffio_read_seek(s->pb, stream_index, pts, flags); if(ret >= 0) asf_reset_header(s); if (ret != AVERROR(ENOSYS)) diff --git a/libavformat/avio.h b/libavformat/avio.h index 2d2afc7112..55eefb5bde 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -415,6 +415,9 @@ attribute_deprecated void put_tag(AVIOContext *s, const char *tag); * @} */ +attribute_deprecated int av_url_read_fpause(AVIOContext *h, int pause); +attribute_deprecated int64_t av_url_read_fseek( AVIOContext *h, int stream_index, + int64_t timestamp, int flags); /** * @defgroup old_url_f_funcs Old url_f* functions @@ -512,10 +515,6 @@ int64_t avio_size(AVIOContext *s); */ int url_feof(AVIOContext *s); -int av_url_read_fpause(AVIOContext *h, int pause); -int64_t av_url_read_fseek(AVIOContext *h, int stream_index, - int64_t timestamp, int flags); - /** @warning currently size is limited */ #ifdef __GNUC__ int avio_printf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); @@ -622,9 +621,10 @@ int url_resetbuf(AVIOContext *s, int flags); int avio_open(AVIOContext **s, const char *url, int flags); int avio_close(AVIOContext *s); -URLContext *url_fileno(AVIOContext *s); #if FF_API_OLD_AVIO +attribute_deprecated URLContext *url_fileno(AVIOContext *s); + /** * @deprecated use AVIOContext.max_packet_size directly. */ diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h index 12578fac6c..88da0f635c 100644 --- a/libavformat/avio_internal.h +++ b/libavformat/avio_internal.h @@ -66,4 +66,9 @@ uint64_t ffio_read_varlen(AVIOContext *bc); /** @warning must be called before any I/O */ int ffio_set_buf_size(AVIOContext *s, int buf_size); +int ffio_read_pause(AVIOContext *h, int pause); +int64_t ffio_read_seek( AVIOContext *h, int stream_index, + int64_t timestamp, int flags); + + #endif // AVFORMAT_AVIO_INTERNAL_H diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index b8cfb9286a..174df21b89 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -406,6 +406,15 @@ void put_flush_packet(AVIOContext *s) { avio_flush(s); } +int av_url_read_fpause(AVIOContext *s, int pause) +{ + return ffio_read_pause(s, pause); +} +int64_t av_url_read_fseek(AVIOContext *s, int stream_index, + int64_t timestamp, int flags) +{ + return ffio_read_seek(s, stream_index, timestamp, flags); +} #endif int avio_put_str(AVIOContext *s, const char *str) @@ -932,10 +941,12 @@ int avio_close(AVIOContext *s) return url_close(h); } +#if FF_API_OLD_AVIO URLContext *url_fileno(AVIOContext *s) { return s->opaque; } +#endif int avio_printf(AVIOContext *s, const char *fmt, ...) { @@ -978,15 +989,15 @@ int url_fget_max_packet_size(AVIOContext *s) } #endif -int av_url_read_fpause(AVIOContext *s, int pause) +int ffio_read_pause(AVIOContext *s, int pause) { if (!s->read_pause) return AVERROR(ENOSYS); return s->read_pause(s->opaque, pause); } -int64_t av_url_read_fseek(AVIOContext *s, int stream_index, - int64_t timestamp, int flags) +int64_t ffio_read_seek(AVIOContext *s, int stream_index, + int64_t timestamp, int flags) { URLContext *h = s->opaque; int64_t ret; diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index d84051c7a8..e3449a6746 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -28,6 +28,7 @@ #include "libavcodec/bytestream.h" #include "libavcodec/mpeg4audio.h" #include "avformat.h" +#include "avio_internal.h" #include "flv.h" typedef struct { @@ -461,7 +462,7 @@ leave: static int flv_read_seek(AVFormatContext *s, int stream_index, int64_t ts, int flags) { - return av_url_read_fseek(s->pb, stream_index, ts, flags); + return ffio_read_seek(s->pb, stream_index, ts, flags); } #if 0 /* don't know enough to implement this */ @@ -482,7 +483,7 @@ static int flv_read_seek2(AVFormatContext *s, int stream_index, ts = av_rescale_rnd(ts, 1000, AV_TIME_BASE, flags & AVSEEK_FLAG_BACKWARD ? AV_ROUND_DOWN : AV_ROUND_UP); } - ret = av_url_read_fseek(s->pb, stream_index, ts, flags); + ret = ffio_read_seek(s->pb, stream_index, ts, flags); } if (ret == AVERROR(ENOSYS)) diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index 027b8d717c..95353276b5 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -187,9 +187,9 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t int isv34, unsync; unsigned tlen; char tag[5]; - int64_t next; + int64_t next, end = avio_tell(s->pb) + len; int taghdrlen; - const char *reason; + const char *reason = NULL; AVIOContext pb; unsigned char *buffer = NULL; int buffer_size = 0; @@ -282,20 +282,15 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t avio_seek(s->pb, next, SEEK_SET); } - if (len > 0) { - /* Skip padding */ - avio_skip(s->pb, len); - } if (version == 4 && flags & 0x10) /* Footer preset, always 10 bytes, skip over it */ - avio_skip(s->pb, 10); - - av_free(buffer); - return; + end += 10; error: - av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason); - avio_seek(s->pb, len, SEEK_CUR); + if (reason) + av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason); + avio_seek(s->pb, end, SEEK_SET); av_free(buffer); + return; } void ff_id3v2_read(AVFormatContext *s, const char *magic) diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index b7386fb78f..1306888b46 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -90,7 +90,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) return -1; /* Check for Xing / Info tag */ - avio_seek(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1], SEEK_CUR); + avio_skip(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1]); v = avio_rb32(s->pb); if(v == MKBETAG('X', 'i', 'n', 'g') || v == MKBETAG('I', 'n', 'f', 'o')) { v = avio_rb32(s->pb); diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c index 4835cf4435..28ee173fb8 100644 --- a/libavformat/rmenc.c +++ b/libavformat/rmenc.c @@ -436,7 +436,7 @@ static int rm_write_trailer(AVFormatContext *s) if (!url_is_streamed(s->pb)) { /* end of file: finish to write header */ - index_pos = avio_seek(pb, 0, SEEK_CUR); + index_pos = avio_tell(pb); data_size = index_pos - rm->data_pos; /* FIXME: write index */ diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index f50650ed8f..0b8430938d 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1157,7 +1157,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, continue; snprintf(transport, sizeof(transport) - 1, "%s/TCP;", trans_pref); - if (rt->server_type == RTSP_SERVER_WMS) + if (rt->transport != RTSP_TRANSPORT_RDT) av_strlcat(transport, "unicast;", sizeof(transport)); av_strlcatf(transport, sizeof(transport), "interleaved=%d-%d", diff --git a/libavformat/utils.c b/libavformat/utils.c index b4923bad92..b4b48643dd 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2554,7 +2554,7 @@ int av_read_play(AVFormatContext *s) if (s->iformat->read_play) return s->iformat->read_play(s); if (s->pb) - return av_url_read_fpause(s->pb, 0); + return ffio_read_pause(s->pb, 0); return AVERROR(ENOSYS); } @@ -2563,7 +2563,7 @@ int av_read_pause(AVFormatContext *s) if (s->iformat->read_pause) return s->iformat->read_pause(s); if (s->pb) - return av_url_read_fpause(s->pb, 1); + return ffio_read_pause(s->pb, 1); return AVERROR(ENOSYS); } diff --git a/libavformat/wtv.c b/libavformat/wtv.c index 35d987c061..a9ad2718ad 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -701,10 +701,10 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, return NULL; if (!ff_guidcmp(formattype, format_videoinfo2)) { int consumed = parse_videoinfoheader2(s, st); - avio_seek(pb, FFMAX(size - consumed, 0), SEEK_CUR); + avio_skip(pb, FFMAX(size - consumed, 0)); } else if (!ff_guidcmp(formattype, format_mpeg2_video)) { int consumed = parse_videoinfoheader2(s, st); - avio_seek(pb, FFMAX(size - consumed, 0), SEEK_CUR); + avio_skip(pb, FFMAX(size - consumed, 0)); } else { if (ff_guidcmp(formattype, format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype)); |