Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

PipeImport Class Reference

Inheritance diagram for PipeImport:

Inheritance graph
[legend]
Collaboration diagram for PipeImport:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 PipeImport ()
virtual ~PipeImport ()
bool Open (char *input)
int GetChannels ()
int GetFrequency ()
int GetBytesPerSample ()
long GetNumberOfSamples ()
bool Seek (off_t offset)
bool Get (int16_t *data, int length)
bool Close ()

Private Attributes

RWPipe m_pipe
string m_file
int16_t m_buffer [4 *DV_AUDIO_MAX_SAMPLES]
char * m_command

Constructor & Destructor Documentation

PipeImport::PipeImport  )  [inline]
 

Definition at line 285 of file kino_av_pipe.cc.

00286         : m_command( 0 )
00287     {
00288     }

virtual PipeImport::~PipeImport  )  [inline, virtual]
 

Definition at line 289 of file kino_av_pipe.cc.

References m_command, m_pipe, and RWPipe::stop().

00290     {
00291         m_pipe.stop();
00292         delete m_command;
00293     }


Member Function Documentation

bool PipeImport::Close void   )  [inline, virtual]
 

Implements KinoAudioInput.

Definition at line 355 of file kino_av_pipe.cc.

References m_pipe, and RWPipe::stop().

00356     {
00357         m_pipe.stop();
00358         return true;
00359     }

bool PipeImport::Get int16_t *  data,
int  length
[inline, virtual]
 

Implements KinoAudioInput.

Definition at line 351 of file kino_av_pipe.cc.

References m_pipe, and RWPipe::readData().

00352     {
00353         return ( m_pipe.readData( data, length ) == length );
00354     }

int PipeImport::GetBytesPerSample  )  [inline, virtual]
 

Implements KinoAudioInput.

Definition at line 339 of file kino_av_pipe.cc.

00340     {
00341         return 2;
00342     }

int PipeImport::GetChannels  )  [inline, virtual]
 

Implements KinoAudioInput.

Definition at line 331 of file kino_av_pipe.cc.

00332     {
00333         return 2;
00334     }

int PipeImport::GetFrequency  )  [inline, virtual]
 

Implements KinoAudioInput.

Definition at line 335 of file kino_av_pipe.cc.

00336     {
00337         return 44100;
00338     }

long PipeImport::GetNumberOfSamples  )  [inline, virtual]
 

Implements KinoAudioInput.

Definition at line 343 of file kino_av_pipe.cc.

00344     {
00345         return -1;
00346     }

bool PipeImport::Open char *  input  )  [inline, virtual]
 

Implements KinoAudioInput.

Definition at line 294 of file kino_av_pipe.cc.

References m_command, m_pipe, RWPipe::readData(), StringUtils::replaceAll(), RWPipe::run(), and RWPipe::stop().

00295     {
00296         bool result = false;
00297         char *kinoHome = getenv("KINO_HOME");
00298         string homeFile, script;
00299         int testHomeFile = 0;
00300 
00301         // Allow a script in home directory to override
00302         if ( kinoHome )
00303             homeFile = string( kinoHome ) + string( "/import/audio.sh" );
00304         else
00305             homeFile = string( getenv( "HOME" ) ) + string( "/kino/import/audio.sh" );
00306         testHomeFile = open( homeFile.c_str(), O_RDONLY );
00307         if ( testHomeFile > -1 )
00308         {
00309             close( testHomeFile );
00310             script = homeFile;
00311         }
00312         else
00313         {
00314             script = string( DATADIR "/kino/scripts/import/audio.sh" );
00315         }
00316 
00317         delete m_command;
00318         string inputFilename = StringUtils::replaceAll( input, "\"", "\\\"" );
00319         m_command = g_strdup_printf( "%s \"%s\"", script.c_str(), inputFilename.c_str() );
00320         m_pipe.stop();
00321         if ( m_pipe.run( m_command ) )
00322         {
00323             char temp[ 10 ];
00324             result = ( m_pipe.readData( temp, 10 ) == 10 );
00325             m_pipe.stop();
00326             if ( result )
00327                 return m_pipe.run( m_command );
00328         }
00329         return result;
00330     }

bool PipeImport::Seek off_t  offset  )  [inline, virtual]
 

Implements KinoAudioInput.

Definition at line 347 of file kino_av_pipe.cc.

00348     {
00349         return false;
00350     }


Member Data Documentation

int16_t PipeImport::m_buffer[4 *DV_AUDIO_MAX_SAMPLES] [private]
 

Definition at line 282 of file kino_av_pipe.cc.

char* PipeImport::m_command [private]
 

Definition at line 283 of file kino_av_pipe.cc.

Referenced by Open(), and ~PipeImport().

string PipeImport::m_file [private]
 

Definition at line 281 of file kino_av_pipe.cc.

RWPipe PipeImport::m_pipe [private]
 

Definition at line 280 of file kino_av_pipe.cc.

Referenced by Close(), Get(), Open(), and ~PipeImport().


The documentation for this class was generated from the following file:
Generated on Sun Mar 11 22:13:22 2007 for Kino by  doxygen 1.4.2