From: Aurelien Jacobs Date: Mon, 9 Apr 2007 16:22:18 +0000 (+0000) Subject: remove wrong and no more used packet reordering code X-Git-Tag: v0.5~9352 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=794857ae45d0a0e75e45554699ad3774686d0fed;p=platform%2Fupstream%2Flibav.git remove wrong and no more used packet reordering code Originally committed as revision 8691 to svn://svn.ffmpeg.org/ffmpeg/trunk --- diff --git a/libavformat/matroska.c b/libavformat/matroska.c index 4143422..ec1f9b9 100644 --- a/libavformat/matroska.c +++ b/libavformat/matroska.c @@ -178,7 +178,6 @@ typedef enum { MATROSKA_TRACK_DEFAULT = (1<<1), MATROSKA_TRACK_LACING = (1<<2), MATROSKA_TRACK_REAL_V = (1<<4), - MATROSKA_TRACK_REORDER = (1<<8), MATROSKA_TRACK_SHIFT = (1<<16) } MatroskaTrackFlags; @@ -338,10 +337,6 @@ typedef struct MatroskaDemuxContext { /* The packet queue. */ AVPacket **packets; int num_packets; - /* Second packet queue used to reorder pts of some video track. */ - AVPacket **packets_reorder; - int num_packets_reorder; - uint64_t reorder_max_pts; /* have we already parse metadata/cues/clusters? */ int metadata_parsed, @@ -1026,42 +1021,6 @@ matroska_queue_packet (MatroskaDemuxContext *matroska, matroska->num_packets++; } -/* - * Put a packet into our internal reordering queue. Will be moved to the - * main packet queue when enough packets are available to reorder pts. - */ - -static void -matroska_queue_packet_reordered (MatroskaDemuxContext *matroska, - AVPacket *pkt, - int is_bframe) -{ - if (matroska->num_packets_reorder && !is_bframe - && pkt->pts > matroska->reorder_max_pts) { - /* reorder pts */ - int i, j, k = 1; - for (j=matroska->num_packets_reorder-1; j && k; j--) { - k = 0; - for (i=0; ipackets_reorder[i]->pts > matroska->packets_reorder[i+1]->pts) { - FFSWAP(uint64_t, matroska->packets_reorder[i]->pts, matroska->packets_reorder[i+1]->pts); - k = 1; - } - } - } - /* then really queue the packets */ - for (i=0; inum_packets_reorder; i++) - matroska_queue_packet (matroska, matroska->packets_reorder[i]); - matroska->num_packets_reorder = 0; - } - matroska->packets_reorder = - av_realloc(matroska->packets_reorder, - (matroska->num_packets_reorder + 1) * sizeof(AVPacket *)); - matroska->packets_reorder[matroska->num_packets_reorder++] = pkt; - if (pkt->pts > matroska->reorder_max_pts) - matroska->reorder_max_pts = pkt->pts; -} - /* * Autodetecting... @@ -2582,9 +2541,6 @@ matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size, pkt->pos = pos; pkt->duration = duration; - if (matroska->tracks[track]->flags & MATROSKA_TRACK_REORDER) - matroska_queue_packet_reordered(matroska, pkt, is_bframe); - else matroska_queue_packet(matroska, pkt); if (timecode != AV_NOPTS_VALUE) @@ -2814,13 +2770,6 @@ matroska_read_close (AVFormatContext *s) } av_free(matroska->packets); } - if (matroska->packets_reorder) { - for (n = 0; n < matroska->num_packets_reorder; n++) { - av_free_packet(matroska->packets_reorder[n]); - av_free(matroska->packets_reorder[n]); - } - av_free(matroska->packets_reorder); - } for (n = 0; n < matroska->num_tracks; n++) { MatroskaTrack *track = matroska->tracks[n];