📄 indexvideo.c
字号:
/******************************************************************** Copyright (c) 2001 Sigma Designs Inc. All rights reserved. ********************************************************************//** @file playlist.c @brief Sample C files showing how to use the external API of the CARIBBEAN driver. This sample shows how to initialise the Caribbean driver, then open an URL and play it. @date 2001-12-15*/#define ALLOW_OS_CODE#include "../rmdef/rmdef.h"#include "../rmcaribbeanapi/include/rmcaribbeanapi.h"#include "../rmmpegindexerapi/include/rmmpegindexerapi.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#ifndef WIN32#include <unistd.h>#include <setjmp.h>#else#include <Windows.h>#endif#define TOTAL_MEMORY_NEEDED (60*1024)jmp_buf g_env;void apidemopaniccallback(RMuint32 reason);void apidemopaniccallback(RMuint32 reason){ longjmp(g_env,(int)reason);}int main(int argc, char **argv){ int rc; RMuint8 *pStart; ExternalRMmpegIndexer indexer; if (argc != 4) { fprintf(stderr, "Usage %s: <type> <mpeg file> <index file>\n" "\ttype: one of M1S, M2P, M2T, VOB, M4T, MPEG2_VIDEO, MPEG4_VIDEO\n" "\tmpeg file: mpeg file to index\n" "\tindex file: index file\n" , argv[0]); return -1; } pStart=(RMuint8 *)malloc(TOTAL_MEMORY_NEEDED); if (pStart==NULL) { fprintf(stderr,"Cannot allocate %d bytes.\n",TOTAL_MEMORY_NEEDED); return -1; } rc=setjmp(g_env); if (rc == 0) { fprintf(stderr,"Saved context for panic situation OK\n"); } else { fprintf(stderr,"CARIBBEAN called RMPanic with RMstatus %d. Exiting\n",rc); if (rc==RM_ERRORGRAPHMISSINGNODEORMODULE) fprintf(stderr, "you are missing a required shared library\n" "run again in gdb with breakpoint on longjmp;\n" "go back in the stack until RMCreateInstance() and\n" "print *(int *)($fp+8) gives the missing cid\n"); return -1; } EnterCaribbean(pStart,TOTAL_MEMORY_NEEDED,RM_ALIGNMENTNONE,apidemopaniccallback); if (RMCreateMpegIndexer(&indexer, argv[1]) != RM_OK) goto cleanup; RMIndexMpegFile(indexer, (RMuint8 *) argv[2], (RMuint8 *) argv[3]); cleanup: if (indexer != NULL) RMDeleteMpegIndexer(indexer); if (ExitCaribbean(NULL)==RM_OK) { free(pStart); fprintf(stderr,"exit caribbean and freed memory space\n"); return 0; } else { fprintf(stderr,"Problems to ExitCaribbean\n"); return -1; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -