| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2002-2010, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bcmplayer_test.c $ |
|---|
| 11 | * $brcm_Revision: 1 $ |
|---|
| 12 | * $brcm_Date: 6/3/10 3:54p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: Transport Stream Index Player Header File |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /BSEAV/lib/bcmplayer/tests/bcmplayer_test.c $ |
|---|
| 19 | * |
|---|
| 20 | * 1 6/3/10 3:54p erickson |
|---|
| 21 | * SW7400-2788: add testse |
|---|
| 22 | * |
|---|
| 23 | ***************************************************************************/ |
|---|
| 24 | #include <stdlib.h> |
|---|
| 25 | #include <stdio.h> |
|---|
| 26 | #include <errno.h> |
|---|
| 27 | |
|---|
| 28 | #include "bcmplayer.h" |
|---|
| 29 | |
|---|
| 30 | int main(int argc, char **argv) |
|---|
| 31 | { |
|---|
| 32 | BNAV_Player_Handle bcmplayer; |
|---|
| 33 | BNAV_Player_Settings settings; |
|---|
| 34 | FILE *indexfile; |
|---|
| 35 | long index; |
|---|
| 36 | int rc; |
|---|
| 37 | |
|---|
| 38 | if (argc < 2) { |
|---|
| 39 | printf("Usage: bcmplayer_test FILE\n"); |
|---|
| 40 | exit(1); |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | indexfile = fopen(argv[1], "rb"); |
|---|
| 44 | if (!indexfile) { |
|---|
| 45 | return -1; |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | BNAV_Player_GetDefaultSettings(&settings); |
|---|
| 49 | settings.videoPid = 0x21; |
|---|
| 50 | settings.readCb = (BP_READ_CB)fread; |
|---|
| 51 | settings.tellCb = (BP_TELL_CB)ftell; |
|---|
| 52 | settings.seekCb = (BP_SEEK_CB)fseek; |
|---|
| 53 | settings.filePointer = indexfile; |
|---|
| 54 | rc = BNAV_Player_Open(&bcmplayer, &settings); |
|---|
| 55 | BDBG_ASSERT(!rc); |
|---|
| 56 | |
|---|
| 57 | index = 100; |
|---|
| 58 | rc = BNAV_Player_SetCurrentIndex(bcmplayer, index); |
|---|
| 59 | BDBG_ASSERT(!rc); |
|---|
| 60 | printf("at index %ld\n", index); |
|---|
| 61 | |
|---|
| 62 | index = BNAV_Player_FindIFrameFromIndex(bcmplayer, index, -1); |
|---|
| 63 | printf("back to I: at index %ld\n", index); |
|---|
| 64 | |
|---|
| 65 | index = BNAV_Player_FindIFrameFromIndex(bcmplayer, index, -1); |
|---|
| 66 | printf("same: at index %ld\n", index); |
|---|
| 67 | |
|---|
| 68 | index = BNAV_Player_FindIFrameFromIndex(bcmplayer, index-1, -1); |
|---|
| 69 | printf("previous: at index %ld\n", index); |
|---|
| 70 | |
|---|
| 71 | index = BNAV_Player_FindIFrameFromIndex(bcmplayer, index+1, 1); |
|---|
| 72 | printf("forward to I: at index %ld\n", index); |
|---|
| 73 | |
|---|
| 74 | index = BNAV_Player_FindIFrameFromIndex(bcmplayer, index, 1); |
|---|
| 75 | printf("same: at index %ld\n", index); |
|---|
| 76 | |
|---|
| 77 | index = BNAV_Player_FindIFrameFromIndex(bcmplayer, index+1, 1); |
|---|
| 78 | printf("next: at index %ld\n", index); |
|---|
| 79 | |
|---|
| 80 | BNAV_Player_Close(bcmplayer); |
|---|
| 81 | |
|---|
| 82 | return 0; |
|---|
| 83 | } |
|---|