|
|
@@ -158,6 +158,7 @@ static void obs_qsv_defaults(obs_data_t *settings)
|
|
|
obs_data_set_default_int(settings, "la_depth", 40);
|
|
|
|
|
|
obs_data_set_default_int(settings, "keyint_sec", 3);
|
|
|
+ obs_data_set_default_int(settings, "bframes", 3);
|
|
|
}
|
|
|
|
|
|
static inline void add_strings(obs_property_t *list, const char *const *strings)
|
|
|
@@ -179,6 +180,7 @@ static inline void add_strings(obs_property_t *list, const char *const *strings)
|
|
|
#define TEXT_ICQ_QUALITY obs_module_text("ICQQuality")
|
|
|
#define TEXT_LA_DEPTH obs_module_text("LookAheadDepth")
|
|
|
#define TEXT_KEYINT_SEC obs_module_text("KeyframeIntervalSec")
|
|
|
+#define TEXT_BFRAMES obs_module_text("B Frames")
|
|
|
|
|
|
static bool rate_control_modified(obs_properties_t *ppts, obs_property_t *p,
|
|
|
obs_data_t *settings)
|
|
|
@@ -279,6 +281,7 @@ static obs_properties_t *obs_qsv_props(void *unused)
|
|
|
obs_properties_add_int(props, "icq_quality", TEXT_ICQ_QUALITY, 1, 51,
|
|
|
1);
|
|
|
obs_properties_add_int(props, "la_depth", TEXT_LA_DEPTH, 10, 100, 1);
|
|
|
+ obs_properties_add_int(props, "bframes", TEXT_BFRAMES, 0, 3, 1);
|
|
|
|
|
|
return props;
|
|
|
}
|
|
|
@@ -305,7 +308,7 @@ static void update_params(struct obs_qsv *obsqsv, obs_data_t *settings)
|
|
|
int la_depth = (int)obs_data_get_int(settings, "la_depth");
|
|
|
int keyint_sec = (int)obs_data_get_int(settings, "keyint_sec");
|
|
|
bool cbr_override = obs_data_get_bool(settings, "cbr");
|
|
|
- int bFrames = 7;
|
|
|
+ int bFrames = (int)obs_data_get_int(settings, "bframes");
|
|
|
|
|
|
if (obs_data_has_user_value(settings, "bf"))
|
|
|
bFrames = (int)obs_data_get_int(settings, "bf");
|
|
|
@@ -611,8 +614,19 @@ static void parse_packet(struct obs_qsv *obsqsv, struct encoder_packet *packet,
|
|
|
packet->size = obsqsv->packet_data.num;
|
|
|
packet->type = OBS_ENCODER_VIDEO;
|
|
|
packet->pts = pBS->TimeStamp * fps_num / 90000;
|
|
|
- packet->keyframe =
|
|
|
- (pBS->FrameType & (MFX_FRAMETYPE_I | MFX_FRAMETYPE_REF));
|
|
|
+ packet->keyframe = (pBS->FrameType & MFX_FRAMETYPE_IDR);
|
|
|
+
|
|
|
+ uint16_t frameType = pBS->FrameType;
|
|
|
+ uint8_t priority;
|
|
|
+
|
|
|
+ if (frameType & MFX_FRAMETYPE_I)
|
|
|
+ priority = OBS_NAL_PRIORITY_HIGHEST;
|
|
|
+ else if ((frameType & MFX_FRAMETYPE_P) || (frameType & MFX_FRAMETYPE_REF))
|
|
|
+ priority = OBS_NAL_PRIORITY_HIGH;
|
|
|
+ else
|
|
|
+ priority = 0;
|
|
|
+
|
|
|
+ packet->priority = priority;
|
|
|
|
|
|
/* ------------------------------------ */
|
|
|
|
|
|
@@ -629,15 +643,8 @@ static void parse_packet(struct obs_qsv *obsqsv, struct encoder_packet *packet,
|
|
|
|
|
|
type = start[0] & 0x1F;
|
|
|
if (type == OBS_NAL_SLICE_IDR || type == OBS_NAL_SLICE) {
|
|
|
- uint8_t prev_type = (start[0] >> 5) & 0x3;
|
|
|
start[0] &= ~(3 << 5);
|
|
|
-
|
|
|
- if (pBS->FrameType & MFX_FRAMETYPE_I)
|
|
|
- start[0] |= OBS_NAL_PRIORITY_HIGHEST << 5;
|
|
|
- else if (pBS->FrameType & MFX_FRAMETYPE_P)
|
|
|
- start[0] |= OBS_NAL_PRIORITY_HIGH << 5;
|
|
|
- else
|
|
|
- start[0] |= prev_type << 5;
|
|
|
+ start[0] |= priority << 5; //0 for non-ref frames and not equal to 0 for ref frames
|
|
|
}
|
|
|
|
|
|
start = (uint8_t *)obs_avc_find_startcode(start, end);
|