/** * initialize the media player * * @param channel opaque handle returned by WTSVirtualChannelOpenEx * @param stream_id unique identification number for this stream * @param filename media file to play * * @return 0 on success, -1 on error *****************************************************************************/ int xrdpvr_init_player(void *channel, int stream_id, char *filename) { if ((channel == NULL) || (stream_id <= 0) || (filename == NULL)) { return -1; } /* send metadata from media file to client */ if (xrdpvr_create_metadata_file(channel, filename)) { printf("error sending metadata to client\n"); return -1; } /* ask client to get video format from media file */ if (xrdpvr_set_video_format(channel, 101)) { printf("xrdpvr_set_video_format() failed\n"); return -1; } /* TODO */ sleep(3); /* ask client to get audio format from media file */ if (xrdpvr_set_audio_format(channel, 101)) { printf("xrdpvr_set_audio_format() failed\n"); return 1; } }
/** * @brief this is a temp hack while we figure out how to set up the right * context for avcodec_decode_video2() on the server side; the workaround * is to send the first 1MB of the media file to the server end which * reads this file and sets up its context * * @return 0 on success, -1 on failure ******************************************************************************/ int OurInterface::sendMetadataFile() { if (xrdpvr_create_metadata_file(channel, filename.toAscii().data())) { emit on_ErrorMsg("I/O Error", "An error occurred while sending data to remote client"); return -1; } return 0; }
/** * @brief this is a temp hack while we figure out how to set up the right * context for avcodec_decode_video2() on the server side; the workaround * is to send the first 1MB of the media file to the server end which * reads this file and sets up its context * * @return 0 on success, -1 on failure ******************************************************************************/ int OurInterface::sendMetadataFile() { if (xrdpvr_init_player(channel, 101, filename.toAscii().data())) { fprintf(stderr, "failed to initialize the player\n"); return -1; } #if 0 if (xrdpvr_create_metadata_file(channel, filename.toAscii().data())) { emit on_ErrorMsg("I/O Error", "An error occurred while sending data to remote client"); return -1; } #endif return 0; }