• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ AVUNERROR函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中AVUNERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ AVUNERROR函数的具体用法?C++ AVUNERROR怎么用?C++ AVUNERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了AVUNERROR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: av_strerror

int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
{
    int ret = 0, i;
    const struct error_entry *entry = NULL;

    for (i = 0; i < FF_ARRAY_ELEMS(error_entries); i++) {
        if (errnum == error_entries[i].num) {
            entry = &error_entries[i];
            break;
        }
    }
    if (entry) {
        av_strlcpy(errbuf, entry->str, errbuf_size);
    } else {
#if HAVE_STRERROR_R
        ret = AVERROR(strerror_r(AVUNERROR(errnum), errbuf, errbuf_size));
#else
        ret = -1;
#endif
        if (ret < 0)
            snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum);
    }

    return ret;
}
开发者ID:Dahlqvist,项目名称:sfeMovie,代码行数:25,代码来源:error.c


示例2: send_command_packet

/** Send a prepared MMST command packet. */
static int send_command_packet(MMSTContext *mmst)
{
    MMSContext *mms  = &mmst->mms;
    int len= mms->write_out_ptr - mms->out_buffer;
    int exact_length = FFALIGN(len, 8);
    int first_length= exact_length - 16;
    int len8= first_length/8;
    int write_result;

    // update packet length fields.
    AV_WL32(mms->out_buffer + 8, first_length);
    AV_WL32(mms->out_buffer + 16, len8);
    AV_WL32(mms->out_buffer + 32, len8-2);
    memset(mms->write_out_ptr, 0, exact_length - len);

    // write it out.
    write_result= ffurl_write(mms->mms_hd, mms->out_buffer, exact_length);
    if(write_result != exact_length) {
        av_log(NULL, AV_LOG_ERROR,
               "Failed to write data of length %d: %d (%s)\n",
               exact_length, write_result,
               write_result < 0 ? strerror(AVUNERROR(write_result)) :
                   "The server closed the connection");
        return AVERROR(EIO);
    }

    return 0;
}
开发者ID:AirStash,项目名称:AirStashPlayer,代码行数:29,代码来源:mmst.c


示例3: av_strerror

int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
{
    int ret = 0;
    const char *errstr = NULL;

    switch (errnum) {
    case AVERROR_BSF_NOT_FOUND:     errstr = "Bitstream filter not found"                   ; break;
    case AVERROR_DECODER_NOT_FOUND: errstr = "Decoder not found"                            ; break;
    case AVERROR_DEMUXER_NOT_FOUND: errstr = "Demuxer not found"                            ; break;
    case AVERROR_ENCODER_NOT_FOUND: errstr = "Encoder not found"                            ; break;
    case AVERROR_EOF:               errstr = "End of file"                                  ; break;
    case AVERROR_EXIT:              errstr = "Immediate exit requested"                     ; break;
    case AVERROR_FILTER_NOT_FOUND:  errstr = "Filter not found"                             ; break;
    case AVERROR_INVALIDDATA:       errstr = "Invalid data found when processing input"     ; break;
    case AVERROR_MUXER_NOT_FOUND:   errstr = "Muxer not found"                              ; break;
    case AVERROR_OPTION_NOT_FOUND:  errstr = "Option not found"                             ; break;
    case AVERROR_PATCHWELCOME:      errstr = "Not yet implemented in FFmpeg, patches welcome"; break;
    case AVERROR_PROTOCOL_NOT_FOUND:errstr = "Protocol not found"                           ; break;
    case AVERROR_STREAM_NOT_FOUND:  errstr = "Stream not found"                             ; break;
    }

    if (errstr) {
        av_strlcpy(errbuf, errstr, errbuf_size);
    } else {
#if HAVE_STRERROR_R
        ret = strerror_r(AVUNERROR(errnum), errbuf, errbuf_size);
#else
        ret = -1;
#endif
        if (ret < 0)
            snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum);
    }

    return ret;
}
开发者ID:Amalerd,项目名称:SoxPlayer,代码行数:35,代码来源:error.c


示例4: Write

/*****************************************************************************
 * Write:
 *****************************************************************************/
static ssize_t Write(sout_access_out_t *p_access, block_t *p_buffer)
{
    sout_access_out_sys_t *p_sys = (sout_access_out_sys_t*)p_access->p_sys;
    size_t i_write = 0;
    int val;

    while (p_buffer != NULL) {
        block_t *p_next = p_buffer->p_next;

        avio_write(p_sys->context, p_buffer->p_buffer, p_buffer->i_buffer);
        avio_flush(p_sys->context);
        if ((val = p_sys->context->error) != 0) {
            p_sys->context->error = 0; /* FIXME? */
            goto error;
        }
        i_write += p_buffer->i_buffer;

        block_Release(p_buffer);

        p_buffer = p_next;
    }

    return i_write;

error:
    msg_Err(p_access, "Wrote only %zu bytes: %s", i_write,
            vlc_strerror_c(AVUNERROR(val)));
    block_ChainRelease( p_buffer );
    return i_write;
}
开发者ID:mstorsjo,项目名称:vlc,代码行数:33,代码来源:avio.c


示例5: mux_next

static int mux_next(stream_t *stream)
{
  int result;
  AVPacket packet;

  do {
    result = get_next(stream);
    if (result <= 0) {
      return result;
    }
  } while (stream->dst_size == 0);

  av_init_packet(&packet);
  packet.data = stream->dst_data;
  packet.size = stream->dst_size;
  /*packet.pts = stream->pts;*/ /* FIXME: proper PTS/DTS handling */
  packet.stream_index = 0;

  result = av_interleaved_write_frame(stream->dst_ctx, &packet);
  if (result < 0) {
    musicd_log(LOG_ERROR, "stream",
               "av_interleaved_write_frame failed: %s",
               strerror(AVUNERROR(result)));
    return -1;
  }

  return 1;
}
开发者ID:EQ4,项目名称:musicd,代码行数:28,代码来源:stream.c


示例6: OutOpenAvio

int OutOpenAvio(vlc_object_t *object)
{
    sout_access_out_t *access = (sout_access_out_t*)object;

    config_ChainParse( access, "sout-avio-", ppsz_sout_options, access->p_cfg );

    sout_access_out_sys_t *sys = malloc(sizeof(*sys));
    if (!sys)
        return VLC_ENOMEM;
    sys->context = NULL;

    /* */
    vlc_init_avformat(object);

    if (!access->psz_path)
        goto error;

    int ret;
#if LIBAVFORMAT_VERSION_MAJOR < 54
    ret = avio_open(&sys->context, access->psz_path, AVIO_FLAG_WRITE);
#else
    AVDictionary *options = NULL;
    char *psz_opts = var_InheritString(access, "sout-avio-options");
    if (psz_opts && *psz_opts) {
        options = vlc_av_get_options(psz_opts);
        free(psz_opts);
    }
    ret = avio_open2(&sys->context, access->psz_path, AVIO_FLAG_WRITE,
                     NULL, &options);
    AVDictionaryEntry *t = NULL;
    while ((t = av_dict_get(options, "", t, AV_DICT_IGNORE_SUFFIX)))
        msg_Err( access, "unknown option \"%s\"", t->key );
    av_dict_free(&options);
#endif
    if (ret < 0) {
        errno = AVUNERROR(ret);
        msg_Err(access, "Failed to open %s", access->psz_path);
        goto error;
    }

#if LIBAVFORMAT_VERSION_MAJOR < 54
    /* We can accept only one active user at any time */
    if (SetupAvioCb(VLC_OBJECT(access))) {
        msg_Err(access, "Module aready in use");
        goto error;
    }
#endif

    access->pf_write = Write;
    access->pf_control = OutControl;
    access->pf_seek = OutSeek;
    access->p_sys = sys;

    return VLC_SUCCESS;

error:
    free(sys);
    return VLC_EGENERIC;
}
开发者ID:Distrotech,项目名称:vlc,代码行数:59,代码来源:avio.c


示例7: print_averror

static void print_averror(int err) {
  char errbuf[128];
  const char *errbuf_ptr = errbuf;

  if (av_strerror(err, errbuf, sizeof(errbuf)) < 0)
    errbuf_ptr = strerror(AVUNERROR(err));
  fprintf(stderr, "%s\n", errbuf_ptr);
}
开发者ID:andygrundman,项目名称:libmediascan,代码行数:8,代码来源:video.c


示例8: print_error

void print_error(const char *filename, int err)
{
    char errbuf[128];
    const char *errbuf_ptr = errbuf;

    if (av_strerror(err, errbuf, sizeof(errbuf)) < 0)
        errbuf_ptr = strerror(AVUNERROR(err));
    av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, errbuf_ptr);
}
开发者ID:Tjoppen,项目名称:FFmpeg,代码行数:9,代码来源:cmdutils.c


示例9: print_error

void print_error(const char *filename, int err)
{
    char errbuf[128];
    const char *errbuf_ptr = errbuf;

    if (av_strerror(err, errbuf, sizeof(errbuf)) < 0)
        errbuf_ptr = strerror(AVUNERROR(err));
    fprintf(stderr, "%s: %s\n", filename, errbuf_ptr);
}
开发者ID:csd,项目名称:ffmpeg,代码行数:9,代码来源:cmdutils.c


示例10: print_av_error

int print_av_error(const char *function_name, int error) {
	char errorbuf[128];
	char *error_ptr = errorbuf;
	if (av_strerror(error, errorbuf, sizeof(errorbuf)) < 0) {
		error_ptr = strerror(AVUNERROR(error));
	}
	fprintf(stderr, "dr_meter: %s: %s\n", function_name, error_ptr);
	return error;
}
开发者ID:magical,项目名称:dr_meter,代码行数:9,代码来源:main.c


示例11: PrintError

void PrintError(const wxString& msg, int err) {
	char errbuf[128];
	const char *errbuf_ptr = errbuf;
	
	if (av_strerror(err, errbuf, sizeof(errbuf)) < 0)
		errbuf_ptr = strerror(AVUNERROR(err));
	wxString errorStr(errbuf_ptr, wxConvUTF8);
	wxLogError(msg + wxT(": ") + errorStr);
}
开发者ID:KastB,项目名称:OpenCPN,代码行数:9,代码来源:mediadec_ffmpeg.cpp


示例12: Write

/*****************************************************************************
 * Write:
 *****************************************************************************/
static ssize_t Write(sout_access_out_t *p_access, block_t *p_buffer)
{
    access_sys_t *p_sys = (access_sys_t*)p_access->p_sys;
    size_t i_write = 0;

    while (p_buffer != NULL) {
        block_t *p_next = p_buffer->p_next;

#if LIBAVFORMAT_VERSION_MAJOR < 54
        int written = url_write(p_sys->context, p_buffer->p_buffer, p_buffer->i_buffer);
        if (written < 0) {
            errno = AVUNERROR(written);
            goto error;
        }
        i_write += written;
#else
        avio_write(p_sys->context, p_buffer->p_buffer, p_buffer->i_buffer);
        avio_flush(p_sys->context);
        if (p_sys->context->error) {
            errno = AVUNERROR(p_sys->context->error);
            p_sys->context->error = 0; /* FIXME? */
            goto error;
        }
        i_write += p_buffer->i_buffer;
#endif

        block_Release(p_buffer);

        p_buffer = p_next;
    }

    return i_write;

error:
    msg_Err(p_access, "Wrote only %zu bytes (%m)", i_write);
    block_ChainRelease( p_buffer );
    return i_write;
}
开发者ID:chucolin,项目名称:vlc,代码行数:41,代码来源:avio.c


示例13: Mux

/*****************************************************************************
 * Mux: multiplex available data in input fifos
 *****************************************************************************/
static int Mux( sout_mux_t *p_mux )
{
    sout_mux_sys_t *p_sys = p_mux->p_sys;

    if( p_sys->b_error ) return VLC_EGENERIC;

    if( p_sys->b_write_header )
    {
        int error;
        msg_Dbg( p_mux, "writing header" );

        char *psz_opts = var_GetNonEmptyString( p_mux, "sout-avformat-options" );
        AVDictionary *options = NULL;
        if (psz_opts) {
            vlc_av_get_options(psz_opts, &options);
            free(psz_opts);
        }
        av_dict_set( &p_sys->oc->metadata, "encoding_tool", "VLC "VERSION, 0 );
        error = avformat_write_header( p_sys->oc, options ? &options : NULL);
        AVDictionaryEntry *t = NULL;
        while ((t = av_dict_get(options, "", t, AV_DICT_IGNORE_SUFFIX))) {
            msg_Err( p_mux, "Unknown option \"%s\"", t->key );
        }
        av_dict_free(&options);
        if( error < 0 )
        {
            msg_Err( p_mux, "could not write header: %s",
                     vlc_strerror_c(AVUNERROR(error)) );
            p_sys->b_write_header = false;
            p_sys->b_error = true;
            return VLC_EGENERIC;
        }

        avio_flush( p_sys->oc->pb );
        p_sys->b_write_header = false;
    }

    for( ;; )
    {
        mtime_t i_dts;

        int i_stream = sout_MuxGetStream( p_mux, 1, &i_dts );
        if( i_stream < 0 )
            return VLC_SUCCESS;

        MuxBlock( p_mux, p_mux->pp_inputs[i_stream] );
    }

    return VLC_SUCCESS;
}
开发者ID:tguillem,项目名称:vlc,代码行数:53,代码来源:mux.c


示例14: ff_listen_connect

int ff_listen_connect(int fd, const struct sockaddr *addr,
                      socklen_t addrlen, int timeout, URLContext *h,
                      int will_try_next)
{
    struct pollfd p = {fd, POLLOUT, 0};
    int ret;
    socklen_t optlen;

    if (ff_socket_nonblock(fd, 1) < 0)
        av_log(NULL, AV_LOG_DEBUG, "ff_socket_nonblock failed\n");

    while ((ret = connect(fd, addr, addrlen))) {
        ret = ff_neterrno();
        switch (ret) {
        case AVERROR(EINTR):
            if (ff_check_interrupt(&h->interrupt_callback))
                return AVERROR_EXIT;
            continue;
        case AVERROR(EINPROGRESS):
        case AVERROR(EAGAIN):
            ret = ff_poll_interrupt(&p, 1, timeout, &h->interrupt_callback);
            if (ret < 0)
                return ret;
            optlen = sizeof(ret);
            if (getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen))
                ret = AVUNERROR(ff_neterrno());
            if (ret != 0) {
                char errbuf[100];
                ret = AVERROR(ret);
                av_strerror(ret, errbuf, sizeof(errbuf));
                if (will_try_next)
                    av_log(h, AV_LOG_WARNING,
                           "Connection to %s failed (%s), trying next address\n",
                           h->filename, errbuf);
                else
                    av_log(h, AV_LOG_ERROR, "Connection to %s failed: %s\n",
                           h->filename, errbuf);
            }
        default:
            return ret;
        }
    }
    return ret;
}
开发者ID:kithan,项目名称:ffmpeg2.6-android,代码行数:44,代码来源:network.c


示例15: OutOpenAvio

int OutOpenAvio(vlc_object_t *object)
{
    sout_access_out_t *access = (sout_access_out_t*)object;

    config_ChainParse( access, "sout-avio-", ppsz_sout_options, access->p_cfg );

    sout_access_out_sys_t *sys = vlc_obj_malloc(object, sizeof(*sys));
    if (!sys)
        return VLC_ENOMEM;
    sys->context = NULL;

    /* */
    vlc_init_avformat(object);

    if (!access->psz_path)
        return VLC_EGENERIC;

    int ret;
    AVDictionary *options = NULL;
    char *psz_opts = var_InheritString(access, "sout-avio-options");
    if (psz_opts) {
        vlc_av_get_options(psz_opts, &options);
        free(psz_opts);
    }
    ret = avio_open2(&sys->context, access->psz_path, AVIO_FLAG_WRITE,
                     NULL, &options);
    AVDictionaryEntry *t = NULL;
    while ((t = av_dict_get(options, "", t, AV_DICT_IGNORE_SUFFIX)))
        msg_Err( access, "unknown option \"%s\"", t->key );
    av_dict_free(&options);
    if (ret < 0) {
        errno = AVUNERROR(ret);
        msg_Err(access, "Failed to open %s", access->psz_path);
        return VLC_EGENERIC;
    }

    access->pf_write = Write;
    access->pf_control = OutControl;
    access->pf_seek = OutSeek;
    access->p_sys = sys;

    return VLC_SUCCESS;
}
开发者ID:mstorsjo,项目名称:vlc,代码行数:43,代码来源:avio.c


示例16: tls_write_cb

static OSStatus tls_write_cb(SSLConnectionRef connection, const void *data, size_t *dataLength)
{
    URLContext *h = (URLContext*)connection;
    TLSContext *c = h->priv_data;
    int written = ffurl_write(c->tls_shared.tcp, data, *dataLength);
    if (written <= 0) {
        *dataLength = 0;
        switch(AVUNERROR(written)) {
            case EAGAIN:
                return errSSLWouldBlock;
            default:
                c->lastErr = written;
                return ioErr;
        }
    } else {
        *dataLength = written;
        return noErr;
    }
}
开发者ID:Hero2000,项目名称:CainCamera,代码行数:19,代码来源:tls_securetransport.c


示例17: Seek

static int Seek(stream_t *access, uint64_t position)
{
    access_sys_t *sys = access->p_sys;
    int ret;

#ifndef EOVERFLOW
# define EOVERFLOW EFBIG
#endif

    if (position > INT64_MAX)
        ret = AVERROR(EOVERFLOW);
    else
        ret = avio_seek(sys->context, position, SEEK_SET);
    if (ret < 0) {
        msg_Err(access, "Seek to %"PRIu64" failed: %s", position,
                vlc_strerror_c(AVUNERROR(ret)));
        if (sys->size < 0 || position != (uint64_t)sys->size)
            return VLC_EGENERIC;
    }
    return VLC_SUCCESS;
}
开发者ID:mstorsjo,项目名称:vlc,代码行数:21,代码来源:avio.c


示例18: open_radio

int open_radio( struct transcode_ctx *ctx, struct media_file_info *mfi )
{
    ctx->fmtctx = avformat_alloc_context();

    URLContext *stream;

    url_alloc(&stream, mfi->url, URL_RDONLY );
    ff_http_set_headers( stream, "Icy-MetaData:1\r\n");

    DPRINTF(E_DBG, L_XCODE, "Trying to open url %s\n", mfi->url);
    int ret = url_connect(stream);

    if (ret != 0)
    {
        DPRINTF(E_WARN, L_XCODE, "Could not open url %s: %s\n", mfi->url, strerror(AVUNERROR(ret)));
        return -1;
    }
    DPRINTF(E_DBG, L_XCODE, "URL opened successfully");

    if (icy)
        free(icy);

    icy = (struct icy_ctx *)malloc(sizeof(struct icy_ctx));
    icy->context = stream;
    icy->data_pos = 0;
    icy->icy_metaint = get_meta_int( stream );
    icy->rewritten_album = 0;
    icy->mfi = mfi;

    ctx->fmtctx = avformat_alloc_context();

    if (buff)
        av_free( buff );
    buff = (uint8_t *) av_malloc( BIO_BUFFER_SIZE );

    ctx->fmtctx->pb = avio_alloc_context(buff, BIO_BUFFER_SIZE, 0, icy, ReadFunc2, NULL, NULL);

    return avformat_open_input(&ctx->fmtctx, mfi->url, NULL, NULL);
}
开发者ID:Impakt,项目名称:forked-daapd,代码行数:39,代码来源:radio.c


示例19: unix_open

static int unix_open(URLContext *h, const char *filename, int flags)
{
    UnixContext *s = h->priv_data;
    int fd, ret;

    av_strstart(filename, "unix:", &filename);
    s->addr.sun_family = AF_UNIX;
    av_strlcpy(s->addr.sun_path, filename, sizeof(s->addr.sun_path));

    if ((fd = ff_socket(AF_UNIX, s->type, 0)) < 0)
        return ff_neterrno();

    if (s->timeout < 0 && h->rw_timeout)
        s->timeout = h->rw_timeout / 1000;

    if (s->listen) {
        ret = ff_listen_bind(fd, (struct sockaddr *)&s->addr,
                             sizeof(s->addr), s->timeout, h);
        if (ret < 0)
            goto fail;
        fd = ret;
    } else {
        ret = ff_listen_connect(fd, (struct sockaddr *)&s->addr,
                                sizeof(s->addr), s->timeout, h, 0);
        if (ret < 0)
            goto fail;
    }

    s->fd = fd;

    return 0;

fail:
    if (s->listen && AVUNERROR(ret) != EADDRINUSE)
        unlink(s->addr.sun_path);
    if (fd >= 0)
        closesocket(fd);
    return ret;
}
开发者ID:AVLeo,项目名称:libav,代码行数:39,代码来源:unix.c


示例20: Seek

static int Seek(access_t *access, uint64_t position)
{
    access_sys_t *sys = access->p_sys;
    int ret;

#ifndef EOVERFLOW
# define EOVERFLOW EFBIG
#endif

    if (position > INT64_MAX)
        ret = AVERROR(EOVERFLOW);
    else
        ret = avio_seek(sys->context, position, SEEK_SET);
    if (ret < 0) {
        errno = AVUNERROR(ret);
        msg_Err(access, "Seek to %"PRIu64" failed: %m", position);
        if (sys->size == 0 || position != sys->size)
            return VLC_EGENERIC;
    }
    access->info.i_pos = position;
    access->info.b_eof = false;
    return VLC_SUCCESS;
}
开发者ID:chucolin,项目名称:vlc,代码行数:23,代码来源:avio.c



注:本文中的AVUNERROR函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AV_RB32函数代码示例发布时间:2022-05-30
下一篇:
C++ AVL_NEXT函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap