FFmpeg
Data Structures | Macros | Functions | Variables
pcm_rechunk.c File Reference
#include "bsf.h"
#include "bsf_internal.h"
#include "libavutil/avassert.h"
#include "libavutil/opt.h"

Go to the source code of this file.

Data Structures

struct  PCMContext
 

Macros

#define OFFSET(x)   offsetof(PCMContext, x)
 
#define FLAGS   (AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_BSF_PARAM)
 

Functions

static int init (AVBSFContext *ctx)
 
static void uninit (AVBSFContext *ctx)
 
static void flush (AVBSFContext *ctx)
 
static int send_packet (PCMContext *s, int nb_samples, AVPacket *pkt)
 
static void drain_packet (AVPacket *pkt, int drain_data, int drain_samples)
 
static int get_next_nb_samples (AVBSFContext *ctx)
 
static void set_silence (AVCodecParameters *par, uint8_t *buf, size_t size)
 
static int rechunk_filter (AVBSFContext *ctx, AVPacket *pkt)
 

Variables

static const AVOption options []
 
static const AVClass pcm_rechunk_class
 
static enum AVCodecID codec_ids []
 
const FFBitStreamFilter ff_pcm_rechunk_bsf
 

Macro Definition Documentation

◆ OFFSET

#define OFFSET (   x)    offsetof(PCMContext, x)

Definition at line 188 of file pcm_rechunk.c.

◆ FLAGS

Definition at line 189 of file pcm_rechunk.c.

Function Documentation

◆ init()

static int init ( AVBSFContext ctx)
static

Definition at line 39 of file pcm_rechunk.c.

◆ uninit()

static void uninit ( AVBSFContext ctx)
static

Definition at line 68 of file pcm_rechunk.c.

Referenced by ff_hwaccel_uninit(), and ff_vdpau_common_reinit().

◆ flush()

static void flush ( AVBSFContext ctx)
static

Definition at line 75 of file pcm_rechunk.c.

◆ send_packet()

static int send_packet ( PCMContext s,
int  nb_samples,
AVPacket pkt 
)
static

Definition at line 83 of file pcm_rechunk.c.

Referenced by rechunk_filter().

◆ drain_packet()

static void drain_packet ( AVPacket pkt,
int  drain_data,
int  drain_samples 
)
static

Definition at line 90 of file pcm_rechunk.c.

Referenced by rechunk_filter().

◆ get_next_nb_samples()

static int get_next_nb_samples ( AVBSFContext ctx)
static

Definition at line 100 of file pcm_rechunk.c.

Referenced by rechunk_filter().

◆ set_silence()

static void set_silence ( AVCodecParameters par,
uint8_t *  buf,
size_t  size 
)
static

Definition at line 111 of file pcm_rechunk.c.

Referenced by rechunk_filter().

◆ rechunk_filter()

static int rechunk_filter ( AVBSFContext ctx,
AVPacket pkt 
)
static

Definition at line 123 of file pcm_rechunk.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "nb_out_samples", "set the number of per-packet output samples", OFFSET(nb_out_samples), AV_OPT_TYPE_INT, {.i64=1024}, 1, INT_MAX, FLAGS },
{ "n", "set the number of per-packet output samples", OFFSET(nb_out_samples), AV_OPT_TYPE_INT, {.i64=1024}, 1, INT_MAX, FLAGS },
{ "pad", "pad last packet with zeros", OFFSET(pad), AV_OPT_TYPE_BOOL, {.i64=1} , 0, 1, FLAGS },
{ "p", "pad last packet with zeros", OFFSET(pad), AV_OPT_TYPE_BOOL, {.i64=1} , 0, 1, FLAGS },
{ "frame_rate", "set number of packets per second", OFFSET(frame_rate), AV_OPT_TYPE_RATIONAL, {.dbl=0}, 0, INT_MAX, FLAGS },
{ "r", "set number of packets per second", OFFSET(frame_rate), AV_OPT_TYPE_RATIONAL, {.dbl=0}, 0, INT_MAX, FLAGS },
{ NULL },
}

Definition at line 190 of file pcm_rechunk.c.

◆ pcm_rechunk_class

const AVClass pcm_rechunk_class
static
Initial value:
= {
.class_name = "pcm_rechunk_bsf",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 200 of file pcm_rechunk.c.

◆ codec_ids

enum AVCodecID codec_ids[]
static

◆ ff_pcm_rechunk_bsf

const FFBitStreamFilter ff_pcm_rechunk_bsf
Initial value:
= {
.p.name = "pcm_rechunk",
.p.codec_ids = codec_ids,
.p.priv_class = &pcm_rechunk_class,
.priv_data_size = sizeof(PCMContext),
.init = init,
.close = uninit,
}

Definition at line 232 of file pcm_rechunk.c.

AV_CODEC_ID_PCM_S16LE
@ AV_CODEC_ID_PCM_S16LE
Definition: codec_id.h:328
AV_CODEC_ID_PCM_F32BE
@ AV_CODEC_ID_PCM_F32BE
Definition: codec_id.h:348
FLAGS
#define FLAGS
Definition: pcm_rechunk.c:189
AV_CODEC_ID_PCM_SGA
@ AV_CODEC_ID_PCM_SGA
Definition: codec_id.h:364
filter
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
Definition: filter_design.txt:228
AV_OPT_TYPE_RATIONAL
@ AV_OPT_TYPE_RATIONAL
Definition: opt.h:240
AV_CODEC_ID_PCM_S64LE
@ AV_CODEC_ID_PCM_S64LE
Definition: codec_id.h:359
init
static int init(AVBSFContext *ctx)
Definition: pcm_rechunk.c:39
AV_CODEC_ID_PCM_S16BE
@ AV_CODEC_ID_PCM_S16BE
Definition: codec_id.h:329
options
static const AVOption options[]
Definition: pcm_rechunk.c:190
AV_CODEC_ID_PCM_S8
@ AV_CODEC_ID_PCM_S8
Definition: codec_id.h:332
pcm_rechunk_class
static const AVClass pcm_rechunk_class
Definition: pcm_rechunk.c:200
AV_CODEC_ID_PCM_F24LE
@ AV_CODEC_ID_PCM_F24LE
Definition: codec_id.h:362
AV_CODEC_ID_PCM_MULAW
@ AV_CODEC_ID_PCM_MULAW
Definition: codec_id.h:334
rechunk_filter
static int rechunk_filter(AVBSFContext *ctx, AVPacket *pkt)
Definition: pcm_rechunk.c:123
AV_CODEC_ID_PCM_ALAW
@ AV_CODEC_ID_PCM_ALAW
Definition: codec_id.h:335
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
AV_CODEC_ID_PCM_S64BE
@ AV_CODEC_ID_PCM_S64BE
Definition: codec_id.h:360
AV_CODEC_ID_PCM_VIDC
@ AV_CODEC_ID_PCM_VIDC
Definition: codec_id.h:363
AV_CODEC_ID_PCM_S24LE
@ AV_CODEC_ID_PCM_S24LE
Definition: codec_id.h:340
PCMContext
Definition: pcm_rechunk.c:26
codec_ids
static enum AVCodecID codec_ids[]
Definition: pcm_rechunk.c:207
uninit
static void uninit(AVBSFContext *ctx)
Definition: pcm_rechunk.c:68
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:50
OFFSET
#define OFFSET(x)
Definition: pcm_rechunk.c:188
AV_CODEC_ID_PCM_F64BE
@ AV_CODEC_ID_PCM_F64BE
Definition: codec_id.h:350
AV_CODEC_ID_PCM_S32BE
@ AV_CODEC_ID_PCM_S32BE
Definition: codec_id.h:337
AV_CODEC_ID_PCM_F16LE
@ AV_CODEC_ID_PCM_F16LE
Definition: codec_id.h:361
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
AV_CODEC_ID_PCM_S32LE
@ AV_CODEC_ID_PCM_S32LE
Definition: codec_id.h:336
AV_CODEC_ID_PCM_U8
@ AV_CODEC_ID_PCM_U8
Definition: codec_id.h:333
flush
static void flush(AVBSFContext *ctx)
Definition: pcm_rechunk.c:75
AV_CODEC_ID_PCM_S24DAUD
@ AV_CODEC_ID_PCM_S24DAUD
Definition: codec_id.h:344
AV_CODEC_ID_PCM_F64LE
@ AV_CODEC_ID_PCM_F64LE
Definition: codec_id.h:351
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:251
AV_CODEC_ID_PCM_F32LE
@ AV_CODEC_ID_PCM_F32LE
Definition: codec_id.h:349
AV_CODEC_ID_PCM_S24BE
@ AV_CODEC_ID_PCM_S24BE
Definition: codec_id.h:341