Exemplo n.º 1
0
/** @internal @This allocates a video blank pipe.
 *
 * @param mgr pointer to upipe manager
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return an allocated pipe
 */
static struct upipe *upipe_vblk_alloc(struct upipe_mgr *mgr,
                                      struct uprobe *uprobe,
                                      uint32_t signature, va_list args)
{
    struct uref *flow_def;
    struct upipe *upipe = upipe_vblk_alloc_flow(mgr, uprobe, signature, args,
                                                &flow_def);
    if (unlikely(!upipe)) {
        return NULL;
    }

    upipe_vblk_init_urefcount(upipe);
    upipe_vblk_init_output(upipe);
    upipe_vblk_init_flow_def(upipe);
    upipe_vblk_init_ubuf_mgr(upipe);

    struct upipe_vblk *upipe_vblk = upipe_vblk_from_upipe(upipe);
    upipe_vblk->ubuf = NULL;

    upipe_throw_ready(upipe);

    if (unlikely(!ubase_check(upipe_vblk_check_flow_def(upipe, flow_def)))) {
        uref_free(flow_def);
        upipe_release(upipe);
        return NULL;
    }

    upipe_vblk_store_flow_def(upipe, flow_def);

    return upipe;
}
Exemplo n.º 2
0
/** @internal @This allocates a avcdec pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_avcdec_alloc(struct upipe_mgr *mgr,
                                      struct uprobe *uprobe)
{
    struct upipe_avcdec *upipe_avcdec = malloc(sizeof(struct upipe_avcdec));
    if (unlikely(upipe_avcdec == NULL))
        return NULL;
    struct upipe *upipe = upipe_avcdec_to_upipe(upipe_avcdec);
    upipe_init(upipe, mgr, uprobe);

    upipe_avcdec_init_uref_mgr(upipe);
    upipe_avcdec_init_ubuf_mgr(upipe);
    upipe_avcdec_init_upump_mgr(upipe);
    upipe_avcdec_init_output(upipe);
    upipe_avcdec->context = NULL;
    upipe_avcdec->upump_av_deal = NULL;
    upipe_avcdec->saved_uref = NULL;
    upipe_avcdec->saved_upump_mgr = NULL;
    upipe_avcdec->pixfmt = NULL;
    upipe_avcdec->frame = avcodec_alloc_frame();
    upipe_avcdec->lowres = 0;

    upipe_avcdec->index_rap = 0;
    upipe_avcdec->prev_rap = 0;

    upipe_throw_ready(upipe);
    return upipe;
}
Exemplo n.º 3
0
/** @internal @This allocates a audiobar pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_audiobar_alloc(struct upipe_mgr *mgr,
                                          struct uprobe *uprobe,
                                          uint32_t signature, va_list args)
{
    struct uref *flow_def;
    struct upipe *upipe = upipe_audiobar_alloc_flow(mgr, uprobe, signature,
                                                    args, &flow_def);
    if (unlikely(upipe == NULL))
        return NULL;

    struct upipe_audiobar *upipe_audiobar = upipe_audiobar_from_upipe(upipe);
    upipe_audiobar_init_urefcount(upipe);
    upipe_audiobar_init_input(upipe);
    upipe_audiobar_init_output(upipe);
    upipe_audiobar_init_ubuf_mgr(upipe);
    upipe_audiobar_init_flow_format(upipe);
    upipe_audiobar->flow_def_config = flow_def;
    upipe_audiobar->alpha = DEFAULT_ALPHA;
    upipe_audiobar->hsize = upipe_audiobar->vsize =
        upipe_audiobar->sep_width = upipe_audiobar->pad_width = UINT64_MAX;

    for (int i = 0; i < 255; i++) {
        upipe_audiobar->peak[i] = 0.;
        upipe_audiobar->peak_date[i] = 0;
    }

    upipe_throw_ready(upipe);
    return upipe;
}
Exemplo n.º 4
0
/** @internal @This allocates an a52f pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_a52f_alloc(struct upipe_mgr *mgr,
                                       struct uprobe *uprobe,
                                       uint32_t signature, va_list args)
{
    struct upipe *upipe = upipe_a52f_alloc_void(mgr, uprobe, signature, args);
    if (unlikely(upipe == NULL))
        return NULL;

    struct upipe_a52f *upipe_a52f = upipe_a52f_from_upipe(upipe);
    upipe_a52f_init_urefcount(upipe);
    upipe_a52f_init_sync(upipe);
    upipe_a52f_init_uref_stream(upipe);
    upipe_a52f_init_output(upipe);
    upipe_a52f_init_flow_def(upipe);
    upipe_a52f->input_latency = 0;
    upipe_a52f->samplerate = 0;
    upipe_a52f->got_discontinuity = false;
    upipe_a52f->next_frame_size = -1;
    uref_init(&upipe_a52f->au_uref_s);
    upipe_a52f_flush_dates(upipe);
    upipe_a52f->drift_rate.num = upipe_a52f->drift_rate.den = 0;
    upipe_a52f->sync_header[0] = 0x0;
    upipe_throw_ready(upipe);
    return upipe;
}
Exemplo n.º 5
0
/** @internal @This allocates an telxf pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_telxf_alloc(struct upipe_mgr *mgr,
                                       struct uprobe *uprobe,
                                       uint32_t signature, va_list args)
{
    struct upipe *upipe = upipe_telxf_alloc_void(mgr, uprobe, signature, args);
    if (unlikely(upipe == NULL))
        return NULL;

    struct upipe_telxf *upipe_telxf = upipe_telxf_from_upipe(upipe);
    upipe_telxf_init_urefcount(upipe);
    upipe_telxf_init_sync(upipe);
    upipe_telxf_init_output(upipe);
    upipe_telxf_init_flow_def(upipe);
    /* There is no known implementation of teletext in non-25 Hz systems. */
    upipe_telxf->fps.num = 25;
    upipe_telxf->fps.den = 1;
    upipe_telxf->octetrate = 0;
    upipe_telxf->next_uref = NULL;
    upipe_telxf->next_uref_size = 0;
    uref_init(&upipe_telxf->au_uref_s);
    uref_clock_set_date_sys(&upipe_telxf->au_uref_s, UINT64_MAX,
                            UREF_DATE_NONE);
    uref_clock_set_date_prog(&upipe_telxf->au_uref_s, UINT64_MAX,
                             UREF_DATE_NONE);
    uref_clock_set_date_orig(&upipe_telxf->au_uref_s, UINT64_MAX,
                             UREF_DATE_NONE);
    upipe_throw_ready(upipe);
    return upipe;
}
Exemplo n.º 6
0
/** helper phony pipe */
static struct upipe *test_alloc(struct upipe_mgr *mgr, struct uprobe *uprobe,
                                uint32_t signature, va_list args)
{
    struct x264_test *x264_test = malloc(sizeof(struct x264_test));
    assert(x264_test != NULL);
    upipe_init(&x264_test->upipe, mgr, uprobe);
    x264_test->counter = 0;
    upipe_throw_ready(&x264_test->upipe);
    return &x264_test->upipe;
}
Exemplo n.º 7
0
/** @internal @This allocates a multicat_probe pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_multicat_probe_alloc(struct upipe_mgr *mgr, struct uprobe *uprobe)
{
    struct upipe_multicat_probe *upipe_multicat_probe = malloc(sizeof(struct upipe_multicat_probe));
    if (unlikely(upipe_multicat_probe == NULL))
        return NULL;
    struct upipe *upipe = upipe_multicat_probe_to_upipe(upipe_multicat_probe);
    upipe_init(upipe, mgr, uprobe);
    upipe_multicat_probe_init_output(upipe);
    upipe_multicat_probe->rotate = UPIPE_MULTICAT_PROBE_DEF_ROTATE;
    upipe_multicat_probe->idx = 0;
    upipe_throw_ready(upipe);
    return upipe;
}
Exemplo n.º 8
0
/** @internal @This allocates a skip pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_htons_alloc(struct upipe_mgr *mgr,
                                       struct uprobe *uprobe,
                                       uint32_t signature, va_list args)
{
    struct upipe *upipe = upipe_htons_alloc_void(mgr, uprobe, signature, args);
    if (unlikely(upipe == NULL))
        return NULL;

    upipe_htons_init_urefcount(upipe);
    upipe_htons_init_output(upipe);

    upipe_throw_ready(upipe);
    return upipe;
}
Exemplo n.º 9
0
/** @internal @This allocates a hls pipe.
 *
 * @param mgr management structure for this pipe type
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to allocated pipe, or NULL in case of failure
 */
static struct upipe *upipe_hls_alloc(struct upipe_mgr *mgr,
                                     struct uprobe *uprobe,
                                     uint32_t signature,
                                     va_list args)
{
    struct upipe *upipe =
        upipe_hls_alloc_void(mgr, uprobe, signature, args);
    if (unlikely(upipe == NULL))
        return NULL;

    struct upipe_hls *upipe_hls = upipe_hls_from_upipe(upipe);

    upipe_hls_init_urefcount(upipe);
    upipe_hls_init_urefcount_real(upipe);
    upipe_hls_init_probe_reader(upipe);
    upipe_hls_init_probe_master(upipe);
    upipe_hls_init_probe_null(upipe);
    upipe_hls_init_first_inner(upipe);
    upipe_hls_init_last_inner(upipe);
    upipe_hls_init_bin_input(upipe);
    upipe_hls_init_bin_output(upipe);
    upipe_hls->flow_def = NULL;
    upipe_hls->item = NULL;
    upipe_hls->sub_pipe_mgr = NULL;

    upipe_throw_ready(upipe);

    struct upipe *inner = NULL;
    struct upipe_mgr *upipe_m3u_reader_mgr = upipe_m3u_reader_mgr_alloc();
    if (unlikely(!upipe_m3u_reader_mgr)) {
        upipe_err(upipe, "fail to allocate m3u reader manager");
        upipe_release(upipe);
        return NULL;
    }

    inner = upipe_void_alloc(
        upipe_m3u_reader_mgr,
        uprobe_pfx_alloc(uprobe_use(&upipe_hls->probe_reader),
                         UPROBE_LOG_VERBOSE, "reader"));
    upipe_mgr_release(upipe_m3u_reader_mgr);
    if (unlikely(!inner)) {
        upipe_err(upipe, "fail to allocate m3u reader");
        upipe_release(upipe);
        return NULL;
    }
    upipe_hls_store_bin_input(upipe, inner);

    return upipe;
}
Exemplo n.º 10
0
/** @internal @This allocates an nacl audio pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_nacl_audio_alloc(struct upipe_mgr *mgr,
                                            struct uprobe *uprobe,
                                            uint32_t signature, va_list args)
{
    if (signature != UPIPE_VOID_SIGNATURE)
        return NULL;
    struct upipe_nacl_audio *upipe_nacl_audio =
        malloc(sizeof(struct upipe_nacl_audio) +
               uqueue_sizeof(MAX_QUEUE_LENGTH));
    if (unlikely(upipe_nacl_audio == NULL))
        return NULL;

    if(unlikely(!uqueue_init(&upipe_nacl_audio->uqueue, MAX_QUEUE_LENGTH,
                             upipe_nacl_audio->uqueue_extra))) {
        free(upipe_nacl_audio);
        return NULL;
    }

    struct upipe *upipe = upipe_nacl_audio_to_upipe(upipe_nacl_audio);
    upipe_init(upipe, mgr, uprobe);

    upipe_nacl_audio_init_urefcount(upipe);
    upipe_nacl_audio_init_input(upipe);
    upipe_nacl_audio_init_upump_mgr(upipe);
    upipe_nacl_audio_init_upump(upipe);
    upipe_nacl_audio_init_uclock(upipe);
    upipe_nacl_audio->started = false;

    PPB_AudioConfig *audio_config_interface =
        (PPB_AudioConfig *)PSGetInterface(PPB_AUDIO_CONFIG_INTERFACE);
    upipe_nacl_audio->nb_samples =
        audio_config_interface->RecommendSampleFrameCount(PSGetInstanceId(),
                SAMPLE_RATE, NB_SAMPLES);
    upipe_nacl_audio->audio_config =
        audio_config_interface->CreateStereo16Bit(PSGetInstanceId(),
                SAMPLE_RATE, upipe_nacl_audio->nb_samples);

    upipe_nacl_audio->core_interface =
        (PPB_Core *)PSGetInterface(PPB_CORE_INTERFACE);
    upipe_nacl_audio->audio_interface =
        (PPB_Audio *)PSGetInterface(PPB_AUDIO_INTERFACE);
    upipe_nacl_audio->audio =
        upipe_nacl_audio->audio_interface->Create(PSGetInstanceId(),
                                upipe_nacl_audio->audio_config,
                                upipe_nacl_audio_worker, upipe);

    upipe_throw_ready(upipe);
    return upipe;
}
Exemplo n.º 11
0
/** @internal @This allocates a skip pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_skip_alloc(struct upipe_mgr *mgr,
                                        struct uprobe *uprobe)
{
    struct upipe_skip *upipe_skip = malloc(sizeof(struct upipe_skip));
    if (unlikely(upipe_skip == NULL))
        return NULL;
    struct upipe *upipe = upipe_skip_to_upipe(upipe_skip);
    upipe_init(upipe, mgr, uprobe);
    upipe_skip_init_output(upipe);

    upipe_skip->offset = 0;

    upipe_throw_ready(upipe);
    return upipe;
}
Exemplo n.º 12
0
/** @internal @This allocates a dejitter pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_dejitter_alloc(struct upipe_mgr *mgr,
                                          struct uprobe *uprobe,
                                          uint32_t signature, va_list args)
{
    struct upipe *upipe = upipe_dejitter_alloc_void(mgr, uprobe, signature,
                                                    args);
    if (unlikely(upipe == NULL))
        return NULL;

    struct upipe_dejitter *upipe_dejitter = upipe_dejitter_from_upipe(upipe);
    upipe_dejitter_init_urefcount(upipe);
    upipe_dejitter_init_output(upipe);
    upipe_dejitter->inited = false;
    upipe_throw_ready(upipe);
    return upipe;
}
Exemplo n.º 13
0
static struct upipe *upipe_dump_alloc(struct upipe_mgr *mgr,
                                      struct uprobe *uprobe,
                                      uint32_t signature,
                                      va_list args)
{
    struct upipe *upipe = upipe_dump_alloc_void(mgr, uprobe, signature, args);

    upipe_dump_init_urefcount(upipe);
    upipe_dump_init_output(upipe);

    struct upipe_dump *upipe_dump = upipe_dump_from_upipe(upipe);
    upipe_dump->max_len = (size_t)-1;

    upipe_throw_ready(upipe);

    return upipe;
}
Exemplo n.º 14
0
/** @internal @This allocates a ts_psim pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_ts_psim_alloc(struct upipe_mgr *mgr,
                                         struct uprobe *uprobe,
                                         uint32_t signature, va_list args)
{
    struct upipe *upipe = upipe_ts_psim_alloc_void(mgr, uprobe, signature,
                                                   args);
    if (unlikely(upipe == NULL))
        return NULL;

    struct upipe_ts_psim *upipe_ts_psim = upipe_ts_psim_from_upipe(upipe);
    upipe_ts_psim_init_urefcount(upipe);
    upipe_ts_psim_init_sync(upipe);
    upipe_ts_psim_init_output(upipe);
    upipe_ts_psim->next_uref = NULL;
    upipe_throw_ready(upipe);
    return upipe;
}
Exemplo n.º 15
0
/** @internal @This allocates a tblk pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_tblk_alloc(struct upipe_mgr *mgr,
                                      struct uprobe *uprobe,
                                      uint32_t signature, va_list args)
{
    struct upipe *upipe = upipe_tblk_alloc_void(mgr, uprobe, signature, args);
    if (unlikely(upipe == NULL))
        return NULL;

    struct upipe_tblk *upipe_tblk = upipe_tblk_from_upipe(upipe);
    upipe_tblk_init_urefcount(upipe);
    upipe_tblk_init_ubuf_mgr(upipe);
    upipe_tblk_init_output(upipe);
    upipe_tblk_init_input(upipe);
    upipe_tblk->input_alloc = UBUF_ALLOC_BLOCK;
    upipe_throw_ready(upipe);
    return upipe;
}
Exemplo n.º 16
0
/** @internal @This allocates a rtpd pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_rtpd_alloc(struct upipe_mgr *mgr,
                                      struct uprobe *uprobe,
                                      uint32_t signature, va_list args)
{
    struct upipe *upipe = upipe_rtpd_alloc_void(mgr, uprobe, signature, args);
    if (unlikely(upipe == NULL))
        return NULL;

    struct upipe_rtpd *upipe_rtpd = upipe_rtpd_from_upipe(upipe);
    upipe_rtpd_init_urefcount(upipe);
    upipe_rtpd_init_output(upipe);
    upipe_rtpd->expected_seqnum = -1;
    upipe_rtpd->type = 0;
    upipe_rtpd->flow_def_input = NULL;

    upipe_throw_ready(upipe);
    return upipe;
}
Exemplo n.º 17
0
/** @internal @This allocates a agg pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_agg_alloc(struct upipe_mgr *mgr,
                                     struct uprobe *uprobe,
                                     uint32_t signature, va_list args)
{
    struct upipe *upipe = upipe_agg_alloc_void(mgr, uprobe, signature, args);
    if (unlikely(upipe == NULL))
        return NULL;

    struct upipe_agg *upipe_agg = upipe_agg_from_upipe(upipe);
    upipe_agg_init_urefcount(upipe);
    upipe_agg_init_output(upipe);
    upipe_agg_init_output_size(upipe, DEFAULT_MTU);
    upipe_agg->input_size = 0;
    upipe_agg->size = 0;
    upipe_agg->aggregated = NULL;
    upipe_throw_ready(upipe);
    return upipe;
}
Exemplo n.º 18
0
/** @internal @This allocates a osx_audioqueue_sink pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_osx_audioqueue_sink_alloc(struct upipe_mgr *mgr,
        struct uprobe *uprobe,
        uint32_t signature, va_list args)
{
    struct upipe *upipe = upipe_osx_audioqueue_sink_alloc_void(mgr, uprobe,
                          signature, args);
    if (unlikely(upipe == NULL))
        return NULL;

    struct upipe_osx_audioqueue_sink *osx_audioqueue =
        upipe_osx_audioqueue_sink_from_upipe(upipe);
    upipe_osx_audioqueue_sink_init_urefcount(upipe);
    osx_audioqueue->queue = NULL;
    osx_audioqueue->volume = 1.0;

    upipe_throw_ready(upipe);
    return upipe;
}
Exemplo n.º 19
0
/** @internal @This allocates a filter pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_filter_ebur128_alloc(struct upipe_mgr *mgr,
                                                struct uprobe *uprobe,
                                                uint32_t signature,
                                                va_list args)
{
    struct upipe *upipe = upipe_filter_ebur128_alloc_void(mgr, uprobe, signature,
                                                        args);
    if (unlikely(upipe == NULL))
        return NULL;
    struct upipe_filter_ebur128 *upipe_filter_ebur128 =
                                 upipe_filter_ebur128_from_upipe(upipe);
    upipe_filter_ebur128->st = NULL;

    upipe_filter_ebur128_init_urefcount(upipe);
    upipe_filter_ebur128_init_output(upipe);
    upipe_throw_ready(upipe);
    return upipe;
}
Exemplo n.º 20
0
/** @internal @This allocates a setflowdef pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_setflowdef_alloc(struct upipe_mgr *mgr,
                                            struct uprobe *uprobe,
                                            uint32_t signature, va_list args)
{
    struct upipe *upipe = upipe_setflowdef_alloc_void(mgr, uprobe, signature,
                                                      args);
    if (unlikely(upipe == NULL))
        return NULL;

    struct upipe_setflowdef *upipe_setflowdef =
        upipe_setflowdef_from_upipe(upipe);
    upipe_setflowdef_init_urefcount(upipe);
    upipe_setflowdef_init_output(upipe);
    upipe_setflowdef->dict = NULL;
    upipe_setflowdef->flow_def_input = NULL;
    upipe_throw_ready(upipe);
    return upipe;
}
Exemplo n.º 21
0
/** @internal @This allocates a fdec pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_fdec_alloc(struct upipe_mgr *mgr,
                                      struct uprobe *uprobe,
                                      uint32_t signature, va_list args)
{
    struct upipe *upipe = upipe_fdec_alloc_void(mgr, uprobe, signature, args);
    if (unlikely(upipe == NULL))
        return NULL;
    struct upipe_fdec *upipe_fdec = upipe_fdec_from_upipe(upipe);
    upipe_fdec_init_urefcount(upipe);
    urefcount_init(upipe_fdec_to_urefcount_real(upipe_fdec),
                   upipe_fdec_free);
    upipe_fdec_init_uref_mgr(upipe);
    upipe_fdec_init_bin_input(upipe);
    upipe_fdec_init_bin_output(upipe, upipe_fdec_to_urefcount_real(upipe_fdec));
    upipe_fdec->options = NULL;
    upipe_throw_ready(upipe);
    upipe_fdec_demand_uref_mgr(upipe);
    return upipe;
}
Exemplo n.º 22
0
/** @internal @This allocates a file sink pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_fsink_alloc(struct upipe_mgr *mgr,
                                       struct uprobe *uprobe,
                                       uint32_t signature, va_list args)
{
    struct upipe *upipe = upipe_fsink_alloc_void(mgr, uprobe, signature, args);
    if (unlikely(upipe == NULL))
        return NULL;

    struct upipe_fsink *upipe_fsink = upipe_fsink_from_upipe(upipe);
    upipe_fsink_init_urefcount(upipe);
    upipe_fsink_init_upump_mgr(upipe);
    upipe_fsink_init_upump(upipe);
    upipe_fsink_init_input(upipe);
    upipe_fsink_init_uclock(upipe);
    upipe_fsink->latency = 0;
    upipe_fsink->fd = -1;
    upipe_fsink->path = NULL;
    upipe_throw_ready(upipe);
    return upipe;
}
Exemplo n.º 23
0
/** @internal @This allocates an s337d pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_s337d_alloc(struct upipe_mgr *mgr,
                                       struct uprobe *uprobe,
                                       uint32_t signature, va_list args)
{
    struct upipe *upipe = upipe_s337d_alloc_void(mgr, uprobe, signature, args);
    if (unlikely(upipe == NULL))
        return NULL;

    struct upipe_s337d *upipe_s337d = upipe_s337d_from_upipe(upipe);
    upipe_s337d_init_urefcount(upipe);
    upipe_s337d_init_sync(upipe);
    upipe_s337d_init_uref_stream(upipe);
    upipe_s337d_init_output(upipe);
    upipe_s337d_init_flow_def(upipe);
    upipe_s337d->data_type = UINT8_MAX;
    upipe_s337d->data_stream = UINT8_MAX;
    upipe_s337d->next_frame_size = -1;
    upipe_s337d->next_frame_discard = true;
    upipe_throw_ready(upipe);
    return upipe;
}
Exemplo n.º 24
0
/** @internal @This allocates a ts_pcr_interpolator pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_ts_pcr_interpolator_alloc(struct upipe_mgr *mgr,
                                           struct uprobe *uprobe,
                                           uint32_t signature, va_list args)
{
    struct upipe *upipe = upipe_ts_pcr_interpolator_alloc_void(mgr, uprobe, signature,
                                                     args);
    if (unlikely(upipe == NULL))
        return NULL;

    struct upipe_ts_pcr_interpolator *upipe_ts_pcr_interpolator = upipe_ts_pcr_interpolator_from_upipe(upipe);
    upipe_ts_pcr_interpolator_init_urefcount(upipe);
    upipe_ts_pcr_interpolator_init_output(upipe);
    upipe_ts_pcr_interpolator->last_pcr = 0;
    upipe_ts_pcr_interpolator->packets = 0;
    upipe_ts_pcr_interpolator->pcr_packets = 0;
    upipe_ts_pcr_interpolator->pcr_delta = 0;
    upipe_ts_pcr_interpolator->discontinuity = true;

    upipe_throw_ready(upipe);
    return upipe;
}
Exemplo n.º 25
0
/** @internal @This allocates a block_to_sound pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_block_to_sound_alloc(struct upipe_mgr *mgr,
                                      struct uprobe *uprobe,
                                      uint32_t signature, va_list args)
{
    struct uref *flow_def;

    struct upipe *upipe = upipe_block_to_sound_alloc_flow(mgr, uprobe, signature, args, &flow_def);
    if (unlikely(upipe == NULL))
        return NULL;

    struct upipe_block_to_sound *upipe_block_to_sound = upipe_block_to_sound_from_upipe(upipe);

    if (unlikely(!ubase_check(uref_sound_flow_get_planes(flow_def,
            &upipe_block_to_sound->planes)) || upipe_block_to_sound->planes != 1 )) {
        upipe_err_va(upipe, "wrong number of planes: %d", upipe_block_to_sound->planes);
        upipe_block_to_sound_free_flow(upipe);
        uref_free(flow_def);
        return NULL;
    }

    if (unlikely(!ubase_check(uref_sound_flow_get_sample_size(flow_def,
            &upipe_block_to_sound->sample_size)))) {
        upipe_err_va(upipe, "flow def needs sample_size");
        upipe_block_to_sound_free_flow(upipe);
        uref_free(flow_def);
        return NULL;
    }

    upipe_block_to_sound->flow_def_config = flow_def;

    upipe_block_to_sound_init_urefcount(upipe);
    upipe_block_to_sound_init_output(upipe);
    upipe_block_to_sound_init_ubuf_mgr(upipe);

    upipe_throw_ready(upipe);

    return upipe;
}
Exemplo n.º 26
0
/** @internal @This allocates and initializes a dvbcsa encryption pipe.
 *
 * @param mgr pointer to pipe manager
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return an allocated and initialized pipe
 */
static struct upipe *upipe_dvbcsa_enc_alloc(struct upipe_mgr *mgr,
                                            struct uprobe *uprobe,
                                            uint32_t signature,
                                            va_list args)
{
    struct upipe *upipe =
        upipe_dvbcsa_enc_alloc_void(mgr, uprobe, signature, args);
    if (unlikely(!upipe))
        return NULL;
    struct upipe_dvbcsa_enc *upipe_dvbcsa_enc =
        upipe_dvbcsa_enc_from_upipe(upipe);
    struct upipe_dvbcsa_common *common =
        upipe_dvbcsa_enc_to_common(upipe_dvbcsa_enc);

    upipe_dvbcsa_enc_init_urefcount(upipe);
    upipe_dvbcsa_enc_init_output(upipe);
    upipe_dvbcsa_common_init(common);
    upipe_dvbcsa_enc->key = NULL;

    upipe_throw_ready(upipe);

    return upipe;
}
Exemplo n.º 27
0
/** @internal @This allocates a ts_pese pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_ts_pese_alloc(struct upipe_mgr *mgr,
                                         struct uprobe *uprobe,
                                         uint32_t signature, va_list args)
{
    struct upipe *upipe = upipe_ts_pese_alloc_void(mgr, uprobe, signature,
                                                   args);
    if (unlikely(upipe == NULL))
        return NULL;

    struct upipe_ts_pese *upipe_ts_pese = upipe_ts_pese_from_upipe(upipe);
    upipe_ts_pese_init_urefcount(upipe);
    upipe_ts_pese_init_ubuf_mgr(upipe);
    upipe_ts_pese_init_output(upipe);
    upipe_ts_pese_init_input(upipe);
    upipe_ts_pese->input_latency = 0;
    upipe_ts_pese->pes_id = 0;
    upipe_ts_pese->pes_header_size = 0;
    upipe_ts_pese->pes_min_duration = 0;
    ulist_init(&upipe_ts_pese->next_pes);
    upipe_ts_pese->next_pes_size = 0;
    upipe_ts_pese->next_pes_duration = 0;
    upipe_throw_ready(upipe);
    return upipe;
}
Exemplo n.º 28
0
/** @internal @This allocates a m3u reader pipe.
 *
 * @param mgr common management structure
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return pointer to upipe or NULL in case of allocation error
 */
static struct upipe *upipe_m3u_reader_alloc(struct upipe_mgr *mgr,
                                            struct uprobe *uprobe,
                                            uint32_t signature,
                                            va_list args)
{
    struct upipe *upipe =
        upipe_m3u_reader_alloc_void(mgr, uprobe, signature, args);

    upipe_m3u_reader_init_urefcount(upipe);
    upipe_m3u_reader_init_output(upipe);
    upipe_m3u_reader_init_uref_stream(upipe);

    struct upipe_m3u_reader *upipe_m3u_reader =
        upipe_m3u_reader_from_upipe(upipe);
    ulist_init(&upipe_m3u_reader->items);
    upipe_m3u_reader->current_flow_def = NULL;
    upipe_m3u_reader->flow_def = NULL;
    upipe_m3u_reader->item = NULL;
    upipe_m3u_reader->key = NULL;
    upipe_m3u_reader->restart = false;
    upipe_throw_ready(upipe);

    return upipe;
}
Exemplo n.º 29
0
/** @internal @This allocates and initializes a void source pipe.
 *
 * @param mgr pointer to upipe manager
 * @param uprobe structure used to raise events
 * @param signature signature of the pipe allocator
 * @param args optional arguments
 * @return an alloocated and initialized pipe or NULL
 */
static struct upipe *upipe_voidsrc_alloc(struct upipe_mgr *mgr,
                                         struct uprobe *uprobe,
                                         uint32_t signature, va_list args)
{
    struct uref *flow;
    struct upipe *upipe = upipe_voidsrc_alloc_flow(mgr, uprobe,
                                                   signature, args,
                                                   &flow);
    if (unlikely(!upipe))
        return NULL;

    uint64_t duration = 0;
    if (unlikely(!ubase_check(
        uref_clock_get_duration(flow, &duration)))) {
        uref_free(flow);
        upipe_voidsrc_free_flow(upipe);
        return NULL;
    }

    upipe_voidsrc_init_urefcount(upipe);
    upipe_voidsrc_init_output(upipe);
    upipe_voidsrc_init_uref_mgr(upipe);
    upipe_voidsrc_init_uclock(upipe);
    upipe_voidsrc_init_upump_mgr(upipe);
    upipe_voidsrc_init_timer(upipe);

    struct upipe_voidsrc *upipe_voidsrc = upipe_voidsrc_from_upipe(upipe);
    upipe_voidsrc->interval = duration;
    upipe_voidsrc->pts = UINT64_MAX;

    upipe_throw_ready(upipe);

    upipe_voidsrc_store_flow_def(upipe, flow);

    return upipe;
}
Exemplo n.º 30
0
static struct upipe *upipe_rtcp_alloc(struct upipe_mgr *mgr,
                                      struct uprobe *uprobe,
                                      uint32_t signature,
                                      va_list args)
{
    struct upipe *upipe = upipe_rtcp_alloc_void(mgr, uprobe, signature, args);
    if (unlikely(upipe == NULL))
        return NULL;

    upipe_rtcp_init_urefcount(upipe);
    upipe_rtcp_init_output(upipe);
    upipe_rtcp_init_uref_mgr(upipe);
    upipe_rtcp_init_ubuf_mgr(upipe);

    struct upipe_rtcp *upipe_rtcp = upipe_rtcp_from_upipe(upipe);
    upipe_rtcp->packet_count = 0;
    upipe_rtcp->octet_count = 0;
    upipe_rtcp->clockrate = 0;
    upipe_rtcp->rate = UCLOCK_FREQ;
    upipe_rtcp->last_sent = 0;
    upipe_throw_ready(upipe);

    return upipe;
}