fix flush and interleaving by edit units
Originally committed as revision 16937 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
		
							parent
							
								
									0e9dbd9685
								
							
						
					
					
						commit
						bc185fc161
					
				| @ -1296,25 +1296,37 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket | |||||||
| 
 | 
 | ||||||
|     if (stream_count && (s->nb_streams == stream_count || flush)) { |     if (stream_count && (s->nb_streams == stream_count || flush)) { | ||||||
|         pktl = s->packet_buffer; |         pktl = s->packet_buffer; | ||||||
|         *out = pktl->pkt; |         if (s->nb_streams != stream_count) { | ||||||
|         //av_log(s, AV_LOG_DEBUG, "out st:%d dts:%lld\n", (*out).stream_index, (*out).dts);
 |             MXFContext *mxf = s->priv_data; | ||||||
|         s->packet_buffer = pktl->next; |             AVPacketList *first = NULL; | ||||||
|         av_freep(&pktl); |             // find first packet in edit unit
 | ||||||
| 
 |             while (pktl) { | ||||||
|         if (flush && stream_count < s->nb_streams) { |                 AVStream *st = s->streams[pktl->pkt.stream_index]; | ||||||
|  |                 if (st->index == mxf->edit_unit_start) | ||||||
|  |                     break; | ||||||
|  |                 else if (!first) | ||||||
|  |                     first = pktl; | ||||||
|  |                 pktl = pktl->next; | ||||||
|  |             } | ||||||
|             // purge packet queue
 |             // purge packet queue
 | ||||||
|             pktl = s->packet_buffer; |  | ||||||
|             while (pktl) { |             while (pktl) { | ||||||
|                 AVPacketList *next = pktl->next; |                 AVPacketList *next = pktl->next; | ||||||
|                 av_free_packet(&pktl->pkt); |                 av_free_packet(&pktl->pkt); | ||||||
|                 av_freep(&pktl); |                 av_freep(&pktl); | ||||||
|                 pktl = next; |                 pktl = next; | ||||||
|             } |             } | ||||||
|             s->packet_buffer = NULL; |             if (!first) | ||||||
|  |                 goto out; | ||||||
|  |             pktl = first; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         *out = pktl->pkt; | ||||||
|  |         //av_log(s, AV_LOG_DEBUG, "out st:%d dts:%lld\n", (*out).stream_index, (*out).dts);
 | ||||||
|  |         s->packet_buffer = pktl->next; | ||||||
|  |         av_freep(&pktl); | ||||||
|         return 1; |         return 1; | ||||||
|     } else { |     } else { | ||||||
|  |     out: | ||||||
|         av_init_packet(out); |         av_init_packet(out); | ||||||
|         return 0; |         return 0; | ||||||
|     } |     } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user