FFmpeg
Macros | Functions | Variables
img2dec.c File Reference
#include "config_components.h"
#include <sys/stat.h>
#include "libavutil/avstring.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/parseutils.h"
#include "libavutil/intreadwrite.h"
#include "libavcodec/gif.h"
#include "avformat.h"
#include "avio_internal.h"
#include "internal.h"
#include "img2.h"
#include "jpegxl_probe.h"
#include "libavcodec/mjpeg.h"
#include "libavcodec/vbn.h"
#include "libavcodec/xwd.h"
#include "subtitles.h"

Go to the source code of this file.

Macros

#define _DEFAULT_SOURCE
 
#define _BSD_SOURCE
 
#define OFFSET(x)   offsetof(VideoDemuxData, x)
 
#define DEC   AV_OPT_FLAG_DECODING_PARAM
 
#define COMMON_OPTIONS
 
#define IMAGEAUTO_DEMUXER_0(imgname, codecid)
 
#define IMAGEAUTO_DEMUXER_1(imgname, codecid)
 
#define IMAGEAUTO_DEMUXER_2(imgname, codecid, enabled)   IMAGEAUTO_DEMUXER_ ## enabled(imgname, codecid)
 
#define IMAGEAUTO_DEMUXER_3(imgname, codecid, config)   IMAGEAUTO_DEMUXER_2(imgname, codecid, config)
 
#define IMAGEAUTO_DEMUXER_EXT(imgname, codecid, uppercase_name)
 
#define IMAGEAUTO_DEMUXER(imgname, codecid)   IMAGEAUTO_DEMUXER_EXT(imgname, codecid, codecid)
 

Functions

static int infer_size (int *width_ptr, int *height_ptr, int size)
 
static int is_glob (const char *path)
 
static int find_image_range (AVIOContext *pb, int *pfirst_index, int *plast_index, const char *path, int start_index, int start_index_range)
 Get index range of image files matched by path. More...
 
static int img_read_probe (const AVProbeData *p)
 
int ff_img_read_header (AVFormatContext *s1)
 
static int add_filename_as_pkt_side_data (char *filename, AVPacket *pkt)
 Add this frame's source path and basename to packet's sidedata as a dictionary, so it can be used by filters like 'drawtext'. More...
 
int ff_img_read_packet (AVFormatContext *s1, AVPacket *pkt)
 
static int img_read_close (struct AVFormatContext *s1)
 
static int img_read_seek (AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
 
static int bmp_probe (const AVProbeData *p)
 
static int cri_probe (const AVProbeData *p)
 
static int dds_probe (const AVProbeData *p)
 
static int dpx_probe (const AVProbeData *p)
 
static int exr_probe (const AVProbeData *p)
 
static int j2k_probe (const AVProbeData *p)
 
static int jpeg_probe (const AVProbeData *p)
 
static int jpegls_probe (const AVProbeData *p)
 
static int jpegxl_probe (const AVProbeData *p)
 
static int pcx_probe (const AVProbeData *p)
 
static int qdraw_probe (const AVProbeData *p)
 
static int pictor_probe (const AVProbeData *p)
 
static int png_probe (const AVProbeData *p)
 
static int psd_probe (const AVProbeData *p)
 
static int sgi_probe (const AVProbeData *p)
 
static int sunrast_probe (const AVProbeData *p)
 
static int svg_probe (const AVProbeData *p)
 
static int tiff_probe (const AVProbeData *p)
 
static int webp_probe (const AVProbeData *p)
 
static int pnm_magic_check (const AVProbeData *p, int magic)
 
static int pnm_probe (const AVProbeData *p)
 
static int pbm_probe (const AVProbeData *p)
 
static int pfm_probe (const AVProbeData *p)
 
static int phm_probe (const AVProbeData *p)
 
static int pgmx_probe (const AVProbeData *p)
 
static int pgm_probe (const AVProbeData *p)
 
static int pgmyuv_probe (const AVProbeData *p)
 
static int pgx_probe (const AVProbeData *p)
 
static int ppm_probe (const AVProbeData *p)
 
static int pam_probe (const AVProbeData *p)
 
static int xbm_probe (const AVProbeData *p)
 
static int xpm_probe (const AVProbeData *p)
 
static int xwd_probe (const AVProbeData *p)
 
static int gif_probe (const AVProbeData *p)
 
static int photocd_probe (const AVProbeData *p)
 
static int qoi_probe (const AVProbeData *p)
 
static int gem_probe (const AVProbeData *p)
 
static int vbn_probe (const AVProbeData *p)
 

Variables

static const int sizes [][2]
 
static const AVOption img2pipe_options []
 
static const AVClass imagepipe_class
 

Macro Definition Documentation

◆ _DEFAULT_SOURCE

#define _DEFAULT_SOURCE

Definition at line 25 of file img2dec.c.

◆ _BSD_SOURCE

#define _BSD_SOURCE

Definition at line 26 of file img2dec.c.

◆ OFFSET

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

Definition at line 608 of file img2dec.c.

◆ DEC

#define DEC   AV_OPT_FLAG_DECODING_PARAM

Definition at line 609 of file img2dec.c.

◆ COMMON_OPTIONS

#define COMMON_OPTIONS
Value:
{ "framerate", "set the video framerate", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, DEC }, \
{ "pixel_format", "set video pixel format", OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, \
{ "video_size", "set video size", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, DEC }, \
{ "loop", "force loop over input file sequence", OFFSET(loop), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, DEC }, \
{ NULL },

Definition at line 610 of file img2dec.c.

◆ IMAGEAUTO_DEMUXER_0

#define IMAGEAUTO_DEMUXER_0 (   imgname,
  codecid 
)

Definition at line 1193 of file img2dec.c.

◆ IMAGEAUTO_DEMUXER_1

#define IMAGEAUTO_DEMUXER_1 (   imgname,
  codecid 
)
Value:
const AVInputFormat ff_image_ ## imgname ## _pipe_demuxer = {\
.name = AV_STRINGIFY(imgname) "_pipe",\
.long_name = NULL_IF_CONFIG_SMALL("piped " AV_STRINGIFY(imgname) " sequence"),\
.priv_data_size = sizeof(VideoDemuxData),\
.read_probe = imgname ## _probe,\
.priv_class = &imagepipe_class,\
.raw_codec_id = codecid,\
};

Definition at line 1194 of file img2dec.c.

◆ IMAGEAUTO_DEMUXER_2

#define IMAGEAUTO_DEMUXER_2 (   imgname,
  codecid,
  enabled 
)    IMAGEAUTO_DEMUXER_ ## enabled(imgname, codecid)

Definition at line 1207 of file img2dec.c.

◆ IMAGEAUTO_DEMUXER_3

#define IMAGEAUTO_DEMUXER_3 (   imgname,
  codecid,
  config 
)    IMAGEAUTO_DEMUXER_2(imgname, codecid, config)

Definition at line 1209 of file img2dec.c.

◆ IMAGEAUTO_DEMUXER_EXT

#define IMAGEAUTO_DEMUXER_EXT (   imgname,
  codecid,
  uppercase_name 
)
Value:
IMAGEAUTO_DEMUXER_3(imgname, AV_CODEC_ID_ ## codecid, \
CONFIG_IMAGE_ ## uppercase_name ## _PIPE_DEMUXER)

Definition at line 1211 of file img2dec.c.

◆ IMAGEAUTO_DEMUXER

#define IMAGEAUTO_DEMUXER (   imgname,
  codecid 
)    IMAGEAUTO_DEMUXER_EXT(imgname, codecid, codecid)

Definition at line 1214 of file img2dec.c.

Function Documentation

◆ infer_size()

static int infer_size ( int width_ptr,
int height_ptr,
int  size 
)
static

Definition at line 69 of file img2dec.c.

Referenced by ff_img_read_packet().

◆ is_glob()

static int is_glob ( const char *  path)
static

Definition at line 84 of file img2dec.c.

Referenced by ff_img_read_header(), and img_read_probe().

◆ find_image_range()

static int find_image_range ( AVIOContext pb,
int pfirst_index,
int plast_index,
const char *  path,
int  start_index,
int  start_index_range 
)
static

Get index range of image files matched by path.

Parameters
pfirst_indexpointer to index updated with the first number in the range
plast_indexpointer to index updated with the last number in the range
pathpath which has to be matched by the image files in the range
start_indexminimum accepted value for the first index in the range
Returns
-1 if no image file could be found

Definition at line 114 of file img2dec.c.

Referenced by ff_img_read_header().

◆ img_read_probe()

static int img_read_probe ( const AVProbeData p)
static

Definition at line 167 of file img2dec.c.

◆ ff_img_read_header()

int ff_img_read_header ( AVFormatContext s1)

Definition at line 186 of file img2dec.c.

◆ add_filename_as_pkt_side_data()

static int add_filename_as_pkt_side_data ( char *  filename,
AVPacket pkt 
)
static

Add this frame's source path and basename to packet's sidedata as a dictionary, so it can be used by filters like 'drawtext'.

Definition at line 387 of file img2dec.c.

Referenced by ff_img_read_packet().

◆ ff_img_read_packet()

int ff_img_read_packet ( AVFormatContext s1,
AVPacket pkt 
)

Definition at line 409 of file img2dec.c.

◆ img_read_close()

static int img_read_close ( struct AVFormatContext s1)
static

Definition at line 577 of file img2dec.c.

◆ img_read_seek()

static int img_read_seek ( AVFormatContext s,
int  stream_index,
int64_t  timestamp,
int  flags 
)
static

Definition at line 588 of file img2dec.c.

◆ bmp_probe()

static int bmp_probe ( const AVProbeData p)
static

Definition at line 676 of file img2dec.c.

◆ cri_probe()

static int cri_probe ( const AVProbeData p)
static

Definition at line 694 of file img2dec.c.

◆ dds_probe()

static int dds_probe ( const AVProbeData p)
static

Definition at line 705 of file img2dec.c.

◆ dpx_probe()

static int dpx_probe ( const AVProbeData p)
static

Definition at line 716 of file img2dec.c.

◆ exr_probe()

static int exr_probe ( const AVProbeData p)
static

Definition at line 734 of file img2dec.c.

◆ j2k_probe()

static int j2k_probe ( const AVProbeData p)
static

Definition at line 743 of file img2dec.c.

◆ jpeg_probe()

static int jpeg_probe ( const AVProbeData p)
static

Definition at line 753 of file img2dec.c.

◆ jpegls_probe()

static int jpegls_probe ( const AVProbeData p)
static

Definition at line 832 of file img2dec.c.

◆ jpegxl_probe()

static int jpegxl_probe ( const AVProbeData p)
static

Definition at line 841 of file img2dec.c.

◆ pcx_probe()

static int pcx_probe ( const AVProbeData p)
static

Definition at line 859 of file img2dec.c.

◆ qdraw_probe()

static int qdraw_probe ( const AVProbeData p)
static

Definition at line 880 of file img2dec.c.

◆ pictor_probe()

static int pictor_probe ( const AVProbeData p)
static

Definition at line 896 of file img2dec.c.

◆ png_probe()

static int png_probe ( const AVProbeData p)
static

Definition at line 905 of file img2dec.c.

◆ psd_probe()

static int psd_probe ( const AVProbeData p)
static

Definition at line 914 of file img2dec.c.

◆ sgi_probe()

static int sgi_probe ( const AVProbeData p)
static

Definition at line 942 of file img2dec.c.

◆ sunrast_probe()

static int sunrast_probe ( const AVProbeData p)
static

Definition at line 954 of file img2dec.c.

◆ svg_probe()

static int svg_probe ( const AVProbeData p)
static

Definition at line 963 of file img2dec.c.

◆ tiff_probe()

static int tiff_probe ( const AVProbeData p)
static

Definition at line 983 of file img2dec.c.

◆ webp_probe()

static int webp_probe ( const AVProbeData p)
static

Definition at line 993 of file img2dec.c.

◆ pnm_magic_check()

static int pnm_magic_check ( const AVProbeData p,
int  magic 
)
static

Definition at line 1003 of file img2dec.c.

Referenced by pam_probe(), pbm_probe(), pfm_probe(), pgmx_probe(), phm_probe(), and ppm_probe().

◆ pnm_probe()

static int pnm_probe ( const AVProbeData p)
inlinestatic

Definition at line 1010 of file img2dec.c.

Referenced by pam_probe(), pbm_probe(), pfm_probe(), pgmx_probe(), phm_probe(), and ppm_probe().

◆ pbm_probe()

static int pbm_probe ( const AVProbeData p)
static

Definition at line 1021 of file img2dec.c.

◆ pfm_probe()

static int pfm_probe ( const AVProbeData p)
static

Definition at line 1026 of file img2dec.c.

◆ phm_probe()

static int phm_probe ( const AVProbeData p)
static

Definition at line 1032 of file img2dec.c.

◆ pgmx_probe()

static int pgmx_probe ( const AVProbeData p)
inlinestatic

Definition at line 1038 of file img2dec.c.

Referenced by pgm_probe(), and pgmyuv_probe().

◆ pgm_probe()

static int pgm_probe ( const AVProbeData p)
static

Definition at line 1043 of file img2dec.c.

◆ pgmyuv_probe()

static int pgmyuv_probe ( const AVProbeData p)
static

Definition at line 1049 of file img2dec.c.

◆ pgx_probe()

static int pgx_probe ( const AVProbeData p)
static

Definition at line 1055 of file img2dec.c.

◆ ppm_probe()

static int ppm_probe ( const AVProbeData p)
static

Definition at line 1063 of file img2dec.c.

◆ pam_probe()

static int pam_probe ( const AVProbeData p)
static

Definition at line 1068 of file img2dec.c.

◆ xbm_probe()

static int xbm_probe ( const AVProbeData p)
static

Definition at line 1073 of file img2dec.c.

◆ xpm_probe()

static int xpm_probe ( const AVProbeData p)
static

Definition at line 1083 of file img2dec.c.

◆ xwd_probe()

static int xwd_probe ( const AVProbeData p)
static

Definition at line 1092 of file img2dec.c.

◆ gif_probe()

static int gif_probe ( const AVProbeData p)
static

Definition at line 1122 of file img2dec.c.

◆ photocd_probe()

static int photocd_probe ( const AVProbeData p)
static

Definition at line 1135 of file img2dec.c.

◆ qoi_probe()

static int qoi_probe ( const AVProbeData p)
static

Definition at line 1146 of file img2dec.c.

◆ gem_probe()

static int gem_probe ( const AVProbeData p)
static

Definition at line 1163 of file img2dec.c.

◆ vbn_probe()

static int vbn_probe ( const AVProbeData p)
static

Definition at line 1183 of file img2dec.c.

Variable Documentation

◆ sizes

const int sizes[][2]
static
Initial value:
= {
{ 640, 480 },
{ 720, 480 },
{ 720, 576 },
{ 352, 288 },
{ 352, 240 },
{ 160, 128 },
{ 512, 384 },
{ 640, 352 },
{ 640, 240 },
}

Definition at line 57 of file img2dec.c.

Referenced by aac_encode_init(), av_image_alloc(), av_image_fill_plane_sizes(), av_image_fill_pointers(), av_image_get_buffer_size(), dequant_lsps(), encode_frame(), encode_slice(), ff_frame_pool_video_init(), get_video_buffer(), infer_size(), main(), ra144_decode_frame(), ra144_encode_frame(), read_in_data(), setup_partitions(), sga_decode_frame(), and svq1_static_init().

◆ img2pipe_options

const AVOption img2pipe_options[]
static
Initial value:
= {
{ "frame_size", "force frame size in bytes", OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, DEC },
}

Definition at line 654 of file img2dec.c.

◆ imagepipe_class

const AVClass imagepipe_class
static
Initial value:
= {
.class_name = "imagepipe demuxer",
.item_name = av_default_item_name,
.option = img2pipe_options,
}

Definition at line 658 of file img2dec.c.

AV_OPT_TYPE_VIDEO_RATE
@ AV_OPT_TYPE_VIDEO_RATE
offset must point to AVRational
Definition: opt.h:238
OFFSET
#define OFFSET(x)
Definition: img2dec.c:608
ff_img_read_header
int ff_img_read_header(AVFormatContext *s1)
Definition: img2dec.c:186
imagepipe_class
static const AVClass imagepipe_class
Definition: img2dec.c:658
framerate
int framerate
Definition: h264_levels.c:65
AVFMT_GENERIC_INDEX
#define AVFMT_GENERIC_INDEX
Use generic index building code.
Definition: avformat.h:482
img2pipe_options
static const AVOption img2pipe_options[]
Definition: img2dec.c:654
loop
static int loop
Definition: ffplay.c:340
AVInputFormat
Definition: avformat.h:656
width
#define width
AVInputFormat::name
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:661
frame_size
int frame_size
Definition: mxfenc.c:2201
IMAGEAUTO_DEMUXER_3
#define IMAGEAUTO_DEMUXER_3(imgname, codecid, config)
Definition: img2dec.c:1209
VideoDemuxData
Definition: img2.h:41
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:532
NULL
#define NULL
Definition: coverity.c:32
read_probe
static int read_probe(const AVProbeData *pd)
Definition: jvdec.c:55
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
Definition: opt.h:235
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
DEC
#define DEC
Definition: img2dec.c:609
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
AV_STRINGIFY
#define AV_STRINGIFY(s)
Definition: macros.h:66
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_reading.c:42
COMMON_OPTIONS
#define COMMON_OPTIONS
Definition: img2dec.c:610
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
ff_img_read_packet
int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
Definition: img2dec.c:409
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:244
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229