1 Avcodec_find_decoder ()
/**
* 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.
*/
Avcodec *avcodec_find_decoder (enum codecid ID);
Find a registered audio and video decoder with code ID
Introduction of #include "libavcodec/avcodec.h"
Implementation in: \FFMPEG\LIBAVCODEC\UTILS.C
Before locating the decoder, you must first call Av_register_all to register all supported decoders
Lookup successfully Returns the decoder pointer, otherwise NULL is returned
The audio and video decoder is stored in a linked list, and during the lookup process, the function iterates through the list, looking for the decoder by comparing its ID.
2 avcodec_find_decoder_by_name ()
/**
* Find a registered decoder with the specified name.
*
* @param name Name of the requested decoder
* @return A Decoder If one was found, NULL otherwise.
*/
Avcodec *avcodec_find_decoder_by_name (const char *name);
Find a registered audio and video decoder with a specified name
Introduction of #include "libavcodec/avcodec.h"
Implementation in: \FFMPEG\LIBAVCODEC\UTILS.C
Before locating the decoder, you must first call Av_register_all to register all supported decoders
Lookup successfully Returns the decoder pointer, otherwise NULL is returned
The audio and video decoder is stored in a linked list, and during the lookup process, the function iterates through the list, looking for the decoder by comparing its name.
3 Avcodec_find_encoder ()
/**
* Find a registered encoder with a matching codec ID.
*
* @param ID Codecid of the requested encoder
* @return An encoder If one is found, NULL otherwise.
*/
Avcodec *avcodec_find_encoder (enum codecid ID);
Find a registered audio and video encoder with code ID
Introduced #include "libavcodec/avcodec.h"//implemented in: \FFMPEG\LIBAVCODEC\UTILS.C
Before you can find an encoder, you must first call Av_register_all to register all supported Encoders
Lookup succeeded in returning encoder pointer, otherwise NULL is returned
Audio and video encoders are stored in a linked list, and during the lookup process, the function iterates through the list, looking for the ID of the encoder by comparing it
4 avcodec_find_encoder_by_name ()
/**
* Find a registered encoder with the specified name.
*
* @param name Name of the requested encoder
* @return An encoder If one is found, NULL otherwise.
*/
Avcodec *avcodec_find_encoder_by_name (const char *name);
Find a registered audio and video encoder with a specified name
Introduced #include "libavcodec/avcodec.h"//implemented in: \FFMPEG\LIBAVCODEC\UTILS.C
Before you can find an encoder, you must first call Av_register_all to register all supported Encoders
Lookup succeeded in returning encoder pointer, otherwise NULL is returned
Audio and video encoders are stored in a linked list, and during the lookup process, the function traverses the list from beginning to end, by comparing the name of the encoder to find
5 Avcodec_open ()
/**
* Initialize the Avcodeccontext to use the given avcodec. Prior to using this
* Function The context has to be allocated.
*
* The Functions Avcodec_find_decoder_by_name (), Avcodec_find_encoder_by_name (),
* Avcodec_find_decoder () and Avcodec_find_encoder () provide an easy to
* Retrieving a codec.
*
* @warning This function was not thread safe!
*
* @code
* Avcodec_register_all ();
* codec = Avcodec_find_decoder (codec_id_h264);
* IF (!CODEC)
* EXIT (1);
*
* context = Avcodec_alloc_context ();
*
* IF (Avcodec_open (context, codec) < 0)
* EXIT (1);
* @endcode
*
* @param avctx the context which would be set up to use the given codec.
* @param codec the codec to use within the context.
* @return Zero on success, a negative value on error
* @see Avcodec_alloc_context, Avcodec_find_decoder, Avcodec_find_encoder, Avcodec_close
*/
int Avcodec_open (Avcodeccontext *avctx, Avcodec *codec);
Initializes the avcodeccontext with the given Avcodec
Introduction of # include "Libavcodec/avcodec.h"
Method: Avcodec_find_decoder_by_name (), Avcodec_find_encoder_by_name (), Avcodec_find_decoder () and Avcodec_find_ Encoder () provides a quick way to get a codec
This method is used in both encoding and decoding.
Return 0 o'clock successful, open as output when the parameter setting is incorrect, the call fails 6 Av_guess_format ()
/**
* 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
*/
Avoutputformat *av_guess_format (const char *short_name,
const Char *filename,
const char *mime_type);
Returns the most appropriate output format that has been registered
Introduction of # include "Libavformat/avformat.h"
Can be obtained through the const char *short_name, such as "MPEG"
can also be obtained through the const char *filename, such as "E:\a.mp4"
7 Av_new_stream ()
/**
* Add a new stream to a media file.
*
* Can only is called in the Read_header () function. IF the flag
* Avfmtctx_noheader is in the format context and then new streams
* Can is added in Read_packet too.
*
* @param s media file handle
* @param ID file-format-dependent stream ID
*/
Avstream *av_new_stream (avformatcontext *s, int id);
Adds a stream to the media file, typically adding a stream of audio and video to the media file container as output
Introduction of #include "Libavformat/avformat.h"
When you open the source file again, the user typically does not need to call the method directly 8 Dump_format ()
#if Ff_api_dump_format
/**
* @deprecated deprecated in favor of Av_dump_format ().
*/
attribute_deprecated void Dump_format (Avformatcontext *ic,
int index,
const Char *url,
int is_output);
#endif//The function is to check whether the parameters set in the initialization process conform to specifications//In some versions av_ Dump_format 9 av_set_parameters ()
#if ff_api_format_parameters
/**
* @deprecated Pass the options to Avformat_write_header directly.
*/
attribute_deprecated int av_set_parameters (Avformatcontext *s, avformatparameters *ap); #endif//Set initialization parameters//Disapprove of skipping this method, call Avformat_write_header/av_write_header Av_write_header () directly
#if ff_api_format_parameters
/**
* 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 is some other time base
*
* @param s media file handle
* @return 0 if OK, averror_xxx on Error
*
* @deprecated use Avformat_write_header.
*/
attribute_deprecated int Av_write_header (Avformatcontext *s);
#endif//write the stream header information to the media file//Return 0 success