aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/utils.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-01-05 10:16:41 +0100
committerAnton Khirnov <anton@khirnov.net>2012-01-05 14:34:28 +0100
commitf9b9dd874030db891b4f1c70e06d48311023a006 (patch)
treee4c2578422b171e5d5c8c1eccb144ead794046fa /libavformat/utils.c
parent6450599e224164d51a90b1be38598cbc3093bad6 (diff)
downloadffmpeg-f9b9dd874030db891b4f1c70e06d48311023a006.tar.gz
lavf: cosmetics, reformat av_read_frame().
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 0332927b43..a79665801f 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1261,30 +1261,29 @@ static int read_from_packet_buffer(AVFormatContext *s, AVPacket *pkt)
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
{
- AVPacketList *pktl;
- int eof=0;
- const int genpts= s->flags & AVFMT_FLAG_GENPTS;
+ const int genpts = s->flags & AVFMT_FLAG_GENPTS;
+ int eof = 0;
if (!genpts)
return s->packet_buffer ? read_from_packet_buffer(s, pkt) :
read_frame_internal(s, pkt);
- for(;;){
+ for (;;) {
int ret;
- pktl = s->packet_buffer;
+ AVPacketList *pktl = s->packet_buffer;
if (pktl) {
- AVPacket *next_pkt= &pktl->pkt;
+ AVPacket *next_pkt = &pktl->pkt;
if (next_pkt->dts != AV_NOPTS_VALUE) {
int wrap_bits = s->streams[next_pkt->stream_index]->pts_wrap_bits;
- while(pktl && next_pkt->pts == AV_NOPTS_VALUE){
- if( pktl->pkt.stream_index == next_pkt->stream_index
- && (0 > av_compare_mod(next_pkt->dts, pktl->pkt.dts, 2LL << (wrap_bits - 1)))
- && av_compare_mod(pktl->pkt.pts, pktl->pkt.dts, 2LL << (wrap_bits - 1))) { //not b frame
- next_pkt->pts= pktl->pkt.dts;
+ while (pktl && next_pkt->pts == AV_NOPTS_VALUE) {
+ if (pktl->pkt.stream_index == next_pkt->stream_index &&
+ (av_compare_mod(next_pkt->dts, pktl->pkt.dts, 2LL << (wrap_bits - 1)) < 0) &&
+ av_compare_mod(pktl->pkt.pts, pktl->pkt.dts, 2LL << (wrap_bits - 1))) { //not b frame
+ next_pkt->pts = pktl->pkt.dts;
}
- pktl= pktl->next;
+ pktl = pktl->next;
}
pktl = s->packet_buffer;
}