Code Search for Developers
 
 
  

codec.cpp from NeoEngineNG at Krugle


Show codec.cpp syntax highlighted

/***************************************************************************
                       codec.cpp  -  Ogg Vorbis codec
                             -------------------
    begin                : Wed Mar 17 2004
    copyright            : (C) 2004 by Reality Rift Studios
    email                : mattias@realityrift.com
 ***************************************************************************

 The contents of this file are subject to the Mozilla Public License Version
 1.1 (the "License"); you may not use this file except in compliance with
 the License. You may obtain a copy of the License at 
 http://www.mozilla.org/MPL/

 Software distributed under the License is distributed on an "AS IS" basis,
 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 for the specific language governing rights and limitations under the
 License.

 The Original Code is the NeoEngine, NeoACVorbis, codec.cpp

 The Initial Developer of the Original Code is Mattias Jansson.
 Portions created by Mattias Jansson are Copyright (C) 2004
 Reality Rift Studios. All Rights Reserved.

 ***************************************************************************/

#include "codec.h"
#include "stream.h"
#include "link.h"

#include <neoengine/core.h>
#include <neoengine/module.h>

#include <vector>

using namespace std;
using namespace NeoEngine;


namespace NeoACVorbis
{


#define VORBISEXPORT
	ModuleStatic *g_pkStaticModule = 0;

	VORBISEXPORT NeoEngine::SoundCodec *LoadSoundCodec()
	{
		vector<string> vstrExtensions;

		vstrExtensions.push_back( "ogg" );
		vstrExtensions.push_back( "OGG" );

		return new NeoACVorbis::Codec( "Ogg Vorbis audio", vstrExtensions );
	}

	VORBISEXPORT int Initialize()
	{
		return 0;
	}

	VORBISEXPORT int Shutdown()
	{
		delete g_pkStaticModule;
		return 0;
	}

	VORBISEXPORT void GetVersion( std::string *pstrName, int *piMajor, int *piMinor, int *piRevision )
	{
		*pstrName   = "NeoACVorbis";
		*piMajor    = NEOENGINEVERSION_MAJOR;
		*piMinor    = NEOENGINEVERSION_MINOR;
		*piRevision = NEOENGINEVERSION_REVISION;
	}

	Link::Link()
	{
#if defined(WIN32) && defined(_DEBUG)
		g_pkStaticModule = new ModuleStatic( "neoacvorbis_debug" );
#else
		g_pkStaticModule = new ModuleStatic( "neoacvorbis" );
#endif

		g_pkStaticModule->m_Symbols.Insert( "LoadSoundCodec", (void**)LoadSoundCodec );
		g_pkStaticModule->m_Symbols.Insert( "Initialize",     (void**)Initialize );
		g_pkStaticModule->m_Symbols.Insert( "Shutdown",       (void**)Shutdown   );
		g_pkStaticModule->m_Symbols.Insert( "GetVersion",     (void**)GetVersion );

		NeoEngine::Core::GetModuleManager()->InsertModule( g_pkStaticModule );
	}


	Codec::Codec( const std::string &rstrFiletypeName, const std::vector< std::string > &rvstrExtensions ) :
		NeoEngine::SoundCodec( rstrFiletypeName, rvstrExtensions )
	{
	}


	Codec::~Codec()
	{
	}

	bool Codec::IsType( NeoEngine::File *pkFile )
	{
		bool bIs = true;
		OggVorbis_File ogg;
		ov_callbacks cb;

		cb.read_func  = read_stream;
		cb.seek_func  = seek_stream;
		cb.close_func = close_stream;
		cb.tell_func  = tell_stream;

		if( ov_open_callbacks( pkFile, &ogg, 0, 0, cb ) )
		{
			bIs = false;
		}

		ov_clear( &ogg );

		return bIs;
	}


	NeoEngine::SoundStream *Codec::GetStream( NeoEngine::File *pkFile )
	{
		return new Stream( pkFile );
	}
	
};




See more files for this project here

NeoEngineNG

NeoenEngine NG (Next Generation) is the evolution of neoengine one,it\'s a different development from NeoEngine2, it\'s a direct inherits from NeoEngine one.\n

Project homepage: http://sourceforge.net/projects/neoengineng
Programming language(s): C,C++
License: other

  ogg/
    bitwise.c
    config_types.h.in
    framing.c
    ogg.h
    os_types.h
  vorbis/
    books/
      coupled/
        res_books_stereo.h
      floor/
        floor_books.h
      uncoupled/
        res_books_uncoupled.h
    modes/
      floor_all.h
      psych_11.h
      psych_16.h
      psych_44.h
      psych_8.h
      residue_16.h
      residue_44.h
      residue_44u.h
      residue_8.h
      setup_11.h
      setup_16.h
      setup_22.h
      setup_32.h
      setup_44.h
      setup_44u.h
      setup_8.h
      setup_X.h
    analysis.c
    backends.h
    barkmel.c
    bitrate.c
    bitrate.h
    block.c
    codebook.c
    codebook.h
    codec.h
    codec_internal.h
    envelope.c
    envelope.h
    floor0.c
    floor1.c
    highlevel.h
    info.c
    lookup.c
    lookup.h
    lookup_data.h
    lookups.pl
    lpc.c
    lpc.h
    lsp.c
    lsp.h
    mapping0.c
    masking.h
    mdct.c
    mdct.h
    misc.h
    os.h
    psy.c
    psy.h
    psytune.c
    registry.c
    registry.h
    res0.c
    scales.h
    sharedbook.c
    smallft.c
    smallft.h
    synthesis.c
    tone.c
    vorbisenc.c
    vorbisenc.h
    vorbisfile.c
    vorbisfile.h
    window.c
    window.h
  Makefile.am
  SConscript
  codec.cpp
  codec.h
  link.h
  neoacvorbis-static.dev
  neoacvorbis.cbp
  neoacvorbis.depend
  neoacvorbis.dev
  neoacvorbis.dsp
  neoacvorbis.layout
  neoacvorbis.vcproj
  stream.cpp
  stream.h