Skip to content

Commit

Permalink
Initial Load
Browse files Browse the repository at this point in the history
All code copied into folders and Readme Updated
  • Loading branch information
fyeh committed Jan 6, 2015
1 parent 806bdb3 commit 64e33f2
Show file tree
Hide file tree
Showing 1,269 changed files with 236,095 additions and 1 deletion.
97 changes: 97 additions & 0 deletions LiveProxy.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LiveProxy", "LiveProxy\LiveProxy.vcxproj", "{EEE559F5-304D-4000-BC9E-3A30131A4F21}"
ProjectSection(ProjectDependencies) = postProject
{FC8C364C-0BAA-42B3-90AD-D2E17516202B} = {FC8C364C-0BAA-42B3-90AD-D2E17516202B}
{A760DF71-E428-4D4A-B9B8-68A9A02670A7} = {A760DF71-E428-4D4A-B9B8-68A9A02670A7}
{A1DDCF99-E9DC-4BBA-B87A-DBF7CC41A551} = {A1DDCF99-E9DC-4BBA-B87A-DBF7CC41A551}
{1A9E01CD-54C2-4C6C-BC78-2F3B7883D23D} = {1A9E01CD-54C2-4C6C-BC78-2F3B7883D23D}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "live", "live", "{F437834D-E0CF-456A-B81A-5458C1BFC728}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BasicUsageEnvironment", "live\BasicUsageEnvironment\BasicUsageEnvironment.vcxproj", "{FC8C364C-0BAA-42B3-90AD-D2E17516202B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "groupsock", "live\groupsock\groupsock.vcxproj", "{A760DF71-E428-4D4A-B9B8-68A9A02670A7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liveMedia", "live\liveMedia\liveMedia.vcxproj", "{A1DDCF99-E9DC-4BBA-B87A-DBF7CC41A551}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UsageEnvironment", "live\UsageEnvironment\UsageEnvironment.vcxproj", "{1A9E01CD-54C2-4C6C-BC78-2F3B7883D23D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|Win32 = Debug|Win32
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EEE559F5-304D-4000-BC9E-3A30131A4F21}.Debug|Any CPU.ActiveCfg = Debug|Win32
{EEE559F5-304D-4000-BC9E-3A30131A4F21}.Debug|Any CPU.Build.0 = Debug|Win32
{EEE559F5-304D-4000-BC9E-3A30131A4F21}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{EEE559F5-304D-4000-BC9E-3A30131A4F21}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{EEE559F5-304D-4000-BC9E-3A30131A4F21}.Debug|Win32.ActiveCfg = Debug|Win32
{EEE559F5-304D-4000-BC9E-3A30131A4F21}.Debug|Win32.Build.0 = Debug|Win32
{EEE559F5-304D-4000-BC9E-3A30131A4F21}.Release|Any CPU.ActiveCfg = Release|Win32
{EEE559F5-304D-4000-BC9E-3A30131A4F21}.Release|Any CPU.Build.0 = Release|Win32
{EEE559F5-304D-4000-BC9E-3A30131A4F21}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{EEE559F5-304D-4000-BC9E-3A30131A4F21}.Release|Mixed Platforms.Build.0 = Release|Win32
{EEE559F5-304D-4000-BC9E-3A30131A4F21}.Release|Win32.ActiveCfg = Release|Win32
{EEE559F5-304D-4000-BC9E-3A30131A4F21}.Release|Win32.Build.0 = Release|Win32
{FC8C364C-0BAA-42B3-90AD-D2E17516202B}.Debug|Any CPU.ActiveCfg = Debug|Win32
{FC8C364C-0BAA-42B3-90AD-D2E17516202B}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{FC8C364C-0BAA-42B3-90AD-D2E17516202B}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{FC8C364C-0BAA-42B3-90AD-D2E17516202B}.Debug|Win32.ActiveCfg = Debug|Win32
{FC8C364C-0BAA-42B3-90AD-D2E17516202B}.Debug|Win32.Build.0 = Debug|Win32
{FC8C364C-0BAA-42B3-90AD-D2E17516202B}.Release|Any CPU.ActiveCfg = Release|Win32
{FC8C364C-0BAA-42B3-90AD-D2E17516202B}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{FC8C364C-0BAA-42B3-90AD-D2E17516202B}.Release|Mixed Platforms.Build.0 = Release|Win32
{FC8C364C-0BAA-42B3-90AD-D2E17516202B}.Release|Win32.ActiveCfg = Release|Win32
{FC8C364C-0BAA-42B3-90AD-D2E17516202B}.Release|Win32.Build.0 = Release|Win32
{A760DF71-E428-4D4A-B9B8-68A9A02670A7}.Debug|Any CPU.ActiveCfg = Debug|Win32
{A760DF71-E428-4D4A-B9B8-68A9A02670A7}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{A760DF71-E428-4D4A-B9B8-68A9A02670A7}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{A760DF71-E428-4D4A-B9B8-68A9A02670A7}.Debug|Win32.ActiveCfg = Debug|Win32
{A760DF71-E428-4D4A-B9B8-68A9A02670A7}.Debug|Win32.Build.0 = Debug|Win32
{A760DF71-E428-4D4A-B9B8-68A9A02670A7}.Release|Any CPU.ActiveCfg = Release|Win32
{A760DF71-E428-4D4A-B9B8-68A9A02670A7}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{A760DF71-E428-4D4A-B9B8-68A9A02670A7}.Release|Mixed Platforms.Build.0 = Release|Win32
{A760DF71-E428-4D4A-B9B8-68A9A02670A7}.Release|Win32.ActiveCfg = Release|Win32
{A760DF71-E428-4D4A-B9B8-68A9A02670A7}.Release|Win32.Build.0 = Release|Win32
{A1DDCF99-E9DC-4BBA-B87A-DBF7CC41A551}.Debug|Any CPU.ActiveCfg = Debug|Win32
{A1DDCF99-E9DC-4BBA-B87A-DBF7CC41A551}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{A1DDCF99-E9DC-4BBA-B87A-DBF7CC41A551}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{A1DDCF99-E9DC-4BBA-B87A-DBF7CC41A551}.Debug|Win32.ActiveCfg = Debug|Win32
{A1DDCF99-E9DC-4BBA-B87A-DBF7CC41A551}.Debug|Win32.Build.0 = Debug|Win32
{A1DDCF99-E9DC-4BBA-B87A-DBF7CC41A551}.Release|Any CPU.ActiveCfg = Release|Win32
{A1DDCF99-E9DC-4BBA-B87A-DBF7CC41A551}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{A1DDCF99-E9DC-4BBA-B87A-DBF7CC41A551}.Release|Mixed Platforms.Build.0 = Release|Win32
{A1DDCF99-E9DC-4BBA-B87A-DBF7CC41A551}.Release|Win32.ActiveCfg = Release|Win32
{A1DDCF99-E9DC-4BBA-B87A-DBF7CC41A551}.Release|Win32.Build.0 = Release|Win32
{1A9E01CD-54C2-4C6C-BC78-2F3B7883D23D}.Debug|Any CPU.ActiveCfg = Debug|Win32
{1A9E01CD-54C2-4C6C-BC78-2F3B7883D23D}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{1A9E01CD-54C2-4C6C-BC78-2F3B7883D23D}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{1A9E01CD-54C2-4C6C-BC78-2F3B7883D23D}.Debug|Win32.ActiveCfg = Debug|Win32
{1A9E01CD-54C2-4C6C-BC78-2F3B7883D23D}.Debug|Win32.Build.0 = Debug|Win32
{1A9E01CD-54C2-4C6C-BC78-2F3B7883D23D}.Release|Any CPU.ActiveCfg = Release|Win32
{1A9E01CD-54C2-4C6C-BC78-2F3B7883D23D}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{1A9E01CD-54C2-4C6C-BC78-2F3B7883D23D}.Release|Mixed Platforms.Build.0 = Release|Win32
{1A9E01CD-54C2-4C6C-BC78-2F3B7883D23D}.Release|Win32.ActiveCfg = Release|Win32
{1A9E01CD-54C2-4C6C-BC78-2F3B7883D23D}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{FC8C364C-0BAA-42B3-90AD-D2E17516202B} = {F437834D-E0CF-456A-B81A-5458C1BFC728}
{A760DF71-E428-4D4A-B9B8-68A9A02670A7} = {F437834D-E0CF-456A-B81A-5458C1BFC728}
{A1DDCF99-E9DC-4BBA-B87A-DBF7CC41A551} = {F437834D-E0CF-456A-B81A-5458C1BFC728}
{1A9E01CD-54C2-4C6C-BC78-2F3B7883D23D} = {F437834D-E0CF-456A-B81A-5458C1BFC728}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
VisualSVNWorkingCopyRoot = .
EndGlobalSection
EndGlobal
Binary file added LiveProxy.v11.suo
Binary file not shown.
132 changes: 132 additions & 0 deletions LiveProxy/H264VideoSink.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
#include "stdafx.h"
#include "H264VideoSink.h"
#include <iostream>
#include <process.h>
#include <cmath>
#include "MediaQueue.h"
#pragma unmanaged

static int frame_count;

/**
Static construtor to create our implemenation of a video size
*/
H264VideoSink* H264VideoSink::createNew(UsageEnvironment& env, MediaSubsession& subsession, char const* streamId) {
return new H264VideoSink(env, subsession, streamId);
}

/**
Singleton constructor
*/
H264VideoSink::H264VideoSink(UsageEnvironment& env, MediaSubsession& subsession, char const* streamId):
MyVideoSink(env), m_fSubsession(subsession)
{
TRACE_INFO("Video sink constructor");
m_fStreamId = strDup(streamId);
//m_bufferSize=253440;//2*DUMMY_SINK_RECEIVE_BUFFER_SIZE;
//m_fPos = 0;
uint8_t startCode[] = {0x00, 0x00,0x01};

//m_buffer = new unsigned char[m_bufferSize];
//m_frameQueue=new CMediaQueue(200);
m_decoder=new CVideoDecoder("H264");
AddData(startCode, sizeof(startCode));
//InitializeCriticalSection(&m_criticalSection);
//m_ready=1;
}

/**
Destructor
*/
H264VideoSink::~H264VideoSink()
{
TRACE_INFO("Cleaning up video sink");
//m_ready=0;
//if(m_buffer!=NULL)
// delete [] m_buffer;
//m_buffer = NULL;
//m_bufferSize = 0;

if(m_fStreamId!=NULL)
delete [] m_fStreamId;
m_fStreamId = NULL;

//if(m_frameQueue!=NULL)
// delete m_frameQueue;
//m_frameQueue=NULL;
}

/**
Initialize the video buffer with the header information
void H264VideoSink::AddData(uint8_t* aData, int aSize)
{
memcpy(m_buffer + m_fPos, aData, aSize);
m_fPos += aSize;
}
*/

/**
Keep retrieving frames from the source
*/
Boolean H264VideoSink::continuePlaying()
{
if (fSource == NULL)
{
TRACE_ERROR("no source for continue play");
return False;
}
TRACE_DEBUG("continuePlaying. BufferSize=%d",m_bufferSize);
fSource->getNextFrame(m_buffer + m_fPos, m_bufferSize - m_fPos, afterGettingFrame, this, onSourceClosure, this);
return True;
}

/**
Called by the live555 code once we have a frame
*/
void H264VideoSink::afterGettingFrame(void* clientData, unsigned frameSize, unsigned numTruncatedBytes,
struct timeval presentationTime, unsigned durationInMicroseconds)
{
TRACE_DEBUG("afterGettingFrame. FrameSize=%d",frameSize);
H264VideoSink* sink = (H264VideoSink*)clientData;
sink->afterGettingFrame1(frameSize, presentationTime);
if (sink->continuePlaying() == false)
{
TRACE_ERROR("Continue play failed closing source");
sink->onSourceClosure(clientData);
}
}

/**
Prepare the video frame for decoding
*/
void H264VideoSink::afterGettingFrame1(unsigned frameSize, struct timeval presentationTime)
{
int got_frame = 0;
unsigned int size = frameSize;
unsigned char *pBuffer = m_buffer + m_fPos;
uint8_t* data = (uint8_t*)pBuffer;
uint8_t startCode4[] = {0x00, 0x00, 0x00, 0x01};
uint8_t startCode3[] = {0x00, 0x00, 0x01};
FrameInfo *frame=NULL;

if(size<4){
return;
}
if(memcmp(startCode3, pBuffer, sizeof(startCode3)) == 0)
{
data += 3;
}else if(memcmp(startCode4, pBuffer, sizeof(startCode4)) == 0){
data += 4;
}else{
pBuffer -= 3;
size += 3;
}

// send the frame out to the decoder
frame=m_decoder->DecodeFrame(pBuffer, size);
if(frame!=NULL)
m_frameQueue->put(frame);
}


57 changes: 57 additions & 0 deletions LiveProxy/H264VideoSink.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#pragma once
#include <MediaSink.hh>
#include <H264VideoRTPSink.hh>
#include <liveMedia.hh>
#include <iostream>
#include <deque>
#include "live.h"
#include "MediaSink.hh"
#include "MediaQueue.h"
#include "VideoDecoder.h"
#include "MyVideoSink.h"

#define DUMMY_SINK_RECEIVE_BUFFER_SIZE 100000


/**
Our implementation of a MediaSink.
The media sink recevices the video frames from the rtsp stream
then passes them to our /sa CVideoDecoder for processing. This class
is also the keeper of our decoded frame queue /sa CMediaQueue
*/
class H264VideoSink : public MyVideoSink {

// static methods
public:
static H264VideoSink * createNew(UsageEnvironment& env, MediaSubsession& subsession, char const* streamId = NULL);

protected:
static void afterGettingFrame(void* clientData, unsigned frameSize, unsigned numTruncatedBytes, timeval presentationTime, unsigned durationInMicroseconds);

public:
//StreamTrack* get_StreamTrack(){return m_tk;}
//void set_StreamTrack(StreamTrack* tk){m_tk=tk;}
//CMediaQueue* get_FrameQueue(){return m_ready==1? m_frameQueue:NULL;}
virtual ~H264VideoSink();


protected:
H264VideoSink(UsageEnvironment& env, MediaSubsession& subsession, char const* streamId);
void afterGettingFrame1(unsigned frameSize, struct timeval presentationTime);
//void AddData(uint8_t* aData, int aSize);
Boolean continuePlaying();


//Members
protected:
CVideoDecoder * m_decoder;
//unsigned char * m_buffer;
//unsigned int m_bufferSize;
MediaSubsession& m_fSubsession;
//CRITICAL_SECTION m_criticalSection;
char * m_fStreamId;
//CMediaQueue* m_frameQueue;
//int m_fPos;
//int m_ready;
};

Loading

0 comments on commit 64e33f2

Please sign in to comment.