Skip to content

Commit

Permalink
libvlc: media: add projection in libvlc_video_track_t
Browse files Browse the repository at this point in the history
  • Loading branch information
tguillem committed Nov 28, 2016
1 parent 08670a3 commit 38aca24
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
15 changes: 15 additions & 0 deletions include/vlc/libvlc_media.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ typedef enum libvlc_video_orient_t
libvlc_video_orient_right_bottom /**< Anti-transposed */
} libvlc_video_orient_t;

typedef enum libvlc_video_projection_t
{
libvlc_video_projection_rectangular,
libvlc_video_projection_equirectangular, /**< 360 spherical */

libvlc_video_projection_cubemap_layout_standard = 0x100,
} libvlc_video_projection_t;

typedef struct libvlc_video_track_t
{
unsigned i_height;
Expand All @@ -194,6 +202,13 @@ typedef struct libvlc_video_track_t
unsigned i_frame_rate_den;

libvlc_video_orient_t i_orientation;
libvlc_video_projection_t i_projection;
struct {
float f_yaw_degrees; /**< View point yaw in degrees ]-180;180] */
float f_pitch_degrees; /**< View point pitch in degrees ]-90;90] */
float f_roll_degrees; /**< View point roll in degrees ]-180;180] */
float f_fov_degrees; /**< View point fov in degrees ]0;180[ */
} pose; /**< Initial view point */
} libvlc_video_track_t;

typedef struct libvlc_subtitle_track_t
Expand Down
15 changes: 15 additions & 0 deletions lib/media.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ static_assert(
ORIENT_RIGHT_BOTTOM == (int) libvlc_video_orient_right_bottom,
"Mismatch between libvlc_video_orient_t and video_orientation_t" );

static_assert(
PROJECTION_MODE_RECTANGULAR == (int) libvlc_video_projection_rectangular &&
PROJECTION_MODE_EQUIRECTANGULAR == (int) libvlc_video_projection_equirectangular &&
PROJECTION_MODE_CUBEMAP_LAYOUT_STANDARD == (int) libvlc_video_projection_cubemap_layout_standard,
"Mismatch between libvlc_video_projection_t and video_projection_mode_t" );

static libvlc_media_list_t *media_get_subitems( libvlc_media_t * p_md,
bool b_create )
{
Expand Down Expand Up @@ -1010,6 +1016,15 @@ libvlc_media_tracks_get( libvlc_media_t *p_md, libvlc_media_track_t *** pp_es )
p_es->video.orientation <= ORIENT_RIGHT_BOTTOM );
p_mes->video->i_orientation = (int) p_es->video.orientation;

assert( ( p_es->video.projection_mode >= PROJECTION_MODE_RECTANGULAR &&
p_es->video.projection_mode <= PROJECTION_MODE_EQUIRECTANGULAR ) ||
( p_es->video.projection_mode == PROJECTION_MODE_CUBEMAP_LAYOUT_STANDARD ) );
p_mes->video->i_projection = (int) p_es->video.projection_mode;

p_mes->video->pose.f_yaw_degrees = p_es->video.pose.f_yaw_degrees;
p_mes->video->pose.f_pitch_degrees = p_es->video.pose.f_pitch_degrees;
p_mes->video->pose.f_roll_degrees = p_es->video.pose.f_roll_degrees;
p_mes->video->pose.f_fov_degrees = p_es->video.pose.f_fov_degrees;
break;
case AUDIO_ES:
p_mes->i_type = libvlc_track_audio;
Expand Down

0 comments on commit 38aca24

Please sign in to comment.