static void output_client_manifest(struct VideoFiles *files,

                                   const char *basename, int split)

{

    char filename[1000];

    FILE *out;

    int i, j;



    if (split)

        snprintf(filename, sizeof(filename), "Manifest");

    else

        snprintf(filename, sizeof(filename), "%s.ismc", basename);

    out = fopen(filename, "w");

    if (!out) {

        perror(filename);

        return;

    }

    fprintf(out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");

    fprintf(out, "<SmoothStreamingMedia MajorVersion=\"2\" MinorVersion=\"0\" "

                 "Duration=\"%"PRId64 "\">\n", files->duration * 10);

    if (files->video_file >= 0) {

        struct VideoFile *vf = files->files[files->video_file];

        int index = 0;

        fprintf(out,

                "\t<StreamIndex Type=\"video\" QualityLevels=\"%d\" "

                "Chunks=\"%d\" "

                "Url=\"QualityLevels({bitrate})/Fragments(video={start time})\">\n",

                files->nb_video_files, vf->chunks);

        for (i = 0; i < files->nb_files; i++) {

            vf = files->files[i];

            if (!vf->is_video)

                continue;

            fprintf(out,

                    "\t\t<QualityLevel Index=\"%d\" Bitrate=\"%d\" "

                    "FourCC=\"%s\" MaxWidth=\"%d\" MaxHeight=\"%d\" "

                    "CodecPrivateData=\"",

                    index, vf->bitrate, vf->fourcc, vf->width, vf->height);

            for (j = 0; j < vf->codec_private_size; j++)

                fprintf(out, "%02X", vf->codec_private[j]);

            fprintf(out, "\" />\n");

            index++;

        }

        vf = files->files[files->video_file];

        for (i = 0; i < vf->chunks; i++)

            fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n", i,

                    vf->offsets[i].duration);

        fprintf(out, "\t</StreamIndex>\n");

    }

    if (files->audio_file >= 0) {

        struct VideoFile *vf = files->files[files->audio_file];

        int index = 0;

        fprintf(out,

                "\t<StreamIndex Type=\"audio\" QualityLevels=\"%d\" "

                "Chunks=\"%d\" "

                "Url=\"QualityLevels({bitrate})/Fragments(audio={start time})\">\n",

                files->nb_audio_files, vf->chunks);

        for (i = 0; i < files->nb_files; i++) {

            vf = files->files[i];

            if (!vf->is_audio)

                continue;

            fprintf(out,

                    "\t\t<QualityLevel Index=\"%d\" Bitrate=\"%d\" "

                    "FourCC=\"%s\" SamplingRate=\"%d\" Channels=\"%d\" "

                    "BitsPerSample=\"16\" PacketSize=\"%d\" "

                    "AudioTag=\"%d\" CodecPrivateData=\"",

                    index, vf->bitrate, vf->fourcc, vf->sample_rate,

                    vf->channels, vf->blocksize, vf->tag);

            for (j = 0; j < vf->codec_private_size; j++)

                fprintf(out, "%02X", vf->codec_private[j]);

            fprintf(out, "\" />\n");

            index++;

        }

        vf = files->files[files->audio_file];

        for (i = 0; i < vf->chunks; i++)

            fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n",

                    i, vf->offsets[i].duration);

        fprintf(out, "\t</StreamIndex>\n");

    }

    fprintf(out, "</SmoothStreamingMedia>\n");

    fclose(out);

}

static void output_client_manifest(struct VideoFiles *files,

                                   const char *basename, int split)

{

    char filename[1000];

    FILE *out;

    int i, j;



    if (split)

        snprintf(filename, sizeof(filename), "Manifest");

    else

        snprintf(filename, sizeof(filename), "%s.ismc", basename);

    out = fopen(filename, "w");

    if (!out) {

        perror(filename);

        return;

    }

    fprintf(out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");

    fprintf(out, "<SmoothStreamingMedia MajorVersion=\"2\" MinorVersion=\"0\" "

                 "Duration=\"%"PRId64 "\">\n", files->duration * 10);

    if (files->video_file >= 0) {

        struct VideoFile *vf = files->files[files->video_file];

        int index = 0;

        fprintf(out,

                "\t<StreamIndex Type=\"video\" QualityLevels=\"%d\" "

                "Chunks=\"%d\" "

                "Url=\"QualityLevels({bitrate})/Fragments(video={start time})\">\n",

                files->nb_video_files, vf->chunks);

        for (i = 0; i < files->nb_files; i++) {

            vf = files->files[i];

            if (!vf->is_video)

                continue;

            fprintf(out,

                    "\t\t<QualityLevel Index=\"%d\" Bitrate=\"%d\" "

                    "FourCC=\"%s\" MaxWidth=\"%d\" MaxHeight=\"%d\" "

                    "CodecPrivateData=\"",

                    index, vf->bitrate, vf->fourcc, vf->width, vf->height);

            for (j = 0; j < vf->codec_private_size; j++)

                fprintf(out, "%02X", vf->codec_private[j]);

            fprintf(out, "\" />\n");

            index++;

        }

        vf = files->files[files->video_file];

        for (i = 0; i < vf->chunks; i++)

            fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n", i,

                    vf->offsets[i].duration);

        fprintf(out, "\t</StreamIndex>\n");

    }

    if (files->audio_file >= 0) {

        struct VideoFile *vf = files->files[files->audio_file];

        int index = 0;

        fprintf(out,

                "\t<StreamIndex Type=\"audio\" QualityLevels=\"%d\" "

                "Chunks=\"%d\" "

                "Url=\"QualityLevels({bitrate})/Fragments(audio={start time})\">\n",

                files->nb_audio_files, vf->chunks);

        for (i = 0; i < files->nb_files; i++) {

            vf = files->files[i];

            if (!vf->is_audio)

                continue;

            fprintf(out,

                    "\t\t<QualityLevel Index=\"%d\" Bitrate=\"%d\" "

                    "FourCC=\"%s\" SamplingRate=\"%d\" Channels=\"%d\" "

                    "BitsPerSample=\"16\" PacketSize=\"%d\" "

                    "AudioTag=\"%d\" CodecPrivateData=\"",

                    index, vf->bitrate, vf->fourcc, vf->sample_rate,

                    vf->channels, vf->blocksize, vf->tag);

            for (j = 0; j < vf->codec_private_size; j++)

                fprintf(out, "%02X", vf->codec_private[j]);

            fprintf(out, "\" />\n");

            index++;

        }

        vf = files->files[files->audio_file];

        for (i = 0; i < vf->chunks; i++)

            fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n",

                    i, vf->offsets[i].duration);

        fprintf(out, "\t</StreamIndex>\n");

    }

    fprintf(out, "</SmoothStreamingMedia>\n");

    fclose(out);

}

        vf = files->files[files->video_file];         for (i = 0; i < vf->chunks; i++)         vf = files->files[files->audio_file];         for (i = 0; i < vf->chunks; i++)
static void FUNC_0(struct VideoFiles *VAR_0,

                                   const char *VAR_1, int VAR_2)

{

    char VAR_3[1000];

    FILE *out;

    int VAR_4, VAR_5;



    if (VAR_2)

        snprintf(VAR_3, sizeof(VAR_3), "Manifest");

    else

        snprintf(VAR_3, sizeof(VAR_3), "%s.ismc", VAR_1);

    out = fopen(VAR_3, "w");

    if (!out) {

        perror(VAR_3);

        return;

    }

    fprintf(out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");

    fprintf(out, "<SmoothStreamingMedia MajorVersion=\"2\" MinorVersion=\"0\" "

                 "Duration=\"%"PRId64 "\">\n", VAR_0->duration * 10);

    if (VAR_0->video_file >= 0) {

        struct VideoFile *VAR_8 = VAR_0->VAR_0[VAR_0->video_file];

        int VAR_8 = 0;

        fprintf(out,

                "\t<StreamIndex Type=\"video\" QualityLevels=\"%d\" "

                "Chunks=\"%d\" "

                "Url=\"QualityLevels({bitrate})/Fragments(video={start time})\">\n",

                VAR_0->nb_video_files, VAR_8->chunks);

        for (VAR_4 = 0; VAR_4 < VAR_0->nb_files; VAR_4++) {

            VAR_8 = VAR_0->VAR_0[VAR_4];

            if (!VAR_8->is_video)

                continue;

            fprintf(out,

                    "\t\t<QualityLevel Index=\"%d\" Bitrate=\"%d\" "

                    "FourCC=\"%s\" MaxWidth=\"%d\" MaxHeight=\"%d\" "

                    "CodecPrivateData=\"",

                    VAR_8, VAR_8->bitrate, VAR_8->fourcc, VAR_8->width, VAR_8->height);

            for (VAR_5 = 0; VAR_5 < VAR_8->codec_private_size; VAR_5++)

                fprintf(out, "%02X", VAR_8->codec_private[VAR_5]);

            fprintf(out, "\" />\n");

            VAR_8++;

        }

        VAR_8 = VAR_0->VAR_0[VAR_0->video_file];

        for (VAR_4 = 0; VAR_4 < VAR_8->chunks; VAR_4++)

            fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n", VAR_4,

                    VAR_8->offsets[VAR_4].duration);

        fprintf(out, "\t</StreamIndex>\n");

    }

    if (VAR_0->audio_file >= 0) {

        struct VideoFile *VAR_8 = VAR_0->VAR_0[VAR_0->audio_file];

        int VAR_8 = 0;

        fprintf(out,

                "\t<StreamIndex Type=\"audio\" QualityLevels=\"%d\" "

                "Chunks=\"%d\" "

                "Url=\"QualityLevels({bitrate})/Fragments(audio={start time})\">\n",

                VAR_0->nb_audio_files, VAR_8->chunks);

        for (VAR_4 = 0; VAR_4 < VAR_0->nb_files; VAR_4++) {

            VAR_8 = VAR_0->VAR_0[VAR_4];

            if (!VAR_8->is_audio)

                continue;

            fprintf(out,

                    "\t\t<QualityLevel Index=\"%d\" Bitrate=\"%d\" "

                    "FourCC=\"%s\" SamplingRate=\"%d\" Channels=\"%d\" "

                    "BitsPerSample=\"16\" PacketSize=\"%d\" "

                    "AudioTag=\"%d\" CodecPrivateData=\"",

                    VAR_8, VAR_8->bitrate, VAR_8->fourcc, VAR_8->sample_rate,

                    VAR_8->channels, VAR_8->blocksize, VAR_8->tag);

            for (VAR_5 = 0; VAR_5 < VAR_8->codec_private_size; VAR_5++)

                fprintf(out, "%02X", VAR_8->codec_private[VAR_5]);

            fprintf(out, "\" />\n");

            VAR_8++;

        }

        VAR_8 = VAR_0->VAR_0[VAR_0->audio_file];

        for (VAR_4 = 0; VAR_4 < VAR_8->chunks; VAR_4++)

            fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n",

                    VAR_4, VAR_8->offsets[VAR_4].duration);

        fprintf(out, "\t</StreamIndex>\n");

    }

    fprintf(out, "</SmoothStreamingMedia>\n");

    fclose(out);

}

static void FUNC_0(struct VideoFiles *VAR_0,
const char *VAR_1, int VAR_2)
{ char VAR_3[1000]; FILE *out; int VAR_4, VAR_5; if (VAR_2)
snprintf(VAR_3, sizeof(VAR_3), "Manifest"); else
snprintf(VAR_3, sizeof(VAR_3), "%s.ismc", VAR_1); out = fopen(VAR_3, "w"); if (!out) { perror(VAR_3); return; } fprintf(out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"); fprintf(out, "<SmoothStreamingMedia MajorVersion=\"2\" MinorVersion=\"0\" "
"Duration=\"%"PRId64 "\">\n", VAR_0->duration * 10); if (VAR_0->video_file >= 0) { struct VideoFile *VAR_8 = VAR_0->VAR_0[VAR_0->video_file]; int VAR_8 = 0; fprintf(out,
"\t<StreamIndex Type=\"video\" QualityLevels=\"%d\" "
"Chunks=\"%d\" "
"Url=\"QualityLevels({bitrate})/Fragments(video={start time})\">\n", VAR_0->nb_video_files, VAR_8->chunks); for (VAR_4 = 0; VAR_4 < VAR_0->nb_files; VAR_4++) { VAR_8 = VAR_0->VAR_0[VAR_4]; if (!VAR_8->is_video)
continue; fprintf(out,
"\t\t<QualityLevel Index=\"%d\" Bitrate=\"%d\" "
"FourCC=\"%s\" MaxWidth=\"%d\" MaxHeight=\"%d\" "
"CodecPrivateData=\"",
VAR_8, VAR_8->bitrate, VAR_8->fourcc, VAR_8->width, VAR_8->height); for (VAR_5 = 0; VAR_5 < VAR_8->codec_private_size; VAR_5++) fprintf(out, "%02X", VAR_8->codec_private[VAR_5]); fprintf(out, "\" />\n"); VAR_8++; } VAR_8 = VAR_0->VAR_0[VAR_0->video_file]; for (VAR_4 = 0; VAR_4 < VAR_8->chunks; VAR_4++) fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n", VAR_4,
VAR_8->offsets[VAR_4].duration); fprintf(out, "\t</StreamIndex>\n"); } if (VAR_0->audio_file >= 0) { struct VideoFile *VAR_8 = VAR_0->VAR_0[VAR_0->audio_file]; int VAR_8 = 0; fprintf(out,
"\t<StreamIndex Type=\"audio\" QualityLevels=\"%d\" "
"Chunks=\"%d\" "
"Url=\"QualityLevels({bitrate})/Fragments(audio={start time})\">\n", VAR_0->nb_audio_files, VAR_8->chunks); for (VAR_4 = 0; VAR_4 < VAR_0->nb_files; VAR_4++) { VAR_8 = VAR_0->VAR_0[VAR_4]; if (!VAR_8->is_audio)
continue; fprintf(out,
"\t\t<QualityLevel Index=\"%d\" Bitrate=\"%d\" "
"FourCC=\"%s\" SamplingRate=\"%d\" Channels=\"%d\" "
"BitsPerSample=\"16\" PacketSize=\"%d\" "
"AudioTag=\"%d\" CodecPrivateData=\"",
VAR_8, VAR_8->bitrate, VAR_8->fourcc, VAR_8->sample_rate,
VAR_8->channels, VAR_8->blocksize, VAR_8->tag); for (VAR_5 = 0; VAR_5 < VAR_8->codec_private_size; VAR_5++) fprintf(out, "%02X", VAR_8->codec_private[VAR_5]); fprintf(out, "\" />\n"); VAR_8++; } VAR_8 = VAR_0->VAR_0[VAR_0->audio_file]; for (VAR_4 = 0; VAR_4 < VAR_8->chunks; VAR_4++) fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n",
VAR_4, VAR_8->offsets[VAR_4].duration); fprintf(out, "\t</StreamIndex>\n"); } fprintf(out, "</SmoothStreamingMedia>\n"); fclose(out); }