}
#endif
-static int _get_first_good_video_frame(AVFormatContext *pFormatCtx, AVCodecContext *pCodecCtx, AVFrame **pFrame, int cdis);
+static int _get_first_good_video_frame(AVFormatContext *pFormatCtx, AVCodecContext *pCodecCtx, AVFrame **pFrame, int cdis, int videoStreamId);
static int __convert_vidio_codec_type(int AVVideoCodecID)
{
}
/* search & decode */
- ret = _get_first_good_video_frame(pFormatCtx, pVideoCodecCtx, &pFrame, formatContext->cdis);
+ ret = _get_first_good_video_frame(pFormatCtx, pVideoCodecCtx, &pFrame, formatContext->cdis, formatContext->videoStreamId);
if (ret != MMFILE_FORMAT_SUCCESS) {
debug_error(DEBUG, "error: get key frame");
goto EXCEPTION;
}
#endif
-static int _get_first_good_video_frame(AVFormatContext *pFormatCtx, AVCodecContext *pCodecCtx, AVFrame **pFrame, int cdis)
+static int _get_first_good_video_frame(AVFormatContext *pFormatCtx, AVCodecContext *pCodecCtx, AVFrame **pFrame, int cdis, int videoStreamId)
{
#define _RETRY_SEARCH_LIMIT 250
#define _KEY_SEARCH_LIMIT (_RETRY_SEARCH_LIMIT*2) /*2 = 1 read. some frame need to read one more*/
break;
}
- if (avcodec_get_type(pFormatCtx->streams[pkt->stream_index]->codecpar->codec_id) != AVMEDIA_TYPE_VIDEO)
+ if (pkt->stream_index != videoStreamId)
goto NEXT;
v++;