我想使用函数SELECT x.*
FROM salaries x
JOIN
( SELECT emp_no
, MAX(to_date) max_to_date
FROM salaries
GROUP
BY emp_no
) y
ON y.emp_no = x.emp_no
AND y.max_to_date = x.to_date;
更新AV音频编码器到avcodec_encode_audio (deprecated)
,而不修改现有编码器的结构:
avcodec_encode_audio2
其中:
1)m_handle AVCodecContext
2)dst,uint8_t *目标缓冲区
3)sizeBytes,uint32_t目标缓冲区的大小
4)m_samBuf void *到要编码的数据的输入块(这被转换为:const short int *)
有一种简单的方法吗?
我试着用:
outBytes = avcodec_encode_audio(m_handle, dst, sizeBytes, (const short int*)m_samBuf);
它编译,但它没有编码任何东西,如果我在输出流管道输出流,我不会在输出音频,这是在升级之前的warking。
我做错了什么?
编码器只接受两种样本格式:
int gotPack = 1;
memset (&m_Packet, 0, sizeof (m_Packet));
m_Frame = av_frame_alloc();
av_init_packet(&m_Packet);
m_Packet.data = dst;
m_Packet.size = sizeBytes;
uint8_t* buffer = (uint8_t*)m_samBuf;
m_Frame->nb_samples = m_handle->frame_size;
avcodec_fill_audio_frame(m_Frame,m_handle->channels,m_handle->sample_fmt,buffer,m_FrameSize,1);
outBytes = avcodec_encode_audio2(m_handle, &m_Packet, m_Frame, &gotPack);
char error[256];
av_strerror(outBytes,error,256);
if (outBytes<0){
m_server->log(1,1,"Input data: %d, encode function call error: %s \n",gotPack, error);
return AUDIOWRAPPER_ERROR;
}
av_frame_free(&m_Frame);
这里是缓冲区的分配方式:
AV_SAMPLE_FMT_S16, ///< signed 16 bits
AV_SAMPLE_FMT_FLT, ///< float
答案 0 :(得分:0)
avcodec_fill_audio_frame应该让你到那里
memset (&m_Packet, 0, sizeof (m_Packet));
memset (&m_Frame, 0, sizeof (m_Frame));
av_init_packet(&m_Packet);
m_Packet.data = dst;
m_Packet.size = sizeBytes;
m_Frame->nb_samples = //you need to get this value from somewhere, it is the number of samples (per channel) this frame represents
avcodec_fill_audio_frame(m_Frame, m_handle->channels, m_handle->sample_fmt,
buffer,
sizeBytes, 1);
int gotPack = 1;
avcodec_encode_audio2(m_handle, &m_Packet, &m_Frame, &gotPack);