Go to the documentation of this file.
31 #define MAX_YUV4_HEADER 128
32 #define MAX_FRAME_HEADER 80
38 char *tokstart, *tokend, *header_end;
42 rated = 0, aspectn = 0, aspectd = 0;
70 tokstart < header_end; tokstart++) {
71 if (*tokstart == 0x20)
73 switch (*tokstart++) {
75 width = strtol(tokstart, &tokend, 10);
79 height = strtol(tokstart, &tokend, 10);
85 #define MAX_PIX_FMT_LENGTH 8
87 #undef MAX_PIX_FMT_LENGTH
124 chroma_sample_location = pix_fmt_array[
i].chroma_loc;
133 while (tokstart < header_end && *tokstart != 0x20)
138 switch (*tokstart++){
153 "interlaced and non-interlaced frames.\n");
160 sscanf(tokstart,
"%d:%d", &raten, &rated);
161 while (tokstart < header_end && *tokstart != 0x20)
165 sscanf(tokstart,
"%d:%d", &aspectn, &aspectd);
166 while (tokstart < header_end && *tokstart != 0x20)
170 if (strncmp(
"YSCSS=", tokstart, 6) == 0) {
171 static const struct {
172 #define MAX_PIX_FMT_LENGTH 8
174 #undef MAX_PIX_FMT_LENGTH
176 } pix_fmt_array[] = {
202 alt_pix_fmt = pix_fmt_array[
i].pix_fmt;
205 }
else if (strncmp(
"COLORRANGE=", tokstart, 11) == 0) {
207 if (strncmp(
"FULL",tokstart, 4) == 0)
209 else if (strncmp(
"LIMITED", tokstart, 7) == 0)
212 while (tokstart < header_end && *tokstart != 0x20)
230 if (raten <= 0 || rated <= 0) {
236 if (aspectn == 0 && aspectd == 0) {
246 av_reduce(&raten, &rated, raten, rated, (1UL << 31) - 1);
257 if ((
int)
s->packet_size < 0)
258 return s->packet_size;
282 else if (
s->pb->eof_reached)
328 .
p.
name =
"yuv4mpegpipe",
330 .p.extensions =
"y4m",
AVPixelFormat
Pixel format.
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 name
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.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
#define AVERROR_EOF
End of file.
@ AVCOL_RANGE_JPEG
Full range content.
#define Y4M_FRAME_MAGIC_LEN
AVRational avg_frame_rate
Average framerate.
#define AV_PIX_FMT_YUV420P10
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int64_t avio_size(AVIOContext *s)
Get the filesize.
@ AV_FIELD_TT
Top coded_first, top displayed first.
#define AV_PIX_FMT_YUV422P9
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
#define AV_PIX_FMT_GRAY16
int64_t duration
Decoding: duration of the stream, in stream time base.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
#define AV_PIX_FMT_YUV444P10
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
#define AV_PIX_FMT_YUV422P16
static int yuv4_probe(const AVProbeData *pd)
#define AV_PIX_FMT_YUV444P16
static enum AVPixelFormat pix_fmt
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
#define AV_PIX_FMT_YUV420P9
int64_t data_offset
offset of the first packet
#define AV_PIX_FMT_YUV420P16
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define AV_PIX_FMT_GRAY10
AVCodecParameters * codecpar
Codec parameters associated with this stream.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
@ AVCHROMA_LOC_LEFT
MPEG-2/4 4:2:0, H.264 default for 4:2:0.
Rational number (pair of numerator and denominator).
@ AVCHROMA_LOC_TOPLEFT
ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2.
This structure contains the data a format has to probe a file.
#define AV_PIX_FMT_YUV422P10
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AVCOL_RANGE_UNSPECIFIED
static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV444P12
@ AVCHROMA_LOC_UNSPECIFIED
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
static const uint8_t header[24]
int avio_r8(AVIOContext *s)
int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height, int align)
Return the size in bytes of the amount of data required to store an image with the given parameters.
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
AVChromaLocation
Location of chroma samples.
#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...
@ AV_FIELD_BB
Bottom coded first, bottom displayed first.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
enum AVColorRange color_range
Video only.
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
#define AV_PIX_FMT_YUV444P9
enum AVFieldOrder field_order
Video only.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
#define AV_PIX_FMT_YUV420P12
enum AVChromaLocation chroma_location
#define AV_PIX_FMT_YUV422P14
@ AVCHROMA_LOC_CENTER
MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0.
const FFInputFormat ff_yuv4mpegpipe_demuxer
static int yuv4_read_header(AVFormatContext *s)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
static int yuv4_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
#define flags(name, subs,...)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define MAX_PIX_FMT_LENGTH
#define AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_GRAY12
AVColorRange
Visual content value range.
#define AV_PIX_FMT_YUV420P14