Skip to content

Commit

Permalink
Updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jan 2, 2014
1 parent 81ccb2c commit a877fc5
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 3,361 deletions.
21 changes: 20 additions & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
sudo sysctl -w net.core.rmem_default=2097152
Copyright 2013

Welcome to the Piracast project.

Limitation:
1. Only works with TP-Link dongle.
2. No HDCP support (cannot remote Netflix or Google Music).

To install:
1. Install the dongle driver in env/
2. Install DHCP server

To compile the project:
1. cd target
2. make app

To run Piracast:
1. cd scripts
2. sudo python main.py

1 change: 0 additions & 1 deletion audio_sink/inc/sx_audio_sink.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#if !defined(AUDIO_SINK_H)
#define AUDIO_SINK_H


extern void sx_audio_sink_init(
void
);
Expand Down
19 changes: 3 additions & 16 deletions audio_sink/src/sx_audio_sink.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

// ========================================================
// Includes
// ========================================================

#include <stdio.h>
#include <assert.h>

Expand All @@ -10,12 +12,6 @@
#include "sx_types.h"
#include "sx_audio_sink.h"

//#define WRITE_TO_FILE 1

#if WRITE_TO_FILE
static FILE * write_ptr;
#endif

// ========================================================
// Constants
// ========================================================
Expand Down Expand Up @@ -327,7 +323,7 @@ INT32 audioplay_set_dest(
}


UINT8 *audioplay_get_buffer(
UINT8 * audioplay_get_buffer(
AUDIOPLAY_STATE_T *st
)
{
Expand Down Expand Up @@ -447,10 +443,6 @@ void sx_audio_sink_init(
rv = audioplay_set_dest(st, AUDIO_RENDERER);
assert(rv == 0);

#if WRITE_TO_FILE
write_ptr = fopen("audio_sink.raw", "wb");
#endif

printf("(sx_audio_sink_init): Initialization completed...\n");
}

Expand Down Expand Up @@ -554,11 +546,6 @@ void sx_audio_sink_buffer_set(
int rv;
OMX_ERRORTYPE error;


#if WRITE_TO_FILE
fwrite(buf, buf_len, 1, write_ptr);
#endif

rv = audioplay_play_buffer(st, buf, buf_len);
assert(rv == 0);
}
6 changes: 3 additions & 3 deletions common/make/makefile.std
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ SYS_INCLUDES := -I $(SDKSTAGE)/opt/vc/include \
-I $(PLATFORM_ROOT)/libs/ilclient \
-I $(PLATFORM_ROOT)/libs/vgfont

MODULE_INCLUDES := -I$(MODULE_INC)
MODULE_INCLUDES := -I $(MODULE_INC)

INCLUDES := $(MODULE_INCLUDES) \
$(DEP_INCLUDES) \
Expand Down Expand Up @@ -70,9 +70,9 @@ CFLAGS := -pg -g
all : $(module_mkdirs) \
$(module_object)

app : $(depend_objects)
core : $(depend_objects)
$(CC) $^ $(LIBDIR) $(LDFLAGS) -o $@
cp $@ ../application
cp $@ ../scripts

# Create output directory.
mkdir_obj :
Expand Down
77 changes: 24 additions & 53 deletions mgmt_data/src/sx_mgmt_data.c
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
// ========================================================
// Includes
// ========================================================

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <mqueue.h>
#include <assert.h>
#include <errno.h>
#include <sys/types.h>
#include <ifaddrs.h>
#include <unistd.h>

#include <netinet/in.h>
#include <sys/socket.h>
#include <netdb.h>

#include "sx_desc.h"
#include "sx_udp.h"
#include "sx_pkt.h"
#include "sx_thread.h"
#include "sx_queue.h"
#include "sx_pipe.h"

#include "sx_mgmt_data.h"
Expand All @@ -33,59 +21,44 @@
// Private Types
// ========================================================

// --------------------------------------------------------
// sMGMT_DATA_CBLK
// Control block structure.
//
typedef struct
{
pthread_t pkt_rx_thread;

SX_QUEUE rx_queue;

SBOX_UDP_ID udp_sock;

unsigned int tx_pkt;
unsigned int rx_pkt;
pthread_t pkt_rx_thread; ///< Packet receive thread
SBOX_UDP_ID udp_sock; ///< UDP socket
unsigned int rx_pkt; ///< Number of received packet

} sMGMT_DATA_CBLK;


// ========================================================
// Private Variables & Functions
// ========================================================

// Define local control block.
static sMGMT_DATA_CBLK f_cblk;


static UINT64 sink_time_get_us(
void
)
{
struct timeval curr_time;


// Get current time.
gettimeofday(&curr_time, NULL);

UINT64 temp = curr_time.tv_sec * 1*1000*1000 + curr_time.tv_usec;

return temp;
}


// --------------------------------------------------------
// pkt_rx_thread
// Create packet receive thread.
//
static void pkt_rx_thread(
void * arg
)
{
sPI_PORTAL_PKT *pkt;
SX_QUEUE *queue;
UINT16 last_seq_num;
UINT16 last_seq_num;
UINT16 curr_seq_num;


while(1)
{
// Malloc packet to hold data.
// Malloc packet to hold data.
pkt = malloc(sizeof(sPI_PORTAL_PKT));

// Receive packet.
// Receive packet.
UINT32 pkt_len = sizeof(sPI_PORTAL_PKT);

// -----------------------------
Expand Down Expand Up @@ -123,11 +96,11 @@ static void pkt_rx_thread(

sx_pipe_put(SX_VRDMA_PKT_QUEUE, desc);

f_cblk.rx_pkt++;
f_cblk.rx_pkt++;
}
}



// --------------------------------------------------------
// data_rx_thread_create
// Create data RX thread
Expand All @@ -145,31 +118,29 @@ static void pkt_rx_thread_create(
// ========================================================

// --------------------------------------------------------
// hole_punching_client_init
// Opens decoder
// sx_mgmt_data_init
// Initialize data manager.
//
void sx_mgmt_data_init(
void
)
{
// Initialize TX pkt queue lock.
f_cblk.rx_queue = sx_queue_create();

f_cblk.udp_sock = sx_udp_create(50000);

printf("(mgmt_data): mgmt_data_init(): Initialized.\n");
}



// --------------------------------------------------------
// mgmt_data_open
// sx_mgmt_data_open
// Open data manager on session boundary.
//
void sx_mgmt_data_open(
void
)
{
{
pkt_rx_thread_create();

printf("(mgmt_data_open): Opened.\n");
}

2 changes: 2 additions & 0 deletions mgmt_sys/src/sx_mgmt_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,13 @@ void mgmt_sys_open(
// Initialize video decoder module.
sx_mgmt_video_decoder_open();

// Initialize video scheduler.
sx_mgmt_video_scheduler_open();

// Initialize video decoder module.
sx_mgmt_audio_decoder_open();

// Initialize audio scheduler.
sx_mgmt_audio_scheduler_open();

printf("(mgmt_sys): (mgmt_sys_open): Done.\n");
Expand Down
Loading

0 comments on commit a877fc5

Please sign in to comment.