Go to the documentation of this file.
44 #define MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32-bit audio
61 { 0xff, 0xff, 0xff, 0x50, 0x51, 0x52, 0x53, 0xff, 0xff },
62 { 0x50, 0x51, 0x52, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff },
63 { 0xff, 0xff, 0xff, 0x50, 0x51, 0x52, 0x53, 0xff, 0xff },
64 { 0x50, 0x51, 0x52, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff },
65 { 0xff, 0xff, 0xff, 0x50, 0x51, 0x52, 0x53, 0xff, 0xff },
66 { 0x50, 0x51, 0x52, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff },
67 { 0xff, 0xff, 0xff, 0x50, 0x51, 0x52, 0x53, 0xff, 0xff },
68 { 0x50, 0x51, 0x52, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff },
69 { 0xff, 0xff, 0xff, 0x50, 0x51, 0x52, 0x53, 0xff, 0xff },
70 { 0x50, 0x51, 0x52, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff },
71 { 0xff, 0xff, 0xff, 0x50, 0x51, 0x52, 0x53, 0xff, 0xff },
72 { 0x50, 0x51, 0x52, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff },
100 timecode |= 1<<23 | 1<<15 | 1<<7 | 1<<6;
104 if (
c->ast[
channel]->codecpar->sample_rate == 44100) {
106 }
else if (
c->ast[
channel]->codecpar->sample_rate == 32000)
111 c->sys->audio_min_samples[audio_type]);
116 (seq >=
c->sys->difseg_size/2);
138 c->sys->ltc_divisor * 4);
150 ((
tc.tm_mday / 10) << 4) |
153 ((
tc.tm_mon / 10) << 4) |
155 buf[4] = (((
tc.tm_year % 100) / 10) << 4) |
166 ((
tc.tm_sec / 10) << 4) |
169 ((
tc.tm_min / 10) << 4) |
172 ((
tc.tm_hour / 10) << 4) |
176 buf[1] = buf[2] = buf[3] = buf[4] = 0xff;
183 int i, j, d, of,
size;
185 frame_ptr +=
channel *
c->sys->difseg_size * 150 * 80;
186 for (
i = 0;
i <
c->sys->difseg_size;
i++) {
188 for (j = 0; j < 9; j++) {
190 for (d = 8; d < 80; d+=2) {
191 of =
c->sys->audio_shuffle[
i][j] + (d - 8)/2 *
c->sys->audio_stride;
198 frame_ptr += 16 * 80;
209 for (buf =
frame; buf <
frame +
c->sys->frame_size; buf += 150 * 80, seq++) {
211 for (j = 80; j < 80 * 3; j += 80) {
212 for (k = 6; k < 6 * 8; k += 8)
215 if (((
long)(buf-
frame)/(
c->sys->frame_size/(
c->sys->difseg_size*
c->sys->n_difchan))%
c->sys->difseg_size) > 5) {
224 for (j = 80*3 + 3; j < 80*6; j += 80) {
243 *
frame = &
c->frame_buf[0];
249 av_log(
s,
AV_LOG_ERROR,
"Can't process DV frame #%d. Insufficient audio data or severe sync problem.\n",
c->frames);
250 if (data_size !=
c->sys->frame_size) {
252 data_size,
c->sys->frame_size);
260 for (
i = 0;
i <
c->n_ast && st !=
c->ast[
i];
i++);
264 av_log(
s,
AV_LOG_ERROR,
"Can't process DV frame #%d. Insufficient video data or severe sync problem.\n",
c->frames);
278 if (
c->has_video == 1 &&
c->has_audio + 1 == 1 <<
c->n_ast) {
281 for (
i=0;
i <
c->n_ast;
i++) {
292 return c->sys->frame_size;
305 if (
s->nb_streams > 5)
309 for (
i=0;
i<
s->nb_streams;
i++) {
310 switch (
s->streams[
i]->codecpar->codec_type) {
312 if (vst)
return NULL;
316 if (
c->n_ast > 1)
return NULL;
317 c->ast[
c->n_ast++] =
s->streams[
i];
327 for (
i=0;
i<
c->n_ast;
i++) {
330 c->ast[
i]->codecpar->channels != 2)
332 if (
c->ast[
i]->codecpar->sample_rate != 48000 &&
333 c->ast[
i]->codecpar->sample_rate != 44100 &&
334 c->ast[
i]->codecpar->sample_rate != 32000 )
343 if ((
c->sys->time_base.den != 25 &&
c->sys->time_base.den != 50) ||
c->sys->time_base.num != 1) {
344 if (
c->ast[0] &&
c->ast[0]->codecpar->sample_rate != 48000)
346 if (
c->ast[1] &&
c->ast[1]->codecpar->sample_rate != 48000)
350 if (((
c->n_ast > 1) && (
c->sys->n_difchan < 2)) ||
351 ((
c->n_ast > 2) && (
c->sys->n_difchan < 4))) {
362 for (
i=0;
i <
c->n_ast;
i++) {
382 "Make sure that you supply exactly two streams:\n"
383 " video: 25fps or 29.97fps, audio: 2ch/48|44|32kHz/PCM\n"
384 " (50Mbps allows an optional second audio stream)\n");
391 for (
i = 0;
i <
s->nb_streams;
i++) {
425 for (
int i = 0;
i <
c->n_ast;
i++)
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
enum AVMediaType codec_type
General type of the encoded data.
int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int(*func)(void *, void *, int))
Feed data from a user-supplied callback to an AVFifoBuffer.
void av_fifo_drain(AVFifoBuffer *f, int size)
Discard data from the FIFO.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_timecode_init(AVTimecode *tc, AVRational rate, int flags, int frame_start, void *log_ctx)
Init a timecode struct with the passed parameters.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static int64_t fsize(FILE *f)
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Describe the class of an AVClass context structure.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Rational number (pair of numerator and denominator).
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
int sample_rate
Audio only.
struct tm * ff_brktimegm(time_t secs, struct tm *tm)
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd)
Rescale a 64-bit integer with specified rounding.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define DV_MAX_FRAME_SIZE
largest possible DV frame, in bytes (1080i50)
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
static uint8_t * av_fifo_peek2(const AVFifoBuffer *f, int offs)
Return a pointer to the data stored in a FIFO buffer at a certain offset.
AVFifoBuffer * audio_data[4]
#define DV_PROFILE_IS_HD(p)
int audio_samples_dist[5]
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum)
Convert frame number to SMPTE 12M binary representation.
#define i(width, name, range_min, range_max)
AVFifoBuffer * av_fifo_alloc_array(size_t nmemb, size_t size)
Initialize an AVFifoBuffer.
@ AV_ROUND_DOWN
Round toward -infinity.
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
uint8_t frame_buf[DV_MAX_FRAME_SIZE]
int av_fifo_size(const AVFifoBuffer *f)
Return the amount of data in bytes in the AVFifoBuffer, that is the amount of data you can read from ...
void av_fifo_freep(AVFifoBuffer **f)
Free an AVFifoBuffer and reset pointer to NULL.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
const AVDVProfile * av_dv_codec_profile2(int width, int height, enum AVPixelFormat pix_fmt, AVRational frame_rate)
Get a DV profile for the provided stream parameters.
int av_timecode_init_from_string(AVTimecode *tc, AVRational rate, const char *str, void *log_ctx)
Parse timecode representation (hh:mm:ss[:;.
static void write_header(FFV1Context *f)