static void rtsp_cmd_play(RTSPContext *ctx, const char *url, RTSPMessageHeader *h) { char path[4096]; // av_url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path, sizeof(path), url); if(strncmp(path, rtspconf->object, strlen(rtspconf->object)) != 0) { rtsp_reply_error(ctx, RTSP_STATUS_SESSION); return; } if(strcmp(ctx->session_id, h->session_id) != 0) { rtsp_reply_error(ctx, RTSP_STATUS_SESSION); return; } // if(ctx->state != SERVER_STATE_READY && ctx->state != SERVER_STATE_PAUSE) { rtsp_reply_error(ctx, RTSP_STATUS_STATE); return; } // create threads #ifndef SHARE_ENCODER if(pthread_create(&ctx->vthread, NULL, vencoder_thread, ctx) != 0) { ga_error("cannot create video thread\n"); rtsp_reply_error(ctx, RTSP_STATUS_INTERNAL); return; } #ifdef ENABLE_AUDIO if(pthread_create(&ctx->athread, NULL, aencoder_thread, ctx) != 0) { ga_error("cannot create audio thread\n"); rtsp_reply_error(ctx, RTSP_STATUS_INTERNAL); return; } #endif /* ENABLE_AUDIO */ #else if(encoder_register_client(ctx) < 0) { ga_error("cannot register encoder client.\n"); rtsp_reply_error(ctx, RTSP_STATUS_INTERNAL); return; } #endif /* SHARE_ENCODER */ // ctx->state = SERVER_STATE_PLAYING; rtsp_reply_header(ctx, RTSP_STATUS_OK); rtsp_printf(ctx, "Session: %s\r\n", ctx->session_id); rtsp_printf(ctx, "\r\n"); return; }
GAVideoLiveSource ::GAVideoLiveSource(UsageEnvironment& env, int cid) : FramedSource(env) { // if (referenceCount == 0) { // Any global initialization of the device would be done here: m = encoder_get_vencoder(); if(strcmp(m->mimetype, "video/H264") == 0 || strcmp(m->mimetype, "video/H265") == 0) remove_startcode = 1; encoder_register_client(this); } ++referenceCount; // Any instance-specific initialization of the device would be done here: this->channelId = cid; vLiveSource[cid] = this; if (eventTriggerId[cid] == 0) { eventTriggerId[cid] = envir().taskScheduler().createEventTrigger(deliverFrame0); encoder_pktqueue_register_callback(this->channelId, signalNewVideoFrameData); } }
int live_server_register_client(void *ccontext) { if(encoder_register_client(ccontext) < 0) return -1; return 0; }