public function testWrite()
 {
     $stream = new Yamdi_OutputStream($this->testFileName);
     /* writing bytes */
     $stream->write('321');
     /* passing input source through */
     $inputStream = new Yamdi_InputStream($this->passthroughFileName);
     $stream->passthrough($inputStream, 3);
     $inputStream->close();
     /* checking writen data */
     $fh = fopen($this->testFileName, 'r');
     $bytes = fread($fh, 6 + 1);
     // reading beyond the eof
     $this->assertTrue(feof($fh));
     $this->assertEqual($bytes, '321abc');
     fclose($fh);
     $stream->close();
 }
Example #2
0
 public function testWriteAndPassthroughFromPosition()
 {
     $stream = new Yamdi_OutputStream($this->outtputFileName);
     // writing bytes
     $stream->write('321');
     // passing input source through
     $inputStream = new Yamdi_InputStream($this->inputFileName);
     $stream->passthrough($inputStream, 3);
     $inputStream->close();
     // reading written file back
     $fh = fopen($this->outtputFileName, 'r');
     $bytes = fread($fh, 6 + 1);
     // reading until the eof
     // assert file length is 6 bytes
     $this->assertTrue(feof($fh));
     // assert writen 3 bytes from $stream->write() and 3 bytes from $stream->passthrough()
     $this->assertEquals($bytes, '321abc');
     fclose($fh);
     $stream->close();
 }
Example #3
0
 /**
  * Writing media tags (passing through with no changes)
  * 
  * @param Yamdi_OutputStream $stream
  */
 protected function writeMediaBlocks($stream)
 {
     $stream->passthrough(new Yamdi_InputStream($this->sourceFilename), $this->sourceMediaTagsStartPosition);
 }
Example #4
0
 public function write(Yamdi_OutputStream $stream)
 {
     return $stream->write($this->pack());
 }
 /**
  * Writes only one video tag
  * 
  * @param Yamdi_OutputStream $stream
  */
 protected function writeMediaBlocks($stream)
 {
     $stream->passthrough(new Yamdi_InputStream($this->sourceFilename), $this->videoTagPosition, $this->videoBlockSize);
     /*		$video_tag = new Yamdi_FlvTag();
     		$video_tag_body = '';
     		$size_tag = new Yamdi_FlvTagSize();
     		
     		*/
     /** read */
     /*
     		$input_stream = new Yamdi_InputStream($this->sourceFilename);
     		$input_stream->seek($this->videoTagPosition);
     		$video_tag->read($input_stream);
     		$video_tag_body = $input_stream->read($video_tag->getDataSize());
     		$size_tag->read($input_stream);		
     */
     /** write */
     /*
     		$video_tag->write($stream);
     		$stream->write($video_tag_body);
     		$size_tag->write($stream);
     */
 }