📄 exolmpegts.c
字号:
// Stop the Fast General Purpose Input (FGPI) instance
ERRCHK( stopFgpiComponent() )
}
ERRCHK( stopComponentInstances() )
ERRCHK( startComponentInstances() )
if (gUseFgpi)
{
// Start the Fast General Purpose Input (FGPI) instance
ERRCHK( startFgpiComponent() )
}
}
DBG_ISR_PRINT( (dbgTsDemux, DBG_LEVEL_2,
"commandControl: Calling tmolDemuxMpegTsChangeToNewPids(): "
"videoPid=0x%x, mainAudioPid=0x%x",
gPids.videoPid, gPids.mainAudioPid) )
if ( gPids.videoPid < 1 )
{
rval = TM_ERR_BAD_INDEX;
goto _return;
}
// Load the pids
ERRCHK( tmolDemuxMpegTsChangeToNewPids(
gDemuxMpegTsInst.DemuxMpegTsInst,
gPids.pcrPid, // PCR PID
gPids.videoPid, // Video PID
gPids.mainAudioPid, // Main audio PID
gPids.secondaryAudioPid, // Secondary audio PID
0 ) ) // Relative index
_return:
bFirstTime = False;
DBG_ISR_PRINT( (dbgTsDemux, DBG_INTERNAL_LEAVE, "commandControl") )
return( (rval == TM_OK) ? False : True ); // Indicates if we want to quit
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
static void
detachPictureInfo(
ptsaInOutDescriptor_t pIod)
{
Int i = 0;
DBG_ISR_PRINT ((dbgTsDemux, DBG_INTERNAL_ENTER, "detachPictureInfo"))
/* NOTE: We can't just loop for 1 to numberOfPackets as there may be other
messages on the queue (e.g. wakeup). Therefore i++ is done only
for data packets*/
for (i = 0; i < pIod->numberOfPackets;)
{
UInt32 msg_buf[4];
UInt32 msgSize;
ptmAvPacket_t packet;
Int32 timeoutNoWait = 0;
ERRCHK (tmosalQueueReceive (pIod->emptyQueue, msg_buf, &msgSize,
&timeoutNoWait, tmosalQueueReceiveFlagNone ) )
switch (msg_buf[1])
{
case tsaCmdDataPacket:
packet = (ptmAvPacket_t)msg_buf[0];
EQ_ERRCHK( packet, Null )
if (packet->header->userPointer)
{
tmmlFree (packet->header->userPointer);
packet->header->userPointer = Null;
}
msg_buf[0] = (UInt32) packet;
msg_buf[1] = tsaCmdDataPacket;
ERRCHK (tmosalQueueSend (pIod->emptyQueue, msg_buf, 16,
&timeoutNoWait, tmosalQueueSendFlagNone ) )
// Increment loop count
i++;
break;
case tsaCmdWakeup:
DBG_ISR_PRINT ((dbgTsDemux, DBG_LEVEL_1,
"detachPictureInfo: Found wakeup packet=%d", i) )
// Will not be put back in the queue as the components are stopped anyway
break;
default:
DBG_ISR_PRINT ((dbgTsDemux, DBG_LEVEL_1,
"detachPictureInfo: Invalid packet=%d, cmd=0x%x",
i, msg_buf[1]))
// Will not be put back in the queue as the components are stopped anyway
break;
} // end switch
} // end loop
DBG_ISR_PRINT ((dbgTsDemux, DBG_INTERNAL_LEAVE, "detachPictureInfo"))
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
static Int
displayCommandMenu(
Bool bUseMenu )
{
Int32 menu_choice = 0;
Int rval = 0;
DBG_ISR_PRINT ((dbgTsDemux, DBG_INTERNAL_ENTER, "displayCommandMenu"))
if ( !bUseMenu )
{
menu_choice = 3;
return menu_choice;
}
do
{
printf( "\nChoose a Command:\n\n" );
printf( "\t1) Set Channel Using Program Number (give 0x for hex)\n" );
printf( "\t2) Set Channel Using Pid Values (give 0x for hex)\n" );
printf( "\t3) Use I2C Interface\n" );
printf( "\t4) Start Time Doctor\n" );
printf( "\t5) Quit\n" );
printf( "Enter a Command: " );
scanf( "%d", &menu_choice );
fflush( stdin );
} while ( (menu_choice != 1) && (menu_choice != 2) && (menu_choice != 3) &&
(menu_choice != 4) && (menu_choice != 5) );
switch (menu_choice)
{
case 1:
do
{
printf( "\n\nEnter Program Number (range = 0x01 to 0xFFFF): " );
scanf( "%i", &gPids.programNum );
fflush( stdin );
} while ( (gPids.programNum < 0) || (gPids.programNum > 0xFFFF) );
rval = menu_choice;
break;
case 2:
// :TODO: Put some range checking in here
printf( "\nEnter Video Pid: " );
scanf( "%i",&gPids.videoPid );
fflush( stdin );
gPids.pcrPid = gPids.videoPid;
printf( "\nEnter Audio Pid: " );
scanf( "%i", &gPids.mainAudioPid );
fflush( stdin );
rval = menu_choice;
break;
case 3:
rval = menu_choice;
break;
case 4:
rval = menu_choice;
break;
case 5:
default:
rval = -1;
break;
} // end switch
DBG_ISR_PRINT ((dbgTsDemux, DBG_INTERNAL_LEAVE, "displayCommandMenu"))
return( rval );
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
static Int
frameRate2Frequency(
tmFrameRate_t frameRate )
{
Int frequency;
switch( frameRate )
{
case tmFrameRate_29_97:
frequency = 30;
break;
case tmFrameRate_30:
frequency = 30;
break;
case tmFrameRate_59_94:
frequency = 60;
break;
case tmFrameRate_60:
frequency = 60;
break;
case tmFrameRate_25:
frequency = 25;
break;
case tmFrameRate_50:
frequency = 50;
break;
case tmFrameRate_23_976:
frequency = 24;
break;
case tmFrameRate_24:
frequency = 24;
break;
case tmFrameRateNone:
default:
frequency = 30;
break;
}
return frequency;
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
static void
printMp3HeaderInfo(
tmAdecMP3Format_t *info)
{
static Char *id[3] = { "2", "1", "2.5" };
static Char *mode[6] = { Null, "stereo", "joint stereo", "dual channel",
"mono", "mono to stereo" };
static Char *yesNo[2] = { "no", "yes" };
DBG_ISR_PRINT ((dbgTsDemux, DBG_INTERNAL_ENTER, "printMp3HeaderInfo"))
printf( "MPEG-%s bitstream:\n", id[info->mpegId] );
// Do not split the printf into separate printfs
printf
(
"\n"
"\n"
"************* Audio information *************\n"
"\n"
" MPEG-%s bit stream\n"
"\n"
"\tLayer\t\t\t%d\n"
"\tBitrate\t\t%dkbps\n"
"\tSampling rate\t\t%dHz\n"
"\tMode\t\t\t%s\n"
"\tIntensity\t\t%s\n"
"\tms\t\t\t%s\n"
"\tCRC\t\t\t%s\n"
"\tEmphasis\t\t%s\n"
"\tCopyright\t\t%s\n"
"\tisCopy\t\t\t%s\n"
"\tPrivateBit\t\t%s\n"
"\n"
"***********************************************\n"
"\n",
id[info->mpegId], info->layer, info->bitRate, (Int)info->sampleRate,
mode[info->stereoMode], yesNo[info->isIs], yesNo[info->isMs],
yesNo[info->protection], yesNo[info->emphasis],
yesNo[info->copyright], yesNo[info->original],
yesNo[info->privateBit]
);
DBG_ISR_PRINT ((dbgTsDemux, DBG_INTERNAL_LEAVE, "printMp3HeaderInfo"))
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
static void
printHelp(
void)
{
printf ("\n-------------------------------------------------------------------------------\n");
printf ("Usage:\n");
printf (" exolMpegTs -infile <file> [-loopEnable] [-vidpid <pid>] [-audpid <pid>]\n");
printf ("or\n");
printf (" exolMpegTs -fgpi\n");
printf ("\twhere -infile <filename> is:\n");
printf ("\t\tThe name and location of the file to be decoded.\n");
printf ("\t\t\te.g.,: -infile c:\\test_files\\flwr_080.trp\n");
printf ("\t\t\te.g.,: -infile file://localhost/c:\\test_files\\lotr.trp\n\n");
printf ("\twhere -loopEnable is:\n");
printf ("\t\tEnable looping when reading the input file.\n\n");
printf ("\twhere -vidpid <pid> is:\n");
printf ("\t\tThe number of the video PID to be redirected to the Video Decoder.\n\n");
printf ("\twhere -audpid <pid> is:\n");
printf ("\t\tThe number of the audio PID to be redirected to the Audio Decoder.\n\n");
printf( "\n-------------------------------------------------------------------------------\n" );
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
static void
setClockFrequency(
UInt32 freq )
{
DBG_ISR_PRINT( (dbgTsDemux, DBG_INTERNAL_ENTER, "setClockFrequency") )
// Remove compiler warning about unused parameters
freq = freq;
#if 0 // Unused code
MMIO( DDS2_CTL ) = 0x80000000U | (UInt32)(((float)freq * 2.485513481) + 0.5);
MMIO( DDS1_CTL ) = 0x80000000U | (UInt32)(((float)freq * 2.485513481) + 0.5);
MMIO( PLL1_CTL ) = 0x00014058;
MMIO( QVCP_CLK_OUT ) = 0x00000003;
MMIO( QVCP_CLK_PIX ) = 0x0000000B;
MMIO( QVCP_CLK_PROC ) = 0x0000002B;
MMIO( LCD_CTL ) = 0x00000000;
MMIO( DDS3_CTL ) = 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -