libextractor

GNU libextractor
Log | Files | Refs | Submodules | README | LICENSE

commit 16f6a0bc587da46e3b702d04e67c24cb8ee697cc
parent e4a78aff0f164f5214335abe2fabcf24076f51cb
Author: Christian Grothoff <christian@grothoff.org>
Date:   Mon,  6 Aug 2012 10:49:58 +0000

fast skip to end for non-compressed large mpeg files

Diffstat:
Msrc/plugins/mpeg_extractor.c | 13+++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/plugins/mpeg_extractor.c b/src/plugins/mpeg_extractor.c @@ -1,4 +1,3 @@ - /* This file is part of libextractor. (C) 2004, 2005, 2006, 2009, 2012 Vidyut Samanta and Christian Grothoff @@ -54,6 +53,7 @@ EXTRACTOR_mpeg_extract_method (struct EXTRACTOR_ExtractContext *ec) char format[256]; char gop_format[256]; int have_gop; + uint64_t fsize; if (NULL == (handle = mpeg2_init ())) return; @@ -62,6 +62,7 @@ EXTRACTOR_mpeg_extract_method (struct EXTRACTOR_ExtractContext *ec) mpeg2_close (handle); return; } + fsize = ec->get_size (ec->cls); buf = NULL; have_gop = 0; while (1) @@ -102,7 +103,15 @@ EXTRACTOR_mpeg_extract_method (struct EXTRACTOR_ExtractContext *ec) if ((info->sequence->flags & SEQ_FLAG_MPEG2) > 0) ADD ("MPEG2", EXTRACTOR_METATYPE_FORMAT_VERSION); else - ADD ("MPEG1", EXTRACTOR_METATYPE_FORMAT_VERSION); + ADD ("MPEG1", EXTRACTOR_METATYPE_FORMAT_VERSION); + if ( (fsize != -1) && + (fsize > 1024 * 256 * 2) ) + { + /* skip to the end of the mpeg for speed */ + ec->seek (ec->cls, + fsize - 256 * 1024, + SEEK_SET); + } break; case STATE_GOP: if ( (NULL != info->gop) &&