aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-29 13:15:16 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-10-29 13:15:27 +0100
commit67420b3de50202c0c71e3c9a57451b4adbcb16ab (patch)
treef7be2c59620ee2cc598467de8155ebb7ceab0bdf
parent7d1e003abddf18ba43be359c4d3b6194f9f2fbca (diff)
parentf174fbac3cb127273b8f3df8e05d7156ec1d7658 (diff)
downloadffmpeg-67420b3de50202c0c71e3c9a57451b4adbcb16ab.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: lavc: add CODEC_CAP_DR1 to all video decoders missing them rtpdec: Cosmetic cleanup Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/bink.c1
-rw-r--r--libavcodec/dpx.c1
-rw-r--r--libavcodec/indeo3.c1
-rw-r--r--libavcodec/indeo4.c1
-rw-r--r--libavcodec/indeo5.c1
-rw-r--r--libavcodec/kgv1dec.c1
-rw-r--r--libavcodec/sgidec.c1
-rw-r--r--libavcodec/vb.c1
-rw-r--r--libavcodec/yop.c1
-rw-r--r--libavformat/rtpdec.c106
10 files changed, 60 insertions, 55 deletions
diff --git a/libavcodec/bink.c b/libavcodec/bink.c
index 31e4ac30da..91cd651468 100644
--- a/libavcodec/bink.c
+++ b/libavcodec/bink.c
@@ -1328,4 +1328,5 @@ AVCodec ff_bink_decoder = {
.close = decode_end,
.decode = decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("Bink video"),
+ .capabilities = CODEC_CAP_DR1,
};
diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index 9b96ed8c64..d9861579ef 100644
--- a/libavcodec/dpx.c
+++ b/libavcodec/dpx.c
@@ -293,4 +293,5 @@ AVCodec ff_dpx_decoder = {
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("DPX image"),
+ .capabilities = CODEC_CAP_DR1,
};
diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c
index 404d24a84f..1f231548cc 100644
--- a/libavcodec/indeo3.c
+++ b/libavcodec/indeo3.c
@@ -1143,4 +1143,5 @@ AVCodec ff_indeo3_decoder = {
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Intel Indeo 3"),
+ .capabilities = CODEC_CAP_DR1,
};
diff --git a/libavcodec/indeo4.c b/libavcodec/indeo4.c
index a3d7e6cde1..1d6d0490e6 100644
--- a/libavcodec/indeo4.c
+++ b/libavcodec/indeo4.c
@@ -646,4 +646,5 @@ AVCodec ff_indeo4_decoder = {
.close = ff_ivi_decode_close,
.decode = ff_ivi_decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("Intel Indeo Video Interactive 4"),
+ .capabilities = CODEC_CAP_DR1,
};
diff --git a/libavcodec/indeo5.c b/libavcodec/indeo5.c
index 423d79b53a..52dddd2ad9 100644
--- a/libavcodec/indeo5.c
+++ b/libavcodec/indeo5.c
@@ -674,4 +674,5 @@ AVCodec ff_indeo5_decoder = {
.close = ff_ivi_decode_close,
.decode = ff_ivi_decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("Intel Indeo Video Interactive 5"),
+ .capabilities = CODEC_CAP_DR1,
};
diff --git a/libavcodec/kgv1dec.c b/libavcodec/kgv1dec.c
index 1cbd1c3489..6552dc537f 100644
--- a/libavcodec/kgv1dec.c
+++ b/libavcodec/kgv1dec.c
@@ -191,4 +191,5 @@ AVCodec ff_kgv1_decoder = {
.decode = decode_frame,
.flush = decode_flush,
.long_name = NULL_IF_CONFIG_SMALL("Kega Game Video"),
+ .capabilities = CODEC_CAP_DR1,
};
diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c
index e9ada699e4..1805e23574 100644
--- a/libavcodec/sgidec.c
+++ b/libavcodec/sgidec.c
@@ -269,4 +269,5 @@ AVCodec ff_sgi_decoder = {
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("SGI image"),
+ .capabilities = CODEC_CAP_DR1,
};
diff --git a/libavcodec/vb.c b/libavcodec/vb.c
index 78ef669c3a..512945810e 100644
--- a/libavcodec/vb.c
+++ b/libavcodec/vb.c
@@ -280,4 +280,5 @@ AVCodec ff_vb_decoder = {
.close = decode_end,
.decode = decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("Beam Software VB"),
+ .capabilities = CODEC_CAP_DR1,
};
diff --git a/libavcodec/yop.c b/libavcodec/yop.c
index 255ed32ca7..905b84f68d 100644
--- a/libavcodec/yop.c
+++ b/libavcodec/yop.c
@@ -272,4 +272,5 @@ AVCodec ff_yop_decoder = {
.close = yop_decode_close,
.decode = yop_decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("Psygnosis YOP Video"),
+ .capabilities = CODEC_CAP_DR1,
};
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 963a3170e0..18cc16fcfe 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -166,71 +166,67 @@ static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char *buf, int l
#define RTP_SEQ_MOD (1<<16)
-/**
-* called on parse open packet
-*/
-static void rtp_init_statistics(RTPStatistics *s, uint16_t base_sequence) // called on parse open packet.
+static void rtp_init_statistics(RTPStatistics *s, uint16_t base_sequence)
{
memset(s, 0, sizeof(RTPStatistics));
- s->max_seq= base_sequence;
- s->probation= 1;
+ s->max_seq = base_sequence;
+ s->probation = 1;
}
-/**
+/*
* called whenever there is a large jump in sequence numbers, or when they get out of probation...
*/
static void rtp_init_sequence(RTPStatistics *s, uint16_t seq)
{
- s->max_seq= seq;
- s->cycles= 0;
- s->base_seq= seq -1;
- s->bad_seq= RTP_SEQ_MOD + 1;
- s->received= 0;
- s->expected_prior= 0;
- s->received_prior= 0;
- s->jitter= 0;
- s->transit= 0;
+ s->max_seq = seq;
+ s->cycles = 0;
+ s->base_seq = seq - 1;
+ s->bad_seq = RTP_SEQ_MOD + 1;
+ s->received = 0;
+ s->expected_prior = 0;
+ s->received_prior = 0;
+ s->jitter = 0;
+ s->transit = 0;
}
-/**
+/*
* returns 1 if we should handle this packet.
*/
static int rtp_valid_packet_in_sequence(RTPStatistics *s, uint16_t seq)
{
- uint16_t udelta= seq - s->max_seq;
- const int MAX_DROPOUT= 3000;
- const int MAX_MISORDER = 100;
+ uint16_t udelta = seq - s->max_seq;
+ const int MAX_DROPOUT = 3000;
+ const int MAX_MISORDER = 100;
const int MIN_SEQUENTIAL = 2;
/* source not valid until MIN_SEQUENTIAL packets with sequence seq. numbers have been received */
- if(s->probation)
- {
- if(seq==s->max_seq + 1) {
+ if (s->probation) {
+ if (seq == s->max_seq + 1) {
s->probation--;
- s->max_seq= seq;
- if(s->probation==0) {
+ s->max_seq = seq;
+ if (s->probation == 0) {
rtp_init_sequence(s, seq);
s->received++;
return 1;
}
} else {
- s->probation= MIN_SEQUENTIAL - 1;
+ s->probation = MIN_SEQUENTIAL - 1;
s->max_seq = seq;
}
} else if (udelta < MAX_DROPOUT) {
// in order, with permissible gap
- if(seq < s->max_seq) {
- //sequence number wrapped; count antother 64k cycles
+ if (seq < s->max_seq) {
+ // sequence number wrapped; count another 64k cycles
s->cycles += RTP_SEQ_MOD;
}
- s->max_seq= seq;
+ s->max_seq = seq;
} else if (udelta <= RTP_SEQ_MOD - MAX_MISORDER) {
// sequence made a large jump...
- if(seq==s->bad_seq) {
+ if (seq == s->bad_seq) {
// two sequential packets-- assume that the other side restarted without telling us; just resync.
rtp_init_sequence(s, seq);
} else {
- s->bad_seq= (seq + 1) & (RTP_SEQ_MOD-1);
+ s->bad_seq = (seq + 1) & (RTP_SEQ_MOD - 1);
return 0;
}
} else {
@@ -246,7 +242,7 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
uint8_t *buf;
int len;
int rtcp_bytes;
- RTPStatistics *stats= &s->statistics;
+ RTPStatistics *stats = &s->statistics;
uint32_t lost;
uint32_t extended_max;
uint32_t expected_interval;
@@ -254,7 +250,7 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
uint32_t lost_interval;
uint32_t expected;
uint32_t fraction;
- uint64_t ntp_time= s->last_rtcp_ntp_time; // TODO: Get local ntp time?
+ uint64_t ntp_time = s->last_rtcp_ntp_time; // TODO: Get local ntp time?
if (!s->rtp_ctx || (count < 1))
return -1;
@@ -281,31 +277,32 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
avio_wb32(pb, s->ssrc); // server SSRC
// some placeholders we should really fill...
// RFC 1889/p64
- extended_max= stats->cycles + stats->max_seq;
- expected= extended_max - stats->base_seq + 1;
- lost= expected - stats->received;
- lost= FFMIN(lost, 0xffffff); // clamp it since it's only 24 bits...
- expected_interval= expected - stats->expected_prior;
- stats->expected_prior= expected;
- received_interval= stats->received - stats->received_prior;
- stats->received_prior= stats->received;
- lost_interval= expected_interval - received_interval;
- if (expected_interval==0 || lost_interval<=0) fraction= 0;
- else fraction = (lost_interval<<8)/expected_interval;
-
- fraction= (fraction<<24) | lost;
+ extended_max = stats->cycles + stats->max_seq;
+ expected = extended_max - stats->base_seq + 1;
+ lost = expected - stats->received;
+ lost = FFMIN(lost, 0xffffff); // clamp it since it's only 24 bits...
+ expected_interval = expected - stats->expected_prior;
+ stats->expected_prior = expected;
+ received_interval = stats->received - stats->received_prior;
+ stats->received_prior = stats->received;
+ lost_interval = expected_interval - received_interval;
+ if (expected_interval == 0 || lost_interval <= 0)
+ fraction = 0;
+ else
+ fraction = (lost_interval << 8) / expected_interval;
+
+ fraction = (fraction << 24) | lost;
avio_wb32(pb, fraction); /* 8 bits of fraction, 24 bits of total packets lost */
avio_wb32(pb, extended_max); /* max sequence received */
- avio_wb32(pb, stats->jitter>>4); /* jitter */
+ avio_wb32(pb, stats->jitter >> 4); /* jitter */
- if(s->last_rtcp_ntp_time==AV_NOPTS_VALUE)
- {
+ if (s->last_rtcp_ntp_time == AV_NOPTS_VALUE) {
avio_wb32(pb, 0); /* last SR timestamp */
avio_wb32(pb, 0); /* delay since last SR */
} else {
- uint32_t middle_32_bits= s->last_rtcp_ntp_time>>16; // this is valid, right? do we need to handle 64 bit values special?
- uint32_t delay_since_last= ntp_time - s->last_rtcp_ntp_time;
+ uint32_t middle_32_bits = s->last_rtcp_ntp_time >> 16; // this is valid, right? do we need to handle 64 bit values special?
+ uint32_t delay_since_last = ntp_time - s->last_rtcp_ntp_time;
avio_wb32(pb, middle_32_bits); /* last SR timestamp */
avio_wb32(pb, delay_since_last); /* delay since last SR */
@@ -431,9 +428,8 @@ RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext
return s;
}
-void
-ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
- RTPDynamicProtocolHandler *handler)
+void ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
+ RTPDynamicProtocolHandler *handler)
{
s->dynamic_protocol_context = ctx;
s->parse_packet = handler->parse_packet;
@@ -674,7 +670,7 @@ static int rtp_parse_queued_packet(RTPDemuxContext *s, AVPacket *pkt)
}
static int rtp_parse_one_packet(RTPDemuxContext *s, AVPacket *pkt,
- uint8_t **bufptr, int len)
+ uint8_t **bufptr, int len)
{
uint8_t* buf = bufptr ? *bufptr : NULL;
int ret, flags = 0;