FFmpeg
Data Structures | Macros | Functions | Variables
pcm_rechunk_bsf.c File Reference
#include "avcodec.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 int rechunk_filter (AVBSFContext *ctx, AVPacket *pkt)
 

Variables

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

Macro Definition Documentation

◆ OFFSET

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

Definition at line 173 of file pcm_rechunk_bsf.c.

◆ FLAGS

Definition at line 174 of file pcm_rechunk_bsf.c.

Function Documentation

◆ init()

static int init ( AVBSFContext ctx)
static

Definition at line 39 of file pcm_rechunk_bsf.c.

◆ uninit()

static void uninit ( AVBSFContext ctx)
static

Definition at line 67 of file pcm_rechunk_bsf.c.

◆ flush()

static void flush ( AVBSFContext ctx)
static

Definition at line 74 of file pcm_rechunk_bsf.c.

◆ send_packet()

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

Definition at line 82 of file pcm_rechunk_bsf.c.

Referenced by rechunk_filter().

◆ drain_packet()

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

Definition at line 89 of file pcm_rechunk_bsf.c.

Referenced by rechunk_filter().

◆ get_next_nb_samples()

static int get_next_nb_samples ( AVBSFContext ctx)
static

Definition at line 99 of file pcm_rechunk_bsf.c.

Referenced by rechunk_filter().

◆ rechunk_filter()

static int rechunk_filter ( AVBSFContext ctx,
AVPacket pkt 
)
static

Definition at line 110 of file pcm_rechunk_bsf.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 175 of file pcm_rechunk_bsf.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 185 of file pcm_rechunk_bsf.c.

◆ codec_ids

enum AVCodecID codec_ids[]
static

◆ ff_pcm_rechunk_bsf

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

Definition at line 211 of file pcm_rechunk_bsf.c.

AV_CODEC_ID_PCM_S16LE
@ AV_CODEC_ID_PCM_S16LE
Definition: codec_id.h:312
AV_CODEC_ID_PCM_F32BE
@ AV_CODEC_ID_PCM_F32BE
Definition: codec_id.h:332
uninit
static void uninit(AVBSFContext *ctx)
Definition: pcm_rechunk_bsf.c:67
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:230
AV_CODEC_ID_PCM_S64LE
@ AV_CODEC_ID_PCM_S64LE
Definition: codec_id.h:343
FLAGS
#define FLAGS
Definition: pcm_rechunk_bsf.c:174
AV_CODEC_ID_PCM_S16BE
@ AV_CODEC_ID_PCM_S16BE
Definition: codec_id.h:313
rechunk_filter
static int rechunk_filter(AVBSFContext *ctx, AVPacket *pkt)
Definition: pcm_rechunk_bsf.c:110
OFFSET
#define OFFSET(x)
Definition: pcm_rechunk_bsf.c:173
flush
static void flush(AVBSFContext *ctx)
Definition: pcm_rechunk_bsf.c:74
AV_CODEC_ID_PCM_S8
@ AV_CODEC_ID_PCM_S8
Definition: codec_id.h:316
AV_CODEC_ID_PCM_F24LE
@ AV_CODEC_ID_PCM_F24LE
Definition: codec_id.h:346
init
static int init(AVBSFContext *ctx)
Definition: pcm_rechunk_bsf.c:39
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:235
AV_CODEC_ID_PCM_S64BE
@ AV_CODEC_ID_PCM_S64BE
Definition: codec_id.h:344
AV_CODEC_ID_PCM_S24LE
@ AV_CODEC_ID_PCM_S24LE
Definition: codec_id.h:324
PCMContext
Definition: pcm_rechunk_bsf.c:26
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:47
pcm_rechunk_class
static const AVClass pcm_rechunk_class
Definition: pcm_rechunk_bsf.c:185
AV_CODEC_ID_PCM_F64BE
@ AV_CODEC_ID_PCM_F64BE
Definition: codec_id.h:334
AV_CODEC_ID_PCM_S32BE
@ AV_CODEC_ID_PCM_S32BE
Definition: codec_id.h:321
AV_CODEC_ID_PCM_F16LE
@ AV_CODEC_ID_PCM_F16LE
Definition: codec_id.h:345
codec_ids
static enum AVCodecID codec_ids[]
Definition: pcm_rechunk_bsf.c:192
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AV_CODEC_ID_PCM_S32LE
@ AV_CODEC_ID_PCM_S32LE
Definition: codec_id.h:320
options
static const AVOption options[]
Definition: pcm_rechunk_bsf.c:175
AV_CODEC_ID_PCM_F64LE
@ AV_CODEC_ID_PCM_F64LE
Definition: codec_id.h:335
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:242
AV_CODEC_ID_PCM_F32LE
@ AV_CODEC_ID_PCM_F32LE
Definition: codec_id.h:333
AV_CODEC_ID_PCM_S24BE
@ AV_CODEC_ID_PCM_S24BE
Definition: codec_id.h:325