libvlc_init在树莓派上崩溃

时间:2018-06-03 17:43:27

标签: raspberry-pi gtk libvlc

我正在研究基于凸轮的gtk应用程序。它在我的笔记本电脑上工作,以前也在树莓派上工作..

我没有做太多事情,因为我在我的cam小部件上没有记住任何东西,但现在它在init上没有太多信息崩溃了。这是我的最后一部分..我真的找不到改变的暗示......

close(10)                               = 0
mprotect(0xb0b01000, 4096, PROT_READ)   = 0
mprotect(0xb087a000, 8192, PROT_READ)   = 0
mprotect(0xb0b2b000, 4096, PROT_READ)   = 0
munmap(0xb0b03000, 66205)               = 0
munmap(0xb0b14000, 98804)               = 0
munmap(0xb07c2000, 765520)              = 0
munmap(0xb0ad6000, 180592)              = 0
getdents64(9, /* 0 entries */, 32768)   = 0
close(9)                                = 0
getdents64(8, /* 0 entries */, 32768)   = 0
close(8)                                = 0
open("/usr/share/vlc/../locale/de_DE.UTF-8/LC_MESSAGES/vlc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/vlc/../locale/de_DE.utf8/LC_MESSAGES/vlc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/vlc/../locale/de_DE/LC_MESSAGES/vlc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/vlc/../locale/de.UTF-8/LC_MESSAGES/vlc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/vlc/../locale/de.utf8/LC_MESSAGES/vlc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/vlc/../locale/de/LC_MESSAGES/vlc.mo", O_RDONLY) = 8
fstat64(8, {st_mode=S_IFREG|0644, st_size=617563, ...}) = 0
mmap2(NULL, 617563, PROT_READ, MAP_PRIVATE, 8, 0) = 0xb0a96000
close(8)                                = 0
munmap(0xb6fb2000, 4096)                = 0
ioctl(1, TCGETS, 0xbecf55bc)            = -1 ENOTTY (Inappropriate ioctl for device)
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---
+++ killed by SIGSEGV +++

这是我的摄像头代码。

#include "camwidget.h"


libvlc_media_player_t *media_player;
libvlc_instance_t *vlc_inst;

char const *params[] = {"--no-xlib", "--file-caching=512"};
char const *mediaopts[] = { ":network-caching=150",":clock-jitter=0", ":clock-synchro=0", NULL};


/**
 * add options to media
 */ 
void media_add_options(libvlc_media_t *media, char const **mediaopts) {
    int i = 0;
    for (int i = 0;mediaopts[i] != NULL; i++) {
        libvlc_media_add_option(media, mediaopts[i]);
    }
}

/**
 * realize widget
 */ 
void player_widget_on_realize(GtkWidget *widget, gpointer data) {
    libvlc_media_player_set_xwindow(media_player, GDK_WINDOW_XID(gtk_widget_get_window(widget)));
}

/**
 * initialize widget
 */ 
int camwidget_init(char const *camstream, GtkWidget * widget) {
    vlc_inst = libvlc_new(2, params);
    media_player = libvlc_media_player_new(vlc_inst);
    g_signal_connect(G_OBJECT(widget), "realize", G_CALLBACK(player_widget_on_realize), NULL);

    libvlc_media_t *media;
    media = libvlc_media_new_location(vlc_inst, camstream);

    if( media == NULL) {
        backlog_print(BACKLOG_ERROR, "could not create media location %s", camstream);
        return -1;
    }

    media_add_options(media, mediaopts);
    libvlc_media_player_set_media(media_player, media);

    if(0 != libvlc_media_player_play(media_player)) {
        backlog_print(BACKLOG_ERROR, "could play media %s", camstream);
        return -2;
    }

    libvlc_media_release(media);

    return 0;
}


/**
 * deinitialize widget
 */ 
void camwidget_uninit() {
    libvlc_media_player_release(media_player);
    libvlc_release(vlc_inst);   
}

/**
 * draw callback
 */ 
gboolean cam_view_draw_cb(GtkWidget *widget, cairo_t *cr, gpointer data) {
    GtkDrawingArea * da = GTK_DRAWING_AREA(widget);
    g_debug("draw");
    return false;
}

崩溃发生在libvlc_init里面,但我不知道为什么:(有人能帮帮我吗?

0 个答案:

没有答案