--- libs/libavformat/avformat.h.orig 2006-08-23 06:43:47.000000000 +0100 +++ libs/libavformat/avformat.h 2006-12-10 14:46:52.529257250 +0000 @@ -467,6 +467,8 @@ #define AVERROR_NOTSUPP (-7) /* operation not supported */ int av_find_stream_info(AVFormatContext *ic); +int av_find_stream_info_deep(AVFormatContext *ic); +int av_find_stream_info_helper(AVFormatContext *ic, int deepsearch); int av_read_packet(AVFormatContext *s, AVPacket *pkt); int av_read_frame(AVFormatContext *s, AVPacket *pkt); int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags); --- libs/libavformat/utils.c.orig 2006-08-23 06:43:47.000000000 +0100 +++ libs/libavformat/utils.c 2006-12-10 14:46:52.541258000 +0000 @@ -1997,15 +1997,47 @@ /** * @brief Read the beginning of a media file to get stream information. * + * This uses the helper function to determine the stream info quickly to + * cut down channel change time. + * + * @param ic media file handle + * @return >=0 if OK. AVERROR_xxx if error. + */ +int av_find_stream_info(AVFormatContext *ic) +{ + return av_find_stream_info_helper(ic, 0); +} + +/** + * @brief Read the beginning of a media file to get stream information. + * + * This uses the helper function to determine the stream info in a thorough + * fashion so that we don't miss any streams. + * + * @param ic media file handle + * @return >=0 if OK. AVERROR_xxx if error. + */ +int av_find_stream_info_deep(AVFormatContext *ic) +{ + return av_find_stream_info_helper(ic, 1); +} + +/** + * @brief Read the beginning of a media file to get stream information. + * * This is useful for file formats with no headers such as MPEG. This * function also computes the real frame rate in case of mpeg2 repeat * frame mode. * + * If we specify a deep search, it will take longer to do (not good for + * channel changes) but will pick up all stream info (good for mytharchive). + * * @param ic media file handle + * @param deepsearch flag to indicate whether the search is fast (0) or thorough (1) * @return >=0 if OK. AVERROR_xxx if error. * @todo let user decide somehow what information is needed so we dont waste time geting stuff the user doesnt need */ -int av_find_stream_info(AVFormatContext *ic) +int av_find_stream_info_helper(AVFormatContext *ic, int deepsearch) { int i, count, ret, read_size, j, read_packets = 0; AVStream *st; @@ -2068,7 +2100,7 @@ stop here */ if (!(ic->ctx_flags & AVFMTCTX_NOHEADER) || (read_size >= MAX_READ_SIZE || read_packets >= MAX_FRAMES) || - (hasvideo && hasaudio)) { + (hasvideo && hasaudio && (deepsearch == 0))) { /* if we found the info for all the codecs, we can stop */ ret = count; break; --- programs/mythtranscode/mpeg2fix.cpp.orig 2006-12-10 14:34:05.013290500 +0000 +++ programs/mythtranscode/mpeg2fix.cpp 2006-12-10 14:46:52.537257750 +0000 @@ -705,7 +705,7 @@ av_seek_frame(inputFC, vid_id, offset, AVSEEK_FLAG_BYTE); // Getting stream information - ret = av_find_stream_info(inputFC); + ret = av_find_stream_info_deep(inputFC); if (ret < 0) {