FFmpeg  4.0
Macros | Functions | Variables
img2dec.c File Reference
#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 "avformat.h"
#include "avio_internal.h"
#include "internal.h"
#include "img2.h"
#include "libavcodec/mjpeg.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 IMAGEAUTO_DEMUXER(imgname, 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 (AVProbeData *p)
 
int ff_img_read_header (AVFormatContext *s1)
 
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 (AVProbeData *p)
 
static int dds_probe (AVProbeData *p)
 
static int dpx_probe (AVProbeData *p)
 
static int exr_probe (AVProbeData *p)
 
static int j2k_probe (AVProbeData *p)
 
static int jpeg_probe (AVProbeData *p)
 
static int jpegls_probe (AVProbeData *p)
 
static int pcx_probe (AVProbeData *p)
 
static int qdraw_probe (AVProbeData *p)
 
static int pictor_probe (AVProbeData *p)
 
static int png_probe (AVProbeData *p)
 
static int psd_probe (AVProbeData *p)
 
static int sgi_probe (AVProbeData *p)
 
static int sunrast_probe (AVProbeData *p)
 
static int svg_probe (AVProbeData *p)
 
static int tiff_probe (AVProbeData *p)
 
static int webp_probe (AVProbeData *p)
 
static int pnm_magic_check (const AVProbeData *p, int magic)
 
static int pnm_probe (const AVProbeData *p)
 
static int pbm_probe (AVProbeData *p)
 
static int pgmx_probe (AVProbeData *p)
 
static int pgm_probe (AVProbeData *p)
 
static int pgmyuv_probe (AVProbeData *p)
 
static int ppm_probe (AVProbeData *p)
 
static int pam_probe (AVProbeData *p)
 
static int xpm_probe (AVProbeData *p)
 

Variables

static const int sizes [][2]
 
const AVOption ff_img_options []
 

Macro Definition Documentation

◆ _DEFAULT_SOURCE

#define _DEFAULT_SOURCE

Definition at line 23 of file img2dec.c.

◆ _BSD_SOURCE

#define _BSD_SOURCE

Definition at line 24 of file img2dec.c.

◆ OFFSET

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

Definition at line 563 of file img2dec.c.

◆ DEC

#define DEC   AV_OPT_FLAG_DECODING_PARAM

Definition at line 564 of file img2dec.c.

◆ IMAGEAUTO_DEMUXER

#define IMAGEAUTO_DEMUXER (   imgname,
  codecid 
)
Value:
static const AVClass imgname ## _class = {\
.class_name = AV_STRINGIFY(imgname) " demuxer",\
.item_name = av_default_item_name,\
.option = ff_img_options,\
.version = LIBAVUTIL_VERSION_INT,\
};\
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 = & imgname ## _class,\
.raw_codec_id = codecid,\
};
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:191
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:72
int ff_img_read_header(AVFormatContext *s1)
Definition: img2dec.c:180
static int flags
Definition: log.c:55
const AVOption ff_img_options[]
Definition: img2dec.c:565
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
static int read_probe(AVProbeData *pd)
Definition: jvdec.c:55
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:530
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_reading.c:42
#define AV_STRINGIFY(s)
Definition: macros.h:36
Describe the class of an AVClass context structure.
Definition: log.h:67
#define AVFMT_GENERIC_INDEX
Use generic index building code.
Definition: avformat.h:470
int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
Definition: img2dec.c:374

Definition at line 977 of file img2dec.c.

Function Documentation

◆ infer_size()

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

Definition at line 63 of file img2dec.c.

Referenced by ff_img_read_packet().

◆ is_glob()

static int is_glob ( const char *  path)
static

Definition at line 78 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 108 of file img2dec.c.

Referenced by ff_img_read_header().

◆ img_read_probe()

static int img_read_probe ( AVProbeData p)
static

Definition at line 161 of file img2dec.c.

◆ ff_img_read_header()

int ff_img_read_header ( AVFormatContext s1)

Definition at line 180 of file img2dec.c.

◆ ff_img_read_packet()

int ff_img_read_packet ( AVFormatContext s1,
AVPacket pkt 
)

Definition at line 374 of file img2dec.c.

◆ img_read_close()

static int img_read_close ( struct AVFormatContext s1)
static

Definition at line 532 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 543 of file img2dec.c.

◆ bmp_probe()

static int bmp_probe ( AVProbeData p)
static

Definition at line 624 of file img2dec.c.

◆ dds_probe()

static int dds_probe ( AVProbeData p)
static

Definition at line 642 of file img2dec.c.

◆ dpx_probe()

static int dpx_probe ( AVProbeData p)
static

Definition at line 653 of file img2dec.c.

◆ exr_probe()

static int exr_probe ( AVProbeData p)
static

Definition at line 671 of file img2dec.c.

◆ j2k_probe()

static int j2k_probe ( AVProbeData p)
static

Definition at line 680 of file img2dec.c.

◆ jpeg_probe()

static int jpeg_probe ( AVProbeData p)
static

Definition at line 690 of file img2dec.c.

◆ jpegls_probe()

static int jpegls_probe ( AVProbeData p)
static

Definition at line 765 of file img2dec.c.

◆ pcx_probe()

static int pcx_probe ( AVProbeData p)
static

Definition at line 774 of file img2dec.c.

◆ qdraw_probe()

static int qdraw_probe ( AVProbeData p)
static

Definition at line 795 of file img2dec.c.

◆ pictor_probe()

static int pictor_probe ( AVProbeData p)
static

Definition at line 811 of file img2dec.c.

◆ png_probe()

static int png_probe ( AVProbeData p)
static

Definition at line 820 of file img2dec.c.

◆ psd_probe()

static int psd_probe ( AVProbeData p)
static

Definition at line 829 of file img2dec.c.

◆ sgi_probe()

static int sgi_probe ( AVProbeData p)
static

Definition at line 857 of file img2dec.c.

◆ sunrast_probe()

static int sunrast_probe ( AVProbeData p)
static

Definition at line 869 of file img2dec.c.

◆ svg_probe()

static int svg_probe ( AVProbeData p)
static

Definition at line 878 of file img2dec.c.

◆ tiff_probe()

static int tiff_probe ( AVProbeData p)
static

Definition at line 898 of file img2dec.c.

◆ webp_probe()

static int webp_probe ( AVProbeData p)
static

Definition at line 908 of file img2dec.c.

◆ pnm_magic_check()

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

Definition at line 918 of file img2dec.c.

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

◆ pnm_probe()

static int pnm_probe ( const AVProbeData p)
inlinestatic

Definition at line 925 of file img2dec.c.

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

◆ pbm_probe()

static int pbm_probe ( AVProbeData p)
static

Definition at line 936 of file img2dec.c.

◆ pgmx_probe()

static int pgmx_probe ( AVProbeData p)
inlinestatic

Definition at line 941 of file img2dec.c.

Referenced by pgm_probe(), and pgmyuv_probe().

◆ pgm_probe()

static int pgm_probe ( AVProbeData p)
static

Definition at line 946 of file img2dec.c.

◆ pgmyuv_probe()

static int pgmyuv_probe ( AVProbeData p)
static

Definition at line 952 of file img2dec.c.

◆ ppm_probe()

static int ppm_probe ( AVProbeData p)
static

Definition at line 958 of file img2dec.c.

◆ pam_probe()

static int pam_probe ( AVProbeData p)
static

Definition at line 963 of file img2dec.c.

◆ xpm_probe()

static int xpm_probe ( AVProbeData p)
static

Definition at line 968 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 51 of file img2dec.c.

Referenced by aac_encode_init(), encode_frame(), infer_size(), ra144_decode_frame(), ra144_encode_frame(), setup_partitions(), svq1_decode_init(), and x8_vlc_init().

◆ ff_img_options

const AVOption ff_img_options[]
Initial value:
= {
{ "framerate", "set the video framerate", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, DEC },
{ "loop", "force loop over input file sequence", OFFSET(loop), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, DEC },
{ "pattern_type", "set pattern type", OFFSET(pattern_type), AV_OPT_TYPE_INT, {.i64=PT_DEFAULT}, 0, INT_MAX, DEC, "pattern_type"},
{ "glob_sequence","select glob/sequence pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_GLOB_SEQUENCE}, INT_MIN, INT_MAX, DEC, "pattern_type" },
{ "glob", "select glob pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_GLOB }, INT_MIN, INT_MAX, DEC, "pattern_type" },
{ "sequence", "select sequence pattern type", 0, AV_OPT_TYPE_CONST, {.i64=PT_SEQUENCE }, INT_MIN, INT_MAX, DEC, "pattern_type" },
{ "none", "disable pattern matching", 0, AV_OPT_TYPE_CONST, {.i64=PT_NONE }, INT_MIN, INT_MAX, DEC, "pattern_type" },
{ "pixel_format", "set video pixel format", OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
{ "start_number", "set first number in the sequence", OFFSET(start_number), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, DEC },
{ "start_number_range", "set range for looking at the first sequence number", OFFSET(start_number_range), AV_OPT_TYPE_INT, {.i64 = 5}, 1, INT_MAX, DEC },
{ "video_size", "set video size", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, DEC },
{ "frame_size", "force frame size in bytes", OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, DEC },
{ "ts_from_file", "set frame timestamp from file's one", OFFSET(ts_from_file), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 2, DEC, "ts_type" },
{ "none", "none", 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, 0, 2, DEC, "ts_type" },
{ "sec", "second precision", 0, AV_OPT_TYPE_CONST, {.i64 = 1 }, 0, 2, DEC, "ts_type" },
{ "ns", "nano second precision", 0, AV_OPT_TYPE_CONST, {.i64 = 2 }, 0, 2, DEC, "ts_type" },
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define OFFSET(x)
Definition: img2dec.c:563
Definition: img2.h:37
uint16_t width
Definition: gdv.c:47
Definition: img2.h:35
#define DEC
Definition: img2dec.c:564
int frame_size
Definition: mxfenc.c:1947
static int loop
Definition: ffplay.c:336
offset must point to AVRational
Definition: opt.h:236
offset must point to two consecutive integers
Definition: opt.h:233

Definition at line 565 of file img2dec.c.