Commit 50ff78980ec019c53797b39be8b90ec0318d65a4

Update to strigi trunk revision 1092994
  
1212
1313##### global variables #####
1414
15set(LIBSTREAMANALYZER_VERSION 0.7.1)
15set(LIBSTREAMANALYZER_VERSION 0.7.2)
1616set(LIBSTREAMANALYZER_SOVERSION 0.7)
1717option(BUILD_UTILS "build luceneindexer, xmlindexer, rdfindexer, ontoprint utilities" ON)
1818option(BUILD_DEEPTOOLS "build deep find and deepgrep tools" ON)
  
2525#include <strigi/fieldtypes.h>
2626#include <strigi/textutils.h>
2727#include <strigi/rdfnamespaces.h>
28#include <strigi/strigi_thread.h>
2829extern "C" {
2930#include <libavcodec/avcodec.h>
3031#include <libavformat/avformat.h>
3434#include <cstring>
3535#include <iostream>
3636#include <sstream>
37#include <cassert>
3738using namespace Strigi;
3839using namespace std;
3940
5555 signed char analyze(AnalysisResult& idx, ::InputStream* in);
5656};
5757
58STRIGI_MUTEX_DEFINE(mutex);
59
60static int
61lockmgr(void **mtx, enum AVLockOp op) {
62 // pre-allocating a single mutex is the only way to get it to work without changing strigi_thread.h
63 assert( (*mtx == &mutex) || (op == AV_LOCK_CREATE) );
64 switch(op) {
65 case AV_LOCK_CREATE:
66 *mtx = &mutex;
67 return !!STRIGI_MUTEX_INIT(&mutex);
68 case AV_LOCK_OBTAIN:
69 return !!STRIGI_MUTEX_LOCK(&mutex);
70 case AV_LOCK_RELEASE:
71 return !!STRIGI_MUTEX_UNLOCK(&mutex);
72 case AV_LOCK_DESTROY:
73 STRIGI_MUTEX_DESTROY(&mutex);
74 return 0;
75 }
76 return 1;
77}
78
5879class STRIGI_PLUGIN_API FFMPEGEndAnalyzerFactory : public StreamEndAnalyzerFactory {
5980friend class FFMPEGEndAnalyzer;
81public:
82 FFMPEGEndAnalyzerFactory() {
83 av_lockmgr_register(lockmgr);
84 av_register_all();
85 }
6086private:
87 ~FFMPEGEndAnalyzerFactory() {
88 av_lockmgr_register(NULL);
89 }
6190 StreamEndAnalyzer* newInstance() const {
62 av_register_all();
6391 return new FFMPEGEndAnalyzer(this);
6492 }
6593 const char* name() const {
221221// Unfortunately you can't save probe results in checkHeader because it's const
222222bool
223223FFMPEGEndAnalyzer::checkHeader(const char* header, int32_t headersize) const {
224
225 // A workaround to let internal MP3, OGG and FLAC analyzers take priority
226 if ((headersize>=64) && (
227 (strncmp("ID3", header, 3) == 0 && ((unsigned char)header[3]) <= 4 && header[5] == 0)
228 || ((readLittleEndianUInt32(header) == 0x43614c66) && ((readLittleEndianUInt32(header+4) & 0xFFFFFF7F) == 0x22000000))
229 || (!strcmp("OggS", header) && !strcmp("vorbis", header+29) && !strcmp("OggS", header+58))) )
230 return false;
231
224232 AVProbeData pd;
225233 pd.buf = (unsigned char*)header;
226234 pd.buf_size = headersize;
249249handle subtitles
250250*/
251251
252extern "C" {
253252int read_data(void *opaque, uint8_t *buf, int buf_size) {
254253 cout<<"READ";
255254 InputStream *s = (InputStream *) opaque;
286286 int64_t t= s->reset(target);
287287 cout<<t<<"\n"<<flush;
288288 return (t == target ? target : -1);
289}
290289}
291290
292291int64_t const no_bitrate = 0x8000000000000000ULL;
  
1414# libstreams defines the definitions shared by the Strigi projects
1515set(STRIGI_VERSION_MAJOR 0 CACHE INT "Major Strigi version number" FORCE)
1616set(STRIGI_VERSION_MINOR 7 CACHE INT "Minor Strigi version number" FORCE)
17set(STRIGI_VERSION_PATCH 1 CACHE INT "Release Strigi version number" FORCE)
17set(STRIGI_VERSION_PATCH 2 CACHE INT "Release Strigi version number" FORCE)
1818set(STRIGI_VERSION_STRING "${STRIGI_VERSION_MAJOR}.${STRIGI_VERSION_MINOR}.${STRIGI_VERSION_PATCH}" CACHE STRING "Strigi version string" FORCE)
1919set(LIBSTREAMS_VERSION ${STRIGI_VERSION_STRING})
2020