SQLITE_NOTICE(283): recovered 2 frames from WAL file /fossil/androwish.fossil-wal

AndroWish: Check-in [4fcdf8ee88]
Check-in [4fcdf8ee88]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fixes in experimental jsmpeg SDL video driver
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4fcdf8ee88e6c0d116a57bc4542e235a615e1275
User & Date: chw 2019-02-11 19:08:28
Context
2019-02-12
06:15
improvements in experimental jsmpeg SDL video driver check-in: e7128384f3 user: chw tags: trunk
2019-02-11
19:09
merge with trunk check-in: 166bd37e61 user: chw tags: wtf-8-experiment
19:08
fixes in experimental jsmpeg SDL video driver check-in: 4fcdf8ee88 user: chw tags: trunk
2019-02-10
21:09
add experimental jsmpeg SDL video driver check-in: 713b08b2bf user: chw tags: trunk
Changes

Changes to jni/SDL2/configure.
21659
21660
21661
21662
21663
21664
21665
21666
21667
21668
21669
21670
21671
21672

























21673




21674
21675
21676
21677
21678
21679
21680
21681
21682
21683
21684

21685
21686
21687
21688
21689
21690
21691
21692
$as_echo "$PKG_CONFIG" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ffmpeg/libwebsocket support" >&5
$as_echo_n "checking for ffmpeg/libwebsocket support... " >&6; }
        video_jsmpeg=no
        if test x$PKG_CONFIG != xno; then
            if $PKG_CONFIG --exists libavutil libavcodec libswscale libwebsockets ; then
                JSMPEG_CFLAGS=`$PKG_CONFIG --cflags libavutil libavcodec libswscale libwebsockets`
                JSMPEG_LIBS=`$PKG_CONFIG --libs libavutil libavcodec libswscale libwebsockets`

























                video_jsmpeg=yes




            fi
        fi
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_jsmpeg" >&5
$as_echo "$video_jsmpeg" >&6; }

        if test x$video_jsmpeg = xyes; then

$as_echo "#define SDL_VIDEO_DRIVER_JSMPEG 1" >>confdefs.h

            JSMPEG_SOURCES="$srcdir/src/video/jsmpeg/*.c"
            SOURCES="$SOURCES $JSMPEG_SOURCES"

            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $JSMPEG_LIBS"
            SUMMARY_video="${SUMMARY_video} jsmpeg"
            have_video=yes
        fi
    fi
}

# Check whether --enable-video-opengl was given.







|
|



|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
>
>
>











>
|







21659
21660
21661
21662
21663
21664
21665
21666
21667
21668
21669
21670
21671
21672
21673
21674
21675
21676
21677
21678
21679
21680
21681
21682
21683
21684
21685
21686
21687
21688
21689
21690
21691
21692
21693
21694
21695
21696
21697
21698
21699
21700
21701
21702
21703
21704
21705
21706
21707
21708
21709
21710
21711
21712
21713
21714
21715
21716
21717
21718
21719
21720
21721
21722
$as_echo "$PKG_CONFIG" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ffmpeg/libwebsockets support" >&5
$as_echo_n "checking for ffmpeg/libwebsockets support... " >&6; }
        video_jsmpeg=no
        if test x$PKG_CONFIG != xno; then
            if $PKG_CONFIG --exists libavutil libavcodec libswscale libwebsockets ; then
                LAV_CFLAGS=`$PKG_CONFIG --cflags libavutil libavcodec libswscale`
                LAV_LIBS=`$PKG_CONFIG --libs libavutil libavcodec libswscale`
                LWS_CFLAGS=`$PKG_CONFIG --cflags libwebsockets`
                LWS_LIBS=`$PKG_CONFIG --libs libwebsockets`
                save_CFLAGS="$CFLAGS"
                CFLAGS="$CFLAGS $LWS_CFLAGS"
		# need libwebsockets 2.x or 3.x
                cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

                 #include <libwebsockets.h>

int
main ()
{

                 struct lws *lws;
		 struct lws_context *lwc;
		 struct lws_context_creation_info lwi;
		 lwc = lws_create_context(&lwi);

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :

                video_jsmpeg=yes

fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
                CFLAGS="$save_CFLAGS"
            fi
        fi
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_jsmpeg" >&5
$as_echo "$video_jsmpeg" >&6; }

        if test x$video_jsmpeg = xyes; then

$as_echo "#define SDL_VIDEO_DRIVER_JSMPEG 1" >>confdefs.h

            JSMPEG_SOURCES="$srcdir/src/video/jsmpeg/*.c"
            SOURCES="$SOURCES $JSMPEG_SOURCES"
            EXTRA_CFLAGS="$EXTRA_CFLAGS $LAV_CFLAGS $LWS_CFLAGS"
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LAV_LIBS $LWS_LIBS"
            SUMMARY_video="${SUMMARY_video} jsmpeg"
            have_video=yes
        fi
    fi
}

# Check whether --enable-video-opengl was given.

Changes to jni/SDL2/configure.in.
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257













2258


2259
2260
2261
2262
2263
2264
2265
2266

2267
2268
2269
2270
2271
2272
2273
2274
CheckJSMPEGVideo()
{
    AC_ARG_ENABLE(video-jsmpeg,
AC_HELP_STRING([--enable-video-jsmpeg], [use jsmpeg video driver [[default=no]]]),
                  , enable_video_jsmpeg=no)
    if test x$enable_video = xyes -a x$enable_video_jsmpeg = xyes; then
        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
        AC_MSG_CHECKING(for ffmpeg/libwebsocket support)
        video_jsmpeg=no
        if test x$PKG_CONFIG != xno; then
            if $PKG_CONFIG --exists libavutil libavcodec libswscale libwebsockets ; then
                JSMPEG_CFLAGS=`$PKG_CONFIG --cflags libavutil libavcodec libswscale libwebsockets`
                JSMPEG_LIBS=`$PKG_CONFIG --libs libavutil libavcodec libswscale libwebsockets`













                video_jsmpeg=yes


            fi
        fi
        AC_MSG_RESULT($video_jsmpeg)

        if test x$video_jsmpeg = xyes; then
            AC_DEFINE(SDL_VIDEO_DRIVER_JSMPEG, 1, [ ])
            JSMPEG_SOURCES="$srcdir/src/video/jsmpeg/*.c"
            SOURCES="$SOURCES $JSMPEG_SOURCES"

            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $JSMPEG_LIBS"
            SUMMARY_video="${SUMMARY_video} jsmpeg"
            have_video=yes
        fi
    fi
}

dnl Check to see if OpenGL support is desired







|



|
|
>
>
>
>
>
>
>
>
>
>
>
>
>

>
>








>
|







2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
CheckJSMPEGVideo()
{
    AC_ARG_ENABLE(video-jsmpeg,
AC_HELP_STRING([--enable-video-jsmpeg], [use jsmpeg video driver [[default=no]]]),
                  , enable_video_jsmpeg=no)
    if test x$enable_video = xyes -a x$enable_video_jsmpeg = xyes; then
        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
        AC_MSG_CHECKING(for ffmpeg/libwebsockets support)
        video_jsmpeg=no
        if test x$PKG_CONFIG != xno; then
            if $PKG_CONFIG --exists libavutil libavcodec libswscale libwebsockets ; then
                LAV_CFLAGS=`$PKG_CONFIG --cflags libavutil libavcodec libswscale`
                LAV_LIBS=`$PKG_CONFIG --libs libavutil libavcodec libswscale`
                LWS_CFLAGS=`$PKG_CONFIG --cflags libwebsockets`
                LWS_LIBS=`$PKG_CONFIG --libs libwebsockets`
                save_CFLAGS="$CFLAGS"
                CFLAGS="$CFLAGS $LWS_CFLAGS"
		# need libwebsockets 2.x or 3.x
                AC_TRY_COMPILE([
                 #include <libwebsockets.h>
                ],[
                 struct lws *lws;
		 struct lws_context *lwc;
		 struct lws_context_creation_info lwi;
		 lwc = lws_create_context(&lwi);
                ],[
                video_jsmpeg=yes
                ])
                CFLAGS="$save_CFLAGS"
            fi
        fi
        AC_MSG_RESULT($video_jsmpeg)

        if test x$video_jsmpeg = xyes; then
            AC_DEFINE(SDL_VIDEO_DRIVER_JSMPEG, 1, [ ])
            JSMPEG_SOURCES="$srcdir/src/video/jsmpeg/*.c"
            SOURCES="$SOURCES $JSMPEG_SOURCES"
            EXTRA_CFLAGS="$EXTRA_CFLAGS $LAV_CFLAGS $LWS_CFLAGS"
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LAV_LIBS $LWS_LIBS"
            SUMMARY_video="${SUMMARY_video} jsmpeg"
            have_video=yes
        fi
    fi
}

dnl Check to see if OpenGL support is desired

Changes to jni/SDL2/src/video/jsmpeg/SDL_jsmpeg.c.
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
...
799
800
801
802
803
804
805




806

807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823



824
825
826

827

828



















829
830
831
832
833
834
835
836
static void JSMPEG_CleanupWindowData(SDL_WindowData *data);
static void JSMPEG_DestroyWindowFramebuffer(_THIS, SDL_Window *window);

static int JSMPEG_CallbackHTTP(struct lws *lws, enum lws_callback_reasons reason, void *user, void *in, size_t len);
static int JSMPEG_CallbackWS(struct lws *lws, enum lws_callback_reasons reason, void *user, void *in, size_t len);

static struct lws_protocols LWS_protos[] = {
    { "http", JSMPEG_CallbackHTTP, 0, 0 },
    { "ws", JSMPEG_CallbackWS, sizeof(Client), 1024 * 1024 },
    { NULL, NULL, 0, 0 }
};

static SDL_INLINE int
geti16(unsigned char *p)
{
................................................................................

    JSMPEG_CleanupWindowData(data);
}

static int
JSMPEG_CallbackHTTP(struct lws *lws, enum lws_callback_reasons reason, void *user, void *in, size_t len)
{




    if (reason == LWS_CALLBACK_HTTP) {

        char *p = (char *) in, *q;
        int i;

        if (len > 0 && p[0] == '/') {
            if (p[1] == '\0') {
                p = "/index.html";
            }
            q = strchr(p + 1, '?');
            for (i = 0; JSMPEG_files[i].name != NULL; i++) {
                if (strcmp(p + 1, JSMPEG_files[i].name) == 0 ||
                    (q != NULL && strncmp(p + 1, JSMPEG_files[i].name, q - p) == 0)) {
                    char buf[128];

                    sprintf(buf, "HTTP/1.1 200 OK\r\nContent-length: %d\r\n\r\n", JSMPEG_files[i].length);
                    lws_write(lws, (unsigned char *) buf, strlen(buf), LWS_WRITE_HTTP_HEADERS);
                    lws_write(lws, (unsigned char *) JSMPEG_files[i].data, JSMPEG_files[i].length, LWS_WRITE_HTTP_FINAL);
                    return 1;



                }
            }
        }

        lws_return_http_status(lws, HTTP_STATUS_NOT_FOUND, NULL);

    }



















    return 0;
}

static int
JSMPEG_CallbackWS(struct lws *lws, enum lws_callback_reasons reason, void *user, void *in, size_t len)
{
    SDL_WindowData *data = (SDL_WindowData *) lws_context_user(lws_get_context(lws));
    Client *client = (Client *) user;







|







 







>
>
>
>
|
>

<






|
|
|


|

|
|
>
>
>



>
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|







118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
...
799
800
801
802
803
804
805
806
807
808
809
810
811
812

813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
static void JSMPEG_CleanupWindowData(SDL_WindowData *data);
static void JSMPEG_DestroyWindowFramebuffer(_THIS, SDL_Window *window);

static int JSMPEG_CallbackHTTP(struct lws *lws, enum lws_callback_reasons reason, void *user, void *in, size_t len);
static int JSMPEG_CallbackWS(struct lws *lws, enum lws_callback_reasons reason, void *user, void *in, size_t len);

static struct lws_protocols LWS_protos[] = {
    { "http", JSMPEG_CallbackHTTP, sizeof(int), 0 },
    { "ws", JSMPEG_CallbackWS, sizeof(Client), 1024 * 1024 },
    { NULL, NULL, 0, 0 }
};

static SDL_INLINE int
geti16(unsigned char *p)
{
................................................................................

    JSMPEG_CleanupWindowData(data);
}

static int
JSMPEG_CallbackHTTP(struct lws *lws, enum lws_callback_reasons reason, void *user, void *in, size_t len)
{
    int index, ret, *udata = (int *) user;

    ret = 0;
    switch (reason) {
    case LWS_CALLBACK_HTTP: {
        int found = 0;
        char *p = (char *) in, *q;


        if (len > 0 && p[0] == '/') {
            if (p[1] == '\0') {
                p = "/index.html";
            }
            q = strchr(p + 1, '?');
            for (index = 0; JSMPEG_files[index].name != NULL; index++) {
                if (strcmp(p + 1, JSMPEG_files[index].name) == 0 ||
                    (q != NULL && strncmp(p + 1, JSMPEG_files[index].name, q - p) == 0)) {
                    char buf[128];

                    sprintf(buf, "HTTP/1.1 200 OK\r\ncontent-length: %d\r\n\r\n", JSMPEG_files[index].length);
                    lws_write(lws, (unsigned char *) buf, strlen(buf), LWS_WRITE_HTTP_HEADERS);
                    /* Remember file index for next callback. */
                    udata[0] = index + 1;
                    lws_callback_on_writable(lws);
                    found = 1;
                    break;
                }
            }
        }
        if (!found) {
            lws_return_http_status(lws, HTTP_STATUS_NOT_FOUND, NULL);
            ret = 1;
        }
        break;
    }
    case LWS_CALLBACK_HTTP_WRITEABLE: {
        index = udata[0];
        if (--index >= 0) {
            lws_write(lws, (unsigned char *) JSMPEG_files[index].data, JSMPEG_files[index].length, LWS_WRITE_HTTP_FINAL);
            /* Next callback will close. */
            udata[0] = 0;
            lws_callback_on_writable(lws);
        } else {
            lws_set_timeout(lws, PENDING_TIMEOUT_HTTP_CONTENT, 0);
            ret = 1;
        }
        break;
    }
    default:
        break;
    }

    return ret;
}

static int
JSMPEG_CallbackWS(struct lws *lws, enum lws_callback_reasons reason, void *user, void *in, size_t len)
{
    SDL_WindowData *data = (SDL_WindowData *) lws_context_user(lws_get_context(lws));
    Client *client = (Client *) user;