Beispiel #1
0
void nav_title_close(NAV_TITLE *title)
{
    unsigned ii, ss;

    if (!title)
        return;

    if (title->sub_path) {
        for (ss = 0; ss < title->sub_path_count; ss++) {
            if (title->sub_path[ss].clip_list.clip) {
                for (ii = 0; ii < title->sub_path[ss].clip_list.count; ii++) {
                    clpi_free(title->sub_path[ss].clip_list.clip[ii].cl);
                }
                X_FREE(title->sub_path[ss].clip_list.clip);
            }
        }
        X_FREE(title->sub_path);
    }

    if (title->clip_list.clip) {
        for (ii = 0; ii < title->clip_list.count; ii++) {
            clpi_free(title->clip_list.clip[ii].cl);
        }
        X_FREE(title->clip_list.clip);
    }

    mpls_free(title->pl);
    X_FREE(title->chap_list.mark);
    X_FREE(title->mark_list.mark);
    X_FREE(title);
}
Beispiel #2
0
static void _fill_clip(NAV_TITLE *title,
                       MPLS_CLIP *mpls_clip,
                       uint8_t connection_condition, uint32_t in_time, uint32_t out_time,
                       unsigned pi_angle_count,
                       NAV_CLIP *clip,
                       unsigned ref, uint32_t *pos, uint32_t *time)

{
    char *path;

    clip->title = title;
    clip->ref   = ref;

    if (title->angle >= pi_angle_count) {
        clip->angle = 0;
    } else {
        clip->angle = title->angle;
    }

    strncpy(clip->name, mpls_clip[clip->angle].clip_id, 5);
    strncpy(&clip->name[5], ".m2ts", 6);
    clip->clip_id = atoi(mpls_clip[clip->angle].clip_id);

    path = str_printf("%s"DIR_SEP"BDMV"DIR_SEP"CLIPINF"DIR_SEP"%s.clpi",
                      title->root, mpls_clip[clip->angle].clip_id);
    clpi_free(clip->cl);
    clip->cl = clpi_parse(path, 0);
    X_FREE(path);
    if (clip->cl == NULL) {
        clip->start_pkt = 0;
        clip->end_pkt = 0;
        return;
    }
    switch (connection_condition) {
        case 5:
        case 6:
            clip->start_pkt = 0;
            clip->connection = CONNECT_SEAMLESS;
            break;
        default:
            if (ref) {
                clip->start_pkt = clpi_lookup_spn(clip->cl, in_time, 1,
                                              mpls_clip[clip->angle].stc_id);
            } else {
                clip->start_pkt = 0;
            }
            clip->connection = CONNECT_NON_SEAMLESS;
            break;
    }
    clip->end_pkt = clpi_lookup_spn(clip->cl, out_time, 0,
                                    mpls_clip[clip->angle].stc_id);
    clip->in_time = in_time;
    clip->out_time = out_time;
    clip->pos = *pos;
    *pos += clip->end_pkt - clip->start_pkt;
    clip->start_time = *time;
    *time += clip->out_time - clip->in_time;
}
Beispiel #3
0
NAV_CLIP* nav_set_angle(NAV_TITLE *title, NAV_CLIP *clip, unsigned angle)
{
    char *path;
    int ii;
    uint32_t pos = 0;
    uint32_t time = 0;

    if (title == NULL) {
        return clip;
    }
    if (angle > 8) {
        // invalid angle
        return clip;
    }
    if (angle == title->angle) {
        // no change
        return clip;
    }

    title->angle = angle;
    // Find length in packets and end_pkt for each clip
    title->packets = 0;
    for (ii = 0; ii < title->pl->list_count; ii++) {
        MPLS_PI *pi;
        NAV_CLIP *clip;

        pi = &title->pl->play_item[ii];
        clip = &title->clip_list.clip[ii];
        if (title->angle >= pi->angle_count) {
            clip->angle = 0;
        } else {
            clip->angle = title->angle;
        }

        clpi_free(clip->cl);

        clip->ref = ii;
        strncpy(clip->name, pi->clip[clip->angle].clip_id, 5);
        strncpy(&clip->name[5], ".m2ts", 6);
        clip->clip_id  = atoi(pi->clip[clip->angle].clip_id);

        path = str_printf("%s"DIR_SEP"BDMV"DIR_SEP"CLIPINF"DIR_SEP"%s.clpi",
                      title->root, pi->clip[clip->angle].clip_id);
        clip->cl = clpi_parse(path, 0);
        X_FREE(path);
        if (clip->cl == NULL) {
            clip->start_pkt = 0;
            clip->end_pkt = 0;
            continue;
        }
        switch (pi->connection_condition) {
            case 5:
            case 6:
                clip->start_pkt = 0;
                clip->connection = CONNECT_SEAMLESS;
                break;
            default:
                clip->start_pkt = clpi_lookup_spn(clip->cl, pi->in_time, 1,
                                                  pi->clip[clip->angle].stc_id);
                clip->connection = CONNECT_NON_SEAMLESS;
            break;
        }
        clip->end_pkt = clpi_lookup_spn(clip->cl, pi->out_time, 0,
                                        pi->clip[clip->angle].stc_id);
        clip->in_time = pi->in_time;
        clip->out_time = pi->out_time;
        clip->pos = pos;
        pos += clip->end_pkt - clip->start_pkt;
        clip->start_time = time;
        time += clip->out_time - clip->in_time;
    }
    _extrapolate_title(title);
    return clip;
}
Beispiel #4
0
int
main(int argc, char *argv[])
{
    CLPI_CL *cl;
    int opt;
    int opt_clip_info = 0, opt_seq_info = 0, opt_prog_info = 0;
    int opt_cpi_info = 0, opt_extent_start = 0;
    int ii;

    do {
        opt = getopt(argc, argv, OPTS);
        switch (opt) {
            case -1: break;

            case 'v':
                verbose = 1;
                break;

            case 's':
                opt_seq_info = 1;
                break;

            case 'i':
                opt_cpi_info = 1;
                break;

            case 'c':
                opt_clip_info = 1;
                break;

            case 'p':
                opt_prog_info = 1;
                break;

            case 'e':
                opt_extent_start = 1;
                break;

            default:
                _usage(argv[0]);
                break;
        }
    } while (opt != -1);

    if (optind >= argc) {
        _usage(argv[0]);
    }

    for (ii = optind; ii < argc; ii++) {
        cl = clpi_parse(argv[ii]);
        if (cl == NULL) {
            fprintf(stderr, "Parse failed\n");
            continue;
        }
        if (opt_clip_info) {
            // Show clip info
            _show_clip_info(&cl->clip, 1);
        }
        if (opt_seq_info) {
            // Show sequence info
            _show_seq_info(&cl->sequence, 1);
        }
        if (opt_prog_info) {
            // Show program info
            _show_prog_info(&cl->program, 1);
        }
        if (opt_cpi_info) {
            // Show cpi
            _show_cpi_info(&cl->cpi, 1);
        }

        if (opt_prog_info) {
            if (cl->program_ss.num_prog) {
                printf("\n");
                indent_printf(1, "Extension: Program Info SS");
                _show_prog_info(&cl->program_ss, 1);
            }
        }
        if (opt_cpi_info) {
            if (cl->program_ss.num_prog) {
                printf("\n");
                indent_printf(1, "Extension: CPI SS");
                _show_cpi_info(&cl->cpi_ss, 1);
            }
        }
        if (opt_extent_start) {
            // Show extent start point
            if (cl->extent_start.num_point > 0) {
                _show_extent_start(&cl->extent_start, 1);
            }
        }

        clpi_free(cl);
    }
    return 0;
}