⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 functions.java

📁 ffmpeg开发指南
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
## Function ListPrintable version Text versionint **av_open_input_file**(AVFormatContext **ptr, const char * filename,AVInputFormat *fmt, int buf_size, AVFormatParameters *ap)      Opens a media file **filename**, stores the format context in the addresspointed to by **ptr**. **fmt** forces file format if not NULL. **buf_size**: optional buffer size. **ap**: AVFormatParameters struct setting parameters (see data reference). void **av_close_input_file**(AVFormatContext *s)    Closes a media file. It does not close its codecs, however. int **av_dup_packet**(AVPacket *pkt)     This apparently is a hack: if this packet wasn't allocated, we allocateit here. It returns 0 on success or AVERROR_NOMEM on failure. int **av_find_stream_info**(AVFormatContext *s)    This function searches the stream to find information about it that mightnot have been obvious like frame rate. This is useful for file formats withoutheaders like MPEG. It's recommended that you call this after opening a file.It returns >= 0 on success, AVERROR_* on error. void **av_free**(void *ptr)    Frees memory allocated by av_malloc() or av_realloc(). You are allowed tocall this function with ptr == NULL. It is recommended you call av_freep()instead.void **av_freep**(void *ptr)    Frees memory and sets the pointer to NULL. Uses av_free() internally. void **av_free_packet**(AVPacket *pkt)    A wrapper around the packet's destruct method (**pkt->destruct**). int64_t **av_gettime**()    Gets the current time in microseconds.void **av_init_packet**(AVPacket *pkt)    Initialize optional fields of a packet. void ***av_malloc**(unsigned int size)    Memory allocation of size byte with alignment suitable for all memoryaccesses (including vectors if available on the CPU). av_malloc(0) must returna non NULL pointer. void ***av_mallocz**(unsigned int size)    Same as av_malloc() but it initializes the memory to zero. double **av_q2d**(AVRational a)    Converts an AVRational to a double.int **av_read_frame**(AVFormatContext *s, AVPacket *pkt)    Return the next frame of a stream. The information is stored as a packet in**pkt**. The returned packet is valid until the next av_read_frame() or untilav_close_input_file() and must be freed with av_free_packet. For video, thepacket contains exactly one frame. For audio, it contains an integer number offrames if each frame has a known fixed size (e.g. PCM or ADPCM data). If theaudio frames have a variable size (e.g. MPEG audio), then it contains oneframe. pkt->pts, pkt->dts and pkt->duration are always set to correct values inAVStream.timebase units (and guessed if the format cannot provided them).pkt->pts can be AV_NOPTS_VALUE if the video format has B frames, so it isbetter to rely on pkt->dts if you do not decompress the payload. **Returns:** 0 if OK, < 0 if error or end of file. void **av_register_all**();    Registers all codecs with the library.int64_t **av_rescale_q**(int64_t a, AVRational bq, AVRational cq)    Returns a * bq / cq.int **av_seek_frame**(AVFormatContext *s, int stream_index, int64_t timestamp,int flags)    Seeks to the key frame at **timestamp**. **stream_index**: If _stream_index_ is -1, a default stream is selected, andtimestamp is automatically converted from AV_TIME_BASE units to the streamspecific time_base. **timestamp** is measured in AVStream.time_base units or if there is no streamspecified then in AV_TIME_BASE units. **flags**: Set options regarding direction and seeking mode.  AVSEEK_FLAG_ANY: Seek to any frame, not just keyframes  AVSEEK_FLAG_BACKWARD: Seek backward  AVSEEK_FLAG_BYTE: Seeking based on position in bytes  AVFrame ***avcodec_alloc_frame**()     Allocates an AVFrame and initializes it. This can be freed with av_free().int **avcodec_decode_audio**(AVCodecContext *codecCtx, int16_t *samples, int*frame_size_ptr, uint8_t *buf, int buf_size)    Deprecated. Use avcodec_decode_audio2.int **avcodec_decode_audio2**(AVCodecContext *avctx, int16_t *samples, int*frame_size_ptr, uint8_t *buf, int buf_size)     Decodes an audio frame from buf into samples. The avcodec_decode_audio2()function decodes a frame of audio from the input buffer buf of size buf_size.To decode it, it makes use of the audiocodec which was coupled with avctxusing avcodec_open(). The resulting decoded frame is stored in output buffersamples. If no frame could be decompressed, 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 outputbuffer before calling avcodec_decode_audio2(). The input buffer must beFF_INPUT_BUFFER_PADDING_SIZE larger than the actual read bytes because someoptimized bitstream readers read 32 or 64 bits at once and could read over theend. The end of the input buffer buf should be set to 0 to ensure that nooverreading happens for damaged MPEG streams. **Note:** You might have to align the input buffer buf and output buffersamples. The alignment requirements depend on the CPU: on some CPUs it isn'tnecessary at all, on others it won't work at all if not aligned and on othersit will work but it will have an impact on performance. In practice, thebitstream should have 4 byte alignment at minimum and all sample data shouldbe 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If thelinesize is not a multiple of 16 then there's no sense in aligning the startof the buffer to 16. **avctx**: The codec context.  **samples**: The output buffer.  **frame_size_ptr**: The output buffer size in bytes.  **buf**: The input buffer.  **buf_size**: The input buffer size in bytes.  **Returns**: On error a negative value is returned, otherwise the number ofbytes used or zero if no frame could be decompressed. int **avcodec_decode_video**(AVCodecContext *avctx, AVFrame *picture, int*frameFinished, uint8_t *buf, int buf_size)      Decodes a video frame from buf into picture. The avcodec_decode_video()function decodes a frame of video from the input buffer buf of size buf_size.To decode it, it makes use of the videocodec which was coupled with avctxusing avcodec_open(). The resulting decoded frame is stored in picture. **Warning**: The sample alignment and buffer problems that apply toavcodec_decode_audio apply to this function as well.**avctx**: The codec context.  **picture**: The AVFrame in which the decoded video will be stored.  **buf**: The input buffer.  **buf_size**: The size of the input buffer in bytes.  **frameFinished** Zero if no frame could be decompressed, otherwise it isnon-zero. **Returns**: On error a negative value is returned, otherwise the number ofbytes used or zero if no frame could be decompressed. int **avcodec_default_get_buffer**(AVCodecContext *s, AVFrame *pic)    Default function for interally allocating a frame buffer. You should knowthis call for when you want to override an AVCodecContext get_buffer function.Returns < 0 on failure.void **avcodec_default_release_buffer**(AVCodecContext *s, AVFrame *pic)     Default function for interally freeing a frame buffer. You should knowthis call for when you want to override an AVCodecContext release_bufferfunction.AVCodec ***avcodec_find_decoder**(enum CodecID id)    Find the decoder with the CodecID **id**. Returns NULL on failure. Thisshould be called after getting the desired AVCodecContext from a stream inAVFormatContext, using codecCtx->codec_id.void **avcodec_flush_buffers**(AVCodecContetx *avctx)    Flush buffers, should be called when seeking or when switching to adifferent stream. int **avcodec_open**(AVCodecContext *avctx, AVCodec *codec)      Initializes **avctx** to use the codec given in **codec**. This should beused after avcodec_find_decoder. Returns zero on success, and a negative valueon error.int **avpicture_fill**(AVPicture *picture, uint8_t *ptr, int pix_fmt, intwidth, int height)    Sets up the struct pointed to by **picture** with the buffer **ptr**, picformat **pix_fmt** and the given width and height. Returns the size of theimage data in bytes.int **avpicture_get_size**(int pix_fmt, int width, int height)     Calculates how many bytes will be required for a picture of the givenwidth, height, and pic format.int img_convert(AVPicture *dst, int dst_pix_fmt, const AVPicture *src, intpix_fmt, int width, int height)    Converts the image from **src** into **dst_pix_fmt** format and stores itin **dst**. Deprecated. Use sws_scale instead.struct SwsContext* sws_getContext(int srcW, int srcH, int srcFormat, int dstW,int dstH, int dstFormat, int flags, SwsFilter *srcFilter, SwsFilter*dstFilter, double *param)    Returns an SwsContext to be used in sws_scale. **Params:**  **srcW, srcH, srcFormat**: source width, height, and pix format  **dstW, dstH, dstFormat**: destination width, height, and pix format  **flags**: Method of scaling to use. Choices are SWS_FAST_BILINEAR,SWS_BILINEAR, SWS_BICUBIC, SWS_X, SWS_POINT, SWS_AREA, SWS_BICUBLIN,SWS_GAUSS, SWS_SINC, SWS_LANCZOS, SWS_SPLINE. Other flags include CPUcapability flags: SWS_CPU_CAPS_MMX, SWS_CPU_CAPS_MMX2, SWS_CPU_CAPS_3DNOW,SWS_CPU_CAPS_ALTIVEC. Other flags include (currently not completelyimplemented) SWS_FULL_CHR_H_INT, SWS_FULL_CHR_H_INP, and SWS_DIRECT_BGR.Finally we have SWS_ACCURATE_RND and perhaps the most useful for beginners,SWS_PRINT_INFO. I have no idea what most of these do. Maybe email me?  **srcFilter, dstFilter**: SwsFilter for source and destination. SwsFilterinvolves chroma/luminsence filtering. A value of NULL sets these to thedefault.  **param**: should be a pointer to an int[2] buffer with coefficients. Notdocumented. Looks like it's used to alter the default scaling algorithmsslightly. A value of NULL sets this to the default. Experts only! int **sws_scale**(SwsContext *c, uint8_t *src, int srcStride[], int srcSliceY,int srcSliceH, uint8_t dst[], int dstStride[] sws_scale(img_convert_ctx, pFrame->data, pFrame->linesize, 0,is->video_st->codec->height, pict.data, pict.linesize);     Scales the data in**src** according to our settings in our SwsContext **c**. **srcStride** and**dstStride** are the source and destination linesize.int **url_ferror**(ByteIOContext *s)    Returns non-zero if there is an error at the ByteIOContext level. Usuallyused to check an AVFormatContext (url_ferror(avctx->pb)). void **url_set_interrupt_cb**(URLInterruptBC *interrupt_cb())      The callback is called in blocking functions to test regulary ifasynchronous interruption is needed. AVERROR(EINTR) is returned in this caseby the interrupted function. 'NULL' means no interrupt callback is given. SDL_TimerID SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void*param)     Adds a callback function to be run after the specified number ofmilliseconds has elapsed. The callback function is passed the current timerinterval and the user supplied parameter from the SDL_AddTimer call andreturns the next timer interval. (If the returned value from the callback isthe same as the one passed in, the timer continues at the same rate.) If thereturned value from the callback is 0, the timer is cancelled. Another way to cancel a currently-running timer is by calling SDL_RemoveTimerwith the timer's ID (which was returned from SDL_AddTimer). The timer callback function may run in a different thread than your mainprogram, and so shouldn't call any functions from within itself. However, youmay always call SDL_PushEvent. The granularity of the timer is platform-dependent, but you should count on itbeing at least 10 ms as this is the most common number. This means that if yourequest a 16 ms timer, your callback will run approximately 20 ms later on anunloaded system. If you wanted to set a flag signaling a frame update at 30frames per second (every 33 ms), you might set a timer for 30 ms (see examplebelow). If you use this function, you need to pass SDL_INIT_TIMER to SDL_Init.Returns an ID value for the added timer or NULL if there was an error.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -