Skip to content

Instantly share code, notes, and snippets.

View FlyingJester's full-sized avatar

Martin McDonough FlyingJester

View GitHub Profile
#include <unistd.h>
#include <cstdlib>
#include <pthread.h>
#include <cstdio>
#ifdef USE_PIPES
freeride:prgtst jester$ g++ -pthread -std=c++11 -O2 pipe.cpp
freeride:prgtst jester$ time ./a.out
Starting iteration.
On iteration 100000.
On iteration 200000.
On iteration 300000.
On iteration 400000.
On iteration 500000.
On iteration 600000.
On iteration 700000.
adb| Media Codec: Ending Format. There are 14 frames that haven't produced output yet. Timestamp 4800000 Duration 335544240000.
adb| Media Codec: Failed to get an input buffer, trying again...
adb| Media Codec: Failed to get an input buffer, trying again...
adb| Media Codec: Failed to get an input buffer, trying again...
adb| Media Codec: Got input buffer 0.
adb| Media Codec: Output was 4.
adb| Media Codec: Ending Format. There are 14 frames that haven't produced output yet. Timestamp 4720000 Duration 335544280000.
adb| Media Codec: Failed to get an input buffer, trying again...
adb| Media Codec: Got input buffer 2.
adb| Media Codec: Failed to get an input buffer, trying again...
@FlyingJester
FlyingJester / reversed_iterators
Created July 9, 2014 08:39
Example of how to use a normal iterator to iterate backward through a vector.
#include <iostream>
#include <map>
#include <vector>
int main()
{
std::vector<int> noobles;
//Copy all chars not newlines.
char *makebuf; //...
char *newstring = new char [0xFF];
int e = 0;
for(int i = 0; i<strnlen(makebuf, 0xFF); i++){
if(makebuf[i]=='\n')
@FlyingJester
FlyingJester / helloworld_t5.cpp
Last active August 29, 2015 14:03
Hello World example using T5
#include <t5.h>
#include <cstdio>
int main(int argc, char *argv[]){
// Create a data source that uses a C file handle.
t5::DataSource *OutSource = t5::DataSource::FromCFileHandle(stdout);
// Create a chained data source that can only write.
* thread #1: tid = 0x6c9a5, 0x0000000100d264d1 libSapphire.dylib`std::__1::__tree_iterator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int>, std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int>, void*>*, long> std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int>, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int> > >::find<std::__1::basic_string<char, std::__1::cha
java -classpath gecko-mozglue.jar:obj-arm-linux-androideabi/build/jarClassProcessors/jarClassProcessors.jar org.mozilla.gecko.jarClassProcessors.JarClassProcessor\
-j ../../adt-bundle-mac/sdk/platforms/android-17/android.jar\
-c android.media.MediaCodec android.media.MediaExtractor android.media.MediaFormat android.media.MediaCodecInfo\
android.media.MediaCodecList java.nio.ByteBuffer java.io.FileDescriptor android.media.MediaCodecList android.media.MediaCodecInfo
79be5ae HEAD@{0}: commit: Changes
73400d2 HEAD@{1}: commit: Cleaned up MediaCodec synchronization primitives. Improved flush and shutdown of MediaCodec decoder.
d2f2e24 HEAD@{2}: rebase finished: returning to refs/heads/FMP4-MediaCodec2
d2f2e24 HEAD@{3}: rebase: Added synchro object.
aadcc7a HEAD@{4}: rebase: Added fully synchronous flushing.
1e7728c HEAD@{5}: rebase: Rebased
ffcb30b HEAD@{6}: rebase: Added proper frame drop on flush
03bba55 HEAD@{7}: rebase: Added proper frame drop on flush
92bb860 HEAD@{8}: rebase: Attempted frame drop until new keyframe on flush
7e3b6ef HEAD@{9}: rebase: Relaxed Flush. Drop frames after a flush until a keyframe occurs.
@FlyingJester
FlyingJester / main.js
Last active August 29, 2015 14:04
TurboSphere Sapphire Demo
var LogoImage = new Image("sphere.png");
var DefaultShader = GetDefaultShaderProgram();
var Vertices = [new Vertex(0, 0), new Vertex(64, 0), new Vertex(64, 64), new Vertex(0, 64)];
var Shapey = new Shape(Vertices, LogoImage);
var Groupy = new Group(Shapey, DefaultShader);