examples/demuxing_decoding: set stream_idx in open_codec_context only if no error occured
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
		
							parent
							
								
									b80106169a
								
							
						
					
					
						commit
						2a3b7a55b5
					
				| @ -138,7 +138,7 @@ static int decode_packet(int *got_frame, int cached) | |||||||
| static int open_codec_context(int *stream_idx, | static int open_codec_context(int *stream_idx, | ||||||
|                               AVFormatContext *fmt_ctx, enum AVMediaType type) |                               AVFormatContext *fmt_ctx, enum AVMediaType type) | ||||||
| { | { | ||||||
|     int ret; |     int ret, stream_index; | ||||||
|     AVStream *st; |     AVStream *st; | ||||||
|     AVCodecContext *dec_ctx = NULL; |     AVCodecContext *dec_ctx = NULL; | ||||||
|     AVCodec *dec = NULL; |     AVCodec *dec = NULL; | ||||||
| @ -150,8 +150,8 @@ static int open_codec_context(int *stream_idx, | |||||||
|                 av_get_media_type_string(type), src_filename); |                 av_get_media_type_string(type), src_filename); | ||||||
|         return ret; |         return ret; | ||||||
|     } else { |     } else { | ||||||
|         *stream_idx = ret; |         stream_index = ret; | ||||||
|         st = fmt_ctx->streams[*stream_idx]; |         st = fmt_ctx->streams[stream_index]; | ||||||
| 
 | 
 | ||||||
|         /* find decoder for the stream */ |         /* find decoder for the stream */ | ||||||
|         dec_ctx = st->codec; |         dec_ctx = st->codec; | ||||||
| @ -170,6 +170,7 @@ static int open_codec_context(int *stream_idx, | |||||||
|                     av_get_media_type_string(type)); |                     av_get_media_type_string(type)); | ||||||
|             return ret; |             return ret; | ||||||
|         } |         } | ||||||
|  |         *stream_idx = stream_index; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     return 0; |     return 0; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user