本文介绍了在不使用 OpenMAX 的情况下在 Raspberry Pi 中解码视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找在 Raspberry Pi 上直接解码视频的示例,而不使用 OpenMAX.

I am looking for an example of decoding video on Raspberry Pi directly, without using OpenMAX.

这解释了多媒体软件的不同层次:

This explains the different layers of multimedia software:

这里没有显示的附加层,MMAL" 层,它(我相信)是 OpenMAX 的 Broadcom 包装器.(如果没有,它将是 OpenMAX 的替代品,位于内核驱动程序的顶部)例如 raspivid 和 raspistill 是使用 MMAL 编写的.

There is an additional layer which is not shown in here, the "MMAL" layer which is (I believe) a Broadcom wrapper around OpenMAX. (If not, it would be an OpenMAX alternative, sitting on top of the kernel driver) raspivid and raspistill for example are written using MMAL.

我想要一个视频解码示例,其中输入是原始 H.264,输出是内存中的视频或屏幕上的视频.我想直接使用 VCHIQ,而不是使用 OpenMAX.(主要是出于性能和灵活性方面的考虑)

I want an example of video decode where the input is raw H.264, and the output is either video in memory or video on screen. I want to do this using VCHIQ directly, not using OpenMAX. (Mainly for performance and flexibility reasons)

此 github 存储库:https://github.com/raspberrypi/userland/ 包含上面显示的所有内容的源(橙色和绿色框;VCHIQ 本身的源,VCHIQ 之上的 OpenMAX IL 实现,还有 OpenGL 和 EGL 实现,......).所以理论上应该足够上手了.问题在于,即使非常熟悉 OpenMAX 和一般的多媒体框架,如何使用它也非常不明显.

This github repository: https://github.com/raspberrypi/userland/ contains the source for everything shown above (the orange and green boxes; source for VCHIQ itself, OpenMAX IL implementation on top of VCHIQ, also OpenGL and EGL implementations, ...). So in theory it should be enough to get started. The problem is that it is highly non-obvious how to use it, even if one is very familiar with OpenMAX and with multimedia frameworks in general.

例如:vchiq_bulk_transmit() 似乎是人们用来将视频发送到解码器的功能.但是如何初始化 VCHIQ_SERVICE_HANDLE_T 类型的第一个参数?结果在哪里,在帧缓冲区中,或在结果句柄中,还是...?

For example: vchiq_bulk_transmit() seems to be the function that one would use to send video to the decoder. But how to initialize the first argument of type VCHIQ_SERVICE_HANDLE_T? Where do the results go, in the framebuffer, or in a result handle, or... ?

EDIT 可以通过提供使用 vchiq 进行视频解码的工作示例、显示调用序列的 API 演练(即使不是工作示例)或指向足够文档的指针来收集赏金写这个.一个有效的例子将获得额外的丰厚奖励 :)

EDIT The bounty can be collected by either providing a working example of video decode using vchiq, an API walkthrough that shows the calling sequence (even though not a working example) or a pointer to sufficient documentation to write this. A working example will get a hefty extra bounty :)

推荐答案

我没有可用的示例,但我有一个 API 演练.有点……

I don't have a working example, but I have an API walkthrough. Sort of..

链接到完整的源代码

我发现以下函数演示了如何调用 vchiq_bulk_transmit

I found the following function that demonstrate how you can call vchiq_bulk_transmit

int32_t vchi_bulk_queue_transmit(VCHI_SERVICE_HANDLE_T handle,
    void *data_src,
    uint32_t data_size,
    VCHI_FLAGS_T flags,
    void *bulk_handle)
{
    SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
    ..
    status = vchiq_bulk_transmit(service->handle, data_src,
        data_size, bulk_handle, mode);
    ..
    return vchiq_status_to_vchi(status);
}
EXPORT_SYMBOL(vchi_bulk_queue_transmit);

有一个函数可以创建VCHI_SERVICE_HANDLE_T

int32_t vchi_service_create(VCHI_INSTANCE_T instance_handle,
    SERVICE_CREATION_T *setup,
    VCHI_SERVICE_HANDLE_T *handle)
{
    VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle;
    SHIM_SERVICE_T *service = service_alloc(instance, setup);

    *handle = (VCHI_SERVICE_HANDLE_T)service;
    ..
    return (service != NULL) ? 0 : -1;
}
EXPORT_SYMBOL(vchi_service_create);

但是你需要一个 VCHI_INSTANCE_T 可以在这里初始化

But you need a VCHI_INSTANCE_T which can be initialized here

int32_t vchi_initialise(VCHI_INSTANCE_T *instance_handle)
{
    VCHIQ_INSTANCE_T instance;
    VCHIQ_STATUS_T status;

    status = vchiq_initialise(&instance);

    *instance_handle = (VCHI_INSTANCE_T)instance;

    return vchiq_status_to_vchi(status);
}
EXPORT_SYMBOL(vchi_initialise);

这篇关于在不使用 OpenMAX 的情况下在 Raspberry Pi 中解码视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-02 22:07