"Video.FFMPEG" Stop video source. Stops video source aborting its thread. Since the method aborts background thread, its usage is highly not preferred and should be done only if there are no other options. The correct way of stopping camera is signaling it stop and then waiting for background thread's completion. Wait for video source has stopped. Waits for source stopping after it was signalled to stop using method. Signal video source to stop its work. Signals video source to stop its background thread, stop to provide new frames and free resources. Start video source. Starts video source and return execution to caller. Video source object creates background thread and notifies about new frames with the help of event. Video source is not specified. Initializes a new instance of the class. Get frame interval from source or use manually specified. The property specifies which frame rate to use for video playing. If the property is set to , then video is played with original frame rate, which is set in source video file. If the property is set to , then custom frame rate is used, which is calculated based on the manually specified frame interval. Default value is set to . Frame interval. The property sets the interval in milliseconds between frames. If the property is set to 100, then the desired frame rate will be 10 frames per second. Setting this property to 0 leads to no delay between video frames - frames are read as fast as possible. Setting this property has effect only when is set to . Default value is set to 0. State of the video source. Current state of video source object - running or not. Received bytes count. Number of bytes the video source provided from the moment of the last access to the property. Received frames count. Number of frames the video source provided from the moment of the last access to the property. Video source. Video file name to play. Video playing finished event. This event is used to notify clients that the video playing has finished. Video source error event. This event is used to notify clients about any type of errors occurred in video source object, for example internal exceptions. New frame event. Notifies clients about new available frame from video source. Since video source may have multiple clients, each client is responsible for making a copy (cloning) of the passed video frame, because the video source disposes its own original copy after notifying of clients. Video source for video files. The video source provides access to video files using FFmpeg library. The class provides video only. Sound is not supported. The class ignores presentation time of video frames while retrieving them from video file. Instead it provides video frames according to the FPS rate of the video file or the configured . Make sure you have FFmpeg binaries (DLLs) in the output folder of your application in order to use this class successfully. FFmpeg binaries can be found in Externals folder provided with AForge.NET framework's distribution. Sample usage: // create video source VideoFileSource videoSource = new VideoFileSource( fileName ); // set NewFrame event handler videoSource.NewFrame += new NewFrameEventHandler( video_NewFrame ); // start the video source videoSource.Start( ); // ... // New frame event handler, which is invoked on each new available video frame private void video_NewFrame( object sender, NewFrameEventArgs eventArgs ) { // get new frame Bitmap bitmap = eventArgs.Frame; // process the frame } Close currently opened video file if any. Read next video frame of the currently opened video file. Returns next video frame of the opened file or if end of file was reached. The returned video frame has 24 bpp color format. Thrown if no video file was open. A error occurred while reading next video frame. See exception message. Open video file with the specified name. Video file name to open. Cannot open video file with the specified name. A error occurred while opening the video file. See exception message. Disposes the object and frees its resources. Initializes a new instance of the class. Object's finalizer. The property specifies if a video file is opened or not by this instance of the class. Name of codec used for encoding the opened video file. Thrown if no video file was open. Number of video frames in the opened video file. Warning: some video file formats may report different value from the actual number of video frames in the file (subject to fix/investigate). Thrown if no video file was open. Frame rate of the opened video file. Thrown if no video file was open. Frame height of the opened video file. Thrown if no video file was open. Frame width of the opened video file. Thrown if no video file was open. Class for reading video files utilizing FFmpeg library. The class allows to read video files using FFmpeg library. Make sure you have FFmpeg binaries (DLLs) in the output folder of your application in order to use this class successfully. FFmpeg binaries can be found in Externals folder provided with AForge.NET framework's distribution. Sample usage: // create instance of video reader VideoFileReader reader = new VideoFileReader( ); // open video file reader.Open( "test.avi" ); // check some of its attributes Console.WriteLine( "width: " + reader.Width ); Console.WriteLine( "height: " + reader.Height ); Console.WriteLine( "fps: " + reader.FrameRate ); Console.WriteLine( "codec: " + reader.CodecName ); // read 100 video frames out of it for ( int i = 0; i < 100; i++ ) { Bitmap videoFrame = reader.ReadVideoFrame( ); // process the frame somehow // ... // dispose the frame when it is no longer required videoFrame.Dispose( ); } reader.Close( ); Get the AVClass for swsContext. It can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options. @see av_opt_find(). Convert an 8-bit paletted frame into a frame with a color depth of 24 bits. With the palette format "ABCD", the destination frame ends up with the format "ABC". @param src source frame buffer @param dst destination frame buffer @param num_pixels number of pixels to convert @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src Convert an 8-bit paletted frame into a frame with a color depth of 32 bits. The output frame will have the same packed format as the palette. @param src source frame buffer @param dst destination frame buffer @param num_pixels number of pixels to convert @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src Allocate and return a clone of the vector a, that is a vector with the same coefficients as a. Scale all the coefficients of a so that their sum equals height. Scale all the coefficients of a by the scalar value. Allocate and return a vector with just one coefficient, with value 1.0. Allocate and return a vector with length coefficients, all with the same value c. Return a normalized Gaussian curve used to filter stuff quality = 3 is high quality, lower is lower quality. Allocate and return an uninitialized vector with length coefficients. @return -1 if not supported @param inv_table the yuv2rgb coefficients, normally ff_yuv2rgb_coeffs[x] @return -1 if not supported Scale the image slice in srcSlice and put the resulting scaled slice in the image in dst. A slice is a sequence of consecutive rows in an image. Slices have to be provided in sequential order, either in top-bottom or bottom-top order. If slices are provided in non-sequential order the behavior of the function is undefined. @param c the scaling context previously created with sws_getContext() @param srcSlice the array containing the pointers to the planes of the source slice @param srcStride the array containing the strides for each plane of the source image @param srcSliceY the position in the source image of the slice to process, that is the number (counted starting from zero) in the image of the first row of the slice @param srcSliceH the height of the source slice, that is the number of rows in the slice @param dst the array containing the pointers to the planes of the destination image @param dstStride the array containing the strides for each plane of the destination image @return the height of the output slice Free the swscaler context swsContext. If swsContext is NULL, then does nothing. Initialize the swscaler context sws_context. @return zero or positive value on success, a negative value on error Allocate an empty SwsContext. This must be filled and passed to sws_init_context(). For filling see AVOptions, options.c and sws_setColorspaceDetails(). Allocate and return an SwsContext. You need it to perform scaling/conversion operations using sws_scale(). @param srcW the width of the source image @param srcH the height of the source image @param srcFormat the source image format @param dstW the width of the destination image @param dstH the height of the destination image @param dstFormat the destination image format @param flags specify which algorithm and options to use for rescaling @return a pointer to an allocated context, or NULL in case of error @note this function is to be removed after a saner alternative is written @deprecated Use sws_getCachedContext() instead. Check if context can be reused, otherwise reallocate a new one. If context is NULL, just calls sws_getContext() to get a new context. Otherwise, checks if the parameters are the ones already saved in context. If that is the case, returns the current context. Otherwise, frees context and gets a new context with the new parameters. Be warned that srcFilter and dstFilter are not checked, they are assumed to remain the same. Return a positive value if pix_fmt is a supported output format, 0 otherwise. Return a positive value if pix_fmt is a supported input format, 0 otherwise. Return the libswscale license. Return the libswscale build-time configuration. @} @file @brief external api for the swscale stuff Those FF_API_* defines are not part of public API. They may change, break or disappear at any time. Return the LIBSWSCALE_VERSION_INT constant. Test if the given container can store a codec. @param std_compliance standards compliance level, one of FF_COMPLIANCE_* @return 1 if codec with ID codec_id can be stored in ofmt, 0 if it cannot. A negative number if this information is not available. Return a positive value if the given filename has one of the given extensions, 0 otherwise. @param extensions a comma-separated list of filename extensions Generate an SDP for an RTP session. @param ac array of AVFormatContexts describing the RTP streams. If the array is composed by only one context, such context can contain multiple AVStreams (one AVStream per RTP stream). Otherwise, all the contexts in the array (an AVCodecContext per RTP stream) must contain only one AVStream. @param n_files number of AVCodecContexts contained in ac @param buf buffer where the SDP will be stored (must be allocated by the caller) @param size the size of the buffer @return 0 if OK, AVERROR_xxx on error Check whether filename actually is a numbered sequence generator. @param filename possible numbered sequence string @return 1 if a valid numbered sequence string, 0 otherwise Return in 'buf' the path with '%d' replaced by a number. Also handles the '%0nd' format where 'n' is the total number of digits and '%%'. @param buf destination buffer @param buf_size destination buffer size @param path numbered sequence string @param number frame number @return 0 if OK, -1 on format error @deprecated use av_find_info_tag in libavutil instead. Get the current time in microseconds. Parse datestr and return a corresponding number of microseconds. @param datestr String representing a date or a duration. See av_parse_time() for the syntax of the provided string. @deprecated in favor of av_parse_time() @deprecated Deprecated in favor of av_dump_format(). Split a URL string into components. The pointers to buffers for storing individual components may be null, in order to ignore that component. Buffers for components not found are set to empty strings. If the port is not found, it is set to a negative value. @param proto the buffer for the protocol @param proto_size the size of the proto buffer @param authorization the buffer for the authorization @param authorization_size the size of the authorization buffer @param hostname the buffer for the host name @param hostname_size the size of the hostname buffer @param port_ptr a pointer to store the port number in @param path the buffer for the path @param path_size the size of the path buffer @param url the URL to split Add an index entry into a sorted list. Update the entry if the list already contains it. @param timestamp timestamp in the time base of the given stream Get the codec tag for the given codec id id. If no codec tag is found returns 0. @param tags list of supported codec_id-codec_tag pairs, as stored in AVInputFormat.codec_tag and AVOutputFormat.codec_tag Send a nice dump of a packet to the log. @param avcl A pointer to an arbitrary struct of which the first field is a pointer to an AVClass struct. @param level The importance level of the message, lower values signifying higher importance. @param pkt packet to dump @param dump_payload True if the payload must be displayed, too. @param st AVStream that the packet belongs to Send a nice dump of a packet to the specified file stream. @param f The file stream pointer where the dump should be sent to. @param pkt packet to dump @param dump_payload True if the payload must be displayed, too. @param st AVStream that the packet belongs to Send a nice hexadecimal dump of a buffer to the log. @param avcl A pointer to an arbitrary struct of which the first field is a pointer to an AVClass struct. @param level The importance level of the message, lower values signifying higher importance. @param buf buffer @param size buffer size @see av_hex_dump, av_pkt_dump2, av_pkt_dump_log2 @} @defgroup lavf_misc Utility functions @ingroup libavf @{ Miscelaneous utility functions related to both muxing and demuxing (or neither). Send a nice hexadecimal dump of a buffer to the specified file stream. @param f The file stream pointer where the dump should be sent to. @param buf buffer @param size buffer size @see av_hex_dump_log, av_pkt_dump2, av_pkt_dump_log2 Get timing information for the data currently output. The exact meaning of "currently output" depends on the format. It is mostly relevant for devices that have an internal buffer and/or work in real time. @param s media file handle @param stream stream in the media file @param dts[out] DTS of the last packet output for the stream, in stream time_base units @param wall[out] absolute time when that packet whas output, in microsecond @return 0 if OK, AVERROR(ENOSYS) if the format does not support it Note: some formats or devices may not allow to measure dts and wall atomically. Return the output format in the list of registered output formats which best matches the provided parameters, or return NULL if there is no match. @param short_name if non-NULL checks if short_name matches with the names of the registered formats @param filename if non-NULL checks if filename terminates with the extensions of the registered formats @param mime_type if non-NULL checks if mime_type matches with the MIME type of the registered formats Write the stream trailer to an output media file and free the file private data. May only be called after a successful call to av_write_header. @param s media file handle @return 0 if OK, AVERROR_xxx on error Write a packet to an output media file ensuring correct interleaving. The packet must contain one audio or video frame. If the packets are already correctly interleaved, the application should call av_write_frame() instead as it is slightly faster. It is also important to keep in mind that completely non-interleaved input will need huge amounts of memory to interleave with this, so it is preferable to interleave at the demuxer level. @param s media file handle @param pkt The packet containing the data to be written. Libavformat takes ownership of the data and will free it when it sees fit using the packet's @ref AVPacket.destruct "destruct" field. The caller must not access the data after this function returns, as it may already be freed. Packet's @ref AVPacket.stream_index "stream_index" field must be set to the index of the corresponding stream in @ref AVFormatContext.streams "s.streams". It is very strongly recommended that timing information (@ref AVPacket.pts "pts", @ref AVPacket.dts "dts" @ref AVPacket.duration "duration") is set to correct values. @return 0 on success, a negative AVERROR on error. Allocate the stream private data and write the stream header to an output media file. @note: this sets stream time-bases, if possible to stream->codec->time_base but for some formats it might also be some other time base @param s media file handle @return 0 if OK, AVERROR_xxx on error @deprecated use avformat_write_header. @addtogroup lavf_encoding @{ Allocate the stream private data and write the stream header to an output media file. @param s Media file handle, must be allocated with avformat_alloc_context(). Its oformat field must be set to the desired output format; Its pb field must be set to an already openened AVIOContext. @param options An AVDictionary filled with AVFormatContext and muxer-private options. On return this parameter will be destroyed and replaced with a dict containing options that were not found. May be NULL. @return 0 on success, negative AVERROR on failure. @see av_opt_find, av_dict_set, avio_open, av_oformat_next. @deprecated pass the options to avformat_write_header directly. @deprecated this function is not supposed to be called outside of lavf @} Add a new stream to a media file. Can only be called in the read_header() function. If the flag AVFMTCTX_NOHEADER is in the format context, then new streams can be added in read_packet too. @param s media file handle @param id file-format-dependent stream ID Close an opened input AVFormatContext. Free it and all its contents and set *s to NULL. @deprecated use avformat_close_input() Close a media file (but not its codecs). @param s media file handle Free a AVFormatContext allocated by av_open_input_stream. @param s context to free @deprecated use av_close_input_file() Pause a network-based stream (e.g. RTSP stream). Use av_read_play() to resume it. Start playing a network-based stream (e.g. RTSP stream) at the current position. Seek to the keyframe at timestamp. 'timestamp' in 'stream_index'. @param stream_index If stream_index is (-1), a default stream is selected, and timestamp is automatically converted from AV_TIME_BASE units to the stream specific time_base. @param timestamp Timestamp in AVStream.time_base units or, if no stream is specified, in AV_TIME_BASE units. @param flags flags which select direction and seeking mode @return >= 0 on success Read a transport packet from a media file. This function is obsolete and should never be used. Use av_read_frame() instead. @param s media file handle @param pkt is filled @return 0 if OK, AVERROR_xxx on error Find the "best" stream in the file. The best stream is determined according to various heuristics as the most likely to be what the user expects. If the decoder parameter is non-NULL, av_find_best_stream will find the default decoder for the stream's codec; streams for which no decoder can be found are ignored. @param ic media file handle @param type stream type: video, audio, subtitles, etc. @param wanted_stream_nb user-requested stream number, or -1 for automatic selection @param related_stream try to find a stream related (eg. in the same program) to this one, or -1 if none @param decoder_ret if non-NULL, returns the decoder for the selected stream @param flags flags; none are currently defined @return the non-negative stream number in case of success, AVERROR_STREAM_NOT_FOUND if no stream with the requested type could be found, AVERROR_DECODER_NOT_FOUND if streams were found but no decoder @note If av_find_best_stream returns successfully and decoder_ret is not NULL, then *decoder_ret is guaranteed to be set to a valid AVCodec. Find the programs which belong to a given stream. @param ic media file handle @param last the last found program, the search will start after this program, or from the beginning if it is NULL @param s stream index @return the next program which belongs to s, NULL if no program is found or the last program is not among the programs of ic. Read packets of a media file to get stream information. This is useful for file formats with no headers such as MPEG. This function also computes the real framerate in case of MPEG-2 repeat frame mode. The logical file position is not changed by this function; examined packets may be buffered for later processing. @param ic media file handle @param options If non-NULL, an ic.nb_streams long array of pointers to dictionaries, where i-th member contains options for codec corresponding to i-th stream. On return each dictionary will be filled with options that were not found. @return >=0 if OK, AVERROR_xxx on error @note this function isn't guaranteed to open all the codecs, so options being non-empty at return is a perfectly normal behavior. @todo Let the user decide somehow what information is needed so that we do not waste time getting stuff the user does not need. Read packets of a media file to get stream information. This is useful for file formats with no headers such as MPEG. This function also computes the real framerate in case of MPEG-2 repeat frame mode. The logical file position is not changed by this function; examined packets may be buffered for later processing. @param ic media file handle @return >=0 if OK, AVERROR_xxx on error @todo Let the user decide somehow what information is needed so that we do not waste time getting stuff the user does not need. @deprecated use avformat_find_stream_info. Open an input stream and read the header. The codecs are not opened. The stream must be closed with av_close_input_file(). @param ps Pointer to user-supplied AVFormatContext (allocated by avformat_alloc_context). May be a pointer to NULL, in which case an AVFormatContext is allocated by this function and written into ps. Note that a user-supplied AVFormatContext will be freed on failure. @param filename Name of the stream to open. @param fmt If non-NULL, this parameter forces a specific input format. Otherwise the format is autodetected. @param options A dictionary filled with AVFormatContext and demuxer-private options. On return this parameter will be destroyed and replaced with a dict containing options that were not found. May be NULL. @return 0 on success, a negative AVERROR on failure. @note If you want to use custom IO, preallocate the format context and set its pb field. Open a media file as input. The codecs are not opened. Only the file header (if present) is read. @param ic_ptr The opened media file handle is put here. @param filename filename to open @param fmt If non-NULL, force the file format to use. @param buf_size optional buffer size (zero if default is OK) @param ap Additional parameters needed when opening the file (NULL if default). @return 0 if OK, AVERROR_xxx otherwise @deprecated use avformat_open_input instead. Allocate all the structures needed to read an input stream. This does not open the needed codecs for decoding the stream[s]. @deprecated use avformat_open_input instead. Probe a bytestream to determine the input format. Each time a probe returns with a score that is too low, the probe buffer size is increased and another attempt is made. When the maximum probe size is reached, the input format with the highest score is returned. @param pb the bytestream to probe @param fmt the input format is put here @param filename the filename of the stream @param logctx the log context @param offset the offset within the bytestream to probe from @param max_probe_size the maximum probe buffer size (zero for default) @return 0 in case of success, a negative value corresponding to an AVERROR code otherwise Guess the file format. @param is_opened Whether the file is already opened; determines whether demuxers with or without AVFMT_NOFILE are probed. @param score_ret The score of the best detection. Guess the file format. @param is_opened Whether the file is already opened; determines whether demuxers with or without AVFMT_NOFILE are probed. @addtogroup lavf_decoding @{ Find AVInputFormat based on the short name of the input format. Allocate an AVFormatContext for an output format. avformat_free_context() can be used to free the context and everything allocated by the framework within it. @param *ctx is set to the created format context, or to NULL in case of failure @param oformat format to use for allocating the context, if NULL format_name and filename are used instead @param format_name the name of output format to use for allocating the context, if NULL filename is used instead @param filename the name of the filename to use for allocating the context, may be NULL @return >= 0 in case of success, a negative AVERROR code in case of failure @deprecated deprecated in favor of avformat_alloc_output_context2() Add a new stream to a media file. When demuxing, it is called by the demuxer in read_header(). If the flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also be called in read_packet(). When muxing, should be called by the user before avformat_write_header(). @param c If non-NULL, the AVCodecContext corresponding to the new stream will be initialized to use this codec. This is needed for e.g. codec-specific defaults to be set, so codec should be provided if it is known. @return newly created stream or NULL on error. Get the AVClass for AVFormatContext. It can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options. @see av_opt_find(). Free an AVFormatContext and all its streams. @param s context to free Allocate an AVFormatContext. avformat_free_context() can be used to free the context and everything allocated by the framework within it. If f is NULL, returns the first registered output format, if f is non-NULL, returns the next registered output format after f or NULL if f is the last one. If f is NULL, returns the first registered input format, if f is non-NULL, returns the next registered input format after f or NULL if f is the last one. Undo the initialization done by avformat_network_init. Do global initialization of network components. This is optional, but recommended, since it avoids the overhead of implicitly doing the setup for each session. Calling this function will become mandatory if using network protocols at some major version bump. Initialize libavformat and register all the muxers, demuxers and protocols. If you do not call this function, then you can select exactly which formats you want to support. @see av_register_input_format() @see av_register_output_format() @see av_register_protocol() Return the libavformat license. Return the libavformat build-time configuration. @defgroup lavf_core Core functions @ingroup libavf Functions for querying libavformat capabilities, allocating core structures, etc. @{ Return the LIBAVFORMAT_VERSION_INT constant. Max chunk size in bytes Note, not all formats support this and unpredictable things may happen if it is used when not supported. - encoding: Set by user via AVOptions (NO direct access) - decoding: unused Max chunk time in microseconds. Note, not all formats support this and unpredictable things may happen if it is used when not supported. - encoding: Set by user via AVOptions (NO direct access) - decoding: unused Audio preload in microseconds. Note, not all formats support this and unpredictable things may happen if it is used when not supported. - encoding: Set by user via AVOptions (NO direct access) - decoding: unused Transport stream id. This will be moved into demuxer private options. Thus no API/ABI compatibility Custom interrupt callbacks for the I/O layer. decoding: set by the user before avformat_open_input(). encoding: set by the user before avformat_write_header() (mainly useful for AVFMT_NOFILE formats). The callback should also be passed to avio_open2() if it's used to open the file. Error recognition; higher values will detect more errors but may misdetect some more or less valid parts as errors. - encoding: unused - decoding: Set by user. decoding: number of frames used to probe fps Start time of the stream in real world time, in microseconds since the unix epoch (00:00 1st January 1970). That is, pts=0 in the stream was captured at this real world time. - encoding: Set by user. - decoding: Unused. Remaining size available for raw_packet_buffer, in bytes. NOT PART OF PUBLIC API Flags to enable debugging. Maximum amount of memory in bytes to use for buffering frames obtained from realtime capture devices. Maximum amount of memory in bytes to use for the index of each stream. If the index exceeds this size, entries will be discarded as needed to maintain a smaller size. This can lead to slower or less accurate seeking (depends on demuxer). Demuxers for which a full in-memory index is mandatory will ignore this. muxing : unused demuxing: set by user decoding: maximum time (in AV_TIME_BASE units) during which the input should be analyzed in avformat_find_stream_info(). decoding: size of data to probe; encoding: unused. @deprecated, use the 'loop' img2 demuxer private option. number of times to loop output in formats that support it @deprecated use the 'loop' private option in the gif muxer. use mpeg muxer private options instead Decoding: total stream bitrate in bit/s, 0 if not available. Never set it directly if the file_size and the duration are known as FFmpeg can compute it automatically. decoding: total file size, 0 if unknown Decoding: duration of the stream, in AV_TIME_BASE fractional seconds. Only set this value if you know none of the individual stream durations and also do not set any of them. This is deduced from the AVStream values if not set. Decoding: position of the first frame of the component, in AV_TIME_BASE fractional seconds. NEVER set this value directly: It is deduced from the AVStream values. @deprecated use 'creation_time' metadata tag instead A list of all streams in the file. New streams are created with avformat_new_stream(). decoding: streams are created by libavformat in avformat_open_input(). If AVFMTCTX_NOHEADER is set in ctx_flags, then new streams may also appear in av_read_frame(). encoding: streams are created by the user before avformat_write_header(). Format private data. This is an AVOptions-enabled struct if and only if iformat/oformat.priv_class is not NULL. A class for logging and AVOptions. Set by avformat_alloc_context(). Exports (de)muxer private options if they exist. Format I/O context. New fields can be added to the end with minor version bumps. Removal, reordering and changes to existing fields require a major version bump. sizeof(AVFormatContext) must not be used outside libav*, use avformat_alloc_context() to create an AVFormatContext. New fields can be added to the end with minor version bumps. Removal, reordering and changes to existing fields require a major version bump. sizeof(AVProgram) must not be used outside libav*. flag to indicate that probing is requested NOT PART OF PUBLIC API Stream Identifier This is the MPEG-TS stream identifier +1 0 means unknown Number of frames that have been demuxed during av_find_stream_info() Average framerate last packet in packet_buffer for this stream when muxing. Used internally, NOT PART OF PUBLIC API, do not read or write from outside of libav* This buffer is only needed when packets were already buffered but not decoded, for example to get the codec parameters in MPEG streams. Raw packets from the demuxer, prior to parsing and decoding. This buffer is used for buffering packets until the codec can be identified, as parsing cannot be done without knowing the codec. Number of packets to buffer for codec probing NOT PART OF PUBLIC API Timestamp corresponding to the last dts sync point. Initialized when AVCodecParserContext.dts_sync_point >= 0 and a DTS is received from the underlying container. Otherwise set to AV_NOPTS_VALUE by default. sample aspect ratio (0 if unknown) - encoding: Set by user. - decoding: Set by libavformat. Decoding: duration of the stream, in stream time base. If a source file does not specify a duration, but does specify a bitrate, this value will be estimated from bitrate and file size. Decoding: pts of the first frame of the stream in presentation order, in stream time base. Only set this if you are absolutely 100% sure that the value you set it to really is the pts of the first frame. This may be undefined (AV_NOPTS_VALUE). @note The ASF header does NOT contain a correct start_time the ASF demuxer must NOT set this. Quality, as it has been removed from AVCodecContext and put in AVVideoFrame. MN: dunno if that is the right place for it This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented. For fixed-fps content, time base should be 1/framerate and timestamp increments should be 1. decoding: set by libavformat encoding: set by libavformat in av_write_header encoding: pts generation when outputting stream Real base framerate of the stream. This is the lowest framerate with which all timestamps can be represented accurately (it is the least common multiple of all framerates in the stream). Note, this value is just a guess! For example, if the time base is 1/90000 and all frames have either approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1. Track should be used during playback by default. Useful for subtitle track that should be displayed even when user did not explicitly ask for subtitles. Stream structure. New fields can be added to the end with minor version bumps. Removal, reordering and changes to existing fields require a major version bump. sizeof(AVStream) must not be used outside libav*. @} Pause playing - only meaningful if using a network-based format (RTSP). Start/resume playing - only meaningful if using a network-based format (RTSP). General purpose read-only value that the format can use. If extensions are defined, then no probe is done. You should usually not use extension format guessing because it is not reliable enough Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS, AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH, AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK. Get the next timestamp in stream[stream_index].time_base units. @return the timestamp or AV_NOPTS_VALUE if an error occurred Seek to a given timestamp relative to the frames in stream component stream_index. @param stream_index Must not be -1. @param flags Selects which direction should be preferred if no exact match is available. @return >= 0 on success (but not necessarily the new offset) Close the stream. The AVFormatContext and AVStreams are not freed by this function Read the format header and initialize the AVFormatContext structure. Return 0 if OK. 'ap' if non-NULL contains additional parameters. Only used in raw format right now. 'av_new_stream' should be called to create new streams. Tell if a given file has a chance of being parsed as this format. The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes big so you do not have to check for that unless you need more. Size of private data so that it can be allocated in the wrapper. Descriptive name for the format, meant to be more human-readable than name. You should use the NULL_IF_CONFIG_SMALL() macro to define it. A comma separated list of short names for the format. New names may be appended with a minor bump. @} @addtogroup lavf_decoding @{ Can only be iformat or oformat, not both at the same time. decoding: set by avformat_open_input(). encoding: set by the user. Test if the given codec can be stored in this container. @return 1 if the codec is supported, 0 if it is not. A negative number if unknown. List of supported codec_id-codec_tag pairs, ordered by "better choice first". The arrays are all terminated by CODEC_ID_NONE. can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE, AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS, AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH Write a packet. If AVFMT_ALLOW_FLUSH is set in flags, pkt can be NULL in order to flush data buffered in the muxer. When flushing, return 0 if there still is more data to flush, or 1 if everything was flushed and there is no more buffered data. size of private data so that it can be allocated in the wrapper Descriptive name for the format, meant to be more human-readable than name. You should use the NULL_IF_CONFIG_SMALL() macro to define it. Demuxer will use avio_open, no opened file should be provided by the caller. @addtogroup lavf_encoding @{ This structure contains the data a format has to probe a file. Read data and append it to the current content of the AVPacket. If pkt->size is 0 this is identical to av_get_packet. Note that this uses av_grow_packet and thus involves a realloc which is inefficient. Thus this function should only be used when there is no reasonable way to know (an upper bound of) the final size. @param pkt packet @param size amount of data to read @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data will not be lost even if an error occurs. @} Allocate and read the payload of a packet and initialize its fields with default values. @param pkt packet @param size desired payload size @return >0 (read size) if OK, AVERROR_xxx otherwise Free all the memory allocated for an AVDictionary struct. Copy metadata from one AVDictionary struct into another. @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL, this function will allocate a struct for you and put it in *dst @param src pointer to source AVDictionary struct @param flags flags to use when setting metadata in *dst @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag This function is provided for compatibility reason and currently does nothing. Get a metadata element with matching key. @param prev Set to the previous matching element to find the next. If set to NULL the first matching element is returned. @param flags Allows case as well as suffix-insensitive comparisons. @return Found tag or NULL, changing key or value leads to undefined behavior. Seek to a given timestamp relative to some component stream. Only meaningful if using a network streaming protocol (e.g. MMS.). @param stream_index The stream index that the timestamp is relative to. If stream_index is (-1) the timestamp should be in AV_TIME_BASE units from the beginning of the presentation. If a stream_index >= 0 is used and the protocol does not support seeking based on component streams, the call will fail. @param timestamp timestamp in AVStream.time_base units or if there is no stream specified then in AV_TIME_BASE units. @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE and AVSEEK_FLAG_ANY. The protocol may silently ignore AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will fail if used and not supported. @return >= 0 on success @see AVInputFormat::read_seek Pause and resume playing - only meaningful if using a network streaming protocol (e.g. MMS). @param pause 1 for pause, 0 for resume Iterate through names of available protocols. @note it is recommanded to use av_protocol_next() instead of this @param opaque A private pointer representing current protocol. It must be a pointer to NULL on first iteration and will be updated by successive calls to avio_enum_protocols. @param output If set to 1, iterate over output protocols, otherwise over input protocols. @return A static string containing the name of current protocol or NULL Return the written size and a pointer to the buffer. The buffer must be freed with av_free(). Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer. @param s IO context @param pbuffer pointer to a byte buffer @return the length of the byte buffer Open a write only memory stream. @param s new IO context @return zero if no error. Create and initialize a AVIOContext for accessing the resource indicated by url. @note When the resource indicated by url has been opened in read+write mode, the AVIOContext can be used only for writing. @param s Used to return the pointer to the created AVIOContext. In case of failure the pointed to value is set to NULL. @param flags flags which control how the resource indicated by url is to be opened @param int_cb an interrupt callback to be used at the protocols level @param options A dictionary filled with protocol-private options. On return this parameter will be destroyed and replaced with a dict containing options that were not found. May be NULL. @return 0 in case of success, a negative value corresponding to an AVERROR code in case of failure @name URL open modes The flags argument to avio_open must be one of the following constants, optionally ORed with other flags. @{ @} Use non-blocking mode. If this flag is set, operations on the context will return AVERROR(EAGAIN) if they can not be performed immediately. If this flag is not set, operations on the context will never return AVERROR(EAGAIN). Note that this flag does not affect the opening/connecting of the context. Connecting a protocol will always block if necessary (e.g. on network protocols) but never hang (e.g. on busy devices). Warning: non-blocking protocols is work-in-progress; this flag may be silently ignored. Create and initialize a AVIOContext for accessing the resource indicated by url. @note When the resource indicated by url has been opened in read+write mode, the AVIOContext can be used only for writing. @param s Used to return the pointer to the created AVIOContext. In case of failure the pointed to value is set to NULL. @param flags flags which control how the resource indicated by url is to be opened @return 0 in case of success, a negative value corresponding to an AVERROR code in case of failure @name Functions for reading from AVIOContext @{ @note return 0 if EOF, so you cannot use it if EOF handling is necessary Read size bytes from AVIOContext into buf. @return number of bytes read or AVERROR @warning currently size is limited feof() equivalent for AVIOContext. @return non zero if and only if end of file Get the filesize. @return filesize or AVERROR ftell() equivalent for AVIOContext. @return position or AVERROR. Skip given number of bytes forward @return new position or AVERROR. Convert an UTF-8 string to UTF-16LE and write it. @return number of bytes written. Write a NULL-terminated string. @return number of bytes written. Allocate and initialize an AVIOContext for buffered I/O. It must be later freed with av_free(). @param buffer Memory block for input/output operations via AVIOContext. The buffer must be allocated with av_malloc() and friends. @param buffer_size The buffer size is very important for performance. For protocols with fixed blocksize it should be set to this blocksize. For others a typical size is a cache page, e.g. 4kb. @param write_flag Set to 1 if the buffer should be writable, 0 otherwise. @param opaque An opaque pointer to user-specific data. @param read_packet A function for refilling the buffer, may be NULL. @param write_packet A function for writing the buffer contents, may be NULL. @param seek A function for seeking to specified byte position, may be NULL. @return Allocated AVIOContext or NULL on failure. The callback is called in blocking functions to test regulary if asynchronous interruption is needed. AVERROR_EXIT is returned in this case by the interrupted function. 'NULL' means no interrupt callback is given. @deprecated Use interrupt_callback in AVFormatContext/avio_open2 instead. Return AVIO_FLAG_* access flags corresponding to the access permissions of the resource in url, or a negative value corresponding to an AVERROR code in case of failure. The returned access flags are masked by the value in flags. @note This function is intrinsically unsafe, in the sense that the checked resource may change its existence or permission status from one call to another. Thus you should not trust the returned value, unless you are sure that no other processes are accessing the checked resource. Return a non-zero value if the resource indicated by url exists, 0 otherwise. @deprecated Use avio_check instead. return the written or read size @deprecated use AVIOContext.max_packet_size directly. @deprecated Use AVIOContext.seekable field directly. @deprecated use avio_get_str instead @note unlike fgets, the EOL character is not returned and a whole line is parsed. return NULL if first char read was EOF @} @defgroup old_url_f_funcs Old url_f* functions The following functions are deprecated, use the "avio_"-prefixed functions instead. @{ @ingroup lavf_io @} @defgroup old_avio_funcs Old put_/get_*() functions The following functions are deprecated. Use the "avio_"-prefixed functions instead. @{ @ingroup lavf_io @} Register the URLProtocol protocol. @param size the size of the URLProtocol struct referenced returns the next registered protocol after the given protocol (the first if NULL is given), or NULL if protocol is the last one. @defgroup old_url_funcs Old url_* functions The following functions are deprecated. Use the buffered API based on #AVIOContext instead. @{ @ingroup lavf_io @name URL open modes The flags argument to url_open and cosins must be one of the following constants, optionally ORed with other flags. @{ @} Use non-blocking mode. If this flag is set, operations on the context will return AVERROR(EAGAIN) if they can not be performed immediately. If this flag is not set, operations on the context will never return AVERROR(EAGAIN). Note that this flag does not affect the opening/connecting of the context. Connecting a protocol will always block if necessary (e.g. on network protocols) but never hang (e.g. on busy devices). Warning: non-blocking protocols is work-in-progress; this flag may be silently ignored. @deprecated This struct is to be made private. Use the higher-level AVIOContext-based API instead. URL Context. New fields can be added to the end with minor version bumps. Removal, reordering and changes to existing fields require a major version bump. sizeof(URLContext) must not be used outside libav*. @deprecated This struct will be made private Close currently opened video file if any. Write new video frame with a specific timestamp into currently opened video file. Bitmap to add as a new video frame. Frame timestamp, total time since recording started. The specified bitmap must be either color 24 or 32 bpp image or grayscale 8 bpp (indexed) image. The parameter allows user to specify presentation time of the frame being saved. However, it is user's responsibility to make sure the value is increasing over time. Thrown if no video file was open. The provided bitmap must be 24 or 32 bpp color image or 8 bpp grayscale image. Bitmap size must be of the same as video size, which was specified on opening video file. A error occurred while writing new video frame. See exception message. Write new video frame into currently opened video file. Bitmap to add as a new video frame. The specified bitmap must be either color 24 or 32 bpp image or grayscale 8 bpp (indexed) image. Thrown if no video file was open. The provided bitmap must be 24 or 32 bpp color image or 8 bpp grayscale image. Bitmap size must be of the same as video size, which was specified on opening video file. A error occurred while writing new video frame. See exception message. Create video file with the specified name and attributes. Video file name to create. Frame width of the video file. Frame height of the video file. Frame rate of the video file. Video codec to use for compression. Bit rate of the video stream. The methods creates new video file with the specified name. If a file with such name already exists in the file system, it will be overwritten. When adding new video frames using method, the video frame must have width and height as specified during file opening. The bit rate parameter represents a trade-off value between video quality and video file size. Higher bit rate value increase video quality and result in larger file size. Smaller values result in opposite – worse quality and small video files. Video file resolution must be a multiple of two. Invalid video codec is specified. A error occurred while creating new video file. See exception message. Cannot open video file with the specified name. Create video file with the specified name and attributes. Video file name to create. Frame width of the video file. Frame height of the video file. Frame rate of the video file. Video codec to use for compression. The methods creates new video file with the specified name. If a file with such name already exists in the file system, it will be overwritten. When adding new video frames using method, the video frame must have width and height as specified during file opening. Video file resolution must be a multiple of two. Invalid video codec is specified. A error occurred while creating new video file. See exception message. Cannot open video file with the specified name. Create video file with the specified name and attributes. Video file name to create. Frame width of the video file. Frame height of the video file. Frame rate of the video file. See documentation to the for more information and the list of possible exceptions. The method opens the video file using codec. Create video file with the specified name and attributes. Video file name to create. Frame width of the video file. Frame height of the video file. See documentation to the for more information and the list of possible exceptions. The method opens the video file using codec and 25 fps frame rate. Disposes the object and frees its resources. Initializes a new instance of the class. Object's finalizer. The property specifies if a video file is opened or not by this instance of the class. Codec to use for the video file. Thrown if no video file was open. Bit rate of the video stream. Thrown if no video file was open. Frame rate of the opened video file. Thrown if no video file was open. Frame height of the opened video file. Thrown if no video file was open. Frame width of the opened video file. Thrown if no video file was open. Class for writing video files utilizing FFmpeg library. The class allows to write video files using FFmpeg library. Make sure you have FFmpeg binaries (DLLs) in the output folder of your application in order to use this class successfully. FFmpeg binaries can be found in Externals folder provided with AForge.NET framework's distribution. Sample usage: int width = 320; int height = 240; // create instance of video writer VideoFileWriter writer = new VideoFileWriter( ); // create new video file writer.Open( "test.avi", width, height, 25, VideoCodec.MPEG4 ); // create a bitmap to save into the video file Bitmap image = new Bitmap( width, height, PixelFormat.Format24bppRgb ); // write 1000 video frames for ( int i = 0; i < 1000; i++ ) { image.SetPixel( i % width, i % height, Color.Red ); writer.WriteVideoFrame( image ); } writer.Close( ); Get the AVClass for AVFrame. It can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options. @see av_opt_find(). Get the AVClass for AVCodecContext. It can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining options. @see av_opt_find(). Register a user provided lock manager supporting the operations specified by AVLockOp. mutex points to a (void *) where the lockmgr should store/get a pointer to a user allocated mutex. It's NULL upon AV_LOCK_CREATE and != NULL for all other ops. @param cb User defined callback. Note: FFmpeg may invoke calls to this callback during the call to av_lockmgr_register(). Thus, the application must be prepared to handle that. If cb is set to NULL the lockmgr will be unregistered. Also note that during unregistration the previously registered lockmgr callback may also be invoked. Lock operation used by lockmgr If hwaccel is NULL, returns the first registered hardware accelerator, if hwaccel is non-NULL, returns the next registered hardware accelerator after hwaccel, or NULL if hwaccel is the last one. Register the hardware accelerator hwaccel. Log a generic warning message asking for a sample. This function is intended to be used internally by FFmpeg (libavcodec, libavformat, etc.) only, and would normally not be used by applications. @param[in] avc a pointer to an arbitrary struct of which the first field is a pointer to an AVClass struct @param[in] msg string containing an optional message, or NULL if no message Log a generic warning message about a missing feature. This function is intended to be used internally by FFmpeg (libavcodec, libavformat, etc.) only, and would normally not be used by applications. @param[in] avc a pointer to an arbitrary struct of which the first field is a pointer to an AVClass struct @param[in] feature string containing the name of the missing feature @param[in] want_sample indicates if samples are wanted which exhibit this feature. If want_sample is non-zero, additional verbage will be added to the log message which tells the user how to report samples to the development mailing list. Encode extradata length to a buffer. Used by xiph codecs. @param s buffer to write to; must be at least (v/255+1) bytes long @param v size of extradata in bytes @return number of bytes written to the buffer. Pad image. Crop image top and left side. Copy image src to dst. Wraps av_picture_data_copy() above. Same behaviour av_fast_malloc but the buffer has additional FF_INPUT_PADDING_SIZE at the end which will will always be 0. In addition the whole buffer will initially and after resizes be 0-initialized so that no uninitialized data will ever appear. Allocate a buffer, reusing the given one if large enough. Contrary to av_fast_realloc the current buffer contents might not be preserved and on error the old buffer is freed, thus no special handling to avoid memleaks is necessary. @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer @param size size of the buffer *ptr points to @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and *size 0 if an error occurred. Reallocate the given block if it is not large enough, otherwise do nothing. @see av_realloc Previous frame byte position. Byte position of currently parsed frame in stream. Position of the packet in file. Analogous to cur_frame_pts/dts Presentation delay of current frame in units of AVCodecContext.time_base. Set to INT_MIN when dts_sync_point unused. Otherwise, it must contain valid non-negative timestamp delta (presentation time of a frame must not lie in the past). This delay represents the difference between decoding and presentation time of the frame. For example, this corresponds to H.264 dpb_output_delay. Offset of the current timestamp against last timestamp sync point in units of AVCodecContext.time_base. Set to INT_MIN when dts_sync_point unused. Otherwise, it must contain a valid timestamp offset. Note that the timestamp of sync point has usually a nonzero dts_ref_dts_delta, which refers to the previous sync point. Offset of the next frame after timestamp sync point will be usually 1. For example, this corresponds to H.264 cpb_removal_delay. Time difference in stream time base units from the pts of this packet to the point at which the output from the decoder has converged independent from the availability of previous frames. That is, the frames are virtually identical no matter if decoding started from the very first frame or from this keyframe. Is AV_NOPTS_VALUE if unknown. This field is not the display duration of the current frame. This field has no meaning if the packet does not have AV_PKT_FLAG_KEY set. The purpose of this field is to allow seeking in streams that have no keyframes in the conventional sense. It corresponds to the recovery point SEI in H.264 and match_time_delta in NUT. It is also essential for some types of subtitle streams to ensure that all subtitles are correctly displayed after seeking. Set by parser to 1 for key frames and 0 for non-key frames. It is initialized to -1, so if the parser doesn't set this flag, old-style fallback using AV_PICTURE_TYPE_I picture type as key frames will be used. Set if the parser has a valid file offset This field is used for proper frame duration computation in lavf. It signals, how much longer the frame duration of the current frame is compared to normal frame duration. frame_duration = (1 + repeat_pict) * time_base It is used by codecs like H.264 to display telecined material. @deprecated Use av_get_bytes_per_sample() instead. Return codec bits per sample. @param[in] codec_id the codec @return Number of bits per sample or zero if unknown for the given codec. Return a single letter to describe the given picture type pict_type. @param[in] pict_type the picture type @return A single character representing the picture type. @deprecated Use av_get_picture_type_char() instead. Flush buffers, should be called when seeking or when switching to a different stream. Register all the codecs, parsers and bitstream filters which were enabled at configuration time. If you do not call this function you can select exactly which formats you want to support, by using the individual registration functions. @see avcodec_register @see av_register_codec_parser @see av_register_bitstream_filter Encode a video frame from pict into buf. The input picture should be stored using a specific format, namely avctx.pix_fmt. @param avctx the codec context @param[out] buf the output buffer for the bitstream of encoded frame @param[in] buf_size the size of the output buffer in bytes @param[in] pict the input picture to encode @return On error a negative value is returned, on success zero or the number of bytes used from the output buffer. Fill audio frame data and linesize. AVFrame extended_data channel pointers are allocated if necessary for planar audio. @param frame the AVFrame frame->nb_samples must be set prior to calling the function. This function fills in frame->data, frame->extended_data, frame->linesize[0]. @param nb_channels channel count @param sample_fmt sample format @param buf buffer to use for frame data @param buf_size size of buffer @param align plane size sample alignment @return 0 on success, negative error code on failure Encode a frame of audio. Takes input samples from frame and writes the next output packet, if available, to avpkt. The output packet does not necessarily contain data for the most recent frame, as encoders can delay, split, and combine input frames internally as needed. @param avctx codec context @param avpkt output AVPacket. The user can supply an output buffer by setting avpkt->data and avpkt->size prior to calling the function, but if the size of the user-provided data is not large enough, encoding will fail. All other AVPacket fields will be reset by the encoder using av_init_packet(). If avpkt->data is NULL, the encoder will allocate it. The encoder will set avpkt->size to the size of the output packet. @param[in] frame AVFrame containing the raw audio data to be encoded. May be NULL when flushing an encoder that has the CODEC_CAP_DELAY capability set. There are 2 codec capabilities that affect the allowed values of frame->nb_samples. If CODEC_CAP_SMALL_LAST_FRAME is set, then only the final frame may be smaller than avctx->frame_size, and all other frames must be equal to avctx->frame_size. If CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame can have any number of samples. If neither is set, frame->nb_samples must be equal to avctx->frame_size for all frames. @param[out] got_packet_ptr This field is set to 1 by libavcodec if the output packet is non-empty, and to 0 if it is empty. If the function returns an error, the packet can be assumed to be invalid, and the value of got_packet_ptr is undefined and should not be used. @return 0 on success, negative error code on failure Encode an audio frame from samples into buf. @deprecated Use avcodec_encode_audio2 instead. @note The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large. However, for codecs with avctx->frame_size equal to 0 (e.g. PCM) the user will know how much space is needed because it depends on the value passed in buf_size as described below. In that case a lower value can be used. @param avctx the codec context @param[out] buf the output buffer @param[in] buf_size the output buffer size @param[in] samples the input buffer containing the samples The number of samples read from this buffer is frame_size*channels, both of which are defined in avctx. For codecs which have avctx->frame_size equal to 0 (e.g. PCM) the number of samples read from samples is equal to: buf_size * 8 / (avctx->channels * av_get_bits_per_sample(avctx->codec_id)) This also implies that av_get_bits_per_sample() must not return 0 for these codecs. @return On error a negative value is returned, on success zero or the number of bytes used to encode the data read from the input buffer. Free all allocated data in the given subtitle struct. @param sub AVSubtitle to free. * Decode a subtitle message. * Return a negative value on error, otherwise return the number of bytes used. * If no subtitle could be decompressed, got_sub_ptr is zero. * Otherwise, the subtitle is stored in *sub. * Note that CODEC_CAP_DR1 is not available for subtitle codecs. This is for * simplicity, because the performance difference is expect to be negligible * and reusing a get_buffer written for video codecs would probably perform badly * due to a potentially very different allocation pattern. * * @param avctx the codec context * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored, must be freed with avsubtitle_free if *got_sub_ptr is set. * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero. * @param[in] avpkt The input AVPacket containing the input buffer. Decode the audio frame of size avpkt->size from avpkt->data into frame. Some decoders may support multiple frames in a single AVPacket. Such decoders would then just decode the first frame. In this case, avcodec_decode_audio4 has to be called again with an AVPacket containing the remaining data in order to decode the second frame, etc... Even if no frames are returned, the packet needs to be fed to the decoder with remaining data until it is completely consumed or an error occurs. @warning The input buffer, avpkt->data must be FF_INPUT_BUFFER_PADDING_SIZE larger than the actual read bytes because some optimized bitstream readers read 32 or 64 bits at once and could read over the end. @note You might have to align the input buffer. The alignment requirements depend on the CPU and the decoder. @param avctx the codec context @param[out] frame The AVFrame in which to store decoded audio samples. Decoders request a buffer of a particular size by setting AVFrame.nb_samples prior to calling get_buffer(). The decoder may, however, only utilize part of the buffer by setting AVFrame.nb_samples to a smaller value in the output frame. @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is non-zero. @param[in] avpkt The input AVPacket containing the input buffer. At least avpkt->data and avpkt->size should be set. Some decoders might also require additional fields to be set. @return A negative error code is returned if an error occurred during decoding, otherwise the number of bytes consumed from the input AVPacket is returned. Wrapper function which calls avcodec_decode_audio4. @deprecated Use avcodec_decode_audio4 instead. Decode the audio frame of size avpkt->size from avpkt->data into samples. Some decoders may support multiple frames in a single AVPacket, such decoders would then just decode the first frame. In this case, avcodec_decode_audio3 has to be called again with an AVPacket that contains the remaining data in order to decode the second frame etc. If no frame could be outputted, frame_size_ptr is zero. Otherwise, it is the decompressed frame size in bytes. @warning You must set frame_size_ptr to the allocated size of the output buffer before calling avcodec_decode_audio3(). @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than the actual read bytes because some optimized bitstream readers read 32 or 64 bits at once and could read over the end. @warning The end of the input buffer avpkt->data should be set to 0 to ensure that no overreading happens for damaged MPEG streams. @warning You must not provide a custom get_buffer() when using avcodec_decode_audio3(). Doing so will override it with avcodec_default_get_buffer. Use avcodec_decode_audio4() instead, which does allow the application to provide a custom get_buffer(). @note You might have to align the input buffer avpkt->data and output buffer samples. The alignment requirements depend on the CPU: On some CPUs it isn't necessary at all, on others it won't work at all if not aligned and on others it will work but it will have an impact on performance. In practice, avpkt->data should have 4 byte alignment at minimum and samples should be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). @note Codecs which have the CODEC_CAP_DELAY capability set have a delay between input and output, these need to be fed with avpkt->data=NULL, avpkt->size=0 at the end to return the remaining frames. @param avctx the codec context @param[out] samples the output buffer, sample type in avctx->sample_fmt If the sample format is planar, each channel plane will be the same size, with no padding between channels. @param[in,out] frame_size_ptr the output buffer size in bytes @param[in] avpkt The input AVPacket containing the input buffer. You can create such packet with av_init_packet() and by then setting data and size, some decoders might in addition need other fields. All decoders are designed to use the least fields possible though. @return On error a negative value is returned, otherwise the number of bytes used or zero if no frame data was decompressed (used) from the input AVPacket. @deprecated Set s->thread_count before calling avcodec_open2() instead of calling this. Modify width and height values so that they will result in a memory buffer that is acceptable for the codec if you also ensure that all line sizes are a multiple of the respective linesize_align[i]. May only be used if a codec with CODEC_CAP_DR1 has been opened. If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased according to avcodec_get_edge_width() before. Modify width and height values so that they will result in a memory buffer that is acceptable for the codec if you do not use any horizontal padding. May only be used if a codec with CODEC_CAP_DR1 has been opened. If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased according to avcodec_get_edge_width() before. Return the amount of padding in pixels which the get_buffer callback must provide around the edge of the image for codecs which do not have the CODEC_FLAG_EMU_EDGE flag. @return Required padding in pixels. Allocate an AVFrame and set its fields to default values. The resulting struct can be deallocated by simply calling av_free(). @return An AVFrame filled with default values or NULL on failure. @see avcodec_get_frame_defaults Set the fields of the given AVFrame to default values. @param pic The AVFrame of which the fields should be set to default values. Copy the settings of the source AVCodecContext into the destination AVCodecContext. The resulting destination codec context will be unopened, i.e. you are required to call avcodec_open2() before you can use this AVCodecContext to decode/encode video/audio data. @param dest target codec context, should be initialized with avcodec_alloc_context3(), but otherwise uninitialized @param src source codec context @return AVERROR() on error (e.g. memory allocation error), 0 on success Allocate an AVCodecContext and set its fields to default values. The resulting struct can be deallocated by simply calling av_free(). @param codec if non-NULL, allocate private data and initialize defaults for the given codec. It is illegal to then call avcodec_open2() with a different codec. @return An AVCodecContext filled with default values or NULL on failure. @see avcodec_get_context_defaults THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! * we WILL change its arguments and name a few times! Allocate an AVCodecContext and set its fields to default values. The resulting struct can be deallocated by simply calling av_free(). @return An AVCodecContext filled with default values or NULL on failure. @see avcodec_get_context_defaults @deprecated use avcodec_alloc_context3() Set the fields of the given AVCodecContext to default values corresponding to the given codec (defaults may be codec-dependent). Do not call this function if a non-NULL codec has been passed to avcodec_alloc_context3() that allocated this AVCodecContext. If codec is non-NULL, it is illegal to call avcodec_open2() with a different codec on this AVCodecContext. THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! * we WILL change its arguments and name a few times! Set the fields of the given AVCodecContext to default values. @param s The AVCodecContext of which the fields should be set to default values. @deprecated use avcodec_get_context_defaults3 Return a name for the specified profile, if available. @param codec the codec that is searched for the given profile @param profile the profile value for which a name is requested @return A name for the profile if found, NULL otherwise. Find a registered decoder with the specified name. @param name name of the requested decoder @return A decoder if one was found, NULL otherwise. Find a registered decoder with a matching codec ID. @param id CodecID of the requested decoder @return A decoder if one was found, NULL otherwise. Find a registered encoder with the specified name. @param name name of the requested encoder @return An encoder if one was found, NULL otherwise. Find a registered encoder with a matching codec ID. @param id CodecID of the requested encoder @return An encoder if one was found, NULL otherwise. Register the codec codec and initialize libavcodec. @warning either this function or avcodec_register_all() must be called before any other libavcodec functions. @see avcodec_register_all() @deprecated this function is called automatically from avcodec_register() and avcodec_register_all(), there is no need to call it manually Return the libavcodec license. Return the libavcodec build-time configuration. Return the LIBAVCODEC_VERSION_INT constant. If c is NULL, returns the first registered codec, if c is non-NULL, returns the next registered codec after c, or NULL if c is the last one. Tell if an image really has transparent alpha values. @return ored mask of FF_ALPHA_xxx constants Compute what kind of losses will occur when converting from one specific pixel format to another. When converting from one pixel format to another, information loss may occur. For example, when converting from RGB24 to GRAY, the color information will be lost. Similarly, other losses occur when converting from some formats to other formats. These losses can involve loss of chroma, but also loss of resolution, loss of color depth, loss due to the color space conversion, loss of the alpha bits or loss due to color quantization. avcodec_get_fix_fmt_loss() informs you about the various types of losses which will occur when converting from one pixel format to another. @param[in] dst_pix_fmt destination pixel format @param[in] src_pix_fmt source pixel format @param[in] has_alpha Whether the source pixel format alpha channel is used. @return Combination of flags informing you what kind of losses will occur (maximum loss for an invalid dst_pix_fmt). Put a string representing the codec tag codec_tag in buf. @param buf_size size in bytes of buf @return the length of the string that would have been generated if enough space had been available, excluding the trailing null Return a value representing the fourCC code associated to the pixel format pix_fmt, or 0 if no associated fourCC code can be found. Return the short name for a pixel format. \see av_get_pix_fmt(), av_get_pix_fmt_string(). @deprecated Deprecated in favor of av_get_pix_fmt_name(). Get the name of a codec. @return a static string identifying the codec; never NULL Calculate the size in bytes that a picture of the given width and height would occupy if stored in the given picture format. Note that this returns the size of a compact representation as generated by avpicture_layout(), which can be smaller than the size required for e.g. avpicture_fill(). @param pix_fmt the given picture format @param width the width of the image @param height the height of the image @return Image data size in bytes or -1 on error (e.g. too large dimensions). Copy pixel data from an AVPicture into a buffer. The data is stored compactly, without any gaps for alignment or padding which may be applied by avpicture_fill(). @see avpicture_get_size() @param[in] src AVPicture containing image data @param[in] pix_fmt The format in which the picture data is stored. @param[in] width the width of the image in pixels. @param[in] height the height of the image in pixels. @param[out] dest A buffer into which picture data will be copied. @param[in] dest_size The size of 'dest'. @return The number of bytes written to dest, or a negative value (error code) on error. Fill in the AVPicture fields. The fields of the given AVPicture are filled in by using the 'ptr' address which points to the image data buffer. Depending on the specified picture format, one or multiple image data pointers and line sizes will be set. If a planar format is specified, several pointers will be set pointing to the different picture planes and the line sizes of the different planes will be stored in the lines_sizes array. Call with ptr == NULL to get the required size for the ptr buffer. To allocate the buffer and fill in the AVPicture fields in one call, use avpicture_alloc(). @param picture AVPicture whose fields are to be filled in @param ptr Buffer which will contain or contains the actual image data @param pix_fmt The format in which the picture data is stored. @param width the width of the image in pixels @param height the height of the image in pixels @return size of the image data in bytes Free a picture previously allocated by avpicture_alloc(). The data buffer used by the AVPicture is freed, but the AVPicture structure itself is not. @param picture the AVPicture to be freed Allocate memory for a picture. Call avpicture_free() to free it. @see avpicture_fill() @param picture the picture to be filled in @param pix_fmt the format of the picture @param width the width of the picture @param height the height of the picture @return zero if successful, a negative value if not Compensate samplerate/timestamp drift. The compensation is done by changing the resampler parameters, so no audible clicks or similar distortions occur @param compensation_distance distance in output samples over which the compensation should be performed @param sample_delta number of output samples which should be output less example: av_resample_compensate(c, 10, 500) here instead of 510 samples only 500 samples would be output note, due to rounding the actual compensation might be slightly different, especially if the compensation_distance is large and the in_rate used during init is small Resample an array of samples using a previously configured context. @param src an array of unconsumed samples @param consumed the number of samples of src which have been consumed are returned here @param src_size the number of unconsumed samples available @param dst_size the amount of space in samples available in dst @param update_ctx If this is 0 then the context will not be modified, that way several channels can be resampled with the same context. @return the number of samples written in dst or -1 if an error occurred * Initialize an audio resampler. * Note, if either rate is not an integer then simply scale both rates up so they are. * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq * @param log2_phase_count log2 of the number of entries in the polyphase filterbank * @param linear If 1 then the used FIR filter will be linearly interpolated between the 2 closest, if 0 the closest will be used * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate Free resample context. @param s a non-NULL pointer to a resample context previously created with av_audio_resample_init() * Initialize audio resampling context. * * @param output_channels number of output channels * @param input_channels number of input channels * @param output_rate output sample rate * @param input_rate input sample rate * @param sample_fmt_out requested output sample format * @param sample_fmt_in input sample format * @param filter_length length of each FIR filter in the filterbank relative to the cutoff frequency * @param log2_phase_count log2 of the number of entries in the polyphase filterbank * @param linear if 1 then the used FIR filter will be linearly interpolated between the 2 closest, if 0 the closest will be used * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate * @return allocated ReSampleContext, NULL if error occurred Get side information from packet. @param pkt packet @param type desired side information type @param size pointer for side information size to store (optional) @return pointer to data if present or NULL otherwise Allocate new information of a packet. @param pkt packet @param type side information type @param size side information size @return pointer to fresh allocated data or NULL otherwise Free a packet. @param pkt packet to free @warning This is a hack - the packet memory allocation stuff is broken. The packet is allocated if it was not really allocated. Increase packet size, correctly zeroing padding @param pkt packet @param grow_by number of bytes by which to increase the size of the packet Reduce packet size, correctly zeroing padding @param pkt packet @param size new size Allocate the payload of a packet and initialize its fields with default values. @param pkt packet @param size wanted payload size @return 0 if OK, AVERROR_xxx otherwise Initialize optional fields of a packet with default values. @param pkt packet Default packet destructor. @deprecated use NULL instead 0 terminated ASS/SSA compatible event line. The pressentation of this is unaffected by the other values in this struct. data+linesize for the bitmap of this subtitle. can be set for text/ass as well once they where rendered Formatted text, the ass field must be set by the decoder and is authoritative. pict and text fields may contain approximations. Plain text, the text field must be set by the decoder and is authoritative. ass and pict fields may contain approximations. four components are given, that's all. the last component is alpha Size of HW accelerator private data. Private data is allocated with av_mallocz() before AVCodecContext.get_buffer() and deallocated after AVCodecContext.release_buffer(). Called at the end of each frame or field picture. The whole picture is parsed at this point and can now be sent to the hardware accelerator. This function is mandatory. @param avctx the codec context @return zero if successful, a negative value otherwise Callback for each slice. Meaningful slice information (codec specific) is guaranteed to be parsed at this point. This function is mandatory. @param avctx the codec context @param buf the slice data buffer base @param buf_size the size of the slice in bytes @return zero if successful, a negative value otherwise Called at the beginning of each frame or field picture. Meaningful frame information (codec specific) is guaranteed to be parsed at this point. This function is mandatory. Note that buf can be NULL along with buf_size set to 0. Otherwise, this means the whole frame is available at this point. @param avctx the codec context @param buf the frame data buffer base @param buf_size the size of the frame in bytes @return zero if successful, a negative value otherwise Hardware accelerated codec capabilities. see FF_HWACCEL_CODEC_CAP_* Codec implemented by the hardware accelerator. See CODEC_ID_xxx Forced video codec_id. Demuxing: Set by user. Forced audio codec_id. Demuxing: Set by user. Forced subtitle codec_id. Demuxing: Set by user. @} Guess the codec ID based upon muxer and filename. Get the CodecID for the given codec tag tag. If no codec id is found returns CODEC_ID_NONE. @param tags list of supported codec_id-codec_tag pairs, as stored in AVInputFormat.codec_tag and AVOutputFormat.codec_tag Name of the hardware accelerated codec. The name is globally unique among encoders and among decoders (but an encoder and a decoder can share the same name). Encode data to an AVPacket. @param avctx codec context @param avpkt output AVPacket (may contain a user-provided buffer) @param[in] frame AVFrame containing the raw data to be encoded @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a non-empty packet was returned in avpkt. @return 0 on success, negative error code on failure Initialize codec static data, called from avcodec_register(). @} Private codec-specific defaults. Copy necessary context variables from a previous thread context to the current one. If not defined, the next thread will start automatically; otherwise, the codec must call ff_thread_finish_setup(). dst and src will (rarely) point to the same context, in which case memcpy should be skipped. @name Frame-level threading support functions @{ If defined, called on thread contexts when they are created. If the codec allocates writable tables in init(), re-allocate them here. priv_data will be set to a copy of the original. Descriptive name for the codec, meant to be more human readable than name. You should use the NULL_IF_CONFIG_SMALL() macro to define it. Flush buffers. Will be called when seeking Codec capabilities. see CODEC_CAP_* Name of the codec implementation. The name is globally unique among encoders and among decoders (but an encoder and a decoder can share the same name). This is the primary way to find a codec from the user perspective. AVCodec. AVProfile. Current statistics for PTS correction. - decoding: maintained and used by libavcodec, not intended to be used by user apps - encoding: unused Field order * - encoding: set by libavcodec * - decoding: Set by libavcodec Private context used for internal data. Unlike priv_data, this is not codec-specific. It is used in general libavcodec functions. Error recognition; may misdetect some more or less valid parts as errors. - encoding: unused - decoding: Set by user. Type of service that the audio stream conveys. - encoding: Set by user. - decoding: Set by libavcodec. VBV delay coded in the last frame (in periods of a 27 MHz clock). Used for compliant TS muxing. - encoding: Set by libavcodec. - decoding: unused. Set by the client if its custom get_buffer() callback can be called from another thread, which allows faster multithreaded decoding. draw_horiz_band() will be called from other threads regardless of this setting. Ignored if the default get_buffer() is used. - encoding: Set by user. - decoding: Set by user. Which multithreading methods are in use by the codec. - encoding: Set by libavcodec. - decoding: Set by libavcodec. Which multithreading methods to use. Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread, so clients which cannot provide future frames should not use it. - encoding: Set by user, otherwise the default is used. - decoding: Set by user, otherwise the default is used. Whether this is a copy of the context which had init() called on it. This is used by multithreading - shared tables and picture pointers should be freed from the original context only. - encoding: Set by libavcodec. - decoding: Set by libavcodec. @deprecated this field has been moved to an internal context Current packet as passed into the decoder, to avoid having to pass the packet into every function. Currently only valid inside lavc and get/release_buffer callbacks. - decoding: set by avcodec_decode_*, read by get_buffer() for setting pkt_pts - encoding: unused Header containing style information for text subtitles. For SUBTITLE_ASS subtitle type, it should contain the whole ASS [Script Info] and [V4+ Styles] section, plus the [Events] line and the Format line following. It shouldn't include any Dialogue line. - encoding: Set/allocated/freed by user (before avcodec_open2()) - decoding: Set/allocated/freed by libavcodec (by avcodec_open2()) Number of slices. Indicates number of picture subdivisions. Used for parallelized decoding. - encoding: Set by user - decoding: unused Number of passes to use for Cholesky factorization during LPC analysis - encoding: Set by user - decoding: unused Constant rate factor maximum With CRF encoding mode and VBV restrictions enabled, prevents quality from being worse than crf_max, even if doing so would violate VBV restrictions. - encoding: Set by user. - decoding: unused RC lookahead Number of frames for frametype and ratecontrol lookahead - encoding: Set by user - decoding: unused PSY trellis Strength of psychovisual optimization - encoding: Set by user - decoding: unused PSY RD Strength of psychovisual optimization - encoding: Set by user - decoding: unused AQ strength Reduces blocking and blurring in flat and textured areas. - encoding: Set by user - decoding: unused AQ mode 0: Disabled 1: Variance AQ (complexity mask) 2: Auto-variance AQ (experimental) - encoding: Set by user - decoding: unused explicit P-frame weighted prediction analysis method 0: off 1: fast blind weighting (one reference duplicate with -1 offset) 2: smart weighting (full fade detection analysis) - encoding: Set by user. - decoding: unused MPEG vs JPEG YUV range. - encoding: Set by user - decoding: Set by libavcodec YUV colorspace type. - encoding: Set by user - decoding: Set by libavcodec Color Transfer Characteristic. - encoding: Set by user - decoding: Set by libavcodec Chromaticity coordinates of the source primaries. - encoding: Set by user - decoding: Set by libavcodec Hardware accelerator context. For some hardware accelerators, a global context needs to be provided by the user. In that case, this holds display-dependent data FFmpeg cannot instantiate itself. Please refer to the FFmpeg HW accelerator documentation to know how to fill this is. e.g. for VA API, this is a struct vaapi_context. - encoding: unused - decoding: Set by user For some codecs, the time base is closer to the field rate than the frame rate. Most notably, H.264 and MPEG-2 specify time_base as half of frame duration if no telecine is used ... Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2. Hardware accelerator in use - encoding: unused. - decoding: Set by libavcodec AVHWAccel. Request decoder to use this channel layout if it can (0 for default) - encoding: unused - decoding: Set by user. Audio channel layout. - encoding: set by user. - decoding: set by user, may be overwritten by libavcodec. Bits per sample/pixel of internal libavcodec pixel/sample format. - encoding: set by user. - decoding: set by libavcodec. opaque 64bit number (generally a PTS) that will be reordered and output in AVFrame.reordered_opaque @deprecated in favor of pkt_pts - encoding: unused - decoding: Set by user. Percentage of dynamic range compression to be applied by the decoder. The default value is 1.0, corresponding to full compression. - encoding: unused - decoding: Set by user. @deprecated use AC3 decoder private option instead. Decoder should decode to this many channels if it can (0 for default) - encoding: unused - decoding: Set by user. @deprecated Deprecated in favor of request_channel_layout. @} GOP timecode frame start number - encoding: Set by user, in non drop frame format - decoding: Set by libavcodec (timecode in the 25 bits format, -1 if unset) - encoding: Set by user. - decoding: unused - encoding: Set by user. - decoding: unused search method for selecting prediction order - encoding: Set by user. - decoding: unused @name FLAC options @deprecated Use FLAC encoder private options instead. @{ LPC coefficient precision - used by FLAC encoder - encoding: Set by user. - decoding: unused - encoding: Set by user. - decoding: unused - encoding: Set by user. - decoding: unused - encoding: Set by user. - decoding: unused Adjust sensitivity of b_frame_strategy 1. - encoding: Set by user. - decoding: unused Note: Value depends upon the compare function used for fullpel ME. - encoding: Set by user. - decoding: unused Multiplied by qscale for each frame and added to scene_change_score. - encoding: Set by user. - decoding: unused Audio cutoff bandwidth (0 means "automatic") - encoding: Set by user. - decoding: unused direct MV prediction mode - 0 (none), 1 (spatial), 2 (temporal), 3 (auto) - encoding: Set by user. - decoding: unused macroblock subpartition sizes to consider - p8x8, p4x4, b8x8, i8x8, i4x4 - encoding: Set by user. - decoding: unused in-loop deblocking filter beta parameter beta is in the range -6...6 - encoding: Set by user. - decoding: unused in-loop deblocking filter alphac0 parameter alpha is in the range -6...6 - encoding: Set by user. - decoding: unused Reduce fluctuations in qp (before curve compression). - encoding: Set by user. - decoding: unused trellis RD quantization - encoding: Set by user. - decoding: unused Influence how often B-frames are used. - encoding: Set by user. - decoding: unused chroma qp offset from luma - encoding: Set by user. - decoding: unused number of reference frames - encoding: Set by user. - decoding: Set by lavc. minimum GOP size - encoding: Set by user. - decoding: unused constant quantization parameter rate control method - encoding: Set by user. - decoding: unused @deprecated use 'cqp' libx264 private option constant rate factor - quality-based VBR - values ~correspond to qps - encoding: Set by user. - decoding: unused @deprecated use 'crf' libx264 private option - encoding: Set by user. - decoding: unused - encoding: Set by user. - decoding: unused - encoding: unused - decoding: Set by user. - encoding: unused - decoding: Set by user. - encoding: unused - decoding: Set by user. - encoding: Set by user. - decoding: unused maximum MB lagrange multipler - encoding: Set by user. - decoding: unused minimum MB lagrange multipler - encoding: Set by user. - decoding: unused Border processing masking, raises the quantizer for mbs on the borders of the picture. - encoding: Set by user. - decoding: unused frame skip comparison function - encoding: Set by user. - decoding: unused frame skip exponent - encoding: Set by user. - decoding: unused frame skip factor - encoding: Set by user. - decoding: unused frame skip threshold - encoding: Set by user. - decoding: unused Bitstream width / height, may be different from width/height if lowres enabled. - encoding: unused - decoding: Set by user before init if known. Codec should override / dynamically change if needed. low resolution decoding, 1-> 1/2 size, 2->1/4 size - encoding: unused - decoding: Set by user. level - encoding: Set by user. - decoding: Set by libavcodec. profile - encoding: Set by user. - decoding: Set by libavcodec. Number of macroblock rows at the bottom which are skipped. - encoding: unused - decoding: Set by user. Number of macroblock rows at the top which are skipped. - encoding: unused - decoding: Set by user. noise vs. sse weight for the nsse comparsion function - encoding: Set by user. - decoding: unused precision of the intra DC coefficient - 8 - encoding: Set by user. - decoding: unused Macroblock threshold below which the user specified macroblock types will be used. - encoding: Set by user. - decoding: unused Motion estimation threshold below which no motion estimation is performed, but instead the user specified motion vectors are used. - encoding: Set by user. - decoding: unused thread opaque Can be used by execute() to store some per AVCodecContext stuff. - encoding: set by execute() - decoding: set by execute() The codec may call this to execute several independent things. It will return only after finishing all tasks. The user may replace this with some multithreaded implementation, the default implementation will execute the parts serially. @param count the number of things to execute - encoding: Set by libavcodec, user can override. - decoding: Set by libavcodec, user can override. thread count is used to decide how many independent tasks should be passed to execute() - encoding: Set by user. - decoding: Set by user. quantizer noise shaping - encoding: Set by user. - decoding: unused MP3 antialias algorithm, see FF_AA_* below. - encoding: unused - decoding: Set by user. Simulates errors in the bitstream to test error concealment. - encoding: Set by user. - decoding: unused CODEC_FLAG2_* - encoding: Set by user. - decoding: Set by user. - encoding: Set by user. - decoding: unused Number of bits which should be loaded into the rc buffer before decoding starts. - encoding: Set by user. - decoding: unused Called at the beginning of a frame to get cr buffer for it. Buffer type (size, hints) must be the same. libavcodec won't check it. libavcodec will pass previous buffer in pic, function should return same buffer or new buffer with old frame "painted" into it. If pic.data[0] == NULL must behave like get_buffer(). if CODEC_CAP_DR1 is not set then reget_buffer() must call avcodec_default_reget_buffer() instead of providing buffers allocated by some other means. - encoding: unused - decoding: Set by libavcodec, user can override. noise reduction strength - encoding: Set by user. - decoding: unused palette control structure - encoding: ??? (no palette-enabled encoder yet) - decoding: Set by user. AVPaletteControl This structure defines a method for communicating palette changes between and demuxer and a decoder. @deprecated Use AVPacket to send palette changes instead. This is totally broken. maximum Lagrange multipler - encoding: Set by user. - decoding: unused minimum Lagrange multipler - encoding: Set by user. - decoding: unused scene change detection threshold 0 is default, larger means fewer detected scene changes. - encoding: Set by user. - decoding: unused custom inter quantization matrix - encoding: Set by user, can be NULL. - decoding: Set by libavcodec. custom intra quantization matrix - encoding: Set by user, can be NULL. - decoding: Set by libavcodec. macroblock decision mode - encoding: Set by user. - decoding: unused XVideo Motion Acceleration - encoding: forbidden - decoding: set by decoder slice flags - encoding: unused - decoding: Set by user. context model - encoding: Set by user. - decoding: unused coder type - encoding: Set by user. - decoding: unused Global quality for codecs which cannot change it per frame. This should be proportional to MPEG-1/2/4 qscale. - encoding: Set by user. - decoding: unused internal_buffers Don't touch, used by libavcodec default_get_buffer(). @deprecated this field was moved to an internal context internal_buffer count Don't touch, used by libavcodec default_get_buffer(). @deprecated this field was moved to an internal context color table ID - encoding: unused - decoding: Which clrtable should be used for 8bit RGB images. Tables have to be stored somewhere. FIXME inter quantizer bias - encoding: Set by user. - decoding: unused intra quantizer bias - encoding: Set by user. - decoding: unused maximum motion estimation search range in subpel units If 0 then no limit. - encoding: Set by user. - decoding: unused DTG active format information (additional aspect ratio information only used in DVB MPEG-2 transport streams) 0 if not set. - encoding: unused - decoding: Set by decoder. subpel ME quality - encoding: Set by user. - decoding: unused motion estimation prepass comparison function - encoding: Set by user. - decoding: unused prepass for motion estimation - encoding: Set by user. - decoding: unused amount of previous MV predictors (2a+1 x 2a+1 square) - encoding: Set by user. - decoding: unused interlaced DCT comparison function - encoding: Set by user. - decoding: unused macroblock comparison function (not supported yet) - encoding: Set by user. - decoding: unused subpixel motion estimation comparison function - encoding: Set by user. - decoding: unused motion estimation comparison function - encoding: Set by user. - decoding: unused debug - encoding: Set by user. - decoding: Set by user. debug - encoding: Set by user. - decoding: Set by user. the picture in the bitstream - encoding: Set by libavcodec. - decoding: Set by libavcodec. sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel. Numerator and denominator must be relatively prime and smaller than 256 for some video standards. - encoding: Set by user. - decoding: Set by libavcodec. prediction method (needed for huffyuv) - encoding: Set by user. - decoding: unused bits per sample/pixel from the demuxer (needed for huffyuv). - encoding: Set by libavcodec. - decoding: Set by user. dsp_mask could be add used to disable unwanted CPU features CPU features (i.e. MMX, SSE. ...) With the FORCE flag you may instead enable given CPU features. (Dangerous: Usable in case of misdetection, improper usage however will result into program crash.) error concealment flags - encoding: unused - decoding: Set by user. slice offsets in the frame in bytes - encoding: Set/allocated by libavcodec. - decoding: Set/allocated by user (or NULL). slice count - encoding: Set by libavcodec. - decoding: Set by user (or 0). IDCT algorithm, see FF_IDCT_* below. - encoding: Set by user. - decoding: Set by user. darkness masking (0-> disabled) - encoding: Set by user. - decoding: unused p block masking (0-> disabled) - encoding: Set by user. - decoding: unused spatial complexity masking (0-> disabled) - encoding: Set by user. - decoding: unused temporary complexity masking (0-> disabled) - encoding: Set by user. - decoding: unused luminance masking (0-> disabled) - encoding: Set by user. - decoding: unused DCT algorithm, see FF_DCT_* below - encoding: Set by user. - decoding: unused initial complexity for pass1 ratecontrol - encoding: Set by user. - decoding: unused qscale offset between P and I-frames - encoding: Set by user. - decoding: unused decoder bitstream buffer size - encoding: Set by user. - decoding: unused minimum bitrate - encoding: Set by user. - decoding: unused maximum bitrate - encoding: Set by user. - decoding: unused rate control equation - encoding: Set by user - decoding: unused ratecontrol override, see RcOverride - encoding: Allocated/set/freed by user. - decoding: unused ratecontrol qmin qmax limiting method 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax. - encoding: Set by user. - decoding: unused pass2 encoding statistics input buffer Concatenated stuff from stats_out of pass1 should be placed here. - encoding: Allocated/set/freed by user. - decoding: unused pass1 encoding statistics output buffer - encoding: Set by libavcodec. - decoding: unused 0-> h263 quant 1-> mpeg quant - encoding: Set by user. - decoding: unused If true, only parsing is done. The frame data is returned. Only MPEG audio decoders support this now. - encoding: unused - decoding: Set by user number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs. Size of the frame reordering buffer in the decoder. For MPEG-2 it is 1 IPB or 0 low delay IP. - encoding: Set by libavcodec. - decoding: Set by libavcodec. Called to release buffers which were allocated with get_buffer. A released buffer can be reused in get_buffer(). pic.data[*] must be set to NULL. May be called from a different thread if frame multithreading is used, but not by more than one thread at once, so does not need to be reentrant. - encoding: unused - decoding: Set by libavcodec, user can override. Called at the beginning of each frame to get a buffer for it. The function will set AVFrame.data[], AVFrame.linesize[]. AVFrame.extended_data[] must also be set, but it should be the same as AVFrame.data[] except for planar audio with more channels than can fit in AVFrame.data[]. In that case, AVFrame.data[] shall still contain as many data pointers as it can hold. if CODEC_CAP_DR1 is not set then get_buffer() must call avcodec_default_get_buffer() instead of providing buffers allocated by some other means. AVFrame.data[] should be 32- or 16-byte-aligned unless the CPU doesn't need it. avcodec_default_get_buffer() aligns the output buffer properly, but if get_buffer() is overridden then alignment considerations should be taken into account. @see avcodec_default_get_buffer() Video: If pic.reference is set then the frame will be read later by libavcodec. avcodec_align_dimensions2() should be used to find the required width and height, as they normally need to be rounded up to the next multiple of 16. If frame multithreading is used and thread_safe_callbacks is set, it may be called from a different thread, but not from more than one at once. Does not need to be reentrant. @see release_buffer(), reget_buffer() @see avcodec_align_dimensions2() Audio: Decoders request a buffer of a particular size by setting AVFrame.nb_samples prior to calling get_buffer(). The decoder may, however, utilize only part of the buffer by setting AVFrame.nb_samples to a smaller value in the output frame. Decoders cannot use the buffer after returning from avcodec_decode_audio4(), so they will not call release_buffer(), as it is assumed to be released immediately upon return. As a convenience, av_samples_get_buffer_size() and av_samples_fill_arrays() in libavutil may be used by custom get_buffer() functions to find the required data size and to fill data pointers and linesize. In AVFrame.linesize, only linesize[0] may be set for audio since all planes must be the same size. @see av_samples_get_buffer_size(), av_samples_fill_arrays() - encoding: unused - decoding: Set by libavcodec, user can override. Error recognition; higher values will detect more errors but may misdetect some more or less valid parts as errors. - encoding: unused - decoding: Set by user. qscale offset between IP and B-frames - encoding: Set by user. - decoding: unused strictly follow the standard (MPEG4, ...). - encoding: Set by user. - decoding: Set by user. Setting this to STRICT or higher means the encoder and decoder will generally do stupid things, whereas setting it to unofficial or lower will mean the encoder might produce output that is not supported by all spec-compliant decoders. Decoders don't differentiate between normal, unofficial and experimental (that is, they always try to decode things when they can) unless they are explicitly asked to behave stupidly (=strictly conform to the specs) chroma single coeff elimination threshold - encoding: Set by user. - decoding: unused luma single coefficient elimination threshold - encoding: Set by user. - decoding: unused Work around bugs in encoders which sometimes cannot be detected automatically. - encoding: Set by user - decoding: Set by user Private data of the user, can be used to carry app specific stuff. - encoding: Set by user. - decoding: Set by user. number of bits used for the previously encoded frame - encoding: Set by libavcodec. - decoding: unused obsolete FIXME remove maximum number of B-frames between non-B-frames Note: The output will be delayed by max_b_frames+1 relative to the input. - encoding: Set by user. - decoding: unused maximum quantizer difference between frames - encoding: Set by user. - decoding: unused maximum quantizer - encoding: Set by user. - decoding: unused minimum quantizer - encoding: Set by user. - decoding: unused Encoding: Number of frames delay there will be from the encoder input to the decoder output. (we assume the decoder matches the spec) Decoding: Number of frames delay in addition to what a standard decoder as specified in the spec would produce. - encoding: Set by libavcodec. - decoding: Set by libavcodec. Samples per packet, initialized when calling 'init'. If non NULL, 'draw_horiz_band' is called by the libavcodec decoder to draw a horizontal band. It improves cache usage. Not all codecs can do that. You must check the codec capabilities beforehand. When multithreading is used, it may be called from multiple threads at the same time; threads might draw different parts of the same AVFrame, or multiple AVFrames, and there is no guarantee that slices will be drawn in order. The function is also used by hardware acceleration APIs. It is called at least once during frame decoding to pass the data needed for hardware render. In that mode instead of pixel data, AVFrame points to a structure specific to the acceleration API. The application reads the structure and can change some fields to indicate progress or mark state. - encoding: unused - decoding: Set by user. @param height the height of the slice @param y the y position of the slice @param type 1->top field, 2->bottom field, 3->frame @param offset offset into the AVFrame.data from which the slice should be read Pixel format, see PIX_FMT_xxx. May be set by the demuxer if known from headers. May be overriden by the decoder if it knows better. - encoding: Set by user. - decoding: Set by user if known, overridden by libavcodec if known callback to negotiate the pixelFormat @param fmt is the list of formats which are supported by the codec, it is terminated by -1 as 0 is a valid format, the formats are ordered by quality. The first is always the native one. @return the chosen format - encoding: unused - decoding: Set by user, if not set the native format will be chosen. Supported pixel format. Only hardware accelerated formats are supported here. the number of pictures in a group of pictures, or 0 for intra_only - encoding: Set by user. - decoding: unused picture width / height. - encoding: MUST be set by user. - decoding: Set by libavcodec. Note: For compatibility it is possible to set this instead of coded_width/height before decoding. This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented. For fixed-fps content, timebase should be 1/framerate and timestamp increments should be identically 1. - encoding: MUST be set by user. - decoding: Set by libavcodec. some codecs need / can use extradata like Huffman tables. mjpeg: Huffman tables rv10: additional flags mpeg4: global headers (they can be in the bitstream or here) The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger than extradata_size to avoid prolems if it is read with the bitstream reader. The bytewise contents of extradata must not depend on the architecture or CPU endianness. - encoding: Set/allocated/freed by libavcodec. - decoding: Set/allocated/freed by user. Motion estimation algorithm used for video coding. 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex), 8 (umh), 9 (iter), 10 (tesa) [7, 8, 10 are x264 specific, 9 is snow specific] - encoding: MUST be set by user. - decoding: unused Some codecs need additional format info. It is stored here. If any muxer uses this then ALL demuxers/parsers AND encoders for the specific codec MUST set it correctly otherwise stream copy breaks. In general use of this field by muxers is not recommended. - encoding: Set by libavcodec. - decoding: Set by libavcodec. (FIXME: Is this OK?) CODEC_FLAG_*. - encoding: Set by user. - decoding: Set by user. number of bits the bitstream is allowed to diverge from the reference. the reference can be CBR (for CBR pass1) or VBR (for pass2) - encoding: Set by user; unused for constant quantizer encoding. - decoding: unused the average bitrate - encoding: Set by user; unused for constant quantizer encoding. - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream. information on struct for av_log - set by avcodec_alloc_context3 reordered pos from the last AVPacket that has been input into the decoder Code outside libavcodec should access this field using: av_opt_ptr(avcodec_get_frame_class(), frame, "pkt_pos"); - encoding: unused - decoding: Read by user. frame timestamp estimated using various heuristics, in stream time base Code outside libavcodec should access this field using: av_opt_ptr(avcodec_get_frame_class(), frame, "best_effort_timestamp"); - encoding: unused - decoding: set by libavcodec, read by user. format of the frame, -1 if unknown or unset Values correspond to enum PixelFormat for video frames, enum AVSampleFormat for audio) - encoding: unused - decoding: Read by user. width and height of the video frame - encoding: unused - decoding: Read by user. sample aspect ratio for the video frame, 0/1 if unknown\unspecified - encoding: unused - decoding: Read by user. pointers to the data planes/channels. For video, this should simply point to data[]. For planar audio, each channel has a separate data pointer, and linesize[0] contains the size of each channel buffer. For packed audio, there is just one data pointer, and linesize[0] contains the total size of the buffer for all channels. Note: Both data and extended_data will always be set by get_buffer(), but for planar audio with more channels that can fit in data, extended_data must be used by the decoder in order to access all channels. encoding: unused decoding: set by AVCodecContext.get_buffer() number of audio samples (per channel) described by this frame - encoding: unused - decoding: Set by libavcodec used by multithreading to store frame-specific info - encoding: Set by libavcodec. - decoding: Set by libavcodec. the AVCodecContext which ff_thread_get_buffer() was last called on - encoding: Set by libavcodec. - decoding: Set by libavcodec. main external API structure. New fields can be added to the end with minor version bumps. Removal, reordering and changes to existing fields require a major version bump. Please use AVOptions (av_opt* / av_set/get*()) to access these fields from user applications. sizeof(AVCodecContext) must not be used outside libav*. dts from the last AVPacket that has been input into the decoder - encoding: unused - decoding: Read by user. reordered pts from the last AVPacket that has been input into the decoder - encoding: unused - decoding: Read by user. hardware accelerator private data (FFmpeg-allocated) - encoding: unused - decoding: Set by libavcodec reordered opaque 64bit (generally an integer or a double precision float PTS but can be anything). The user sets AVCodecContext.reordered_opaque to represent the input at that time, the decoder reorders values as needed and sets AVFrame.reordered_opaque to exactly one of the values provided by the user through AVCodecContext.reordered_opaque @deprecated in favor of pkt_pts - encoding: unused - decoding: Read by user. motion reference frame index the order in which these are stored can depend on the codec. - encoding: Set by user. - decoding: Set by libavcodec. DCT coefficients - encoding: unused - decoding: Set by libavcodec. codec suggestion on buffer type if != 0 - encoding: unused - decoding: Set by libavcodec. (before get_buffer() call)). Tell user application that palette has changed from previous frame. - encoding: ??? (no palette-enabled encoder yet) - decoding: Set by libavcodec. (default 0). Pan scan. - encoding: Set by user. - decoding: Set by libavcodec. If the content is interlaced, is top field displayed first. - encoding: Set by user. - decoding: Set by libavcodec. The content of the picture is interlaced. - encoding: Set by user. - decoding: Set by libavcodec. (default 0) When decoding, this signals how much the picture must be delayed. extra_delay = repeat_pict / (2*fps) - encoding: unused - decoding: Set by libavcodec. for some private data of the user - encoding: unused - decoding: Set by user. log2 of the size of the block which a single vector in motion_val represents: (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2) - encoding: unused - decoding: Set by libavcodec. macroblock type table mb_type_base + mb_width + 2 - encoding: Set by user. - decoding: Set by libavcodec. mbskip_table[mb]>=1 if MB didn't change stride= mb_width = (width+15)>>4 - encoding: unused - decoding: Set by libavcodec. QP store stride - encoding: unused - decoding: Set by libavcodec. QP table - encoding: unused - decoding: Set by libavcodec. is this picture used as reference The values for this are the same as the MpegEncContext.picture_structure variable, that is 1->top field, 2->bottom field, 3->frame/both fields. Set to 4 for delayed, non-reference frames. - encoding: unused - decoding: Set by libavcodec. (before get_buffer() call)). @deprecated unused quality (between 1 (good) and FF_LAMBDA_MAX (bad)) - encoding: Set by libavcodec. for coded_picture (and set by user for input). - decoding: Set by libavcodec. picture number in display order - encoding: set by - decoding: Set by libavcodec. picture number in bitstream order - encoding: set by - decoding: Set by libavcodec. presentation timestamp in time_base units (time when frame should be shown to user) If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed. - encoding: MUST be set by user. - decoding: Set by libavcodec. 1 -> keyframe, 0-> not - encoding: Set by libavcodec. - decoding: Set by libavcodec. pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer. This isn't used by libavcodec unless the default get/release_buffer() is used. - encoding: - decoding: Size, in bytes, of the data for each picture/channel plane. For audio, only linesize[0] may be set. For planar audio, each channel plane must be the same size. - encoding: Set by user (video only) - decoding: set by AVCodecContext.get_buffer() pointer to the picture/channel planes. This might be different from the first allocated byte - encoding: Set by user - decoding: set by AVCodecContext.get_buffer() Audio Video Frame. New fields can be added to the end of AVFRAME with minor version bumps. Similarly fields that are marked as to be only accessed by av_opt_ptr() can be reordered. This allows 2 forks to add fields without breaking compatibility with each other. Removal, reordering and changes in the remaining cases require a major version bump. sizeof(AVFrame) must not be used outside libavcodec. Time difference in AVStream->time_base units from the pts of this packet to the point at which the output from the decoder has converged independent from the availability of previous frames. That is, the frames are virtually identical no matter if decoding started from the very first frame or from this keyframe. Is AV_NOPTS_VALUE if unknown. This field is not the display duration of the current packet. This field has no meaning if the packet does not have AV_PKT_FLAG_KEY set. The purpose of this field is to allow seeking in streams that have no keyframes in the conventional sense. It corresponds to the recovery point SEI in H.264 and match_time_delta in NUT. It is also essential for some types of subtitle streams to ensure that all subtitles are correctly displayed after seeking. Duration of this packet in AVStream->time_base units, 0 if unknown. Equals next_pts - this_pts in presentation order. A combination of AV_PKT_FLAG values Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed. Can be AV_NOPTS_VALUE if it is not stored in the file. Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will be presented to the user. Can be AV_NOPTS_VALUE if it is not stored in the file. pts MUST be larger or equal to dts as presentation cannot happen before decompression, unless one wants to view hex dumps. Some formats misuse the terms dts and pts/cts to mean something different. Such timestamps must be converted to true pts/dts before they are stored in AVPacket. position of the top left corner in 1/16 pel for up to 3 fields/frames - encoding: Set by user. - decoding: Set by libavcodec. width and height in 1/16 pel - encoding: Set by user. - decoding: Set by libavcodec. id - encoding: Set by user. - decoding: Set by libavcodec. The parent program guarantees that the input for B-frames containing streams is not written to for at least s->max_b_frames+1 frames, if this is not set the input will be copied. @defgroup deprecated_flags Deprecated codec flags Use corresponding private codec options instead. @{ @} Codec uses get_buffer() for allocating buffers and supports custom allocators. If not set, it might not use get_buffer() at all or use operations that assume the buffer was allocated by avcodec_default_get_buffer. Encoder or decoder requires flushing with NULL input at the end in order to give the complete and correct output. NOTE: If this flag is not set, the codec is guaranteed to never be fed with with NULL data. The user can still send NULL data to the public encode or decode function, but libavcodec will not pass it along to the codec unless this flag is set. Decoders: The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL, avpkt->size=0 at the end to get the delayed data until the decoder no longer returns frames. Encoders: The encoder needs to be fed with NULL data at the end of encoding until the encoder no longer returns data. NOTE: For encoders implementing the AVCodec.encode2() function, setting this flag also means that the encoder must set the pts and duration for each output packet. If this flag is not set, the pts and duration will be determined by libavcodec from the input frame. Codec can be fed a final frame with a smaller size. This can be used to prevent truncation of the last audio samples. Codec can export data for HW decoding (VDPAU). Codec can output multiple frames per AVPacket Normally demuxers return one frame at a time, demuxers which do not do are connected to a parser to split what they return into proper frames. This flag is reserved to the very rare category of codecs which have a bitstream that cannot be split into frames without timeconsuming operations like full decoding. Demuxers carring such bitstreams thus may return multiple frames in a packet. This has many disadvantages like prohibiting stream copy in many cases thus it should only be considered as a last resort. Codec is experimental and is thus avoided in favor of non experimental encoders Codec should fill in channel configuration and samplerate instead of container Codec is able to deal with negative linesizes Codec supports frame-level multithreading. Codec supports slice-based (or partition-based) multithreading. Codec supports changed parameters at any point. Codec supports avctx->thread_count == 0 (auto). Audio encoder supports receiving a different number of samples in each call. Codec is lossless. Pan Scan area. This specifies the area which should be displayed. Note there may be multiple such areas for one frame. LPC analysis type Determine which LPC analysis algorithm to use. - encoding: Set by user - decoding: unused X X 3 4 X X are luma samples, 1 2 1-6 are possible chroma positions X X 5 6 X 0 is undefined/unknown position This defines the location of chroma samples. - encoding: Set by user - decoding: Set by libavcodec Return default channel layout for a given number of channels. Return the number of channels in the channel layout. @file audio conversion routines @addtogroup lavu_audio @{ @defgroup channel_masks Audio channel masks @{ Channel mask value used for AVCodecContext.request_channel_layout to indicate that the user requests the channel order of the decoder output to be the native codec channel order. @} @defgroup channel_mask_c Audio channel convenience macros @{ @} * Return a channel layout id that matches name, 0 if no match. * name can be one or several of the following notations, * separated by '+' or '|': * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0, * 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix); * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC, * SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR); * - a number of channels, in decimal, optionnally followed by 'c', yielding * the default channel layout for that number of channels (@see * av_get_default_channel_layout); * - a channel layout mask, in hexadecimal starting with "0x" (see the * AV_CH_* macros). + Example: "stereo+FC" = "2+FC" = "2c+1c" = "0x7" Free all the memory allocated for an AVDictionary struct and all keys and values. Copy entries from one AVDictionary struct into another. @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL, this function will allocate a struct for you and put it in *dst @param src pointer to source AVDictionary struct @param flags flags to use when setting entries in *dst @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag Get a dictionary entry with matching key. @param prev Set to the previous matching element to find the next. If set to NULL the first matching element is returned. @param flags Allows case as well as suffix-insensitive comparisons. @return Found entry or NULL, changing key or value leads to undefined behavior. Disables cpu detection and forces the specified flags. Return the flags which specify extensions supported by the CPU. Fill channel data pointers and linesize for samples with sample format sample_fmt. The pointers array is filled with the pointers to the samples data: for planar, set the start point of each channel's data within the buffer, for packed, set the start point of the entire buffer only. The linesize array is filled with the aligned size of each channel's data buffer for planar layout, or the aligned size of the buffer for all channels for packed layout. @param[out] audio_data array to be filled with the pointer for each channel @param[out] linesize calculated linesize @param buf the pointer to a buffer containing the samples @param nb_channels the number of channels @param nb_samples the number of samples in a single channel @param sample_fmt the sample format @param align buffer size alignment (1 = no alignment required) @return 0 on success or a negative error code on failure Get the required buffer size for the given audio parameters. @param[out] linesize calculated linesize, may be NULL @param nb_channels the number of channels @param nb_samples the number of samples in a single channel @param sample_fmt the sample format @return required buffer size, or negative error code on failure Check if the sample format is planar. @param sample_fmt the sample format to inspect @return 1 if the sample format is planar, 0 if it is interleaved Return number of bytes per sample. @param sample_fmt the sample format @return number of bytes per sample or zero if unknown for the given sample format @deprecated Use av_get_bytes_per_sample() instead. Generate a string corresponding to the sample format with sample_fmt, or a header if sample_fmt is negative. @param buf the buffer where to write the string @param buf_size the size of buf @param sample_fmt the number of the sample format to print the corresponding info string, or a negative value to print the corresponding header. @return the pointer to the filled buffer or NULL if sample_fmt is unknown or in case of other errors Return the name of sample_fmt, or NULL if sample_fmt is not recognized. @} @} all in native-endian format Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE on error. audio sample format - encoding: Set by user. - decoding: Set by libavcodec. desired sample format - encoding: Not used. - decoding: Set by user. Decoder will decode to this format if it can. Return x default pointer in case p is NULL. av_dlog macros Useful to print debug messages that shouldn't get compiled in normally. Skip repeated messages, this requires the user app to use av_log() instead of (f)printf as the 2 would otherwise interfere and lead to "Last message repeated x times" messages below (f)printf messages with some bad luck. Also to receive the last, "last repeated" line if any, the user app must call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end Format a line of log the same way as the default callback. @param line buffer to receive the formated line @param line_size size of the buffer @param print_prefix used to store whether the prefix must be printed; must point to a persistent integer initially set to 1 Something went really wrong and we will crash now. Something went wrong and recovery is not possible. For example, no header was found for a format which depends on headers or an illegal combination of parameters is used. Something went wrong and cannot losslessly be recovered. However, not all future data is affected. Something somehow does not look correct. This may or may not lead to problems. An example would be the use of '-vstrict -2'. Stuff which is only useful for libav* developers. Send the specified message to the log if the level is less than or equal to the current av_log_level. By default, all logging messages are sent to stderr. This behavior can be altered by setting a different av_vlog callback function. @param avcl A pointer to an arbitrary struct of which the first field is a pointer to an AVClass struct. @param level The importance level of the message, lower values signifying higher importance. @param fmt The format string (printf-compatible) that specifies how subsequent arguments are converted to output. @see av_vlog Return an AVClass corresponding to next potential AVOptions-enabled child. The difference between child_next and this is that child_next iterates over _already existing_ objects, while child_class_next iterates over _all possible_ children. Return next AVOptions-enabled child or NULL Offset in the structure where a pointer to the parent context for loging is stored. for example a decoder that uses eval.c could pass its AVCodecContext to eval as such parent context. And a av_log() implementation could then display the parent context can be NULL of course Offset in the structure where log_level_offset is stored. 0 means there is no such variable LIBAVUTIL_VERSION with which this structure was created. This is used to allow fields to be added without requiring major version bumps everywhere. a pointer to the first option specified in the class if any or NULL @see av_set_default_options() A pointer to a function which returns the name of a context instance ctx associated with the class. The name of the class; usually it is the same name as the context structure type to which the AVClass is associated. Compare 2 integers modulo mod. That is we compare integers a and b for which only the least significant log2(mod) bits are known. @param mod must be a power of 2 @return a negative value if a is smaller than b a positive value if a is greater than b 0 if a equals b Compare 2 timestamps each in its own timebases. The result of the function is undefined if one of the timestamps is outside the int64_t range when represented in the others timebase. @return -1 if ts_a is before ts_b, 1 if ts_a is after ts_b or 0 if they represent the same position Rescale a 64-bit integer by 2 rational numbers. Rescale a 64-bit integer with specified rounding. A simple a*b/c isn't possible as it can overflow. Rescale a 64-bit integer with rounding to nearest. A simple a*b/c isn't possible as it can overflow. @} @addtogroup lavu_math @{ Find the nearest value in q_list to q. @param q_list an array of rationals terminated by {0, 0} @return the index of the nearest value found in the array @return 1 if q1 is nearer to q than q2, -1 if q2 is nearer than q1, 0 if they have the same distance. Convert a double precision floating point number to a rational. inf is expressed as {1,0} or {-1,0} depending on the sign. @param d double to convert @param max the maximum allowed numerator and denominator @return (AVRational) d Subtract one rational from another. @param b first rational @param c second rational @return b-c Add two rationals. @param b first rational @param c second rational @return b+c Divide one rational by another. @param b first rational @param c second rational @return b/c Multiply two rationals. @param b first rational @param c second rational @return b*c Convert rational to double. @param a rational to convert @return (double) a Set the maximum size that may me allocated in one block. Multiply two size_t values checking for overflow. @return 0 if success, AVERROR(EINVAL) if overflow. Add an element to a dynamic array. @param tab_ptr Pointer to the array. @param nb_ptr Pointer to the number of elements in the array. @param elem Element to be added. Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer pointing to it to NULL. @param ptr Pointer to the pointer to the memory block which should be freed. @see av_free() Duplicate the string s. @param s string to be duplicated @return Pointer to a newly allocated string containing a copy of s or NULL if the string cannot be allocated. Allocate a block of nmemb * size bytes with alignment suitable for all memory accesses (including vectors if available on the CPU) and zero all the bytes of the block. The allocation will fail if nmemb * size is greater than or equal to INT_MAX. @param nmemb @param size @return Pointer to the allocated block, NULL if it cannot be allocated. Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if available on the CPU) and zero all the bytes of the block. @param size Size in bytes for the memory block to be allocated. @return Pointer to the allocated block, NULL if it cannot be allocated. @see av_malloc() Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). @param ptr Pointer to the memory block which should be freed. @note ptr = NULL is explicitly allowed. @note It is recommended that you use av_freep() instead. @see av_freep() Allocate or reallocate a block of memory. This function does the same thing as av_realloc, except: - It takes two arguments and checks the result of the multiplication for integer overflow. - It frees the input block in case of failure, thus avoiding the memory leak with the classic "buf = realloc(buf); if (!buf) return -1;". Allocate or reallocate a block of memory. If ptr is NULL and size > 0, allocate a new block. If size is zero, free the memory block pointed to by ptr. @param ptr Pointer to a memory block already allocated with av_malloc(z)() or av_realloc() or NULL. @param size Size in bytes for the memory block to be allocated or reallocated. @return Pointer to a newly reallocated block or NULL if the block cannot be reallocated or the function is used to free the memory block. @see av_fast_realloc() @} @addtogroup lavu_mem @{ Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if available on the CPU). @param size Size in bytes for the memory block to be allocated. @return Pointer to the allocated block, NULL if the block cannot be allocated. @see av_mallocz() Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form. @param val Output value, must be an lvalue of type uint32_t. @param GET_BYTE Expression reading one byte from the input. Evaluated up to 7 times (4 for the currently assigned Unicode range). With a memory buffer input, this could be *ptr++. @param ERROR Expression to be evaluated on invalid input, typically a goto statement. Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form. @param val Output value, must be an lvalue of type uint32_t. @param GET_16BIT Expression returning two bytes of UTF-16 data converted to native byte order. Evaluated one or two times. @param ERROR Expression to be evaluated on invalid input, typically a goto statement. @def PUT_UTF8(val, tmp, PUT_BYTE) Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long). @param val is an input-only argument and should be of type uint32_t. It holds a UCS-4 encoded Unicode character that is to be converted to UTF-8. If val is given as a function it is executed only once. @param tmp is a temporary variable and should be of type uint8_t. It represents an intermediate value during conversion that is to be output by PUT_BYTE. @param PUT_BYTE writes the converted UTF-8 bytes to any proper destination. It could be a function or a statement, and uses tmp as the input byte. For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be executed up to 4 times for values in the valid UTF-8 range and up to 7 times in the general case, depending on the length of the converted Unicode character. @def PUT_UTF16(val, tmp, PUT_16BIT) Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes). @param val is an input-only argument and should be of type uint32_t. It holds a UCS-4 encoded Unicode character that is to be converted to UTF-16. If val is given as a function it is executed only once. @param tmp is a temporary variable and should be of type uint16_t. It represents an intermediate value during conversion that is to be output by PUT_16BIT. @param PUT_16BIT writes the converted UTF-16 data to any proper destination in desired endianness. It could be a function or a statement, and uses tmp as the input byte. For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be executed 1 or 2 times depending on input character. @file memory handling functions @file Macro definitions for various function/variable attributes @file error code definitions @addtogroup lavu_error @{ This is semantically identical to AVERROR_BUG it has been introduced in Libav after our AVERROR_BUG and with a modified value. Put a description of the AVERROR code errnum in errbuf. In case of failure the global variable errno is set to indicate the error. Even in case of failure av_strerror() will print a generic error message indicating the errnum provided to errbuf. @param errnum error code to describe @param errbuf buffer to which description is written @param errbuf_size the size in bytes of errbuf @return 0 on success, a negative value if a description for errnum cannot be found Count number of bits set to one in x @param x value to count bits of @return the number of bits set to one in x Count number of bits set to one in x @param x value to count bits of @return the number of bits set to one in x Compute ceil(log2(x)). * @param x value used to compute ceil(log2(x)) * @return computed ceiling of log2(x) Clip a float value into the amin-amax range. @param a value to clip @param amin minimum value of the clip range @param amax maximum value of the clip range @return clipped value Clip a signed integer to an unsigned power of two range. @param a value to clip @param p bit position to clip at @return clipped value Clip a signed 64-bit integer value into the -2147483648,2147483647 range. @param a value to clip @return clipped value Clip a signed integer value into the -32768,32767 range. @param a value to clip @return clipped value Clip a signed integer value into the 0-65535 range. @param a value to clip @return clipped value Clip a signed integer value into the -128,127 range. @param a value to clip @return clipped value Clip a signed integer value into the 0-255 range. @param a value to clip @return clipped value @file common internal and external API header Clip a signed integer value into the amin-amax range. @param a value to clip @param amin minimum value of the clip range @param amax maximum value of the clip range @return clipped value @file Macro definitions for various function/variable attributes Disable warnings about deprecated features This is useful for sections of code kept for backward compatibility and scheduled for removal. Mark a variable as used and prevent the compiler from optimizing it away. This is useful for variables accessed only from inline assembler without the compiler being aware. @} @file common internal and external API header Return a single letter to describe the given picture type pict_type. @param[in] pict_type the picture type @return a single character representing the picture type, '?' if pict_type is unknown @defgroup lavu_const Constants @{ @defgroup lavu_enc Encoding specific @note those definition should move to avcodec @{ @} @defgroup lavu_time Timestamp specific FFmpeg internal timebase and timestamp definitions @{ @brief Undefined timestamp value Usually reported by demuxer that work on containers that do not provide either pts or dts. Internal time base represented as integer Internal time base represented as fractional value @} @} @defgroup lavu_picture Image related AVPicture types, pixel formats and basic image planes manipulation. @{ Picture type of the frame, see ?_TYPE below. - encoding: Set by libavcodec. for coded_picture (and set by user for input). - decoding: Set by libavcodec. Return a string describing the media_type enum, NULL if media_type is unknown. @} @addtogroup lavu_media Media Type @brief Media Type Type of codec implemented by the hardware accelerator. See AVMEDIA_TYPE_xxx Get the type of the given codec. Return the libavutil license. Return the libavutil build-time configuration. @file external API header @mainpage @section libav_intro Introduction This document describe the usage of the different libraries provided by FFmpeg. @li @ref libavc "libavcodec" encoding/decoding library @li @subpage libavfilter graph based frame editing library @li @ref libavf "libavformat" I/O and muxing/demuxing library @li @ref lavd "libavdevice" special devices muxing/demuxing library @li @ref lavu "libavutil" common utility library @li @subpage libpostproc post processing library @li @subpage libswscale color conversion and scaling library @defgroup lavu Common utility functions @brief libavutil contains the code shared across all the other FFmpeg libraries @note In order to use the functions provided by avutil you must include the specific header. @{ @defgroup lavu_crypto Crypto and Hashing @{ @} @defgroup lavu_math Maths @{ @} @defgroup lavu_string String Manipulation @{ @} @defgroup lavu_mem Memory Management @{ @} @defgroup lavu_data Data Structures @{ @} @defgroup lavu_audio Audio related @{ @} @defgroup lavu_error Error Codes @{ @} @defgroup lavu_misc Other @{ @defgroup lavu_internal Internal Not exported functions, for internal usage only @{ @} @defgroup preproc_misc Preprocessor String Macros String manipulation macros @{ @} @defgroup version_utils Library Version Macros Useful to check and match library version in order to maintain backward compatibility. @{ @} @defgroup lavu_ver Version and Build diagnostics Macros and function useful to check at compiletime and at runtime which version of libavutil is in use. @{ @} @defgroup depr_guards Deprecation guards Those FF_API_* defines are not part of public API. They may change, break or disappear at any time. They are used mostly internally to mark code that will be removed on the next major version. @{ @} @addtogroup lavu_ver @{ Return the LIBAVUTIL_VERSION_INT constant. Enumeration of some video codecs from FFmpeg library, which are available for writing video files. Raw (uncompressed) video. MPEG-2 part 2. Flash Video (FLV) / Sorenson Spark / Sorenson H.263. H.263+ / H.263-1998 / H.263 version 2. MPEG-4 part 2 Microsoft variant version 3. MPEG-4 part 2 Microsoft variant version 2. Windows Media Video 8. Windows Media Video 7. MPEG-4 part 2. Default video codec, which FFmpeg library selects for the specified file format.