Ejemplo n.º 1
0
static int demux_open_mf(demuxer_t *demuxer, enum demux_check check)
{
    mf_t *mf;

    if (strncmp(demuxer->stream->url, "mf://", 5) == 0 &&
        demuxer->stream->type == STREAMTYPE_MF)
        mf = open_mf_pattern(demuxer, demuxer->log, demuxer->stream->url + 5);
    else {
        mf = open_mf_single(demuxer, demuxer->log, demuxer->stream->url);
        int bog = 0;
        MP_TARRAY_APPEND(mf, mf->streams, bog, demuxer->stream);
    }

    if (!mf || mf->nr_of_files < 1)
        goto error;

    char *force_type = demuxer->opts->mf_type;
    const char *codec = mp_map_mimetype_to_video_codec(demuxer->stream->mime_type);
    if (!codec || (force_type && force_type[0]))
        codec = probe_format(mf, force_type, check);
    if (!codec)
        goto error;

    mf->curr_frame = 0;

    // create a new video stream header
    struct sh_stream *sh = demux_alloc_sh_stream(STREAM_VIDEO);
    struct mp_codec_params *c = sh->codec;

    c->codec = codec;
    c->disp_w = 0;
    c->disp_h = 0;
    c->fps = demuxer->opts->mf_fps;

    demux_add_sh_stream(demuxer, sh);

    mf->sh = sh;
    demuxer->priv = (void *)mf;
    demuxer->seekable = true;

    return 0;

error:
    return -1;
}
Ejemplo n.º 2
0
static int demux_open_mf(demuxer_t *demuxer, enum demux_check check)
{
    sh_video_t *sh_video = NULL;
    mf_t *mf;

    if (strncmp(demuxer->stream->url, "mf://", 5) == 0 &&
        demuxer->stream->type == STREAMTYPE_MF)
        mf = open_mf_pattern(demuxer, demuxer->stream->url + 5);
    else {
        mf = open_mf_single(demuxer, demuxer->stream->url);
        int bog = 0;
        MP_TARRAY_APPEND(mf, mf->streams, bog, demuxer->stream);
    }

    if (!mf || mf->nr_of_files < 1)
        goto error;

    const char *codec = probe_format(mf, check);
    if (!codec)
        goto error;

    mf->curr_frame = 0;

    // create a new video stream header
    struct sh_stream *sh = new_sh_stream(demuxer, STREAM_VIDEO);
    sh_video = sh->video;

    sh_video->gsh->codec = codec;
    sh_video->disp_w = 0;
    sh_video->disp_h = 0;
    sh_video->fps = mf_fps;

    mf->sh = sh_video;
    demuxer->priv = (void *)mf;
    demuxer->seekable = true;

    return 0;

error:
    return -1;
}