static int webm_dash_manifest_read_header(AVFormatContext *s)

{

    char *buf;

    int ret = matroska_read_header(s);

    MatroskaTrack *tracks;

    MatroskaDemuxContext *matroska = s->priv_data;

    if (ret) {

        av_log(s, AV_LOG_ERROR, "Failed to read file headers\n");

        return -1;









    if (!matroska->is_live) {

        buf = av_asprintf("%g", matroska->duration);

        if (!buf) return AVERROR(ENOMEM);

        av_dict_set(&s->streams[0]->metadata, DURATION, buf, 0);

        av_free(buf);



        // initialization range

        // 5 is the offset of Cluster ID.

        av_dict_set_int(&s->streams[0]->metadata, INITIALIZATION_RANGE, avio_tell(s->pb) - 5, 0);




    // basename of the file

    buf = strrchr(s->filename, '/');

    av_dict_set(&s->streams[0]->metadata, FILENAME, buf ? ++buf : s->filename, 0);



    // track number

    tracks = matroska->tracks.elem;

    av_dict_set_int(&s->streams[0]->metadata, TRACK_NUMBER, tracks[0].num, 0);



    // parse the cues and populate Cue related fields

    return matroska->is_live ? 0 : webm_dash_manifest_cues(s);

static int webm_dash_manifest_read_header(AVFormatContext *s)

{

    char *buf;

    int ret = matroska_read_header(s);

    MatroskaTrack *tracks;

    MatroskaDemuxContext *matroska = s->priv_data;

    if (ret) {

        av_log(s, AV_LOG_ERROR, "Failed to read file headers\n");

        return -1;









    if (!matroska->is_live) {

        buf = av_asprintf("%g", matroska->duration);

        if (!buf) return AVERROR(ENOMEM);

        av_dict_set(&s->streams[0]->metadata, DURATION, buf, 0);

        av_free(buf);



        

        

        av_dict_set_int(&s->streams[0]->metadata, INITIALIZATION_RANGE, avio_tell(s->pb) - 5, 0);




    

    buf = strrchr(s->filename, '/');

    av_dict_set(&s->streams[0]->metadata, FILENAME, buf ? ++buf : s->filename, 0);



    

    tracks = matroska->tracks.elem;

    av_dict_set_int(&s->streams[0]->metadata, TRACK_NUMBER, tracks[0].num, 0);



    

    return matroska->is_live ? 0 : webm_dash_manifest_cues(s);

static int FUNC_0(AVFormatContext *VAR_0)

{

    char *VAR_1;

    int VAR_2 = matroska_read_header(VAR_0);

    MatroskaTrack *tracks;

    MatroskaDemuxContext *matroska = VAR_0->priv_data;

    if (VAR_2) {

        av_log(VAR_0, AV_LOG_ERROR, "Failed to read file headers\n");

        return -1;









    if (!matroska->is_live) {

        VAR_1 = av_asprintf("%g", matroska->duration);

        if (!VAR_1) return AVERROR(ENOMEM);

        av_dict_set(&VAR_0->streams[0]->metadata, DURATION, VAR_1, 0);

        av_free(VAR_1);



        

        

        av_dict_set_int(&VAR_0->streams[0]->metadata, INITIALIZATION_RANGE, avio_tell(VAR_0->pb) - 5, 0);




    

    VAR_1 = strrchr(VAR_0->filename, '/');

    av_dict_set(&VAR_0->streams[0]->metadata, FILENAME, VAR_1 ? ++VAR_1 : VAR_0->filename, 0);



    

    tracks = matroska->tracks.elem;

    av_dict_set_int(&VAR_0->streams[0]->metadata, TRACK_NUMBER, tracks[0].num, 0);



    

    return matroska->is_live ? 0 : webm_dash_manifest_cues(VAR_0);

static int FUNC_0(AVFormatContext *VAR_0)
{ char *VAR_1; int VAR_2 = matroska_read_header(VAR_0); MatroskaTrack *tracks; MatroskaDemuxContext *matroska = VAR_0->priv_data; if (VAR_2) { av_log(VAR_0, AV_LOG_ERROR, "Failed to read file headers\n"); return -1; if (!matroska->is_live) { VAR_1 = av_asprintf("%g", matroska->duration); if (!VAR_1) return AVERROR(ENOMEM); av_dict_set(&VAR_0->streams[0]->metadata, DURATION, VAR_1, 0); av_free(VAR_1); av_dict_set_int(&VAR_0->streams[0]->metadata, INITIALIZATION_RANGE, avio_tell(VAR_0->pb) - 5, 0); VAR_1 = strrchr(VAR_0->filename, '/'); av_dict_set(&VAR_0->streams[0]->metadata, FILENAME, VAR_1 ? ++VAR_1 : VAR_0->filename, 0); tracks = matroska->tracks.elem; av_dict_set_int(&VAR_0->streams[0]->metadata, TRACK_NUMBER, tracks[0].num, 0); return matroska->is_live ? 0 : webm_dash_manifest_cues(VAR_0);