/** * Print detailed information about the input or output format, such as * duration, bitrate, streams, container, programs, metadata, side data, * codec and time base. * * @param ic the context to analyze * @param index index of the stream to dump information about * @param url the URL to print, such as source or destination file * @param is_output Select whether the specified context is an input(0) or output(1) */ voidav_dump_format(AVFormatContext *ic, int index, constchar *url, int is_output);
AVCodecParameters { /** * General type of the encoded data. */ enumAVMediaTypecodec_type; /** * Specific type of the encoded data (the codec used). */ enumAVCodecIDcodec_id; /** * Additional information about the codec (corresponds to the AVI FOURCC). */ uint32_t codec_tag; /** * - video: the pixel format, the value corresponds to enum AVPixelFormat. * - audio: the sample format, the value corresponds to enum AVSampleFormat. */ int format; /** * Video only. The dimensions of the video frame in pixels. */ int width; int height; /** * Audio only. The channel layout bitmask. May be 0 if the channel layout is * unknown or unspecified, otherwise the number of bits set must be equal to * the channels field. * @deprecated use ch_layout */ attribute_deprecated uint64_t channel_layout; int channels; /** * Audio only. The number of audio samples per second. */ int sample_rate; /** * Audio only. Audio frame size, if known. Required by some formats to be static. */ int frame_size; }
1 2 3 4 5 6 7 8 9
enumAVMediaType { AVMEDIA_TYPE_UNKNOWN = -1, ///< Usually treated as AVMEDIA_TYPE_DATA AVMEDIA_TYPE_VIDEO, AVMEDIA_TYPE_AUDIO, AVMEDIA_TYPE_DATA, ///< Opaque data information usually continuous AVMEDIA_TYPE_SUBTITLE, AVMEDIA_TYPE_ATTACHMENT, ///< Opaque data information usually sparse AVMEDIA_TYPE_NB };
typedefstructAVPacket { /** * A reference to the reference-counted buffer where the packet data is stored. * May be NULL, then the packet data is not reference-counted. */ AVBufferRef *buf; /** * 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. */ int64_t pts; /** * 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. */ int64_t dts; uint8_t *data; int size; int stream_index; /** * A combination of AV_PKT_FLAG values */ int flags; /** * Additional packet data that can be provided by the container. * Packet can contain several types of side information. */ AVPacketSideData *side_data; int side_data_elems;
/** * Duration of this packet in AVStream->time_base units, 0 if unknown. * Equals next_pts - this_pts in presentation order. */ int64_t duration;
int64_t pos; ///< byte position in stream, -1 if unknown
/** * for some private data of the user */ void *opaque;
/** * AVBufferRef for free use by the API user. FFmpeg will never check the * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when * the packet is unreferenced. av_packet_copy_props() calls create a new * reference with av_buffer_ref() for the target packet's opaque_ref field. * * This is unrelated to the opaque field, although it serves a similar * purpose. */ AVBufferRef *opaque_ref;
/** * Time base of the packet's timestamps. * In the future, this field may be set on packets output by encoders or * demuxers, but its value will be by default ignored on input to decoders * or muxers. */ AVRational time_base; } AVPacket;
/** * Setup a new reference to the data described by a given packet * * If src is reference-counted, setup dst as a new reference to the * buffer in src. Otherwise allocate a new buffer in dst and copy the * data from src into it. * * All the other fields are copied from src. * * @see av_packet_unref * * @param dst Destination packet. Will be completely overwritten. * @param src Source packet * * @return 0 on success, a negative AVERROR on error. On error, dst * will be blank (as if returned by av_packet_alloc()). */ intav_packet_ref(AVPacket *dst, const AVPacket *src);//增加引用
减少引用
1 2 3 4 5 6 7 8 9
/** * Wipe the packet. * * Unreference the buffer referenced by the packet and reset the * remaining packet fields to their default values. * * @param pkt The packet to be unreferenced. */ voidav_packet_unref(AVPacket *pkt);
清空对象
1 2 3 4 5 6 7 8
/** * Free the packet, if the packet is reference counted, it will be * unreferenced first. * * @param pkt packet to be freed. The pointer will be set to NULL. * @note passing NULL is a no-op. */ voidav_packet_free(AVPacket **pkt);
seek
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/** * Seek to the keyframe at timestamp. * 'timestamp' in 'stream_index'. * * @param s media file handle * @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 */ intav_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp,int flags);
/** * 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 * @param param extra parameters to tune the used scaler * For SWS_BICUBIC param[0] and [1] tune the shape of the basis * function, param[0] tunes f(1) and param[1] f´(1) * For SWS_GAUSS param[0] tunes the exponent and thus cutoff * frequency * For SWS_LANCZOS param[0] tunes the width of the window function * @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 */ struct SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat, int dstW, int dstH, enum AVPixelFormat dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, constdouble *param);
flag参数
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/** * 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. */ struct SwsContext *sws_getCachedContext(struct SwsContext *context, int srcW, int srcH, enum AVPixelFormat srcFormat, int dstW, int dstH, enum AVPixelFormat dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, constdouble *param);
/** * 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 */ intsws_scale(struct SwsContext *c, constuint8_t *const srcSlice[], constint srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], constint dstStride[]);
/** * Allocate SwrContext if needed and set/reset common parameters. * * This function does not require s to be allocated with swr_alloc(). On the * other hand, swr_alloc() can use swr_alloc_set_opts() to set the parameters * on the allocated context. * * @param s existing Swr context if available, or NULL if not * @param out_ch_layout output channel layout (AV_CH_LAYOUT_*) * @param out_sample_fmt output sample format (AV_SAMPLE_FMT_*). * @param out_sample_rate output sample rate (frequency in Hz) * @param in_ch_layout input channel layout (AV_CH_LAYOUT_*) * @param in_sample_fmt input sample format (AV_SAMPLE_FMT_*). * @param in_sample_rate input sample rate (frequency in Hz) * @param log_offset logging level offset * @param log_ctx parent logging context, can be NULL * * @see swr_init(), swr_free() * @return NULL on error, allocated context otherwise * @deprecated use @ref swr_alloc_set_opts2() */ attribute_deprecated struct SwrContext *swr_alloc_set_opts(struct SwrContext *s, int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate, int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate, int log_offset, void *log_ctx);