57 #define OFFSET(x) offsetof(MovieContext, x)
62 {
"stream_index",
"set stream index",
OFFSET(stream_index),
AV_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX },
96 "Failed to avformat_open_input '%s'\n", movie->
file_name);
109 "%s: seek value overflow with start_time:%"PRId64
" seek_point:%"PRId64
"\n",
155 av_log(ctx,
AV_LOG_INFO,
"seek_point:%"PRIi64
" format_name:%s file_name:%s stream_index:%d\n",
213 outlink->
w = movie->
w;
214 outlink->
h = movie->
h;
224 int ret, frame_decoded;
255 "movie_get_frame(): file:'%s' pts:%"PRId64
" time:%lf pos:%"PRId64
" aspect:%d/%d\n",
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
AVFilterBufferRef * avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
Request a picture buffer with a specific set of permissions.
AVFilterBufferRefVideoProps * video
video buffer specific properties
int linesize[8]
number of bytes per line
int64_t pos
byte position in stream, -1 if unknown
int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt)
Decode the video frame of size avpkt->size from avpkt->data into picture.
int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
int h
agreed upon image height
#define AV_LOG_WARNING
Something somehow does not look correct.
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
int av_set_options_string(void *ctx, const char *opts, const char *key_val_sep, const char *pairs_sep)
Parse the key/value pairs list in opts.
AVCodec * avcodec_find_decoder(enum CodecID id)
Find a registered decoder with a matching codec ID.
static int config_output_props(AVFilterLink *outlink)
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
int avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
void avfilter_end_frame(AVFilterLink *link)
Notifie the next filter that the current frame has finished.
static int request_frame(AVFilterLink *outlink)
static double av_q2d(AVRational a)
Convert rational to double.
void av_free_packet(AVPacket *pkt)
Free a packet.
AVFrame * frame
video frame to store the decoded images in
#define AVERROR_EOF
End of file.
AVRational pixel_aspect
pixel aspect ratio
int64_t pts
presentation timestamp.
A filter pad used for either input or output.
int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src)
Copy the frame properties of src to dst, without copying the actual image data.
A link between two filters.
int av_find_best_stream(AVFormatContext *ic, enum AVMediaType type, int wanted_stream_nb, int related_stream, AVCodec **decoder_ret, int flags)
Find the "best" stream in the file.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
void avfilter_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
A helper for query_formats() which sets all links to the same list of formats.
static const AVClass movie_class
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
void av_log(void *avcl, int level, const char *fmt,...)
AVFilterFormats * avfilter_make_format_list(const int *fmts)
Create a list of supported formats.
static int movie_init(AVFilterContext *ctx)
char * av_get_token(const char **buf, const char *term)
Unescape the given string until a non escaped terminating char, and return the token corresponding to...
AVCodecContext * codec
codec context
int w
agreed upon image width
AVFrame * avcodec_alloc_frame(void)
Allocate an AVFrame and set its fields to default values.
AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
int width
picture width / height.
void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], const uint8_t *src_data[4], const int src_linesizes[4], enum PixelFormat pix_fmt, int width, int height)
Copy image in src_data to dst_data.
static av_cold void uninit(AVFilterContext *ctx)
int64_t reordered_opaque
opaque 64bit number (generally a PTS) that will be reordered and output in AVFrame.reordered_opaque
AVFilterContext * src
source filter
void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
Send a slice to the next filter.
#define av_dlog(pctx,...)
av_dlog macros Useful to print debug messages that shouldn't get compiled in normally.
static int query_formats(AVFilterContext *ctx)
void avfilter_unref_buffer(AVFilterBufferRef *ref)
Remove a reference to a buffer.
A reference to an AVFilterBuffer.
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
main external API structure.
AVRational sample_aspect_ratio
sample aspect ratio for the video frame, 0/1 if unknown
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVCodecContext * codec_ctx
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
int64_t reordered_opaque
reordered opaque 64bit (generally an integer or a double precision float PTS but can be anything)...
Describe the class of an AVClass context structure.
AVFilterBufferRef * avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
Add a new reference to a buffer.
int64_t seek_point
seekpoint in microseconds
void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
Notify the next filter of the start of a frame.
const char * name
filter name
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
Return the next frame of a stream.
int64_t pkt_pts
reordered pts from the last AVPacket that has been input into the decoder
int avcodec_close(AVCodecContext *avctx)
Close a given AVCodecContext and free all the data associated with it (but not the AVCodecContext its...
#define AV_PERM_PRESERVE
nobody else can overwrite the buffer
int64_t start_time
Decoding: position of the first frame of the component, in AV_TIME_BASE fractional seconds...
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Seek to the keyframe at timestamp.
AVFilter avfilter_vsrc_movie
static const char * movie_get_name(void *ctx)
int64_t pkt_dts
dts from the last AVPacket that has been input into the decoder
static AVInputFormat * iformat
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
Read packets of a media file to get stream information.
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
#define AV_PERM_REUSE2
can output the buffer multiple times, modified each time
#define AV_PERM_WRITE
can write to the buffer
int64_t pos
byte position in stream, -1 if unknown
static const AVOption movie_options[]
uint8_t * data[8]
picture/audio data for each plane
AVFormatContext * format_ctx
AVFilterBufferRef * picref
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
void av_register_all(void)
Initialize libavformat and register all the muxers, demuxers and protocols.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static int movie_get_frame(AVFilterLink *outlink)