diff options
author | Ramiro Polla <ramiro.polla@gmail.com> | 2012-04-04 09:50:05 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-09-12 18:36:57 +0400 |
commit | b04fbd2cd250f1c9fdaeb47275d71d6df3ee457d (patch) | |
tree | 10b38f17d6931475117e5b9d1871bc28d981144a | |
parent | f7b045db09e126ea86b4908e37370ea5cdcc46a3 (diff) |
asfenc: reduce code duplication with new variable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f2fad251b8f0b5cfa9fa43200e72f5f9194fd620)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/asfenc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index 1e42e1c825..d1bb07b8eb 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -808,6 +808,7 @@ static int asf_write_packet(AVFormatContext *s, AVPacket *pkt) /* check index */ if ((!asf->is_streamed) && (flags & AV_PKT_FLAG_KEY)) { + uint16_t packet_count = asf->nb_packets - packet_number; start_sec = (int)(pts / INT64_C(10000000)); if (start_sec != (int)(asf->last_indexed_pts / INT64_C(10000000))) { if (start_sec > asf->nb_index_memory_alloc) { @@ -817,8 +818,8 @@ static int asf_write_packet(AVFormatContext *s, AVPacket *pkt) for(i=asf->nb_index_count;i<start_sec;i++) { // store asf->index_ptr[i].packet_number = (uint32_t)packet_number; - asf->index_ptr[i].packet_count = (uint16_t)(asf->nb_packets-packet_number); - asf->maximum_packet = FFMAX(asf->maximum_packet, (uint16_t)(asf->nb_packets-packet_number)); + asf->index_ptr[i].packet_count = (uint16_t)packet_count; + asf->maximum_packet = FFMAX(asf->maximum_packet, (uint16_t)packet_count); } asf->nb_index_count = start_sec; asf->last_indexed_pts = pts; |