asfenc: reduce code duplication with new variable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
committed by
Michael Niedermayer
parent
1ceff0859d
commit
f2fad251b8
@@ -808,6 +808,7 @@ static int asf_write_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
|
|
||||||
/* check index */
|
/* check index */
|
||||||
if ((!asf->is_streamed) && (flags & AV_PKT_FLAG_KEY)) {
|
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));
|
start_sec = (int)(pts / INT64_C(10000000));
|
||||||
if (start_sec != (int)(asf->last_indexed_pts / INT64_C(10000000))) {
|
if (start_sec != (int)(asf->last_indexed_pts / INT64_C(10000000))) {
|
||||||
if (start_sec > asf->nb_index_memory_alloc) {
|
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++) {
|
for(i=asf->nb_index_count;i<start_sec;i++) {
|
||||||
// store
|
// store
|
||||||
asf->index_ptr[i].packet_number = (uint32_t)packet_number;
|
asf->index_ptr[i].packet_number = (uint32_t)packet_number;
|
||||||
asf->index_ptr[i].packet_count = (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)(asf->nb_packets-packet_number));
|
asf->maximum_packet = FFMAX(asf->maximum_packet, (uint16_t)packet_count);
|
||||||
}
|
}
|
||||||
asf->nb_index_count = start_sec;
|
asf->nb_index_count = start_sec;
|
||||||
asf->last_indexed_pts = pts;
|
asf->last_indexed_pts = pts;
|
||||||
|
Reference in New Issue
Block a user