Skip to content

Commit

Permalink
SMS Version 2.1 (Rev.2)
Browse files Browse the repository at this point in the history
git-svn-id: http://psp.jim.sh/svn/ps2ware/trunk@596 5c23000f-aefb-0310-8550-8024f1b2be0e
  • Loading branch information
eeug committed Apr 22, 2007
1 parent 08c6f0a commit ca143c4
Show file tree
Hide file tree
Showing 7 changed files with 451 additions and 393 deletions.
6 changes: 6 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -1036,3 +1036,9 @@ Update (12-04-2007)
without embedded subtitles while previously played clip contained them;
- slightly improved playback performance for .avi clips by using DMA stall control
feature instead of interrupt handler;

Update (22-04-2007)
-------------------
- improved MPEG auto detection and playback for broken streams (thanks to the
'topshooter' for the sample clip);
- network adapter driver is updated again;
12 changes: 3 additions & 9 deletions drv/SMSMAP/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,10 @@ void SMap_Thread ( void* apArg ) {
while ( 1 ) {

unsigned long lRes;
int lfTXBD = 0;

WaitEventFlag ( ( int )apArg, EVENT_MASK, WEF_CLEAR | WEF_OR, &lRes );

if ( lRes & EVENT_TIMER ) {
QueueHandler ();
lfTXBD = SMap_HandleTXInterrupt ( lSema );
} /* end if */
if ( lRes & EVENT_TIMER ) QueueHandler ();

if ( lRes & EVENT_INTR ) {

Expand All @@ -181,17 +177,15 @@ void SMap_Thread ( void* apArg ) {
if ( lFlags & INTR_EMAC3 ) SMap_HandleEMACInterrupt ();
if ( lFlags & INTR_RXEND ) SMap_HandleRXInterrupt ();
if ( lFlags & INTR_RXDNV ) SMap_ClearIRQ ( INTR_RXDNV );
if ( lFlags & INTR_TXDNV ) SMap_HandleTXInterrupt ( lSema );
if ( lFlags & INTR_TXDNV ) SMap_ClearIRQ ( INTR_TXDNV );

QueueHandler ();

lfTXBD = SMap_HandleTXInterrupt ( lSema );

dev9IntrEnable ( INTR_EMAC3 | INTR_RXEND | INTR_RXDNV );

} /* end if */

if ( lfTXBD ) dev9IntrEnable ( INTR_TXDNV );
if ( SMap_HandleTXInterrupt ( lSema ) ) dev9IntrEnable ( INTR_TXDNV );

} /* end while */

Expand Down
25 changes: 21 additions & 4 deletions drv/SMSMAP/smap.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "loadcore.h"
#include "thbase.h"
#include "thevent.h"
#include "thsemap.h"
#include "dev9.h"
#include "ps2ip.h"
#include "../SMSUTILS/smsutils.h"
Expand Down Expand Up @@ -1445,20 +1446,36 @@ static int inline IsEMACReady ( SMap* apSMap ) {

SMapStatus SMap_Send ( struct pbuf* apPacket ) {

static u32 sl_TXBuf[ ( SMAP_TXMAXSIZE + SMAP_TXMAXTAILPAD + 3 ) / 4 ];

SMap* lpSMap = &SMap0;
SMapBD* lpTXBD = &lpSMap -> TX.pBD[ lpSMap -> TX.u8IndexEnd ];
int lTotalLen = apPacket -> tot_len;
int lTXLen;
int lTXLen;
u32* lpSrc;

if ( ! ( lpSMap -> u32Flags & SMAP_F_LINKVALID ) ) return SMap_Con;
if ( lTotalLen > SMAP_TXMAXSIZE ) return SMap_Err;

lTXLen = ( lTotalLen + 3 ) & ~3;

if ( lTXLen > ComputeFreeSize ( &lpSMap -> TX ) ) return SMap_TX;
if ( !IsEMACReady ( lpSMap ) ) return SMap_Err;

SMAP_CopyToFIFO ( lpSMap, apPacket -> payload, lTXLen );
if ( !IsEMACReady ( lpSMap ) ) return SMap_TX;

if ( !apPacket -> next )
lpSrc = apPacket -> payload;
else {
u8* lpDst = ( u8* )sl_TXBuf;
while ( apPacket ) {
int lLen = apPacket -> len;
mips_memcpy ( lpDst, apPacket -> payload, lLen );
lpDst += apPacket -> len;
apPacket = apPacket -> next;
} /* end while */
lpSrc = sl_TXBuf;
} /* end else */

SMAP_CopyToFIFO ( lpSMap, lpSrc, lTXLen );

lpTXBD -> length = lTotalLen;
lpTXBD -> pointer = lpSMap -> TX.u16PTREnd + SMAP_TXBUFBASE;
Expand Down
2 changes: 1 addition & 1 deletion include/SMS_Data.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# define SMS_USB_MASS_SIZE 27693
# define SMS_USBD_SIZE 26065
# define SMS_PS2IP_SIZE 64625
# define SMS_PS2SMAP_SIZE 11661
# define SMS_PS2SMAP_SIZE 11797
# define SMS_PS2HOST_SIZE 16349
# define SMS_VU0_MPG_SIZE 1312
# define SMS_VU0_DATA_SIZE 256
Expand Down
52 changes: 38 additions & 14 deletions src/SMS_ContainerMPEG_PS.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,27 +276,51 @@ static int _read_header (

} /* end _read_header */

static int _fill_video_parameters ( FileContext* apFileCtx, SMS_Stream* apStm, int aLen ) {
static int _fill_video_parameters ( SMS_Container* apCont, SMS_Stream* apStm, int aLen, int aSID ) {

int retVal = 0;
unsigned int lPos = apFileCtx -> m_CurPos;
int i = 0;
int retVal = 0;
FileContext* lpFileCtx = apCont -> m_pFileCtx;
unsigned int lPos = lpFileCtx -> m_CurPos;

if ( _next_start_code ( apFileCtx ) == 0x000001B3 ) {
while ( 1 ) {

char lBuffer[ aLen ];
SMS_BitContext lBitCtx;
if ( _next_start_code ( lpFileCtx ) == 0x000001B3 ) {

apFileCtx -> Read ( apFileCtx, lBuffer, aLen );
SMS_InitGetBits ( &lBitCtx, lBuffer, aLen );
char* lpBuffer = ( char* )malloc ( aLen );
SMS_BitContext lBitCtx;

apStm -> m_pCodec -> m_Width = SMS_GetBits ( &lBitCtx, 12 );
apStm -> m_pCodec -> m_Height = SMS_GetBits ( &lBitCtx, 12 );
lpFileCtx -> Read ( lpFileCtx, lpBuffer, aLen );
SMS_InitGetBits ( &lBitCtx, lpBuffer, aLen );

retVal = 1;
apStm -> m_pCodec -> m_Width = SMS_GetBits ( &lBitCtx, 12 );
apStm -> m_pCodec -> m_Height = SMS_GetBits ( &lBitCtx, 12 );

} /* end if */
free ( lpBuffer );

apFileCtx -> Seek ( apFileCtx, lPos );
retVal = 1;
break;

} /* end if */

while ( 1 ) {

uint64_t lPTS, lDTS;
int lStartCode;

if ( i++ == 1024 || FILE_EOF( lpFileCtx ) ) goto end;

aLen = _read_header ( apCont, &lStartCode, &lPTS, &lDTS );

if ( !aLen ) goto end;

if ( lStartCode == aSID ) break;

} /* end while */

} /* end while */
end:
lpFileCtx -> Seek ( lpFileCtx, lPos );

return retVal;

Expand Down Expand Up @@ -641,7 +665,7 @@ int SMS_GetContainerMPEG_PS ( SMS_Container* apCont ) {

if ( lCodecType == SMS_CodecTypeVideo ) {

if ( !lfVideoParam ) lfVideoParam = _fill_video_parameters ( lpFileCtx, lpStm, lLen );
if ( !lfVideoParam ) lfVideoParam = _fill_video_parameters ( apCont, lpStm, lLen, lStartCode );

} else lfAudio = _fill_audio_parameters ( lpFileCtx, lpStm, lLen );

Expand Down
Loading

0 comments on commit ca143c4

Please sign in to comment.