Mercurial > libavcodec.hg
comparison avcodec.h @ 4566:1cb0cac7b19d libavcodec
Add more Doxygen documentation.
author | takis |
---|---|
date | Thu, 22 Feb 2007 18:59:05 +0000 |
parents | 53ed3a394b4b |
children | f0138063c568 |
comparison
equal
deleted
inserted
replaced
4565:8ae1cba27dbe | 4566:1cb0cac7b19d |
---|---|
894 | 894 |
895 int b_frame_strategy; | 895 int b_frame_strategy; |
896 | 896 |
897 /** | 897 /** |
898 * hurry up amount. | 898 * hurry up amount. |
899 * deprecated in favor of skip_idct and skip_frame | |
900 * - encoding: unused | 899 * - encoding: unused |
901 * - decoding: set by user. 1-> skip b frames, 2-> skip idct/dequant too, 5-> skip everything except header | 900 * - decoding: set by user. 1-> skip b frames, 2-> skip idct/dequant too, 5-> skip everything except header |
901 * @deprecated Deprecated in favor of skip_idct and skip_frame. | |
902 */ | 902 */ |
903 int hurry_up; | 903 int hurry_up; |
904 | 904 |
905 struct AVCodec *codec; | 905 struct AVCodec *codec; |
906 | 906 |
2437 * | 2437 * |
2438 * @param picture the picture to be filled in. | 2438 * @param picture the picture to be filled in. |
2439 * @param pix_fmt the format of the picture. | 2439 * @param pix_fmt the format of the picture. |
2440 * @param width the width of the picture. | 2440 * @param width the width of the picture. |
2441 * @param height the height of the picture. | 2441 * @param height the height of the picture. |
2442 * @return 0 if successful, -1 if not. | 2442 * @return Zero if successful, a negative value if not. |
2443 */ | 2443 */ |
2444 int avpicture_alloc(AVPicture *picture, int pix_fmt, int width, int height); | 2444 int avpicture_alloc(AVPicture *picture, int pix_fmt, int width, int height); |
2445 | 2445 |
2446 /* Free a picture previously allocated by avpicture_alloc. */ | 2446 /* Free a picture previously allocated by avpicture_alloc. */ |
2447 void avpicture_free(AVPicture *picture); | 2447 void avpicture_free(AVPicture *picture); |
2491 | 2491 |
2492 /* returns LIBAVCODEC_VERSION_INT constant */ | 2492 /* returns LIBAVCODEC_VERSION_INT constant */ |
2493 unsigned avcodec_version(void); | 2493 unsigned avcodec_version(void); |
2494 /* returns LIBAVCODEC_BUILD constant */ | 2494 /* returns LIBAVCODEC_BUILD constant */ |
2495 unsigned avcodec_build(void); | 2495 unsigned avcodec_build(void); |
2496 | |
2497 /** | |
2498 * Initializes libavcodec. | |
2499 * | |
2500 * @warning This function \e must be called before any other libavcodec | |
2501 * function. | |
2502 */ | |
2496 void avcodec_init(void); | 2503 void avcodec_init(void); |
2497 | 2504 |
2498 void register_avcodec(AVCodec *format); | 2505 void register_avcodec(AVCodec *format); |
2506 | |
2507 /** | |
2508 * Finds an encoder with a matching codec ID. | |
2509 * | |
2510 * @param id CodecID of the requested encoder. | |
2511 * @return An encoder if one was found, NULL otherwise. | |
2512 */ | |
2499 AVCodec *avcodec_find_encoder(enum CodecID id); | 2513 AVCodec *avcodec_find_encoder(enum CodecID id); |
2514 | |
2515 /** | |
2516 * Finds an encoder with the specified name. | |
2517 * | |
2518 * @param name Name of the requested encoder. | |
2519 * @return An encoder if one was found, NULL otherwise. | |
2520 */ | |
2500 AVCodec *avcodec_find_encoder_by_name(const char *name); | 2521 AVCodec *avcodec_find_encoder_by_name(const char *name); |
2522 | |
2523 /** | |
2524 * Finds a decoder with a matching codec ID. | |
2525 * | |
2526 * @param id CodecID of the requested decoder. | |
2527 * @return A decoder if one was found, NULL otherwise. | |
2528 */ | |
2501 AVCodec *avcodec_find_decoder(enum CodecID id); | 2529 AVCodec *avcodec_find_decoder(enum CodecID id); |
2530 | |
2531 /** | |
2532 * Finds an decoder with the specified name. | |
2533 * | |
2534 * @param name Name of the requested decoder. | |
2535 * @return A decoder if one was found, NULL otherwise. | |
2536 */ | |
2502 AVCodec *avcodec_find_decoder_by_name(const char *name); | 2537 AVCodec *avcodec_find_decoder_by_name(const char *name); |
2503 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); | 2538 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); |
2504 | 2539 |
2540 /** | |
2541 * Sets the fields of the given AVCodecContext to default values. | |
2542 * | |
2543 * @param s The AVCodecContext of which the fields should be set to default values. | |
2544 */ | |
2505 void avcodec_get_context_defaults(AVCodecContext *s); | 2545 void avcodec_get_context_defaults(AVCodecContext *s); |
2546 | |
2547 /** | |
2548 * Allocates an AVCodecContext and sets its fields to default values. The | |
2549 * resulting struct can be deallocated by simply calling av_free(). | |
2550 * | |
2551 * @return An AVCodecContext filled with default values or NULL on failure. | |
2552 * @see avcodec_get_context_defaults | |
2553 */ | |
2506 AVCodecContext *avcodec_alloc_context(void); | 2554 AVCodecContext *avcodec_alloc_context(void); |
2555 | |
2556 /** | |
2557 * Sets the fields of the given AVFrame to default values. | |
2558 * | |
2559 * @param pic The AVFrame of which the fields should be set to default values. | |
2560 */ | |
2507 void avcodec_get_frame_defaults(AVFrame *pic); | 2561 void avcodec_get_frame_defaults(AVFrame *pic); |
2562 | |
2563 /** | |
2564 * Allocates an AVFrame and sets its fields to default values. The resulting | |
2565 * struct can be deallocated by simply calling av_free(). | |
2566 * | |
2567 * @return An AVFrame filled with default values or NULL on failure. | |
2568 * @see avcodec_get_frame_defaults | |
2569 */ | |
2508 AVFrame *avcodec_alloc_frame(void); | 2570 AVFrame *avcodec_alloc_frame(void); |
2509 | 2571 |
2510 int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic); | 2572 int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic); |
2511 void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic); | 2573 void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic); |
2512 int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic); | 2574 int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic); |
2513 void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); | 2575 void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); |
2576 | |
2577 /** | |
2578 * Checks if the given dimension of a picture is valid, meaning that all | |
2579 * bytes of the picture can be addressed with a signed int. | |
2580 * | |
2581 * @param[in] w Width of the picture. | |
2582 * @param[in] h Height of the picture. | |
2583 * @return Zero if valid, a negative value if invalid. | |
2584 */ | |
2514 int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h); | 2585 int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h); |
2515 enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt); | 2586 enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt); |
2516 | 2587 |
2517 int avcodec_thread_init(AVCodecContext *s, int thread_count); | 2588 int avcodec_thread_init(AVCodecContext *s, int thread_count); |
2518 void avcodec_thread_free(AVCodecContext *s); | 2589 void avcodec_thread_free(AVCodecContext *s); |
2519 int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count); | 2590 int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count); |
2520 int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count); | 2591 int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count); |
2521 //FIXME func typedef | 2592 //FIXME func typedef |
2522 | 2593 |
2523 /** | 2594 /** |
2524 * opens / inits the AVCodecContext. | 2595 * Initializes the AVCodecContext to use the given AVCodec. Prior to using this |
2525 * not thread save! | 2596 * function the context has to be allocated. |
2597 * | |
2598 * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(), | |
2599 * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for | |
2600 * retrieving a codec. | |
2601 * | |
2602 * @warning This function is not thread save! | |
2603 * | |
2604 * @code | |
2605 * codec = avcodec_find_decoder(CODEC_ID_H264); | |
2606 * if (!codec) | |
2607 * exit(1); | |
2608 * | |
2609 * context = avcodec_alloc_context(); | |
2610 * | |
2611 * if (avcodec_open(context, codec) < 0) | |
2612 * exit(1); | |
2613 * @endcode | |
2614 * | |
2615 * @param avctx The context which will be setup to use the given codec. | |
2616 * @param codec The codec to use within the context. | |
2617 * @return Zero on success, a negative value on error. | |
2618 * @see avcodec_alloc_context, avcodec_find_decoder, avcodec_find_encoder | |
2526 */ | 2619 */ |
2527 int avcodec_open(AVCodecContext *avctx, AVCodec *codec); | 2620 int avcodec_open(AVCodecContext *avctx, AVCodec *codec); |
2528 | 2621 |
2529 | 2622 /** |
2623 * @deprecated Use avcodec_decode_audio2() instead. | |
2624 */ | |
2530 attribute_deprecated int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples, | 2625 attribute_deprecated int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples, |
2531 int *frame_size_ptr, | 2626 int *frame_size_ptr, |
2532 uint8_t *buf, int buf_size); | 2627 uint8_t *buf, int buf_size); |
2533 /** | 2628 |
2534 * Decode an audio frame. | 2629 /** |
2535 * | 2630 * Decodes an audio frame from \p buf into \p samples. |
2536 * @param avctx the codec context. | 2631 * The avcodec_decode_audio2() function decodes a frame of audio from the input |
2537 * @param samples output buffer, 16 byte aligned | 2632 * buffer \p buf of size \p buf_size. To decode it, it makes use of the |
2538 * @param frame_size_ptr the output buffer size in bytes (you MUST set this to the allocated size before calling avcodec_decode_audio2()), zero if no frame could be compressed | 2633 * audiocodec which was coupled with \p avctx using avcodec_open(). The |
2539 * @param buf input buffer, 16 byte aligned | 2634 * resulting decoded frame is stored in output buffer \p samples. If no frame |
2540 * @param buf_size the input buffer size | 2635 * could be decompressed, \p frame_size_ptr is zero. Otherwise, it is the |
2541 * @return 0 if successful, -1 if not. | 2636 * decompressed frame size in \e bytes. |
2637 * | |
2638 * @warning You \e must set \p frame_size_ptr to the allocated size of the | |
2639 * output buffer before calling avcodec_decode_audio2(). | |
2640 * | |
2641 * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than | |
2642 * the actual read bytes because some optimized bitstream readers read 32 or 64 | |
2643 * bits at once and could read over the end. | |
2644 * | |
2645 * @warning The end of the input buffer \p buf should be set to 0 to ensure that | |
2646 * no overreading happens for damaged MPEG streams. | |
2647 * | |
2648 * @note You might have to align the input buffer \p buf and output buffer \p | |
2649 * samples. The alignment requirements depend on the CPU: on some CPUs it isn't | |
2650 * necessary at all, on others it won't work at all if not aligned and on others | |
2651 * it will work but it will have an impact on performance. In practice, the | |
2652 * bitstream should have 4 byte alignment at minimum and all sample data should | |
2653 * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If | |
2654 * the linesize is not a multiple of 16 then there's no sense in aligning the | |
2655 * start of the buffer to 16. | |
2656 * | |
2657 * @param avctx The codec context. | |
2658 * @param[out] samples The output buffer. | |
2659 * @param[in,out] frame_size_ptr The output buffer size in bytes. | |
2660 * @param[in] buf The input buffer. | |
2661 * @param[in] buf_size The input buffer size in bytes. | |
2662 * @return On error a negative value is returned, otherwise the number of bytes | |
2663 * used or zero if no frame could be decompressed. | |
2542 */ | 2664 */ |
2543 int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples, | 2665 int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples, |
2544 int *frame_size_ptr, | 2666 int *frame_size_ptr, |
2545 uint8_t *buf, int buf_size); | 2667 uint8_t *buf, int buf_size); |
2668 | |
2669 /** | |
2670 * Decodes a video frame from \p buf into \p picture. | |
2671 * The avcodec_decode_video() function decodes a frame of video from the input | |
2672 * buffer \p buf of size \p buf_size. To decode it, it makes use of the | |
2673 * videocodec which was coupled with \p avctx using avcodec_open(). The | |
2674 * resulting decoded frame is stored in \p picture. | |
2675 * | |
2676 * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than | |
2677 * the actual read bytes because some optimized bitstream readers read 32 or 64 | |
2678 * bits at once and could read over the end. | |
2679 * | |
2680 * @warning The end of the input buffer \p buf should be set to 0 to ensure that | |
2681 * no overreading happens for damaged MPEG streams. | |
2682 * | |
2683 * @note You might have to align the input buffer \p buf and output buffer \p | |
2684 * samples. The alignment requirements depend on the CPU: on some CPUs it isn't | |
2685 * necessary at all, on others it won't work at all if not aligned and on others | |
2686 * it will work but it will have an impact on performance. In practice, the | |
2687 * bitstream should have 4 byte alignment at minimum and all sample data should | |
2688 * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If | |
2689 * the linesize is not a multiple of 16 then there's no sense in aligning the | |
2690 * start of the buffer to 16. | |
2691 * | |
2692 * @param avctx The codec context. | |
2693 * @param[out] picture The AVFrame in which the decoded video frame will be stored. | |
2694 * @param[in] buf The input buffer. | |
2695 * @param[in] buf_size The size of the input buffer in bytes. | |
2696 * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is non zero. | |
2697 * @return On error a negative value is returned, otherwise the number of bytes | |
2698 * used or zero if no frame could be decompressed. | |
2699 */ | |
2546 int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, | 2700 int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, |
2547 int *got_picture_ptr, | 2701 int *got_picture_ptr, |
2548 uint8_t *buf, int buf_size); | 2702 uint8_t *buf, int buf_size); |
2549 int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub, | 2703 int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub, |
2550 int *got_sub_ptr, | 2704 int *got_sub_ptr, |
2551 const uint8_t *buf, int buf_size); | 2705 const uint8_t *buf, int buf_size); |
2552 int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata, | 2706 int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata, |
2553 int *data_size_ptr, | 2707 int *data_size_ptr, |
2554 uint8_t *buf, int buf_size); | 2708 uint8_t *buf, int buf_size); |
2709 | |
2710 /** | |
2711 * Encodes an audio frame from \p samples into \p buf. | |
2712 * The avcodec_encode_audio() function encodes a frame of audio from the input | |
2713 * buffer \p samples. To encode it, it makes use of the audiocodec which was | |
2714 * coupled with \p avctx using avcodec_open(). The resulting encoded frame is | |
2715 * stored in output buffer \p buf. | |
2716 * | |
2717 * @note The output buffer should be at least \c FF_MIN_BUFFER_SIZE bytes large. | |
2718 * | |
2719 * @param avctx The codec context. | |
2720 * @param[out] buf The output buffer. | |
2721 * @param[in] buf_size The output buffer size. | |
2722 * @param[in] samples The input buffer containing the samples. | |
2723 * @return On error a negative value is returned, on succes zero or the number | |
2724 * of bytes used from the input buffer. | |
2725 */ | |
2555 int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, | 2726 int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, |
2556 const short *samples); | 2727 const short *samples); |
2728 | |
2729 /** | |
2730 * Encodes a video frame from \p pict into \p buf. | |
2731 * The avcodec_encode_video() function encodes a frame of video from the input | |
2732 * \p pict. To encode it, it makes use of the videocodec which was coupled with | |
2733 * \p avctx using avcodec_open(). The resulting encoded bytes representing the | |
2734 * frame are stored in the output buffer \p buf. The input picture should be | |
2735 * stored using a specific format, namely \c avctx.pix_fmt. | |
2736 * | |
2737 * @param avctx The codec context. | |
2738 * @param[out] buf The output buffer for the bitstream of encoded frame. | |
2739 * @param[in] buf_size The size of the outputbuffer in bytes. | |
2740 * @param[in] pict The input picture to encode. | |
2741 * @return On error a negative value is returned, on success zero or the number | |
2742 * of bytes used from the input buffer. | |
2743 */ | |
2557 int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, | 2744 int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, |
2558 const AVFrame *pict); | 2745 const AVFrame *pict); |
2559 int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, | 2746 int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, |
2560 const AVSubtitle *sub); | 2747 const AVSubtitle *sub); |
2561 | 2748 |