使用ffmpeg出现UINT64_C错误

在ubuntu-10.10上用g++编译gnash-0.8.7时遇到下面的问题

/usr/include/libavutil/common.h: In function 'int32_t av_clipl_int32(int64_t)':
/usr/include/libavutil/common.h:154:47: error: 'UINT64_C' was not declared in this scope
 
 
然后我在gnashconfig.h最后加上这句#define __STDC_CONSTANT_MACROS
 
 
这个方法是参考自下面这个帖子:
http://code.google.com/p/ffmpegsource/issues/detail?id=11

转载于:https://www.cnblogs.com/knief/archive/2011/09/09/2172886.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在 C 语言中实现 FFmpeg 的音频重采样,需要使用 FFmpeg 的 libswresample 库。下面是一个简单的音频重采样的示例代码: ```c #include <stdio.h> #include <stdlib.h> #include <libswresample/swresample.h> int main(int argc, char **argv) { // source audio data uint8_t *src_data[2] = { NULL }; src_data[0] = (uint8_t *)malloc(src_nb_samples * src_channels * sizeof(uint8_t)); src_data[1] = NULL; int src_nb_samples = 1024; int src_channels = 2; int src_sample_rate = 44100; int src_bytes_per_sample = 2; // destination audio data uint8_t *dst_data[2] = { NULL }; dst_data[0] = (uint8_t *)malloc(dst_nb_samples * dst_channels * sizeof(uint8_t)); dst_data[1] = NULL; int dst_nb_samples = 1024; int dst_channels = 1; int dst_sample_rate = 48000; int dst_bytes_per_sample = 2; // create resampler context SwrContext *swr_ctx = swr_alloc_set_opts(NULL, av_get_default_channel_layout(dst_channels), AV_SAMPLE_FMT_S16, dst_sample_rate, av_get_default_channel_layout(src_channels), AV_SAMPLE_FMT_S16, src_sample_rate, 0, NULL); swr_init(swr_ctx); // perform audio resampling swr_convert(swr_ctx, dst_data, dst_nb_samples, (const uint8_t **)src_data, src_nb_samples); // cleanup swr_free(&swr_ctx); free(src_data[0]); free(dst_data[0]); return 0; } ``` 上述代码中,我们首先定义了源音频和目标音频的相关参数,包括采样率、声道数、采样位数等。然后我们创建了一个 SwrContext 上下文对象,并设置了源和目标音频的相关参数。接着我们调用 swr_init 函数初始化这个上下文对象,然后使用 swr_convert 函数将原始音频数据重采样为目标音频数据。最后我们释放了上下文对象和内存空间。 需要注意的是,该示例代码仅为了演示音频重采样的基本流程,实际使用时还需要进行参数检查和错误处理等操作。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值