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

📄 lqt.h

📁 这个库实现了录象功能
💻 H
📖 第 1 页 / 共 4 页
字号:
 *  overhead. i.e. you'll get the colormodel of your list, which is "closest" to the *  colormodel, the codec delivers. To make sure, that this function never fails, you *  should at least support \ref BC_RGB888 . *  This function works for en- and decoding. */int lqt_get_best_colormodel(quicktime_t * file, int track, int * supported);/** \ingroup video *  \brief Get the colormodel, which will be valid for the next en-/decode call. *  \param file A quicktime handle *  \param track Track index (starting with 0) *  \returns The colormodel used for en-/decode functions. * *  By default, it will return the colormodel, which is used natively *  by the codec. It can be changed with \ref lqt_set_cmodel . */  int lqt_get_cmodel(quicktime_t * file, int track);  /** \ingroup video *  \brief Allocate a frame buffer for use with libquicktime *  \param width The width of the frame *  \param height The height of the frame *  \param colormodel The colormodel of the frame (see \ref color). *  \param rowspan Specifies the row span to use for the luma plane. Can be 0 to use default values. After the function call, it will contain the rowspan actually used. *  \param rowspan_uv Specifies the row span to use for the chroma planes. Can be 0 to use default values. After the function call, it will contain the rowspan actually used. *  \returns An array of pointers to be passed to any of the en-/decoding functions. * *  What is called "row_pointers" here is a bit misleading: For packed formats, *  the pointers point to the beginnings of scanlines. For planar formats, the pointers *  point to the beginning of planes. In either case, the byte offsets between scanlines are *  be specified by rowspan and rowspan_uv. To free the returned frame, call \ref lqt_rows_free */  uint8_t ** lqt_rows_alloc(int width, int height, int colormodel, int * rowspan, int * rowspan_uv);/** \ingroup video * \brief Copy a video frame. * \param out_rows Destination frame * \param in_rows Source frame * \param width Width of the frame * \param height Height of the frame * \param in_rowspan Rowspan for the luma plane of the input frame * \param in_rowspan_uv Rowspan for the chroma planes of the input frame * \param out_rowspan Rowspan for the luma plane of the output frame * \param out_rowspan_uv Rowspan for the chroma planes of the output frame * \param colormodel The colormodel of the frames */   void lqt_rows_copy(uint8_t **out_rows, uint8_t **in_rows, int width, int height, int in_rowspan, int in_rowspan_uv,                   int out_rowspan, int out_rowspan_uv, int colormodel);  /** \ingroup video *  \brief Free a frame allocated by \ref lqt_rows_alloc *  \param rows The frame to be freed */  void lqt_rows_free(uint8_t ** rows);  /************************************** * Set streams for encoding **************************************//** \ingroup audio_encode *  \brief Set up audio tracks for encoding *  \param file A quicktime handle *  \param channels Number of channels *  \param sample_rate Samplerate *  \param bits Bits per sample (always 16) *  \param codec_info Codec to use (see \ref codec_registry ) * *  This sets one audio track for encoding. Note that the bits argument *  should always be 16 since it's implicit to the codec in all cases. *  To add more than one audio track, use \ref lqt_add_audio_track . */ int lqt_set_audio(quicktime_t *file, int channels,                  long sample_rate,  int bits,                  lqt_codec_info_t * codec_info);  /** \ingroup video_encode *  \brief Set up video tracks for encoding *  \param file A quicktime handle *  \param tracks Number of video tracks *  \param frame_w Image width *  \param frame_h Image height *  \param frame_duration Duration of one frame. This can later be overridden *  \param timescale Timescale of the track *  \param codec_info Codec to use (see \ref codec_registry ) * *  This sets one or more video tracks for encoding. The framerate is *  passed as a rational number (timescale/frame_duration). E.g. for an NTSC *  stream, you'll choose timescale = 30000 and frame_duration = 1001. *  To set up multiple video tracks with different formats and/or codecs, *  use \ref lqt_add_video_track . */int lqt_set_video(quicktime_t *file, int tracks,                   int frame_w, int frame_h,                  int frame_duration, int timescale,                  lqt_codec_info_t * codec_info); /** \ingroup audio_encode *  \brief Add an audio tracks for encoding *  \param file A quicktime handle *  \param channels Number of channels *  \param sample_rate Samplerate *  \param bits Bits per sample (always 16) *  \param codec_info Codec to use (see \ref codec_registry ) * *  This sets adds a new audio track for encoding. Note that the bits argument *  should always be 16 since it's implicit to the codec in all cases. *  Call this function to subsequently to add as many tracks as you like. */int lqt_add_audio_track(quicktime_t *file,                        int channels, long sample_rate, int bits,                        lqt_codec_info_t * codec_info);/** \ingroup audio_encode *  \brief Set the audio language *  \param file A quicktime handle *  \param track Track index (starting with 0) *  \param language ISO-639 Language code * *  The language code is a 3-character code, English is "eng", *  Japanese is "jpn". */void lqt_set_audio_language(quicktime_t * file, int track, const char * language);  /** \ingroup video_encode *  \brief Add a video track for encoding *  \param file A quicktime handle *  \param frame_w Image width *  \param frame_h Image height *  \param frame_duration Duration of one frame. This can later be overridden *  \param timescale Timescale of the track *  \param codec_info Codec to use (see \ref codec_registry ) * *  This sets one or more video tracks for encoding. The framerate is *  passed as a rational number (timescale/frame_duration). E.g. for an NTSC *  stream, you'll choose timescale = 30000 and frame_duration = 1001. *  Call this function to subsequently to add as many tracks as you like. */  int lqt_add_video_track(quicktime_t *file,                        int frame_w, int frame_h,                        int frame_duration, int timescale,                        lqt_codec_info_t * codec_info);/** \ingroup video_encode *  \brief Enable multipass encoding *  \param file A quicktime handle *  \param track Track index (starting with 0) *  \param pass The number of this pass (starting with 1) *  \param total_passes The total number of passes *  \param stats_file Statistics file * *  This is a purely optional function, which enables multipass encoding. *  Multipass encoding is done by repeatedly opening a quicktime file, *  encoding video and and closing it again. The stats_file parameter must *  always be the same for all passes. * *  Having more than 2 passes is not always useful. Audio encoding can be *  skipped for all passes until the last one. */int lqt_set_video_pass(quicktime_t *file,                       int pass, int total_passes,                        const char * stats_file, int track);/** \ingroup video_decode *  \brief Get the timestamp of the next frame to be decoded *  \param file A quicktime handle *  \param track Track index (starting with 0) *  \returns The timestamp of the next frame to be decoded * *  Call this BEFORE one of the decoding functions to get the *  timestamp of the next frame */  int64_t lqt_frame_time(quicktime_t * file, int track);/** \ingroup video_decode *  \brief Decode one video frame *  \param file A quicktime handle *  \param row_pointers Frame (see \ref lqt_rows_alloc) *  \param track Track index (starting with 0) * * Decode one video frame and increment the interal frame pointer. * To get the presentation timestamp for this frame, call * \ref lqt_frame_time before. */  int lqt_decode_video(quicktime_t *file,                     unsigned char **row_pointers, int track);/** \ingroup video_decode *  \brief Read a compressed video frame *  \param file A quicktime handle *  \param buffer Buffer where the frame will be read to *  \param buffer_alloc Number of bytes allocated for the buffer *  \param frame Number of the frame to be read (starting with 0) *  \param time If non NULL, returns the timestamp in timescale tics *  \param track Track index (starting with 0) *  \returns The number of bytes in the frame or 0 if no frame could be read. * * Read one compressed video frame. This function calls realloc() * to ensure, that the buffer will be large enough. To use this * function, set buffer to NULL and buffer_alloc to zero before * the first call. After the last call, free the buffer with free(). * This function is mainly used by video codecs. */int lqt_read_video_frame(quicktime_t * file,                         uint8_t ** buffer, int * buffer_alloc,                         int64_t frame, int64_t * time, int track);  /** \ingroup video_encode *  \brief Encode one video frame *  \param file A quicktime handle *  \param row_pointers Frame (see \ref lqt_rows_alloc) *  \param track Track index (starting with 0) *  \param time Timestamp of the frame in timescale tics *  \returns 0 if the frame was encoded, 1 else. * * Encode one video frame. The presentation timestamp is in * timescale tics with the timescale you passed to * \ref lqt_add_video_track or \ref lqt_set_video . WARNING: AVI files * don't support arbitrary timestamps. For AVI files *  time is ignored, instead it's frame_number * frame_duration, */  int lqt_encode_video(quicktime_t *file,                      unsigned char **row_pointers,                      int track, int64_t time);  /** \ingroup video_decode *  \brief Get the duration of the NEXT frame to be decoded *  \param file A quicktime handle *  \param track Track index (starting with 0) *  \param constant If non NULL it will be set to 1 if the frame duration is constant throughout the whole track *  \returns The frame duration in timescale tics */int lqt_frame_duration(quicktime_t * file, int track, int *constant);  /** \ingroup video_decode *  \brief Get the timescale of the track *  \param file A quicktime handle *  \param track Track index (starting with 0) *  \returns The timescale of the track */  int lqt_video_time_scale(quicktime_t * file, int track);/** \ingroup video_decode *  \brief Get the duration of a video track *  \param file A quicktime handle *  \param track Track index (starting with 0) *  \returns The total duration of the track in timescale tics * *  Use this function if you want to support nonconstant framerates. */int64_t lqt_video_duration(quicktime_t * file, int track);/** \ingroup video * \brief Set the colormodel for en-/decoding *  \param file A quicktime handle *  \param track Track index (starting with 0) *  \param colormodel The colormodel to use. * *  Set colormodel of a video track. It's the colormodel, libquicktime *  will expect for the next call to \ref lqt_encode_video or *  \ref lqt_decode_video respectively. Before you should call this, *  you should verify, that this colormodel can be used with *  \ref quicktime_reads_cmodel (for reading), \ref quicktime_writes_cmodel *  (for writing) or \ref lqt_get_best_colormodel (for reading and writing).  */void lqt_set_cmodel(quicktime_t *file, int track, int colormodel);/** \ingroup video * \brief Set the row span for the luma plane * \param file A quicktime handle * \param track Track index (starting with 0) * \param row_span The row span for the luma plane * * This sets the row_span, which will be used for the next en-/decode * calls (see \ref lqt_rows_alloc ). */void lqt_set_row_span(quicktime_t *file, int track, int row_span);/** \ingroup video * \brief Set the row span for the chroma planes * \param file A quicktime handle * \param track Track index (starting with 0) * \param row_span_uv The row span for the chroma planes * * This sets the row_span, which will be used for the next en-/decode * calls (see \ref lqt_rows_alloc ). */void lqt_set_row_span_uv(quicktime_t *file, int track, int row_span_uv);  /** \ingroup audio_decode * \brief Decode all channels from all tracks at once * \param file A quicktime handle * \param output_i 16 bit integer output buffer (or NULL) * \param output_f floating point output buffer (or NULL) * \param samples How many samples to decode * * quicktime4linux hides the concept of multiple audio tracks from the user. * The idea was probably to put an arbitrary number of channels into a file * regardless of the codec (some codecs don't support more than 2 channels). * So in principle, this function does the same as \ref quicktime_decode_audio, * but it grabs all channels at once. Or if you want only some channels you can * leave the channels you don't want = NULL in the output array. The output * arrays must contain at least lqt_total_channels(file) elements. * * Libquicktime supports an arbitrary number of audio tracks, which can even have * completely different formats and codecs. Therefore you should always use * \ref lqt_decode_audio_track or \ref lqt_decode_audio_raw to decode audio from a * particular track. * * The number of actually decoded samples (and EOF) can be obtained with * \ref lqt_last_audio_position */int lqt_decode_audio(quicktime_t *file,                      int16_t **output_i,                      float **output_f,                      long samples);  /** \ingroup audio_decode *  \brief Get the position of the last decoded sample. *  \param file A quicktime handle *  \param track index (starting with 0) *  \returns The position of the last decoded sample. *  * Returns the position of the last decoded sample. It is updated by the codec in each decode * call and resembles the true position of the stream. Therefore, after each decode call, * the last position should increment by the number of samples you decoded. If it's smaller, * it means, that no more samples are available and that the end of the track is reached. */  int64_t lqt_last_audio_position(quicktime_t * file, int track);  /** \ingroup audio_encode *  \brief Encode a number of audio samples for the first track *  \param file A quicktime handle *  \param output_i 16 bit integer output buffer (or NULL) *  \param output_f floating point output buffer (or NULL) *  \param samples Number of samples to decode *  \param track index (starting with 0) * * Same as \ref quicktime_encode_audio but with an additional track argument * for encoding files with more than one audio track. If you want to pass the full * resolution even for 24/32 bit audio, use \ref lqt_encode_audio_raw . */  int lqt_encode_audio_track(quicktime_t *file, 

⌨️ 快捷键说明

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