Use a macro for specifying the slices per frame capability to allow for configurable slicing

This commit is contained in:
Cameron Gutman 2015-08-16 12:11:10 -07:00
parent 2d35d7262f
commit 19849a1ac5
2 changed files with 9 additions and 7 deletions

View File

@ -69,9 +69,10 @@ typedef struct _DECODE_UNIT {
// supports reference frame invalidation. This flag is only valid on video renderers.
#define CAPABILITY_REFERENCE_FRAME_INVALIDATION 0x2
// If set in the video renderer capabilities field, this flag specifies that the renderer
// supports slicing to increase decoding performance. This flag is only valid on video renderers.
#define CAPABILITY_SLICING 0x4
// If set in the video renderer capabilities field, this macro specifies that the renderer
// supports H264 slicing to increase decoding performance. The parameter specifies the desired
// number of slices per frame. This capability is only valid on video renderers.
#define CAPABILITY_SLICES_PER_FRAME(x) (((unsigned char)(x)) << 24)
// This callback is invoked to provide details about the video stream and allow configuration of the decoder
typedef void(*DecoderRendererSetup)(int width, int height, int redrawRate, void* context, int drFlags);

View File

@ -133,16 +133,17 @@ static int addGen3Options(PSDP_OPTION *head, char* addrStr) {
static int addGen4Options(PSDP_OPTION *head, char* addrStr) {
char payloadStr[92];
int err = 0;
unsigned char slicesPerFrame;
sprintf(payloadStr, "rtsp://%s:48010", addrStr);
err |= addAttributeString(head, "x-nv-general.serverAddress", payloadStr);
err |= addAttributeString(head, "x-nv-video[0].rateControlMode", "4");
if (VideoCallbacks.capabilities & CAPABILITY_SLICING) {
// Use slicing for increased performance on some decoders
err |= addAttributeString(head, "x-nv-video[0].videoEncoderSlicesPerFrame", "4");
}
// Use slicing for increased performance on some decoders
slicesPerFrame = (unsigned char) (VideoCallbacks.capabilities >> 24);
sprintf(payloadStr, "%d", slicesPerFrame);
err |= addAttributeString(head, "x-nv-video[0].videoEncoderSlicesPerFrame", payloadStr);
return err;
}