Skip to content

Commit

Permalink
Merge pull request #17 from manishj-patel/master
Browse files Browse the repository at this point in the history
Fix piracast to make it work with Sony Xperia M
  • Loading branch information
codemonkeyricky committed Jul 17, 2014
2 parents 934962a + 379c5dc commit 04a0d2b
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 10 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ Copyright 2014

### To run Piracast:
1. cd scripts
2. sudo python piracast.py
2. sudo nice -n -20 ./core &
3. sudo python piracast.py
8 changes: 6 additions & 2 deletions mgmt_audio_decoder/src/sx_mgmt_audio_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ static UINT32 pes_payload_size(
{
if(PUSI_GET(ts->hdr))
{
assert(afc == 0x01);
// This makes Piracast to work with Sony Xperia
// As it sends afc with payload (11b)
assert((afc == 0x01) || (afc == 0x03));

// printf("### 0x%x 0x%x 0x%x 0x%x\n",
// ts->payload.payload[14],
Expand Down Expand Up @@ -251,7 +253,9 @@ static UINT8 slice_start_find(
sPES_EXT *pes_ext = (sPES_EXT *) curr_ptr;

*pes_payload_size = ntohs(pes_ext->length) - 14;
assert(*pes_payload_size == 1920);

// PES packet length is zero for Sony Xperia
assert((*pes_payload_size == 1920) || (*pes_payload_size == -14));

return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion mgmt_sys/src/sx_mgmt_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void mgmt_sys_init(

sx_mgmt_video_scheduler_init();

// Initialize video decoder module.
// Initialize audio decoder module.
sx_mgmt_audio_decoder_init();

sx_mgmt_audio_scheduler_init();
Expand Down
5 changes: 4 additions & 1 deletion mgmt_video_decoder/src/sx_mgmt_video_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,10 @@ static UINT8 slice_start_find(

curr_ptr += sizeof(sPES_EXT);

if(*curr_ptr != 0x05)
// The adaptation field is present in the TS header of
// Sony Xperia. Due to this initial byte of PES payload
// becomes 0x0a
if((*curr_ptr != 0x05) && (*curr_ptr != 0x0a))
{
printf("0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
((UINT8 *) ts)[0],
Expand Down
11 changes: 7 additions & 4 deletions scripts/piracast.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,17 @@ def leased_ip_get():
print 'Increase rmem_default...'
get_stdout(cmd_inc_rmem_default)

print 'Kill running application...'
# Don't kill running application as
# it is started explicitly
#print 'Kill running application...'
#core_channel.end()
print get_stdout(cmd_kill_core_app)
#print get_stdout(cmd_kill_core_app)

while 1:

# Launch application
get_stdout(cmd_launch_core_app)
# Don't launch application, because it stuck
# the execution
# get_stdout(cmd_launch_core_app)

# Start DHCP
print get_stdout(cmd_dhcp_start)
Expand Down
2 changes: 1 addition & 1 deletion scripts/wfd.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def p2p_peer_devaddr_get():
print 'p2p_peer_devaddr_get:'
output = get_stdout(["iwpriv", "wlan0", "p2p_get", "peer_deva"])
match = re.search(r'\n(.*)$', output)
mac = '%s%s:%s%s:%s%s:%s%s:%s%s:%s%s' % match.group(1)[0:11]
mac = ':'.join(re.findall('..', match.group(1)))
#mac = match.group(1)[0] + match.group(1)[1] + ':' \
# + match.group(1)[2] + match.group(1)[3] + ':' \
# + match.group(1)[4] + match.group(1)[5] + ':' \
Expand Down

0 comments on commit 04a0d2b

Please sign in to comment.