2012-03-25 2 views
0

Windows에서 Xuggler 구축을 위해 노력. Xuggler은 (는 FFmpeg 포함) 사운드 처리 목적에 랩 코어 자바 네이티브 코드의 함수이다.왜 FREAD는()는 MSYS /는 MinGW에서 (건너 뛰는 바이트)를 작동하지 않을 수 있습니까?

내 윈도우 64 승 7 교수이지만, 모든 사용되는 라이브러리는 32 비트입니다. 나는 followinf 스크립트 MSYS 쉘 아래에서,는 MinGW /는 MSys에서 빌드 절차를 실행하고 있습니다 :

#!/bin/sh 
export JAVA_HOME=/C/Program\ Files\ \(x86\)/Java/jdk1.6.0_25 
export XUGGLE_HOME=/C/Xuggler 

PATH=$XUGGLE_HOME/bin:/C/Program\ Files\ \(x86\)/Java/jdk1.6.0_25/bin:/d/APPS/msysgit/msysgit/bin/git:/D/APPS/MinGW/bin:/bin:/D/APPS/apa che-ant-1.8.2/bin:/D/Users/Dims/Design/MinGW/Util:$PATH 
ant -Dbuild.m64=no run-tests 

개미 대상에 오류가 줄 끝에 몇 가지 테스트가 포함되어 있습니다.

int32_t totalBytes = 0; 
do { 
    unsigned char buf[2048]; 
    retval = handler->url_read(buf, (int)sizeof(buf)); 
    if (retval > 0) 
     totalBytes+= retval; 
} while (retval > 0); 
VS_TUT_ENSURE_EQUALS("", 4546420, totalBytes); 

url_read 코드가있는 동안은 다음과 같습니다 :

int 
StdioURLProtocolHandler :: url_read(unsigned char* buf, int size) 
{ 
    if (!mFile) 
     return -1; 
    return (int) fread(buf, 1, size, mFile); 
} 

이해가 안 오류는 다음과

[exec] Running 6 tests.. 
[exec] In StdioURLProtocolHandlerTest::testRead: 
[exec] ../../../../../../../../../test/csrc/com/xuggle/xuggler/io/StdioURLProtocolHandlerTest.cpp:108: Error: Expected (4546420 == totalBytes), found (4546420 != 1042) 
[exec] In StdioURLProtocolHandlerTest::testReadWrite: 
[exec] ../../../../../../../../../test/csrc/com/xuggle/xuggler/io/StdioURLProtocolHandlerTest.cpp:185: Error: Expected (4546420 == totalBytes), found (4546420 != 1042) 
[exec] In StdioURLProtocolHandlerTest::testSeek: 
[exec] ../../../../../../../../../test/csrc/com/xuggle/xuggler/io/StdioURLProtocolHandlerTest.cpp:139: Error: Expected (4546420 == totalBytes), found (4546420 != 1042) 
[exec] . 
[exec] Failed 3 of 6 tests 
[exec] Success rate: 50% 
[exec] FAIL: xugglerioTestStdioURLProtocolHandler.exe 

UPDATE 1

테스트 코드는 다음과 , 어떤 상황에서 1042를 돌려 줄 수 있느냐 ?? ? 여하튼 64 비트가 될 수 있습니까?

업데이트 2

내가 사용하는 파일 이름을 인쇄하고이 경로가 올바른지

d:/......./../../../test/fixtures/testfile.flv 

했지만,이 MSYS에서 역할을 할 수 /d/

d:/하지 시작 ?

UPDATE 3

내가 테스트 파일의 실제 내용으로 readen 바이트를 비교 발견, 그 FREAD()는 어떤 이유로 몇 바이트를 건너 뜁니다. 아직 바이트 알고하지 마십시오 아마도 이러한 CR/LF

UPDATE 같아요 CR/LF와 관련되지 않음 4

있습니다.

원래 바이트

46 4C 56 01 05 00 00 00 09 00 00 00 00 12 00 00 F4 00 00 00 00 00 00 00 02 00 0A 6F 6E 4D 65 74 61 44 61 74 61 08 00 00 ... 

readen 바이트이 FLV 파일이 시작됩니다

46 4C 56 15 00 09 00 00 12 00 F4 00 00 00 02 0A 6F 6E 4D 65 74 61 44 61 74 61 80 00 B0 86 47 57 26 17 46 96 F6 E0 40 62 ... 

되어 있습니다. 나는 부패의 경향을 이해하지 못한다.

어떻게 01 05 00 00 단지 15에 변환 할 수 있습니다 ???

UPDATE 5

파일 열기는 다음과 같이 수행

void 
StdioURLProtocolHandlerTest :: testRead() 
{ 
    StdioURLProtocolManager::registerProtocol("test"); 
    URLProtocolHandler* handler = StdioURLProtocolManager::findHandler("test:foo", 0,0); 
    VS_TUT_ENSURE("", handler); 

    int retval = 0; 
    retval = handler->url_open(mSampleFile, URLProtocolHandler::URL_RDONLY_MODE); 
    VS_TUT_ENSURE("", retval >= 0); 

    int32_t totalBytes = 0; 
    printf("Bytes:\n"); 
    do { 
    //... 

url_open() 함수는 다음과 같습니다

int StdioURLProtocolHandler :: url_open(const char *url, int flags) 
{ 
    if (!url || !*url) 
    return -1; 
    reset(); 
    const char * mode; 

    switch(flags) { 
    case URLProtocolHandler::URL_RDONLY_MODE: 
     mode="r"; 
     break; 
    case URLProtocolHandler::URL_WRONLY_MODE: 
     mode="w"; 
     break; 
    case URLProtocolHandler::URL_RDWR_MODE: 
      mode="r+"; 
      break; 
     default: 
     return -1; 
    } 

    // The URL MAY contain a protocol string. Find it now. 
    char proto[256]; 
    const char* protocol = URLProtocolManager::parseProtocol(proto, sizeof(proto), url); 
    if (protocol) 
    { 
    size_t protoLen = strlen(protocol); 
    // skip past it 
    url = url + protoLen; 
    if (*url == ':' || *url == ',') 
     ++url; 
    } 
// fprintf(stderr, "protocol: %s; url: %s; mode: %s\n", protocol, url, mode); 
    mFile = fopen(url, mode); 
    if (!mFile) 
    return -1; 
    return 0; 
} 
+0

어떻게 파일을여시겠습니까? – Mat

+0

업데이트 5를 참조하십시오. 의심스럽지 않게 보입니다. – Dims

+1

의심스러운 것으로 보입니다. 열린 모드에서는 "b"가 표시되지 않습니다. – Mat

답변

1

는의와 CROSS_COMPILE 지점에 GIT 저장소에 고정해야 오늘. 이번 주말/다음 주 초에 이것을 나무 꼭대기에 넣을 것입니다.

이제 stdio 처리기는 모든 파일을 이진 파일로 엽니 다.

+0

고마워. 사용자가'cross_compile'을 사용하여 Windows 용으로 컴파일 할 것을 권장합니까? 나는. 나는 리눅스에서 컴파일러를 실행할 수 있지만 Windows 용 바이너리를 얻을 것인가? – Dims

+0

master에는 이제이 수정본이 포함되어 있으며 ivy repo에 배포 된 미리 만들어진 jar 파일에는 모든 os가 포함되어 있습니다. Linux로 빌드하면 기본적으로 Windows 빌드가 생성되지 않습니다. 교차 컴파일을 사용하도록 설정해야합니다 (블로그에서 검색 방법을 찾으십시오). –