33int main(
int argc,
char **argv)
37 int sample_rate = 44100;
42 fprintf(stderr,
"Usage: %s <codec_name> [sample_rate] [channels]\n",
48 sample_rate = atoi(argv[2]);
54 fprintf(stderr,
"Encoder '%s' not found\n", argv[1]);
62 ctx->sample_rate = sample_rate;
66 fprintf(stderr,
"avcodec_get_supported_config failed: %d\n", ret);
75 fprintf(stderr,
"avcodec_open2 failed: %d\n", ret);
80 printf(
"%s bit_rate=%"PRId64
" block_align=%d bits_per_coded_sample=%d frame_size=%d\n",
82 ctx->bits_per_coded_sample,
ctx->frame_size);
static enum AVSampleFormat sample_fmts[]
Libavcodec external API header.
Public libavutil channel layout APIs header.
__device__ int printf(const char *,...)
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
const AVCodec * avcodec_find_encoder_by_name(const char *name)
Find a registered encoder with the specified name.
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
int avcodec_get_supported_config(const AVCodecContext *avctx, const AVCodec *codec, enum AVCodecConfig config, unsigned flags, const void **out, int *out_num)
Retrieve a list of all supported values for a given configuration type.
@ AV_CODEC_CONFIG_SAMPLE_FORMAT
AVSampleFormat, terminated by AV_SAMPLE_FMT_NONE.
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
AVSampleFormat
Audio sample formats.
@ AV_SAMPLE_FMT_S16
signed 16 bits
main external API structure.
const char * name
Name of the codec implementation.
static AVFormatContext * ctx