Go to the documentation of this file.
30 #define ROQ_FRAME_SIZE 735
31 #define ROQ_HEADER_SIZE 8
33 #define MAX_DPCM (127*127)
73 sizeof(*
context->frame_buffer));
89 diff = current - *previous;
106 predicted = *previous +
diff;
109 if (predicted > 32767 || predicted < -32768) {
117 *previous = predicted;
125 int i, stereo, data_size,
ret;
126 const int16_t *in =
frame ? (
const int16_t *)
frame->data[0] :
NULL;
133 if (!in &&
context->input_frames >= 8)
136 if (in &&
context->input_frames < 8) {
140 if (
context->input_frames == 0)
142 if (
context->input_frames < 7) {
151 context->lastSample[0] &= 0xFF00;
152 context->lastSample[1] &= 0xFF00;
155 if (
context->input_frames == 7)
165 bytestream_put_byte(&
out, stereo ? 0x21 : 0x20);
166 bytestream_put_byte(&
out, 0x10);
167 bytestream_put_le32(&
out, data_size);
170 bytestream_put_byte(&
out, (
context->lastSample[1])>>8);
171 bytestream_put_byte(&
out, (
context->lastSample[0])>>8);
173 bytestream_put_le16(&
out,
context->lastSample[0]);
176 for (
i = 0;
i < data_size;
i++)
191 .
p.
name =
"roq_dpcm",
int frame_size
Number of samples per channel in an audio frame.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int sample_rate
samples per second
This structure describes decoded (raw) audio or video data.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int nb_channels
Number of channels in this layout.
AVCodec p
The public AVCodec.
AVChannelLayout ch_layout
Audio channel layout.
#define FF_CODEC_ENCODE_CB(func)
const FFCodec ff_roq_dpcm_encoder
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int(* init)(AVBSFContext *ctx)
#define CODEC_LONG_NAME(str)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option keep it simple and lowercase description are in without and describe what they for example set the foo of the bar offset is the offset of the field in your context
and forward the result(frame or status change) to the corresponding input. If nothing is possible
int64_t bit_rate
the average bitrate
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
static av_cold int roq_dpcm_encode_init(AVCodecContext *avctx)
static int roq_dpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
static unsigned char dpcm_predict(short *previous, short current)
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
AVSampleFormat
Audio sample formats.
@ AV_SAMPLE_FMT_S16
signed 16 bits
const char * name
Name of the codec implementation.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
main external API structure.
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
Get a buffer for a packet.
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
static av_cold int roq_dpcm_encode_close(AVCodecContext *avctx)
This structure stores compressed data.