Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

VideoAccessStrategyFactory.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Stream_Lavc_VideoAccessStrategyFactory_h
00002 #define Impala_Core_Stream_Lavc_VideoAccessStrategyFactory_h
00003 
00004 #include "Basis/CmdOptions.h"
00005 
00006 #include "Core/Stream/Lavc/VideoAccessObject.h"
00007 #include "Core/Stream/Lavc/VideoAccessStrategy.h"
00008 #include "Core/Stream/Lavc/StrategyUsingNativeIndex.h"
00009 #include "Core/Stream/Lavc/StrategyIgnoringNativeIndex.h"
00010 
00011 namespace Impala
00012 {
00013 namespace Core
00014 {
00015 namespace Stream
00016 {
00017 namespace Lavc
00018 {
00019 
00025 class VideoAccessStrategyFactory
00026 {
00027 
00028 public:
00029 
00030     VideoAccessStrategy*
00031     Construct(CString videoAddress) const
00032     {
00033         const Lavc::VideoAccessObject* vao = 
00034             new Lavc::VideoAccessObject(videoAddress);
00035         if (vao == 0 || !vao->IsValid())
00036             return 0;
00037 
00038         // consider the user's preference and otherwise the default value:
00039         bool useNativeIndex = 
00040             (CmdOptions::GetInstance().GetString("jmp") == "pts");
00041 
00042         const String formatName = vao->FormatNameShort();
00043         if ((formatName == "avi") ||
00044             (formatName == "mov,mp4,m4a,3gp,3g2,mj2"))
00045         {
00046             const String codecName = vao->VideoCodecName();
00047 
00048             // "mpeg1video" is troublesome with presentation timestamps,
00049             if (codecName != "mpeg1video")
00050                 useNativeIndex = vao->NativeIndexValid();
00051         }
00052 
00053         // ownership of the VAO will be passed to the strategy object 
00054         if (useNativeIndex)
00055             return new StrategyUsingNativeIndex(vao);
00056         else
00057             return new StrategyIgnoringNativeIndex(vao);
00058     }
00059 
00060 
00061 private:
00062 
00063     ILOG_VAR_DECL;
00064 
00065 }; //class
00066 
00067 ILOG_VAR_INIT(VideoAccessStrategyFactory, Impala.Core.Stream.Lavc);
00068 
00069 }}}} // namespace Impala::Core::Stream::Lavc
00070 
00071 #endif

Generated on Fri Mar 19 09:31:17 2010 for ImpalaSrc by  doxygen 1.5.1