summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-03-24 02:12:17 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-03-24 02:16:11 +0100
commit2fd41c9067fc67b40f80e9cbd4787018009040db (patch)
tree378cc399057a6089f3f06bc62f0eff97d3ada56b /libavformat
parent00dc0206cb5b351a66d7cce77b8a65fabe6ea7da (diff)
parent4ec153bb66a95da46c98e269bd0aa787e6172ed3 (diff)
Merge remote-tracking branch 'newdev/master'
* newdev/master: avio: make udp_set_remote_url/get_local_port internal. asfdec: also subtract preroll when reading simple index object matroskaenc: remove a variable that's unused after bc17bd9. avio: cosmetics - nicer vertical alignment. Remove unnecessary icc version checks Disable 'attribute "foo" ignored' warnings from icc rtsp: Don't use a locale dependent format string Add xd55 codec tag for XDCAM HD422 720p25 CBR files. configure: get libavcodec version from new version.h header lavc: move the version macros to a new installed header. matroskaenc: simplify get_aac_sample_rates by using ff_mpeg4audio_get_config Do not use format string "%0.3f" for RTSP Range field. Add apply_window_int16() to DSPContext with x86-optimized versions and use it in the ac3_fixed encoder. Document usage of import libraries created by dlltool configure: Set the correct lib target for arm/wince dlltool fate: simplify regression-funcs.sh fate: add support for multithread testing Conflicts: libavformat/rtspdec.c libavutil/attributes.h libavutil/internal.h libavutil/mem.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/asfdec.c4
-rw-r--r--libavformat/avio.h8
-rw-r--r--libavformat/avio_internal.h6
-rw-r--r--libavformat/matroskaenc.c24
-rw-r--r--libavformat/rtpproto.c11
-rw-r--r--libavformat/rtspdec.c12
-rw-r--r--libavformat/rtspenc.c3
-rw-r--r--libavformat/udp.c7
8 files changed, 31 insertions, 44 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index aac52ee045..031d4820f5 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -1217,10 +1217,10 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
int pktnum=avio_rl32(s->pb);
int pktct =avio_rl16(s->pb);
int64_t pos = s->data_offset + s->packet_size*(int64_t)pktnum;
- int64_t index_pts= av_rescale(itime, i, 10000);
+ int64_t index_pts= FFMAX(av_rescale(itime, i, 10000) - asf->hdr.preroll, 0);
if(pos != last_pos){
- av_log(s, AV_LOG_DEBUG, "pktnum:%d, pktct:%d\n", pktnum, pktct);
+ av_log(s, AV_LOG_DEBUG, "pktnum:%d, pktct:%d pts: %"PRId64"\n", pktnum, pktct, index_pts);
av_add_index_entry(s->streams[stream_index], pos, index_pts, s->packet_size, 0, AVINDEX_KEYFRAME);
last_pos=pos;
}
diff --git a/libavformat/avio.h b/libavformat/avio.h
index 55eefb5bde..173b6f7896 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -416,7 +416,7 @@ 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,
+attribute_deprecated int64_t av_url_read_fseek (AVIOContext *h, int stream_index,
int64_t timestamp, int flags);
/**
@@ -444,6 +444,9 @@ attribute_deprecated void put_flush_packet(AVIOContext *s);
*/
attribute_deprecated int url_ferror(AVIOContext *s);
+
+attribute_deprecated int udp_set_remote_url(URLContext *h, const char *uri);
+attribute_deprecated int udp_get_local_port(URLContext *h);
#endif
AVIOContext *avio_alloc_context(
@@ -674,9 +677,6 @@ void init_checksum(AVIOContext *s,
unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
unsigned long checksum);
-/* udp.c */
-int udp_set_remote_url(URLContext *h, const char *uri);
-int udp_get_local_port(URLContext *h);
#if FF_API_UDP_GET_FILE
int udp_get_file_handle(URLContext *h);
#endif
diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h
index 88da0f635c..53121ff44c 100644
--- a/libavformat/avio_internal.h
+++ b/libavformat/avio_internal.h
@@ -67,8 +67,12 @@ uint64_t ffio_read_varlen(AVIOContext *bc);
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 ffio_read_seek (AVIOContext *h, int stream_index,
int64_t timestamp, int flags);
+/* udp.c */
+int ff_udp_set_remote_url(URLContext *h, const char *uri);
+int ff_udp_get_local_port(URLContext *h);
+
#endif // AVFORMAT_AVIO_INTERNAL_H
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index df192a1cb3..973f31c129 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -438,29 +438,15 @@ static int put_xiph_codecpriv(AVFormatContext *s, AVIOContext *pb, AVCodecContex
static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec, int *sample_rate, int *output_sample_rate)
{
- int sri;
+ MPEG4AudioConfig mp4ac;
- if (codec->extradata_size < 2) {
- av_log(s, AV_LOG_WARNING, "No AAC extradata, unable to determine samplerate.\n");
+ if (ff_mpeg4audio_get_config(&mp4ac, codec->extradata, codec->extradata_size) < 0) {
+ av_log(s, AV_LOG_WARNING, "Error parsing AAC extradata, unable to determine samplerate.\n");
return;
}
- sri = ((codec->extradata[0] << 1) & 0xE) | (codec->extradata[1] >> 7);
- if (sri > 12) {
- av_log(s, AV_LOG_WARNING, "AAC samplerate index out of bounds\n");
- return;
- }
- *sample_rate = ff_mpeg4audio_sample_rates[sri];
-
- // if sbr, get output sample rate as well
- if (codec->extradata_size == 5) {
- sri = (codec->extradata[4] >> 3) & 0xF;
- if (sri > 12) {
- av_log(s, AV_LOG_WARNING, "AAC output samplerate index out of bounds\n");
- return;
- }
- *output_sample_rate = ff_mpeg4audio_sample_rates[sri];
- }
+ *sample_rate = mp4ac.sample_rate;
+ *output_sample_rate = mp4ac.ext_sample_rate;
}
static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecContext *codec, int native_id, int qt_id)
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index bca8ab648b..4b8d1db382 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -27,6 +27,7 @@
#include "libavutil/parseutils.h"
#include "libavutil/avstring.h"
#include "avformat.h"
+#include "avio_internal.h"
#include "rtpdec.h"
#include <unistd.h>
@@ -71,10 +72,10 @@ int rtp_set_remote_url(URLContext *h, const char *uri)
path, sizeof(path), uri);
ff_url_join(buf, sizeof(buf), "udp", NULL, hostname, port, "%s", path);
- udp_set_remote_url(s->rtp_hd, buf);
+ ff_udp_set_remote_url(s->rtp_hd, buf);
ff_url_join(buf, sizeof(buf), "udp", NULL, hostname, port + 1, "%s", path);
- udp_set_remote_url(s->rtcp_hd, buf);
+ ff_udp_set_remote_url(s->rtcp_hd, buf);
return 0;
}
@@ -191,7 +192,7 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
if (url_open(&s->rtp_hd, buf, flags) < 0)
goto fail;
if (local_rtp_port>=0 && local_rtcp_port<0)
- local_rtcp_port = udp_get_local_port(s->rtp_hd) + 1;
+ local_rtcp_port = ff_udp_get_local_port(s->rtp_hd) + 1;
build_udp_url(buf, sizeof(buf),
hostname, rtcp_port, local_rtcp_port, ttl, max_packet_size,
@@ -326,7 +327,7 @@ static int rtp_close(URLContext *h)
int rtp_get_local_rtp_port(URLContext *h)
{
RTPContext *s = h->priv_data;
- return udp_get_local_port(s->rtp_hd);
+ return ff_udp_get_local_port(s->rtp_hd);
}
/**
@@ -338,7 +339,7 @@ int rtp_get_local_rtp_port(URLContext *h)
int rtp_get_local_rtcp_port(URLContext *h)
{
RTPContext *s = h->priv_data;
- return udp_get_local_port(s->rtcp_hd);
+ return ff_udp_get_local_port(s->rtcp_hd);
}
static int rtp_get_file_handle(URLContext *h)
diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index f0187de714..8fa419714e 100644
--- a/libavformat/rtspdec.c
+++ b/libavformat/rtspdec.c
@@ -59,14 +59,10 @@ static int rtsp_read_play(AVFormatContext *s)
if (rt->state == RTSP_STATE_PAUSED) {
cmd[0] = 0;
} else {
- if (!rt->seek_timestamp) {
- snprintf(cmd, sizeof(cmd), "Range: npt=0.000-\r\n");
- } else {
- snprintf(cmd, sizeof(cmd),
- "Range: npt=%"PRId64".%03"PRId64"-\r\n",
- rt->seek_timestamp / AV_TIME_BASE,
- rt->seek_timestamp / (AV_TIME_BASE / 1000) % 1000);
- }
+ snprintf(cmd, sizeof(cmd),
+ "Range: npt=%"PRId64".%03"PRId64"-\r\n",
+ rt->seek_timestamp / AV_TIME_BASE,
+ rt->seek_timestamp / (AV_TIME_BASE / 1000) % 1000);
}
ff_rtsp_send_cmd(s, "PLAY", rt->control_uri, cmd, reply, NULL);
if (reply->status_code != RTSP_STATUS_OK) {
diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c
index 34deeeb636..5d76fdf0b5 100644
--- a/libavformat/rtspenc.c
+++ b/libavformat/rtspenc.c
@@ -103,8 +103,7 @@ static int rtsp_write_record(AVFormatContext *s)
char cmd[1024];
snprintf(cmd, sizeof(cmd),
- "Range: npt=%0.3f-\r\n",
- (double) 0);
+ "Range: npt=0.000-\r\n");
ff_rtsp_send_cmd(s, "RECORD", rt->control_uri, cmd, reply, NULL);
if (reply->status_code != RTSP_STATUS_OK)
return -1;
diff --git a/libavformat/udp.c b/libavformat/udp.c
index 76a0f35099..25541845a9 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -27,6 +27,7 @@
#define _BSD_SOURCE /* Needed for using struct ip_mreq with recent glibc */
#define _DARWIN_C_SOURCE /* Needed for using IP_MULTICAST_TTL on OS X */
#include "avformat.h"
+#include "avio_internal.h"
#include "libavutil/parseutils.h"
#include <unistd.h>
#include "internal.h"
@@ -243,7 +244,7 @@ static int udp_port(struct sockaddr_storage *addr, int addr_len)
* @param uri of the remote server
* @return zero if no error.
*/
-int udp_set_remote_url(URLContext *h, const char *uri)
+int ff_udp_set_remote_url(URLContext *h, const char *uri)
{
UDPContext *s = h->priv_data;
char hostname[256], buf[10];
@@ -282,7 +283,7 @@ int udp_set_remote_url(URLContext *h, const char *uri)
* @param h media file context
* @return the local port number
*/
-int udp_get_local_port(URLContext *h)
+int ff_udp_get_local_port(URLContext *h)
{
UDPContext *s = h->priv_data;
return s->local_port;
@@ -365,7 +366,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
if (flags & URL_WRONLY)
goto fail;
} else {
- if (udp_set_remote_url(h, uri) < 0)
+ if (ff_udp_set_remote_url(h, uri) < 0)
goto fail;
}