static void srt_to_ass(AVCodecContext *avctx, AVBPrint *dst,

                       const char *in, int x1, int y1, int x2, int y2)

{

    if (x1 >= 0 && y1 >= 0) {

        /* XXX: here we rescale coordinate assuming they are in DVD resolution

         * (720x480) since we don't have anything better */



        if (x2 >= 0 && y2 >= 0 && (x2 != x1 || y2 != y1) && x2 >= x1 && y2 >= y1) {

            /* text rectangle defined, write the text at the center of the rectangle */

            const int cx = x1 + (x2 - x1)/2;

            const int cy = y1 + (y2 - y1)/2;

            const int scaled_x = cx * (int64_t)ASS_DEFAULT_PLAYRESX / 720;

            const int scaled_y = cy * (int64_t)ASS_DEFAULT_PLAYRESY / 480;

            av_bprintf(dst, "{\\an5}{\\pos(%d,%d)}", scaled_x, scaled_y);

        } else {

            /* only the top left corner, assume the text starts in that corner */

            const int scaled_x = x1 * (int64_t)ASS_DEFAULT_PLAYRESX / 720;

            const int scaled_y = y1 * (int64_t)ASS_DEFAULT_PLAYRESY / 480;

            av_bprintf(dst, "{\\an1}{\\pos(%d,%d)}", scaled_x, scaled_y);

        }

    }



    ff_htmlmarkup_to_ass(avctx, dst, in);

}

static void srt_to_ass(AVCodecContext *avctx, AVBPrint *dst,

                       const char *in, int x1, int y1, int x2, int y2)

{

    if (x1 >= 0 && y1 >= 0) {

        





        if (x2 >= 0 && y2 >= 0 && (x2 != x1 || y2 != y1) && x2 >= x1 && y2 >= y1) {

            

            const int cx = x1 + (x2 - x1)/2;

            const int cy = y1 + (y2 - y1)/2;

            const int scaled_x = cx * (int64_t)ASS_DEFAULT_PLAYRESX / 720;

            const int scaled_y = cy * (int64_t)ASS_DEFAULT_PLAYRESY / 480;

            av_bprintf(dst, "{\\an5}{\\pos(%d,%d)}", scaled_x, scaled_y);

        } else {

            

            const int scaled_x = x1 * (int64_t)ASS_DEFAULT_PLAYRESX / 720;

            const int scaled_y = y1 * (int64_t)ASS_DEFAULT_PLAYRESY / 480;

            av_bprintf(dst, "{\\an1}{\\pos(%d,%d)}", scaled_x, scaled_y);

        }

    }



    ff_htmlmarkup_to_ass(avctx, dst, in);

}

static void FUNC_0(AVCodecContext *VAR_0, AVBPrint *VAR_1,

                       const char *VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6)

{

    if (VAR_3 >= 0 && VAR_4 >= 0) {

        





        if (VAR_5 >= 0 && VAR_6 >= 0 && (VAR_5 != VAR_3 || VAR_6 != VAR_4) && VAR_5 >= VAR_3 && VAR_6 >= VAR_4) {

            

            const int VAR_7 = VAR_3 + (VAR_5 - VAR_3)/2;

            const int VAR_8 = VAR_4 + (VAR_6 - VAR_4)/2;

            const int VAR_11 = VAR_7 * (int64_t)ASS_DEFAULT_PLAYRESX / 720;

            const int VAR_11 = VAR_8 * (int64_t)ASS_DEFAULT_PLAYRESY / 480;

            av_bprintf(VAR_1, "{\\an5}{\\pos(%d,%d)}", VAR_11, VAR_11);

        } else {

            

            const int VAR_11 = VAR_3 * (int64_t)ASS_DEFAULT_PLAYRESX / 720;

            const int VAR_11 = VAR_4 * (int64_t)ASS_DEFAULT_PLAYRESY / 480;

            av_bprintf(VAR_1, "{\\an1}{\\pos(%d,%d)}", VAR_11, VAR_11);

        }

    }



    ff_htmlmarkup_to_ass(VAR_0, VAR_1, VAR_2);

}

static void FUNC_0(AVCodecContext *VAR_0, AVBPrint *VAR_1,
const char *VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6)
{ if (VAR_3 >= 0 && VAR_4 >= 0) { if (VAR_5 >= 0 && VAR_6 >= 0 && (VAR_5 != VAR_3 || VAR_6 != VAR_4) && VAR_5 >= VAR_3 && VAR_6 >= VAR_4) { const int VAR_7 = VAR_3 + (VAR_5 - VAR_3)/2; const int VAR_8 = VAR_4 + (VAR_6 - VAR_4)/2; const int VAR_11 = VAR_7 * (int64_t)ASS_DEFAULT_PLAYRESX / 720; const int VAR_11 = VAR_8 * (int64_t)ASS_DEFAULT_PLAYRESY / 480; av_bprintf(VAR_1, "{\\an5}{\\pos(%d,%d)}", VAR_11, VAR_11); } else { const int VAR_11 = VAR_3 * (int64_t)ASS_DEFAULT_PLAYRESX / 720; const int VAR_11 = VAR_4 * (int64_t)ASS_DEFAULT_PLAYRESY / 480; av_bprintf(VAR_1, "{\\an1}{\\pos(%d,%d)}", VAR_11, VAR_11); } } ff_htmlmarkup_to_ass(VAR_0, VAR_1, VAR_2); }