📄 exolmpegts.c
字号:
DBG_ISR_PRINT ((dbgTsDemux, DBG_INTERNAL_LEAVE, "tmMain"))
tmMain_EXIT (0);
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
static tmErrorCode_t
attachPictureInfo(
ptsaInOutDescriptor_t pIod)
{
Int i = 0;
DBG_ISR_PRINT ((dbgTsDemux, DBG_INTERNAL_ENTER, "attachPictureInfo"))
for (i = 0; i < pIod->numberOfPackets; i++)
{
UInt32 msg_buf[4];
UInt32 msgSize;
ptmAvPacket_t packet;
Int32 timeoutNoWait = 0;
tmalVdecMpegPictureInfo_t *pictureInfo;
ERRCHK (tmosalQueueReceive (pIod->emptyQueue, msg_buf, &msgSize,
&timeoutNoWait, tmosalQueueReceiveFlagNone ) )
packet = (ptmAvPacket_t)msg_buf[0];
EQ_ERRCHK( packet, Null )
ERRCHK (tmmlMalloc (gAppInstanceMmsp, sizeof (tmalVdecMpegPictureInfo_t),
(pVoid *)&pictureInfo, tmmlMallocCleared ) )
pictureInfo->size = sizeof (tmalVdecMpegPictureInfo_t);
pictureInfo->dataFormat = 0xFFFFFFFF;
packet->header->userPointer = pictureInfo;
msg_buf[0] = (UInt32) packet;
msg_buf[1] = tsaCmdDataPacket;
ERRCHK (tmosalQueueSend (pIod->emptyQueue, msg_buf, 16, &timeoutNoWait,
tmosalQueueSendFlagNone ) )
}
DBG_ISR_PRINT ((dbgTsDemux, DBG_INTERNAL_LEAVE, "attachPictureInfo"))
return( TM_OK );
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
static tmErrorCode_t
checkArgCv(
Int argc,
Char **argv)
{
Int i;
Int urlIndex = 0;
Char *pUrlPath = Null;
Char *endPtr = Null;
FILE *fp;
ptmDbgUnit_t dbgUnit;
for ( i = 1; i != argc; ++i )
{
if ( strcmp( argv[i], "-fgpi" ) == 0 )
{
gUseFgpi = True;
}
else if ( strcmp( argv[i], "-0" ) == 0 )
{
// Trace unit specified
++i;
tmTr_SetLevel( argv[i], 0, Null );
printf( "Trace level %s set to 0\n", argv[i] );
}
else if (strcmp (argv[i], "-1") == 0)
{
// Debug unit specified
++i;
tmDbg_AttachModule (&dbgUnit, DBG_MODULE_NAME, argv[i],
DBG_PREREGISTER);
tmDbg_SetOption (dbgUnit, DBG_PRINT_FORMAT,
(DBG_PRINT_THREAD | DBG_PRINT_UNIT) );
tmDbg_SetOption( dbgUnit, DBG_OUTPUT_DESTINATION, DBG_OUTPUT_MEMORY );
tmDbg_SetFlags( dbgUnit, (tmDbg_GetFlags (dbgUnit) | DBG_LEVEL_1) );
tmDbg_Detach (&dbgUnit);
printf ("Debug level %s set to 0x%XU\n", argv[i], DBG_LEVEL_1);
}
else if (strcmp (argv[i], "-2") == 0)
{
// Debug unit specified
++i;
tmDbg_AttachModule (&dbgUnit, DBG_MODULE_NAME, argv[i],
DBG_PREREGISTER);
tmDbg_SetOption (dbgUnit, DBG_PRINT_FORMAT,
(DBG_PRINT_THREAD | DBG_PRINT_UNIT) );
tmDbg_SetOption( dbgUnit, DBG_OUTPUT_DESTINATION, DBG_OUTPUT_MEMORY );
tmDbg_SetFlags( dbgUnit, (tmDbg_GetFlags (dbgUnit) | DBG_LEVEL_2) );
tmDbg_Detach (&dbgUnit);
printf ("Debug level %s set to 0x%XU\n", argv[i], DBG_LEVEL_2);
}
else if (strcmp (argv[i], "-3") == 0)
{
// Debug unit specified
++i;
tmDbg_AttachModule (&dbgUnit, DBG_MODULE_NAME, argv[i],
DBG_PREREGISTER);
tmDbg_SetOption (dbgUnit, DBG_PRINT_FORMAT,
(DBG_PRINT_THREAD | DBG_PRINT_UNIT) );
tmDbg_SetOption( dbgUnit, DBG_OUTPUT_DESTINATION, DBG_OUTPUT_MEMORY );
tmDbg_SetFlags( dbgUnit, (tmDbg_GetFlags (dbgUnit) | DBG_LEVEL_3) );
tmDbg_Detach (&dbgUnit);
printf ("Debug level %s set to 0x%XU\n", argv[i], DBG_LEVEL_3);
}
else if (strcmp (argv[i], "-4") == 0)
{
// Debug unit specified
++i;
tmDbg_AttachModule (&dbgUnit, DBG_MODULE_NAME, argv[i],
DBG_PREREGISTER);
tmDbg_SetOption (dbgUnit, DBG_PRINT_FORMAT,
(DBG_PRINT_THREAD | DBG_PRINT_UNIT) );
tmDbg_SetOption( dbgUnit, DBG_OUTPUT_DESTINATION, DBG_OUTPUT_MEMORY );
tmDbg_SetFlags( dbgUnit, (tmDbg_GetFlags (dbgUnit) | DBG_LEVEL_4) );
tmDbg_Detach (&dbgUnit);
printf ("Debug level %s set to 0x%XU\n", argv[i], DBG_LEVEL_4);
}
else if (strcmp (argv[i], "-5") == 0)
{
// Debug unit specified
++i;
tmDbg_AttachModule (&dbgUnit, DBG_MODULE_NAME, argv[i],
DBG_PREREGISTER);
tmDbg_SetOption (dbgUnit, DBG_PRINT_FORMAT,
(DBG_PRINT_THREAD | DBG_PRINT_UNIT) );
tmDbg_SetOption( dbgUnit, DBG_OUTPUT_DESTINATION, DBG_OUTPUT_MEMORY );
tmDbg_SetFlags( dbgUnit, (tmDbg_GetFlags (dbgUnit) | DBG_LEVEL_5) );
tmDbg_Detach (&dbgUnit);
printf ("Debug level %s set to 0x%XU\n", argv[i], DBG_LEVEL_5);
}
else if (strcmp (argv[i], "-dbg") == 0)
{
// Debug unit specified
++i;
tmDbg_AttachModule (&dbgUnit, DBG_MODULE_NAME, argv[i],
DBG_PREREGISTER);
tmDbg_SetOption (dbgUnit, DBG_PRINT_FORMAT,
(DBG_PRINT_THREAD | DBG_PRINT_UNIT) );
tmDbg_SetOption( dbgUnit, DBG_OUTPUT_DESTINATION, DBG_OUTPUT_MEMORY );
tmDbg_SetFlags (dbgUnit, ~0U);
tmDbg_Detach (&dbgUnit);
printf ("Debug level %s set to 0x%XU\n", argv[i], ~0U);
}
else if (strcmp (argv[i], "-infile") == 0)
{
// Infile specified
++i;
sprintf (gDefaultInfile, "%s", argv[i]);
}
else if (strcmp (argv[i], "-vidpid") == 0)
{
// PID to be redirected to Video Decoder was specified
++i;
gPids.videoPid = strtol (argv[i], &endPtr, 0);
if (argv[i] == endPtr)
{
printf ("\nExpected a number for -vidpid option, got '%s'\n",
argv[i]);
tmMain_EXIT (-1);
}
gPids.pcrPid = gPids.videoPid;
}
else if (strcmp (argv[i], "-audpid") == 0)
{
// PID to be redirected to Audio Decoder was specified
++i;
gPids.mainAudioPid = strtol (argv[i], &endPtr, 0);
if (argv[i] == endPtr)
{
printf ("\nExpected a number for -audpid option, got '%s'\n",
argv[i]);
tmMain_EXIT (-1);
}
}
else if (strcmp (argv[i], "-loopEnable") == 0)
{
// Enable looping on reading input file
bLoopEnable = True;
}
else if ((strcmp (argv[i], "-h") == 0) ||
(strcmp (argv[i], "-help") == 0) ||
(strcmp (argv[i], "-?") == 0) ||
(strcmp (argv[i], "help") == 0))
{
// Help
printHelp();
tmMain_EXIT (-1);
}
else if (strcmp (argv[i], "-vbuf") == 0)
{
/* Number of buffers Demux->Vdec */
++i;
numOfDemuxToVdecBuffers = atoi (argv[i]);
DBG_ASSERT (numOfDemuxToVdecBuffers <= MAX_BUFFERS_PER_PACKET);
printf ("Num of video buffers set to %d\n", numOfDemuxToVdecBuffers);
}
else if (strcmp (argv[i], "-abuf") == 0)
{
/* Number of buffers Demux->Adec */
++i;
numOfDemuxToAdecBuffers = atoi (argv[i]);
DBG_ASSERT (numOfDemuxToAdecBuffers <= MAX_BUFFERS_PER_PACKET);
printf ("Num of audio buffers set to %d\n", numOfDemuxToAdecBuffers);
}
else if (strcmp (argv[i], "-ac3") == 0)
{
gAudioStreamType = AC3_AUDIO_STREAM;
}
else if (strcmp (argv[i], "-mp3") == 0)
{
gAudioStreamType = MP3_AUDIO_STREAM;
}
else
{
printf ("\nUnrecognized command line switch %s\n", argv[i]);
printHelp();
tmMain_EXIT (-1);
}
} // end for loop
if (gUseFgpi)
{
printf ("Input will be read from FGPI\n");
gDemuxInputFormat.dataSubtype = tsfFgpiTimeStamped;
}
else
{
pUrlPath = gDefaultInfile;
if (0 == strncmp (gDefaultInfile, "file:///", 8))
{
urlIndex = 8;
}
else if (0 == strncmp ((const Char *)gDefaultInfile, "file://localhost/",
17))
{
urlIndex = 17;
}
if (urlIndex != 0)
{
strncpy (gInfileName, (pUrlPath + urlIndex), 100);
}
else
{
sprintf (gInfileName, "%s", gDefaultInfile);
}
printf ("Input will be read from file %s\n", gInfileName);
if ((fp = fopen (gInfileName, "rb")) == Null)
{
printf ("Error! File not found!\n");
tmMain_EXIT (-1);
}
else
{
fclose (fp);
}
gDemuxInputFormat.dataSubtype = tsfStandard;
}
DBG_ISR_PRINT ((dbgTsDemux, DBG_INTERNAL_LEAVE, "checkArgCv"))
return (TM_OK);
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
static Bool
commandControl(
Int menuResult,
Bool bUseMenu )
{
tmErrorCode_t rval = TM_OK;
static Bool bFirstTime = True;
DBG_ISR_PRINT( (dbgTsDemux, DBG_INTERNAL_ENTER, "commandControl") )
// Start timeDoctor
if ( menuResult == 4 )
{
#if TMFL_NEED_TIME_DOCTOR
// Start Time Doctor
tmtdStart();
#endif
menuResult = displayCommandMenu (bUseMenu);
}
// Menu result less than 0 = quit program
if ( menuResult < 0 )
{
#if STORE_DEBUG_IN_RAM
storeDataInRam( ERROR_TIMESTAMP, 0xFFFFFFFF, True );
#endif
rval = TM_ERR_STOP_REQUESTED; // Indicates if we want to quit
goto _return;
}
if ( menuResult == 3 )
{
if ( (gPids.programNum != 0) &&
(gPids.mainAudioPid == DEMUXMPEGTS_NO_PID) &&
(gPids.videoPid == DEMUXMPEGTS_NO_PID) )
{
menuResult = 1;
verifyProgramNumber_GetPids( menuResult );
}
}
// If changing the channel, stop components and start them again
if ( !bFirstTime )
{
if (gUseFgpi)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -