Skip to content

Commit a74198a

Browse files
committed
h264: set profile_idc in SPS
Signed-off-by: Philipp Zabel <[email protected]>
1 parent 6d59904 commit a74198a

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

src/h264.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,27 @@ int h264_get_controls(struct request_data *driver_data,
464464
return VA_STATUS_SUCCESS;
465465
}
466466

467+
static inline __u8 h264_profile_to_idc(VAProfile profile)
468+
{
469+
switch (profile) {
470+
case VAProfileH264Main:
471+
return 77;
472+
case VAProfileH264High:
473+
return 100;
474+
case VAProfileH264ConstrainedBaseline:
475+
return 66;
476+
case VAProfileH264MultiviewHigh:
477+
return 118;
478+
case VAProfileH264StereoHigh:
479+
return 128;
480+
default:
481+
return 0;
482+
}
483+
}
484+
467485
int h264_set_controls(struct request_data *driver_data,
468486
struct object_context *context,
487+
VAProfile profile,
469488
struct object_surface *surface)
470489
{
471490
struct v4l2_ctrl_h264_scaling_matrix matrix = { 0 };
@@ -494,6 +513,8 @@ int h264_set_controls(struct request_data *driver_data,
494513
&surface->params.h264.slice,
495514
&surface->params.h264.picture, &slice);
496515

516+
sps.profile_idc = h264_profile_to_idc(profile);
517+
497518
struct v4l2_ext_control controls[5] = {
498519
{
499520
.id = V4L2_CID_MPEG_VIDEO_H264_SPS,

src/h264.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ int h264_get_controls(struct request_data *driver_data,
5555
struct object_context *context);
5656
int h264_set_controls(struct request_data *data,
5757
struct object_context *context,
58+
VAProfile profile,
5859
struct object_surface *surface);
5960

6061
#endif

src/picture.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ static VAStatus codec_set_controls(struct request_data *driver_data,
193193
case VAProfileH264ConstrainedBaseline:
194194
case VAProfileH264MultiviewHigh:
195195
case VAProfileH264StereoHigh:
196-
rc = h264_set_controls(driver_data, context, surface_object);
196+
rc = h264_set_controls(driver_data, context, profile,
197+
surface_object);
197198
if (rc < 0)
198199
return VA_STATUS_ERROR_OPERATION_FAILED;
199200
break;

0 commit comments

Comments
 (0)