• 大小: 22.89MB
    文件类型: .rar
    金币: 2
    下载: 0 次
    发布日期: 2024-01-29
  • 语言: C/C++
  • 标签: C++  FFmpeg  

资源简介

包含FFmpeg 32 64位版本的C++库 .

资源截图

代码片段和文件信息

/*
 * Copyright (c) 2014 Stefano Sabatini
 *
 * Permission is hereby granted free of charge to any person obtaining a copy
 * of this software and associated documentation files (the “Software“) to deal
 * in the Software without restriction including without limitation the rights
 * to use copy modify merge publish distribute sublicense and/or sell
 * copies of the Software and to permit persons to whom the Software is
 * furnished to do so subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED “AS IS“ WITHOUT WARRANTY OF ANY KIND EXPRESS OR
 * IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM DAMAGES OR OTHER
 * LIABILITY WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

/**
 * @file
 * libavformat AVIOContext API example.
 *
 * Make libavformat demuxer access media content through a custom
 * AVIOContext read callback.
 * @example avio_reading.c
 */

#include 
#include 
#include 
#include 

struct buffer_data {
    uint8_t *ptr;
    size_t size; ///< size left in the buffer
};

static int read_packet(void *opaque uint8_t *buf int buf_size)
{
    struct buffer_data *bd = (struct buffer_data *)opaque;
    buf_size = FFMIN(buf_size bd->size);

    printf(“ptr:%p size:%zu\n“ bd->ptr bd->size);

    /* copy internal buffer data to buf */
    memcpy(buf bd->ptr buf_size);
    bd->ptr  += buf_size;
    bd->size -= buf_size;

    return buf_size;
}

int main(int argc char *argv[])
{
    AVFormatContext *fmt_ctx = NULL;
    AVIOContext *avio_ctx = NULL;
    uint8_t *buffer = NULL *avio_ctx_buffer = NULL;
    size_t buffer_size avio_ctx_buffer_size = 4096;
    char *input_filename = NULL;
    int ret = 0;
    struct buffer_data bd = { 0 };

    if (argc != 2) {
        fprintf(stderr “usage: %s input_file\n“
                “API example program to show how to read from a custom buffer “
                “accessed through AVIOContext.\n“ argv[0]);
        return 1;
    }
    input_filename = argv[1];

    /* register codecs and formats and other lavf/lavc components*/
    av_register_all();

    /* slurp file content into buffer */
    ret = av_file_map(input_filename &buffer &buffer_size 0 NULL);
    if (ret < 0)
        goto end;

    /* fill opaque structure used by the AVIOContext read callback */
    bd.ptr  = buffer;
    bd.size = buffer_size;

    if (!(fmt_ctx = avformat_alloc_context())) {
        ret = AVERROR(ENOMEM);
        goto end;
    }

    avio_ctx_buffer = av_malloc(avio_ctx_buffer_size);
    if (!avio_ctx_

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      26501  2016-02-16 18:52  Include\config.h

     文件      36806  2016-02-16 18:52  Include\doc\developer.html

     文件       4060  2016-02-16 18:52  Include\doc\examples\avio_reading.c

     文件      19627  2016-02-16 18:52  Include\doc\examples\decoding_encoding.c

     文件      14368  2016-02-16 18:52  Include\doc\examples\demuxing_decoding.c

     文件       9521  2016-02-16 18:52  Include\doc\examples\filtering_audio.c

     文件       8440  2016-02-16 18:52  Include\doc\examples\filtering_video.c

     文件      11827  2016-02-16 18:52  Include\doc\examples\filter_audio.c

     文件       1566  2016-02-16 18:52  Include\doc\examples\Makefile

     文件       1941  2016-02-16 18:52  Include\doc\examples\metadata.c

     文件      20280  2016-02-16 18:52  Include\doc\examples\muxing.c

     文件        888  2016-02-16 18:52  Include\doc\examples\README

     文件       5625  2016-02-16 18:52  Include\doc\examples\remuxing.c

     文件       8027  2016-02-16 18:52  Include\doc\examples\resampling_audio.c

     文件       5050  2016-02-16 18:52  Include\doc\examples\scaling_video.c

     文件      27979  2016-02-16 18:52  Include\doc\examples\transcode_aac.c

     文件      21369  2016-02-16 18:52  Include\doc\examples\transcoding.c

     文件      45152  2016-02-16 18:52  Include\doc\faq.html

     文件      11997  2016-02-16 18:52  Include\doc\fate.html

     文件     974065  2016-02-16 18:52  Include\doc\ffmpeg-all.html

     文件      10585  2016-02-16 18:52  Include\doc\ffmpeg-bitstream-filters.html

     文件     158923  2016-02-16 18:52  Include\doc\ffmpeg-codecs.html

     文件      65776  2016-02-16 18:52  Include\doc\ffmpeg-devices.html

     文件     461027  2016-02-16 18:52  Include\doc\ffmpeg-filters.html

     文件      89727  2016-02-16 18:52  Include\doc\ffmpeg-formats.html

     文件      54654  2016-02-16 18:52  Include\doc\ffmpeg-protocols.html

     文件      13300  2016-02-16 18:52  Include\doc\ffmpeg-resampler.html

     文件       7043  2016-02-16 18:52  Include\doc\ffmpeg-scaler.html

     文件      44729  2016-02-16 18:52  Include\doc\ffmpeg-utils.html

     文件      93335  2016-02-16 18:52  Include\doc\ffmpeg.html

............此处省略212个文件信息

评论

共有 条评论