在Mac上使用VLCJ时出错

时间:2012-09-12 12:13:37

标签: macos media-player vlc libvlc vlcj

我正在使用VLCJ库在Mac和PC上开发简单的媒体播放器应用程序。在PC上,所有媒体文件都可以顺利运行。 在Mac上运行应用程序时(在配置Mac .dylib文件之后)我设法打开应用程序,当我点击进度条时帧显示正常,但当我想实际播放文件时,我得到以下内容错误:

    /Users/ronenshani/Desktop/Cinenote/CineNotes/resources/icons/control_start_blue.png/Users/ronenshani/Desktop/Cinenote/CineNotes/resources/icons/control_rewind_blue.png/Users/ronenshani/Desktop/Cinenote/CineNotes/resources/icons/control_fastforward_blue.png/Users/ronenshani/Desktop/Cinenote/CineNotes/resources/icons/control_end_blue.pngSep 12 13:48:59 Ronens-MacBook-Pro.local java[59043] <Error>: CGContextGetCTM: invalid context 0x0
Sep 12 13:48:59 Ronens-MacBook-Pro.local java[59043] <Error>: CGContextSetBaseCTM: invalid context 0x0
Sep 12 13:48:59 Ronens-MacBook-Pro.local java[59043] <Error>: CGContextGetCTM: invalid context 0x0
Sep 12 13:48:59 Ronens-MacBook-Pro.local java[59043] <Error>: CGContextSetBaseCTM: invalid context 0x0
mediaChanged
opening
playing 
paused
Fontconfig error: Cannot load default config file
Fontconfig error: Cannot load default config file
Fontconfig error: Cannot load default config file
[0x7faeb4413f50] main vout display error: option macosx-video-autoresize does not exist
2012-09-12 13:49:18.133 java[59043:407] -[CocoaAppWindow isFullscreen]: unrecognized selector sent to instance 0x7faeaa4aba90
2012-09-12 13:49:18.134 java[59043:407] -[CocoaAppWindow isFullscreen]: unrecognized selector sent to instance 0x7faeaa4aba90
2012-09-12 13:49:18.166 java[59043:407] (
 0   CoreFoundation                      0x00007fff8dcf6f56 __exceptionPreprocess + 198
 1   libobjc.A.dylib                     0x00007fff8db84d5e objc_exception_throw + 43
 2   CoreFoundation                      0x00007fff8dd831be -[NSObject doesNotRecognizeSelector:] + 190
 3   CoreFoundation                      0x00007fff8dce3e23 ___forwarding___ + 371
 4   CoreFoundation                      0x00007fff8dce3c38 _CF_forwarding_prep_0 + 232
 5   libvout_macosx_plugin.dylib         0x0000000123affc21 -[VLCOpenGLVideoView setWindowFrameWithValue:] + 49
 6   CoreFoundation                      0x00007fff8dce670d -[NSObject performSelector:withObject:] + 61
 7   Foundation                          0x00007fff8eba6d70 __NSThreadPerformPerform + 214
 8   CoreFoundation                      0x00007fff8dc654f1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
 9   CoreFoundation                      0x00007fff8dc64d5d __CFRunLoopDoSources0 + 253
 10  CoreFoundation                      0x00007fff8dc8bb49 __CFRunLoopRun + 905
 11  CoreFoundation                      0x00007fff8dc8b486 CFRunLoopRunSpecific + 230
 12  HIToolbox                           0x00007fff868174d3 RunCurrentEventLoopInMode + 277
 13  HIToolbox                           0x00007fff8681e781 ReceiveNextEventCommon + 355
 14  HIToolbox                           0x00007fff8681e60e BlockUntilNextEventMatchingListInMode + 62
 15  AppKit                              0x00007fff83befe31 _DPSNextEvent + 659
 16  AppKit                              0x00007fff83bef735 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 135
 17  libawt.jnilib                       0x0000000118bdcfe3 -[NSApplicationAWT nextEventMatchingMask:untilDate:inMode:dequeue:] + 124
 18  AppKit                              0x00007fff83bec071 -[NSApplication run] + 470
 19  libawt.jnilib                       0x0000000118bdb694 +[AWTStarter startAWT:] + 1495
 20  libawt.jnilib                       0x0000000118bdb00e -[CPerformer perform] + 93
 21  CoreFoundation                      0x00007fff8dce670d -[NSObject performSelector:withObject:] + 61
 22  Foundation                          0x00007fff8eba6d70 __NSThreadPerformPerform + 214
 23  CoreFoundation                      0x00007fff8dc654f1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
 24  CoreFoundation                      0x00007fff8dc64d5d __CFRunLoopDoSources0 + 253
 25  CoreFoundation                      0x00007fff8dc8bb49 __CFRunLoopRun + 905
 26  CoreFoundation                      0x00007fff8dc8b486 CFRunLoopRunSpecific + 230
 27  java                                0x000000010fa3a843 java + 18499
 28  java                                0x000000010fa3a29a java + 17050
 29  java                                0x000000010fa37a98 java + 6808
)
playingAssertion failed: (p->pause_date != VLC_TS_INVALID), function aout_PacketPause, file ../../extras/package/macosx/../../../src/audio_output/output.c, line 431.

我相信这是错误的核心,虽然我不确定:

[0x7faeb4413f50] main vout display error: option macosx-video-autoresize does not exist
2012-09-12 13:49:18.133 java[59043:407] -[CocoaAppWindow isFullscreen]: unrecognized selector sent to instance 0x7faeaa4aba90
2012-09-12 13:49:18.134 java[59043:407] -[CocoaAppWindow isFullscreen]: unrecognized selector sent to instance 0x7faeaa4aba90

应用程序正在使用VLCJ包装器来访问libvlc库。

如果有人对此事有任何见解,请告诉我。我已经被困在这个错误上几天了,仍然没有设法解决它。

谢谢, tamash

修改

在对代码进行一些挖掘之后,我发现VLCJ的以下代码导致错误:

static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_name )
{
    module_config_t *p_config;

    **p_config = config_FindConfig( p_this, psz_name );**

    /* sanity checks */
    if( !p_config )
    {
        msg_Err( p_this, "option %s does not exist", psz_name );
        return NULL;
    }

    if ( p_config->psz_longtext )
        return p_config->psz_longtext;
    else if( p_config->psz_text )
        return p_config->psz_text;
    else
        msg_Warn( p_this, "option %s does not include any help", psz_name );

    return NULL;
}

并且此函数无法加载一些配置文件(这是有道理的,因为上面的错误消息中指出了一些错误:“Fontconfig错误:无法加载默认配置文件”)。 我在哪里可以在Mac上找到这些配置文件,我应该在哪里加载它们?

1 个答案:

答案 0 :(得分:0)

在此错误的所有问题之后,libvlc库正在Mac上的“/Library/Preferences/org.videolan.vlc”文件夹下查找“vlcrc”文件。但是,在打开视频文件之后,我开始并暂停了VLCJ库提供的嵌入式媒体播放器组件:

mediaPlayer.start();
mediaPlayer.pause();

因为我希望电影在启动时暂停,但是要显示的第一帧。在评论出第二行后,它起作用了。