我可以在ALSA中设置时间戳吗? [英] Can i set timestamp in ALSA?

查看:269
本文介绍了我可以在ALSA中设置时间戳吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序,其中我需要按照时间戳播放音频数据包。为此,我需要告诉alsa驱动程序我的音频数据包应在什么时间戳播放。为此,我需要设置ALSA的时间戳。

I am developing one application in which i need to play audio packets as per timestamp. For this i need to tell alsa driver at what timestamp my audio packet should get played. For this i need to set the timestamp of ALSA.

我可以找到alsa api来获取播放音频数据包的时间戳(snd_pcm_status_get_tstamp())。

I could find the alsa api to get the timestamp (snd_pcm_status_get_tstamp()) at which the audio packet are getting played.

void gettimestamp(snd_pcm_t *handle, snd_timestamp_t *timestamp)
{
    int err;
    snd_pcm_status_t *status;
    snd_pcm_status_alloca(&status);
    if ((err = snd_pcm_status(handle, status)) < 0) {
        printf("Stream status error: %s\n", snd_strerror(err));
        exit(0);
    }
    snd_pcm_status_get_tstamp (status, timestamp);
}

我找不到任何用于设置时间戳的api。

I could not find any api to set the timestamp.

请帮助!

推荐答案

您找不到用于设置时间戳的任何API,因为没有。

You could not find any API to set the timestamp because there is none.

这篇关于我可以在ALSA中设置时间戳吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆