【发布时间】:2011-06-06 17:08:17
【问题描述】:
我还有一个指针问题,如果你能帮我解决这个问题,我会很高兴
我有这个结构:
uint8_t *reconstructed[3];
reconstructed[0] = buff_offset + (uint8_t *) malloc (buff_size);
reconstructed[1] = buff_offset + (uint8_t *) malloc (buff_size);
reconstructed[2] = buff_offset + (uint8_t *) malloc (buff_size);
我是这样使用这个变量的:
y4m_write_frame (fd_out, &ostreaminfo, &oframeinfo, reconstructed);
我的任务是并行化这个应用程序,出于几个原因,我需要将此结构放入 GLib 队列并在一些操作后使用它。
所以我把它放在队列中:
g_queue_push_tail(queue, (gpointer) reconstructed);
但现在我不知道如何从那里得到它。我试过了:
uint8_t * const * frame = (uint8_t * const *) g_queue_pop_head(queue);
y4m_write_frame (fd_out, &ostreaminfo, &oframeinfo, frame);
但应用程序因分段错误而失败。
谁能帮帮我?我没有得到整个指针问题。
【问题讨论】:
-
我只是重写这段代码,所以我想尽可能避免更改现有代码
标签: c pointers queue segmentation-fault glib