aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-06-11 03:51:36 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-06-11 03:51:36 +0200
commit45fb64749584ed07ea88549a3e06ae70e1d736e9 (patch)
treef46fb2de436c34ea90b71e06e11f09fc6bc2f594 /libavformat
parent39dbe9b6b8fdd587793583c8296fecf94b3aee58 (diff)
parent19d824e47373594739bb9a05cd4e7edbc441b173 (diff)
downloadffmpeg-45fb64749584ed07ea88549a3e06ae70e1d736e9.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: bitstream: Properly promote av_reverse values before shifting. libavutil/swscale: YUV444P10/YUV444P9 support. H.264: Fix high bit depth explicit biweight h264: Fix 10-bit H.264 x86 chroma v loopfilter asm. Replace DEBUG_SEEK/DEBUG_SI + av_log combinations by av_dlog. Update copyright year for ac3enc_opts_template.c. adts: Adjust frame size mask to follow the specification. movenc: Add RTP muxer/hinter options movenc: Pass the RTP AVFormatContext to the SDP generation rtspenc: Add RTP muxer options rtspenc: Add an AVClass for setting muxer specific options rtpenc_chain: Pass the rtpflags options through to the chained muxer rtpenc: Declare the rtp flags private AVOptions in rtpenc.h sdp: Reindent after the previous commit rtpenc: MP4A-LATM payload support avoptions: Add an av_opt_flag_is_set function for inspecting flag fields sdp: Allow passing an AVFormatContext to the SDP generation mov: Fix wrong timestamp generation for fragmented movies that have time offset caused by the first edit list entry. mpeg12: more advanced ffmpeg mpeg2 aspect guessing code. swscale: split YUYV output out of yuv2packed[12X]_c(). Conflicts: doc/APIchanges libavcodec/Makefile libavcodec/h264dsp_template.c libavcodec/mpeg12.c libavformat/aacdec.c libavformat/avidec.c libavformat/internal.h libavformat/movenc.c libavformat/rtpenc.c libavformat/rtpenc_latm.c libavformat/sdp.c libavformat/version.h libavutil/avutil.h libavutil/pixfmt.h libswscale/swscale.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/aacdec.c2
-rw-r--r--libavformat/avidec.c33
-rw-r--r--libavformat/ffmdec.c14
-rw-r--r--libavformat/internal.h5
-rw-r--r--libavformat/mov.c9
-rw-r--r--libavformat/movenc.c4
-rw-r--r--libavformat/movenc.h1
-rw-r--r--libavformat/mpeg.c12
-rw-r--r--libavformat/mpegenc.c1
-rw-r--r--libavformat/mpegts.c2
-rw-r--r--libavformat/nsvdec.c2
-rw-r--r--libavformat/rtpenc.c16
-rw-r--r--libavformat/rtpenc.h9
-rw-r--r--libavformat/rtpenc_chain.c8
-rw-r--r--libavformat/rtpenc_latm.c3
-rw-r--r--libavformat/rtsp.h5
-rw-r--r--libavformat/rtspenc.c15
-rw-r--r--libavformat/sdp.c20
-rw-r--r--libavformat/utils.c47
-rw-r--r--libavformat/version.h2
20 files changed, 112 insertions, 98 deletions
diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c
index a224c96fba..4ac2cadb8f 100644
--- a/libavformat/aacdec.c
+++ b/libavformat/aacdec.c
@@ -44,7 +44,7 @@ static int adts_aac_probe(AVProbeData *p)
uint32_t header = AV_RB16(buf2);
if((header&0xFFF6) != 0xFFF0)
break;
- fsize = (AV_RB32(buf2+3)>>13) & 0x1FFF;
+ fsize = (AV_RB32(buf2 + 3) >> 13) & 0x1FFF;
if(fsize < 7)
break;
buf2 += fsize;
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 41bc4ad7f3..b7d09d799e 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-//#define DEBUG
-//#define DEBUG_SEEK
-
#include <strings.h>
#include "libavutil/intreadwrite.h"
#include "libavutil/bswap.h"
@@ -160,10 +157,8 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
int64_t last_pos= -1;
int64_t filesize= avio_size(s->pb);
-#ifdef DEBUG_SEEK
- av_log(s, AV_LOG_ERROR, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16"PRIX64"\n",
- longs_pre_entry,index_type, entries_in_use, chunk_id, base);
-#endif
+ av_dlog(s, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16"PRIX64"\n",
+ longs_pre_entry,index_type, entries_in_use, chunk_id, base);
if(stream_id >= s->nb_streams || stream_id < 0)
return -1;
@@ -1182,10 +1177,8 @@ static int avi_read_idx1(AVFormatContext *s, int size)
flags = avio_rl32(pb);
pos = avio_rl32(pb);
len = avio_rl32(pb);
-#if defined(DEBUG_SEEK)
- av_log(s, AV_LOG_DEBUG, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/",
- i, tag, flags, pos, len);
-#endif
+ av_dlog(s, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/",
+ i, tag, flags, pos, len);
if(i==0 && pos > avi->movi_list)
avi->movi_list= 0; //FIXME better check
pos += avi->movi_list;
@@ -1254,22 +1247,18 @@ static int avi_load_index(AVFormatContext *s)
if (avio_seek(pb, avi->movi_end, SEEK_SET) < 0)
goto the_end; // maybe truncated file
-#ifdef DEBUG_SEEK
- av_log(s, AV_LOG_DEBUG, "movi_end=0x%"PRIx64"\n", avi->movi_end);
-#endif
+ av_dlog(s, "movi_end=0x%"PRIx64"\n", avi->movi_end);
for(;;) {
if (url_feof(pb))
break;
tag = avio_rl32(pb);
size = avio_rl32(pb);
-#ifdef DEBUG_SEEK
- av_log(s, AV_LOG_DEBUG, "tag=%c%c%c%c size=0x%x\n",
- tag & 0xff,
- (tag >> 8) & 0xff,
- (tag >> 16) & 0xff,
- (tag >> 24) & 0xff,
- size);
-#endif
+ av_dlog(s, "tag=%c%c%c%c size=0x%x\n",
+ tag & 0xff,
+ (tag >> 8) & 0xff,
+ (tag >> 16) & 0xff,
+ (tag >> 24) & 0xff,
+ size);
switch(tag) {
case MKTAG('i', 'd', 'x', '1'):
if (avi_read_idx1(s, size) < 0)
diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index 604e75183c..e776d0c384 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -163,8 +163,6 @@ static int ffm_read_data(AVFormatContext *s,
return size1 - size;
}
-//#define DEBUG_SEEK
-
/* ensure that acutal seeking happens between FFM_PACKET_SIZE
and file_size - FFM_PACKET_SIZE */
static void ffm_seek1(AVFormatContext *s, int64_t pos1)
@@ -175,9 +173,7 @@ static void ffm_seek1(AVFormatContext *s, int64_t pos1)
pos = FFMIN(pos1, ffm->file_size - FFM_PACKET_SIZE);
pos = FFMAX(pos, FFM_PACKET_SIZE);
-#ifdef DEBUG_SEEK
- av_log(s, AV_LOG_DEBUG, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos);
-#endif
+ av_dlog(s, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos);
avio_seek(pb, pos, SEEK_SET);
}
@@ -189,9 +185,7 @@ static int64_t get_dts(AVFormatContext *s, int64_t pos)
ffm_seek1(s, pos);
avio_skip(pb, 4);
dts = avio_rb64(pb);
-#ifdef DEBUG_SEEK
- av_log(s, AV_LOG_DEBUG, "dts=%0.6f\n", dts / 1000000.0);
-#endif
+ av_dlog(s, "dts=%0.6f\n", dts / 1000000.0);
return dts;
}
@@ -464,9 +458,7 @@ static int ffm_seek(AVFormatContext *s, int stream_index, int64_t wanted_pts, in
int64_t pts_min, pts_max, pts;
double pos1;
-#ifdef DEBUG_SEEK
- av_log(s, AV_LOG_DEBUG, "wanted_pts=%0.6f\n", wanted_pts / 1000000.0);
-#endif
+ av_dlog(s, "wanted_pts=%0.6f\n", wanted_pts / 1000000.0);
/* find the position using linear interpolation (better than
dichotomy in typical cases) */
pos_min = FFM_PACKET_SIZE;
diff --git a/libavformat/internal.h b/libavformat/internal.h
index d6c4fa6801..e0d04db43f 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -122,11 +122,12 @@ int ff_url_join(char *str, int size, const char *proto,
* @param dest_type the destination address type, may be NULL
* @param port the destination port of the media stream, 0 if unknown
* @param ttl the time to live of the stream, 0 if not multicast
- * @param flags the AVFormatContext->flags, modifying the generated SDP
+ * @param fmt the AVFormatContext, which might contain options modifying
+ * the generated SDP
*/
void ff_sdp_write_media(char *buff, int size, AVCodecContext *c,
const char *dest_addr, const char *dest_type,
- int port, int ttl, int flags);
+ int port, int ttl, AVFormatContext *fmt);
/**
* Write a packet to another muxer than the one the user originally
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 4eb8c74a34..6a49f37741 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1537,8 +1537,9 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
/* adjust first dts according to edit list */
if (sc->time_offset && mov->time_scale > 0) {
- int rescaled = sc->time_offset < 0 ? av_rescale(sc->time_offset, sc->time_scale, mov->time_scale) : sc->time_offset;
- current_dts = -rescaled;
+ if (sc->time_offset < 0)
+ sc->time_offset = av_rescale(sc->time_offset, sc->time_scale, mov->time_scale);
+ current_dts = -sc->time_offset;
if (sc->ctts_data && sc->stts_data &&
sc->ctts_data[0].duration / FFMAX(sc->stts_data[0].duration, 1) > 16) {
/* more than 16 frames delay, dts are likely wrong
@@ -2072,7 +2073,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (flags & 0x001) data_offset = avio_rb32(pb);
if (flags & 0x004) first_sample_flags = avio_rb32(pb);
- dts = st->duration;
+ dts = st->duration - sc->time_offset;
offset = frag->base_data_offset + data_offset;
distance = 0;
av_dlog(c->fc, "first sample flags 0x%x\n", first_sample_flags);
@@ -2101,7 +2102,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
offset += sample_size;
}
frag->moof_offset = offset;
- st->duration = dts;
+ st->duration = dts + sc->time_offset;
return 0;
}
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 35526c0d1a..ebfcacb107 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -34,6 +34,7 @@
#include "libavutil/avstring.h"
#include "libavutil/opt.h"
#include "libavutil/dict.h"
+#include "rtpenc.h"
#undef NDEBUG
#include <assert.h>
@@ -41,6 +42,7 @@
static const AVOption options[] = {
{ "movflags", "MOV muxer flags", offsetof(MOVMuxContext, flags), FF_OPT_TYPE_FLAGS, {.dbl = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
{ "rtphint", "Add RTP hint tracks", 0, FF_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_RTP_HINT}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
+ FF_RTP_FLAG_OPTS(MOVMuxContext, rtp_flags),
{ NULL },
};
@@ -1368,7 +1370,7 @@ static int mov_write_udta_sdp(AVIOContext *pb, AVFormatContext *ctx, int index)
char buf[1000] = "";
int len;
- ff_sdp_write_media(buf, sizeof(buf), ctx->streams[0]->codec, NULL, NULL, 0, 0, ctx->flags);
+ ff_sdp_write_media(buf, sizeof(buf), ctx->streams[0]->codec, NULL, NULL, 0, 0, ctx);
av_strlcatf(buf, sizeof(buf), "a=control:streamid=%d\r\n", index);
len = strlen(buf);
diff --git a/libavformat/movenc.h b/libavformat/movenc.h
index 4e583b3108..610683fa6a 100644
--- a/libavformat/movenc.h
+++ b/libavformat/movenc.h
@@ -111,6 +111,7 @@ typedef struct MOVMuxContext {
MOVTrack *tracks;
int flags;
+ int rtp_flags;
} MOVMuxContext;
#define FF_MOV_FLAG_RTP_HINT 1
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index f7c57c0a86..1bc4480cd8 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -23,8 +23,6 @@
#include "internal.h"
#include "mpeg.h"
-//#define DEBUG_SEEK
-
#undef NDEBUG
#include <assert.h>
@@ -592,9 +590,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,
for(;;) {
len = mpegps_read_pes_header(s, &pos, &startcode, &pts, &dts);
if (len < 0) {
-#ifdef DEBUG_SEEK
- av_log(s, AV_LOG_DEBUG, "none (ret=%d)\n", len);
-#endif
+ av_dlog(s, "none (ret=%d)\n", len);
return AV_NOPTS_VALUE;
}
if (startcode == s->streams[stream_index]->id &&
@@ -603,10 +599,8 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,
}
avio_skip(s->pb, len);
}
-#ifdef DEBUG_SEEK
- av_log(s, AV_LOG_DEBUG, "pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n",
- pos, dts, dts / 90000.0);
-#endif
+ av_dlog(s, "pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n",
+ pos, dts, dts / 90000.0);
*ppos = pos;
return dts;
}
diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index 01b9434187..9c808d0f1e 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -25,7 +25,6 @@
#include "mpeg.h"
#define MAX_PAYLOAD_SIZE 4096
-//#define DEBUG_SEEK
#undef NDEBUG
#include <assert.h>
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 5de7c5d050..74c9ac931c 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-//#define DEBUG
-//#define DEBUG_SEEK
//#define USE_SYNCPOINT_SEARCH
#include "libavutil/crc.h"
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index 8d22520e80..b1efa5bd9c 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -22,9 +22,7 @@
#include "riff.h"
#include "libavutil/dict.h"
-//#define DEBUG
//#define DEBUG_DUMP_INDEX // XXX dumbdriving-271.nsv breaks with it commented!!
-//#define DEBUG_SEEK
#define CHECK_SUBSEQUENT_NSVS
//#define DISABLE_AUDIO
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index 7b2e78e88e..60629b098b 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -23,11 +23,24 @@
#include "mpegts.h"
#include "internal.h"
#include "libavutil/random_seed.h"
+#include "libavutil/opt.h"
#include "rtpenc.h"
//#define DEBUG
+static const AVOption options[] = {
+ FF_RTP_FLAG_OPTS(RTPMuxContext, flags),
+ { NULL },
+};
+
+static const AVClass rtp_muxer_class = {
+ .class_name = "RTP muxer",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
#define RTCP_SR_SIZE 28
static int is_supported(enum CodecID id)
@@ -404,7 +417,7 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
ff_rtp_send_mpegvideo(s1, pkt->data, size);
break;
case CODEC_ID_AAC:
- if (s1->flags & AVFMT_FLAG_MP4A_LATM)
+ if (s->flags & FF_RTP_FLAG_MP4A_LATM)
ff_rtp_send_latm(s1, pkt->data, size);
else
ff_rtp_send_aac(s1, pkt->data, size);
@@ -458,4 +471,5 @@ AVOutputFormat ff_rtp_muxer = {
rtp_write_header,
rtp_write_packet,
rtp_write_trailer,
+ .priv_class = &rtp_muxer_class,
};
diff --git a/libavformat/rtpenc.h b/libavformat/rtpenc.h
index d65214aeb0..cba0d02d91 100644
--- a/libavformat/rtpenc.h
+++ b/libavformat/rtpenc.h
@@ -25,6 +25,7 @@
#include "rtp.h"
struct RTPMuxContext {
+ const AVClass *av_class;
AVFormatContext *ic;
AVStream *st;
int payload_type;
@@ -56,10 +57,18 @@ struct RTPMuxContext {
* (1, 2 or 4)
*/
int nal_length_size;
+
+ int flags;
};
typedef struct RTPMuxContext RTPMuxContext;
+#define FF_RTP_FLAG_MP4A_LATM 1
+
+#define FF_RTP_FLAG_OPTS(ctx, fieldname) \
+ { "rtpflags", "RTP muxer flags", offsetof(ctx, fieldname), FF_OPT_TYPE_FLAGS, {.dbl = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" }, \
+ { "latm", "Use MP4A-LATM packetization instead of MPEG4-GENERIC for AAC", 0, FF_OPT_TYPE_CONST, {.dbl = FF_RTP_FLAG_MP4A_LATM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "rtpflags" } \
+
void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m);
void ff_rtp_send_h264(AVFormatContext *s1, const uint8_t *buf1, int size);
diff --git a/libavformat/rtpenc_chain.c b/libavformat/rtpenc_chain.c
index faaff097d7..7f1a8868eb 100644
--- a/libavformat/rtpenc_chain.c
+++ b/libavformat/rtpenc_chain.c
@@ -23,6 +23,7 @@
#include "avio_internal.h"
#include "rtpenc_chain.h"
#include "avio_internal.h"
+#include "libavutil/opt.h"
AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
URLContext *handle, int packet_size)
@@ -50,6 +51,13 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
rtpctx->streams[0]->sample_aspect_ratio = st->sample_aspect_ratio;
rtpctx->flags |= s->flags & AVFMT_FLAG_MP4A_LATM;
+ av_set_parameters(rtpctx, NULL);
+ /* Copy the rtpflags values straight through */
+ if (s->oformat->priv_class &&
+ av_find_opt(s->priv_data, "rtpflags", NULL, 0, 0))
+ av_set_int(rtpctx->priv_data, "rtpflags",
+ av_get_int(s->priv_data, "rtpflags", NULL));
+
/* Set the synchronized start time. */
rtpctx->start_time_realtime = s->start_time_realtime;
diff --git a/libavformat/rtpenc_latm.c b/libavformat/rtpenc_latm.c
index 501fa5d5d5..4430c44afe 100644
--- a/libavformat/rtpenc_latm.c
+++ b/libavformat/rtpenc_latm.c
@@ -22,7 +22,8 @@
#include "avformat.h"
#include "rtpenc.h"
-void ff_rtp_send_latm(AVFormatContext *s1, const uint8_t *buff, int size) {
+void ff_rtp_send_latm(AVFormatContext *s1, const uint8_t *buff, int size)
+{
/* MP4A-LATM
* The RTP payload format specification is described in RFC 3016
* The encoding specifications are provided in ISO/IEC 14496-3 */
diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
index 57990b763c..6b060923e4 100644
--- a/libavformat/rtsp.h
+++ b/libavformat/rtsp.h
@@ -344,6 +344,11 @@ typedef struct RTSPState {
* Do not begin to play the stream immediately.
*/
int initial_pause;
+
+ /**
+ * Option flags for the chained RTP muxer.
+ */
+ int rtp_muxer_flags;
} RTSPState;
/**
diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c
index 1cbcb49750..9120d187b4 100644
--- a/libavformat/rtspenc.c
+++ b/libavformat/rtspenc.c
@@ -33,9 +33,23 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/avstring.h"
#include "url.h"
+#include "libavutil/opt.h"
+#include "rtpenc.h"
#define SDP_MAX_SIZE 16384
+static const AVOption options[] = {
+ FF_RTP_FLAG_OPTS(RTSPState, rtp_muxer_flags),
+ { NULL },
+};
+
+static const AVClass rtsp_muxer_class = {
+ .class_name = "RTSP muxer",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr)
{
RTSPState *rt = s->priv_data;
@@ -238,5 +252,6 @@ AVOutputFormat ff_rtsp_muxer = {
rtsp_write_packet,
rtsp_write_close,
.flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER,
+ .priv_class = &rtsp_muxer_class,
};
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 3abc5ef567..32cef49916 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -23,6 +23,7 @@
#include "libavutil/base64.h"
#include "libavutil/dict.h"
#include "libavutil/parseutils.h"
+#include "libavutil/opt.h"
#include "libavcodec/xiph.h"
#include "libavcodec/mpeg4audio.h"
#include "avformat.h"
@@ -301,7 +302,8 @@ xiph_fail:
return NULL;
}
-static int latm_context2profilelevel(AVCodecContext *c) {
+static int latm_context2profilelevel(AVCodecContext *c)
+{
/* MP4A-LATM
* The RTP payload format specification is described in RFC 3016
* The encoding specifications are provided in ISO/IEC 14496-3 */
@@ -329,7 +331,8 @@ static int latm_context2profilelevel(AVCodecContext *c) {
return profile_level;
}
-static char *latm_context2config(AVCodecContext *c) {
+static char *latm_context2config(AVCodecContext *c)
+{
/* MP4A-LATM
* The RTP payload format specification is described in RFC 3016
* The encoding specifications are provided in ISO/IEC 14496-3 */
@@ -364,7 +367,7 @@ static char *latm_context2config(AVCodecContext *c) {
return config;
}
-static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c, int payload_type, int flags)
+static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c, int payload_type, AVFormatContext *fmt)
{
char *config = NULL;
@@ -399,7 +402,8 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
payload_type, config ? config : "");
break;
case CODEC_ID_AAC:
- if (flags & AVFMT_FLAG_MP4A_LATM) {
+ if (fmt && fmt->oformat->priv_class &&
+ av_opt_flag_is_set(fmt->priv_data, "rtpflags", "latm")) {
config = latm_context2config(c);
if (!config)
return NULL;
@@ -523,7 +527,7 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
return buff;
}
-void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl, int flags)
+void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl, AVFormatContext *fmt)
{
const char *type;
int payload_type;
@@ -546,7 +550,7 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des
av_strlcatf(buff, size, "b=AS:%d\r\n", c->bit_rate / 1000);
}
- sdp_write_media_attributes(buff, size, c, payload_type, flags);
+ sdp_write_media_attributes(buff, size, c, payload_type, fmt);
}
int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
@@ -596,7 +600,7 @@ int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
ff_sdp_write_media(buf, size,
ac[i]->streams[j]->codec, dst[0] ? dst : NULL,
dst_type, (port > 0) ? port + j * 2 : 0, ttl,
- ac[i]->flags);
+ ac[i]);
if (port <= 0) {
av_strlcatf(buf, size,
"a=control:streamid=%d\r\n", i + j);
@@ -612,7 +616,7 @@ int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
return AVERROR(ENOSYS);
}
-void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl, int flags)
+void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, const char *dest_type, int port, int ttl, AVFormatContext *fmt)
{
}
#endif
diff --git a/libavformat/utils.c b/libavformat/utils.c
index b625f2c3df..8d5d8ab2d3 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1449,8 +1449,6 @@ int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp,
wanted_timestamp, flags);
}
-#define DEBUG_SEEK
-
int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags){
AVInputFormat *avif= s->iformat;
int64_t av_uninit(pos_min), av_uninit(pos_max), pos, pos_limit;
@@ -1462,9 +1460,7 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts
if (stream_index < 0)
return -1;
-#ifdef DEBUG_SEEK
- av_log(s, AV_LOG_DEBUG, "read_seek: %d %"PRId64"\n", stream_index, target_ts);
-#endif
+ av_dlog(s, "read_seek: %d %"PRId64"\n", stream_index, target_ts);
ts_max=
ts_min= AV_NOPTS_VALUE;
@@ -1481,10 +1477,8 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts
if(e->timestamp <= target_ts || e->pos == e->min_distance){
pos_min= e->pos;
ts_min= e->timestamp;
-#ifdef DEBUG_SEEK
- av_log(s, AV_LOG_DEBUG, "using cached pos_min=0x%"PRIx64" dts_min=%"PRId64"\n",
- pos_min,ts_min);
-#endif
+ av_dlog(s, "using cached pos_min=0x%"PRIx64" dts_min=%"PRId64"\n",
+ pos_min,ts_min);
}else{
assert(index==0);
}
@@ -1497,10 +1491,8 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts
pos_max= e->pos;
ts_max= e->timestamp;
pos_limit= pos_max - e->min_distance;
-#ifdef DEBUG_SEEK
- av_log(s, AV_LOG_DEBUG, "using cached pos_max=0x%"PRIx64" pos_limit=0x%"PRIx64" dts_max=%"PRId64"\n",
- pos_max,pos_limit, ts_max);
-#endif
+ av_dlog(s, "using cached pos_max=0x%"PRIx64" pos_limit=0x%"PRIx64" dts_max=%"PRId64"\n",
+ pos_max,pos_limit, ts_max);
}
}
@@ -1522,9 +1514,7 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i
int64_t start_pos, filesize;
int no_change;
-#ifdef DEBUG_SEEK
- av_log(s, AV_LOG_DEBUG, "gen_seek: %d %"PRId64"\n", stream_index, target_ts);
-#endif
+ av_dlog(s, "gen_seek: %d %"PRId64"\n", stream_index, target_ts);
if(ts_min == AV_NOPTS_VALUE){
pos_min = s->data_offset;
@@ -1566,11 +1556,8 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i
no_change=0;
while (pos_min < pos_limit) {
-#ifdef DEBUG_SEEK
- av_log(s, AV_LOG_DEBUG, "pos_min=0x%"PRIx64" pos_max=0x%"PRIx64" dts_min=%"PRId64" dts_max=%"PRId64"\n",
- pos_min, pos_max,
- ts_min, ts_max);
-#endif
+ av_dlog(s, "pos_min=0x%"PRIx64" pos_max=0x%"PRIx64" dts_min=%"PRId64" dts_max=%"PRId64"\n",
+ pos_min, pos_max, ts_min, ts_max);
assert(pos_limit <= pos_max);
if(no_change==0){
@@ -1597,11 +1584,9 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i
no_change++;
else
no_change=0;
-#ifdef DEBUG_SEEK
- av_log(s, AV_LOG_DEBUG, "%"PRId64" %"PRId64" %"PRId64" / %"PRId64" %"PRId64" %"PRId64" target:%"PRId64" limit:%"PRId64" start:%"PRId64" noc:%d\n",
- pos_min, pos, pos_max, ts_min, ts, ts_max, target_ts, pos_limit,
- start_pos, no_change);
-#endif
+ av_dlog(s, "%"PRId64" %"PRId64" %"PRId64" / %"PRId64" %"PRId64" %"PRId64" target:%"PRId64" limit:%"PRId64" start:%"PRId64" noc:%d\n",
+ pos_min, pos, pos_max, ts_min, ts, ts_max, target_ts,
+ pos_limit, start_pos, no_change);
if(ts == AV_NOPTS_VALUE){
av_log(s, AV_LOG_ERROR, "read_timestamp() failed in the middle\n");
return -1;
@@ -1620,13 +1605,13 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i
pos = (flags & AVSEEK_FLAG_BACKWARD) ? pos_min : pos_max;
ts = (flags & AVSEEK_FLAG_BACKWARD) ? ts_min : ts_max;
-#ifdef DEBUG_SEEK
+#if 1
pos_min = pos;
ts_min = read_timestamp(s, stream_index, &pos_min, INT64_MAX);
pos_min++;
ts_max = read_timestamp(s, stream_index, &pos_min, INT64_MAX);
- av_log(s, AV_LOG_DEBUG, "pos=0x%"PRIx64" %"PRId64"<=%"PRId64"<=%"PRId64"\n",
- pos, ts_min, target_ts, ts_max);
+ av_dlog(s, "pos=0x%"PRIx64" %"PRId64"<=%"PRId64"<=%"PRId64"\n",
+ pos, ts_min, target_ts, ts_max);
#endif
*ts_ret= ts;
return pos;
@@ -2694,9 +2679,7 @@ AVProgram *av_new_program(AVFormatContext *ac, int id)
AVProgram *program=NULL;
int i;
-#ifdef DEBUG_SI
- av_log(ac, AV_LOG_DEBUG, "new_program: id=0x%04x\n", id);
-#endif
+ av_dlog(ac, "new_program: id=0x%04x\n", id);
for(i=0; i<ac->nb_programs; i++)
if(ac->programs[i]->id == id)
diff --git a/libavformat/version.h b/libavformat/version.h
index 50c39dc7d9..48224f8506 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -25,7 +25,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 53
#define LIBAVFORMAT_VERSION_MINOR 3
-#define LIBAVFORMAT_VERSION_MICRO 0
+#define LIBAVFORMAT_VERSION_MICRO 1
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \