[vlc-devel] [PATCH 21/28] vlc_es: use a vlc_rationale_t for the SAR
Steve Lhomme
robux4 at videolabs.io
Mon Apr 3 10:22:09 CEST 2017
---
include/vlc_es.h | 3 +-
lib/media.c | 4 +-
modules/access/decklink.cpp | 8 +--
modules/access/dshow/dshow.cpp | 8 +--
modules/access/dvdnav.c | 4 +-
modules/access/dvdread.c | 4 +-
modules/access/imem.c | 6 +--
modules/access/linsys/linsys_hdsdi.c | 4 +-
modules/access/linsys/linsys_sdi.c | 4 +-
modules/access/screen/mac.c | 4 +-
modules/access/screen/wayland.c | 2 +-
modules/access/screen/win32.c | 2 +-
modules/access/screen/xcb.c | 2 +-
modules/access/shm.c | 2 +-
modules/access/v4l2/demux.c | 6 +--
modules/access/vnc.c | 2 +-
modules/codec/aom.c | 6 +--
modules/codec/arib/substext.h | 6 +--
modules/codec/avcodec/encoder.c | 4 +-
modules/codec/avcodec/video.c | 26 ++++-----
modules/codec/bpg.c | 4 +-
modules/codec/cdg.c | 4 +-
modules/codec/crystalhd.c | 8 +--
modules/codec/cvdsub.c | 4 +-
modules/codec/daala.c | 18 +++----
modules/codec/dmo/dmo.c | 12 ++---
modules/codec/dvbsub.c | 8 +--
modules/codec/gstreamer/gstdecode.c | 6 +--
modules/codec/jpeg.c | 4 +-
modules/codec/kate.c | 4 +-
modules/codec/libmpeg2.c | 12 ++---
modules/codec/oggspots.c | 4 +-
modules/codec/omxil/omxil.c | 20 +++----
modules/codec/png.c | 4 +-
modules/codec/schroedinger.c | 8 +--
modules/codec/scte27.c | 4 +-
modules/codec/sdl_image.c | 4 +-
modules/codec/spudec/parse.c | 4 +-
modules/codec/substext.h | 14 ++---
modules/codec/subsusf.c | 2 +-
modules/codec/svcdsub.c | 4 +-
modules/codec/svg.c | 8 +--
modules/codec/theora.c | 14 ++---
modules/codec/videotoolbox.m | 14 ++---
modules/codec/vpx.c | 12 ++---
modules/codec/x264.c | 8 +--
modules/codec/xwd.c | 4 +-
modules/codec/zvbi.c | 2 +-
modules/demux/asf/asf.c | 10 ++--
modules/demux/avformat/demux.c | 6 +--
modules/demux/avformat/mux.c | 6 +--
modules/demux/avi/avi.c | 4 +-
modules/demux/mkv/matroska_segment_parse.cpp | 4 +-
modules/demux/mp4/essetup.c | 8 +--
modules/demux/nuv.c | 4 +-
modules/demux/ogg.c | 4 +-
modules/hw/mmal/codec.c | 4 +-
modules/hw/mmal/deinterlace.c | 4 +-
modules/hw/mmal/vout.c | 8 +--
modules/misc/stats.c | 4 +-
modules/mux/asf.c | 12 ++---
modules/mux/mp4/libmp4mux.c | 14 ++---
modules/mux/ogg.c | 4 +-
modules/packetizer/h264.c | 4 +-
modules/packetizer/mpegvideo.c | 4 +-
modules/packetizer/vc1.c | 4 +-
modules/spu/audiobargraph_v.c | 2 +-
modules/spu/logo.c | 2 +-
modules/spu/marq.c | 2 +-
modules/spu/remoteosd.c | 2 +-
modules/spu/rss.c | 2 +-
modules/stream_out/mosaic_bridge.c | 20 +++----
modules/stream_out/transcode/video.c | 50 ++++++++---------
modules/text_renderer/freetype/freetype.c | 4 +-
modules/video_chroma/swscale.c | 8 +--
modules/video_filter/canvas.c | 10 ++--
modules/video_filter/deinterlace/deinterlace.c | 2 +-
modules/video_filter/scene.c | 2 +-
modules/video_filter/transform.c | 8 +--
modules/video_output/android/display.c | 22 ++++----
modules/video_output/decklink.cpp | 4 +-
modules/video_output/yuv.c | 10 ++--
modules/video_splitter/wall.c | 4 +-
modules/visualization/goom.c | 2 +-
modules/visualization/visual/visual.c | 4 +-
src/input/decoder.c | 20 +++----
src/misc/es_format.c | 26 ++++-----
src/misc/image.c | 42 +++++++--------
src/misc/picture.c | 24 ++++-----
src/misc/subpicture.c | 4 +-
src/video_output/display.c | 74 +++++++++++++-------------
src/video_output/video_epg.c | 14 ++---
src/video_output/video_output.c | 26 ++++-----
src/video_output/video_text.c | 8 +--
src/video_output/video_widgets.c | 14 ++---
src/video_output/vout_subpictures.c | 14 ++---
test/libvlc/media.c | 2 +-
97 files changed, 428 insertions(+), 429 deletions(-)
diff --git a/include/vlc_es.h b/include/vlc_es.h
index 6d7eb58352..33054a5622 100644
--- a/include/vlc_es.h
+++ b/include/vlc_es.h
@@ -318,8 +318,7 @@ struct video_format_t
unsigned int i_bits_per_pixel; /**< number of bits per pixel */
- unsigned int i_sar_num; /**< sample/pixel aspect ratio */
- unsigned int i_sar_den;
+ vlc_rational_t sar; /**< sample/pixel aspect ratio */
vlc_rational_t frame_rate; /**< frame rate */
diff --git a/lib/media.c b/lib/media.c
index 9593b6e1a9..9ff9db4d91 100644
--- a/lib/media.c
+++ b/lib/media.c
@@ -1007,8 +1007,8 @@ libvlc_media_tracks_get( libvlc_media_t *p_md, libvlc_media_track_t *** pp_es )
p_mes->i_type = libvlc_track_video;
p_mes->video->i_height = p_es->video.i_visible_height;
p_mes->video->i_width = p_es->video.i_visible_width;
- p_mes->video->i_sar_num = p_es->video.i_sar_num;
- p_mes->video->i_sar_den = p_es->video.i_sar_den;
+ p_mes->video->i_sar_num = p_es->video.sar.num;
+ p_mes->video->i_sar_den = p_es->video.sar.den;
p_mes->video->i_frame_rate_num = p_es->video.frame_rate.num;
p_mes->video->i_frame_rate_den = p_es->video.frame_rate.den;
diff --git a/modules/access/decklink.cpp b/modules/access/decklink.cpp
index e9b4a41624..41a811eb46 100644
--- a/modules/access/decklink.cpp
+++ b/modules/access/decklink.cpp
@@ -190,8 +190,8 @@ static es_format_t GetModeSettings(demux_t *demux, IDeckLinkDisplayMode *m)
video_fmt.video.i_width = m->GetWidth();
video_fmt.video.i_height = m->GetHeight();
- video_fmt.video.i_sar_num = 1;
- video_fmt.video.i_sar_den = 1;
+ video_fmt.video.sar.num = 1;
+ video_fmt.video.sar.den = 1;
video_fmt.video.frame_rate.num = time_scale;
video_fmt.video.frame_rate.den = frame_duration;
video_fmt.i_bitrate = video_fmt.video.i_width * video_fmt.video.i_height * video_fmt.video.frame_rate.num * 2 * 8;
@@ -199,8 +199,8 @@ static es_format_t GetModeSettings(demux_t *demux, IDeckLinkDisplayMode *m)
vlc_rational_t aspect;
if (!var_InheritURational(demux, &aspect, "decklink-aspect-ratio") &&
aspect.num > 0 && aspect.den > 0) {
- video_fmt.video.i_sar_num = aspect.num * video_fmt.video.i_height;
- video_fmt.video.i_sar_den = aspect.den * video_fmt.video.i_width;
+ video_fmt.video.sar.num = aspect.num * video_fmt.video.i_height;
+ video_fmt.video.sar.den = aspect.den * video_fmt.video.i_width;
}
sys->dominance_flags = flags;
diff --git a/modules/access/dshow/dshow.cpp b/modules/access/dshow/dshow.cpp
index 3ec963a7d6..36589f2d3d 100644
--- a/modules/access/dshow/dshow.cpp
+++ b/modules/access/dshow/dshow.cpp
@@ -704,13 +704,13 @@ static int DemuxOpen( vlc_object_t *p_this )
if( psz_delim )
{
- fmt.video.i_sar_num = atoi( psz_aspect ) * fmt.video.i_height;
- fmt.video.i_sar_den = atoi( psz_delim + 1 ) * fmt.video.i_width;
+ fmt.video.sar.num = atoi( psz_aspect ) * fmt.video.i_height;
+ fmt.video.sar.den = atoi( psz_delim + 1 ) * fmt.video.i_width;
}
else
{
- fmt.video.i_sar_num = 4 * fmt.video.i_height;
- fmt.video.i_sar_den = 3 * fmt.video.i_width;
+ fmt.video.sar.num = 4 * fmt.video.i_height;
+ fmt.video.sar.den = 3 * fmt.video.i_width;
}
free( psz_aspect );
diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index 4bddd856d3..7b957849c4 100644
--- a/modules/access/dvdnav.c
+++ b/modules/access/dvdnav.c
@@ -1450,8 +1450,8 @@ static void ESNew( demux_t *p_demux, int i_id )
/* Add a new ES */
if( tk->fmt.i_cat == VIDEO_ES )
{
- tk->fmt.video.i_sar_num = p_sys->sar.i_num;
- tk->fmt.video.i_sar_den = p_sys->sar.i_den;
+ tk->fmt.video.sar.num = p_sys->sar.i_num;
+ tk->fmt.video.sar.den = p_sys->sar.i_den;
b_select = true;
}
else if( tk->fmt.i_cat == AUDIO_ES )
diff --git a/modules/access/dvdread.c b/modules/access/dvdread.c
index fa9496eb30..c075ec8613 100644
--- a/modules/access/dvdread.c
+++ b/modules/access/dvdread.c
@@ -664,8 +664,8 @@ static void ESNew( demux_t *p_demux, int i_id, int i_lang )
/* Add a new ES */
if( tk->fmt.i_cat == VIDEO_ES )
{
- tk->fmt.video.i_sar_num = p_sys->sar.num;
- tk->fmt.video.i_sar_den = p_sys->sar.den;
+ tk->fmt.video.sar.num = p_sys->sar.num;
+ tk->fmt.video.sar.den = p_sys->sar.den;
}
else if( tk->fmt.i_cat == AUDIO_ES )
{
diff --git a/modules/access/imem.c b/modules/access/imem.c
index 67e175ff27..bdef833826 100644
--- a/modules/access/imem.c
+++ b/modules/access/imem.c
@@ -433,8 +433,8 @@ static int OpenDemux(vlc_object_t *object)
vlc_rational_t rat;
if (!var_InheritURational(object, &rat, "imem-dar") && rat.num && rat.den) {
if (fmt.video.i_width > 0 && fmt.video.i_height > 0) {
- fmt.video.i_sar_num = rat.num * fmt.video.i_height;
- fmt.video.i_sar_den = rat.den * fmt.video.i_width;
+ fmt.video.sar.num = rat.num * fmt.video.i_height;
+ fmt.video.sar.den = rat.den * fmt.video.i_width;
}
}
if (!var_InheritURational(object, &rat, "imem-fps") && rat.num && rat.den) {
@@ -444,7 +444,7 @@ static int OpenDemux(vlc_object_t *object)
msg_Dbg(object, "Video %4.4s %dx%d SAR %d:%d frame rate %u/%u",
(const char *)&fmt.i_codec,
fmt.video.i_width, fmt.video.i_height,
- fmt.video.i_sar_num, fmt.video.i_sar_den,
+ fmt.video.sar.num, fmt.video.sar.den,
fmt.video.frame_rate.num, fmt.video.frame_rate.den);
break;
}
diff --git a/modules/access/linsys/linsys_hdsdi.c b/modules/access/linsys/linsys_hdsdi.c
index bd3402c86d..00e20d62d8 100644
--- a/modules/access/linsys/linsys_hdsdi.c
+++ b/modules/access/linsys/linsys_hdsdi.c
@@ -511,9 +511,9 @@ static int InitVideo( demux_t *p_demux )
fmt.video.frame_rate = p_sys->frame_rate;
fmt.video.i_width = fmt.video.i_visible_width = p_sys->i_width;
fmt.video.i_height = fmt.video.i_visible_height = p_sys->i_height;
- fmt.video.i_sar_num = p_sys->i_aspect * fmt.video.i_height
+ fmt.video.sar.num = p_sys->i_aspect * fmt.video.i_height
/ fmt.video.i_width;
- fmt.video.i_sar_den = VOUT_ASPECT_FACTOR;
+ fmt.video.sar.den = VOUT_ASPECT_FACTOR;
p_sys->p_es_video = es_out_Add( p_demux->out, &fmt );
return VLC_SUCCESS;
diff --git a/modules/access/linsys/linsys_sdi.c b/modules/access/linsys/linsys_sdi.c
index 7b4ad4f60c..4b81ef0221 100644
--- a/modules/access/linsys/linsys_sdi.c
+++ b/modules/access/linsys/linsys_sdi.c
@@ -447,9 +447,9 @@ static int StartDecode( demux_t *p_demux )
fmt.video.i_height = p_sys->i_height;
int i_aspect = p_sys->i_forced_aspect ? p_sys->i_forced_aspect
: p_sys->i_aspect;
- fmt.video.i_sar_num = i_aspect * fmt.video.i_height
+ fmt.video.sar.num = i_aspect * fmt.video.i_height
/ fmt.video.i_width;
- fmt.video.i_sar_den = VOUT_ASPECT_FACTOR;
+ fmt.video.sar.den = VOUT_ASPECT_FACTOR;
p_sys->p_es_video = es_out_Add( p_demux->out, &fmt );
if ( p_sys->b_vbi && InitWSS( p_demux ) != VLC_SUCCESS )
diff --git a/modules/access/screen/mac.c b/modules/access/screen/mac.c
index e9ae7bcf76..0ad0dde6c9 100644
--- a/modules/access/screen/mac.c
+++ b/modules/access/screen/mac.c
@@ -124,8 +124,8 @@ int screen_InitCapture(demux_t *p_demux)
p_sys->fmt.video.i_rmask = 0x00ff0000;
p_sys->fmt.video.i_gmask = 0x0000ff00;
p_sys->fmt.video.i_bmask = 0x000000ff;
- p_sys->fmt.video.i_sar_num =
- p_sys->fmt.video.i_sar_den = 1;
+ p_sys->fmt.video.sar.num =
+ p_sys->fmt.video.sar.den = 1;
p_sys->fmt.video.frame_rate.num = 1000 * p_data->rate;
p_sys->fmt.video.frame_rate.den = 1000;
diff --git a/modules/access/screen/wayland.c b/modules/access/screen/wayland.c
index 5b9cf2f133..7af6da464a 100644
--- a/modules/access/screen/wayland.c
+++ b/modules/access/screen/wayland.c
@@ -123,7 +123,7 @@ static void output_mode_cb(void *data, struct wl_output *output,
es_format_Init(&fmt, VIDEO_ES, VLC_CODEC_RGB32);
fmt.video.i_chroma = VLC_CODEC_RGB32;
fmt.video.i_bits_per_pixel = 32;
- fmt.video.i_sar_num = fmt.video.i_sar_den = 1;
+ fmt.video.sar.num = fmt.video.sar.den = 1;
fmt.video.frame_rate.num = lroundf(1000.f * sys->rate);
fmt.video.frame_rate.den = 1000;
fmt.video.i_width = width;
diff --git a/modules/access/screen/win32.c b/modules/access/screen/win32.c
index 6b94def13f..6fe7bb67e3 100644
--- a/modules/access/screen/win32.c
+++ b/modules/access/screen/win32.c
@@ -131,7 +131,7 @@ int screen_InitCapture( demux_t *p_demux )
p_sys->fmt.video.i_visible_height =
p_sys->fmt.video.i_height = GetSystemMetrics( SM_CYVIRTUALSCREEN );
p_sys->fmt.video.i_bits_per_pixel = i_bits_per_pixel;
- p_sys->fmt.video.i_sar_num = p_sys->fmt.video.i_sar_den = 1;
+ p_sys->fmt.video.sar.num = p_sys->fmt.video.sar.den = 1;
p_sys->fmt.video.i_chroma = i_chroma;
switch( i_chroma )
diff --git a/modules/access/screen/xcb.c b/modules/access/screen/xcb.c
index 7a69cfebfe..3ddd8d6e63 100644
--- a/modules/access/screen/xcb.c
+++ b/modules/access/screen/xcb.c
@@ -566,7 +566,7 @@ static es_out_id_t *InitES (demux_t *demux, uint_fast16_t width,
es_format_Init (&fmt, VIDEO_ES, chroma);
fmt.video.i_chroma = chroma;
fmt.video.i_bits_per_pixel = *bpp;
- fmt.video.i_sar_num = fmt.video.i_sar_den = 1;
+ fmt.video.sar.num = fmt.video.sar.den = 1;
fmt.video.frame_rate.num = 1000 * p_sys->rate;
fmt.video.frame_rate.den = 1000;
fmt.video.i_visible_width = fmt.video.i_width = width;
diff --git a/modules/access/shm.c b/modules/access/shm.c
index 69f741035b..fef004c924 100644
--- a/modules/access/shm.c
+++ b/modules/access/shm.c
@@ -231,7 +231,7 @@ static int Open (vlc_object_t *obj)
es_format_Init (&fmt, VIDEO_ES, chroma);
fmt.video.i_chroma = chroma;
fmt.video.i_bits_per_pixel = bpp;
- fmt.video.i_sar_num = fmt.video.i_sar_den = 1;
+ fmt.video.sar.num = fmt.video.sar.den = 1;
fmt.video.frame_rate.num = 1000 * rate;
fmt.video.frame_rate.den = 1000;
fmt.video.i_visible_width = fmt.video.i_width = width;
diff --git a/modules/access/v4l2/demux.c b/modules/access/v4l2/demux.c
index 37db002770..ad3695bd1a 100644
--- a/modules/access/v4l2/demux.c
+++ b/modules/access/v4l2/demux.c
@@ -402,7 +402,7 @@ static int InitVideo (demux_t *demux, int fd, uint32_t caps)
es_fmt.video.i_height = fmt.fmt.pix.height;
es_fmt.video.frame_rate.num = parm.parm.capture.timeperframe.denominator;
es_fmt.video.frame_rate.den = parm.parm.capture.timeperframe.numerator;
- GetAR (fd, &es_fmt.video.i_sar_num, &es_fmt.video.i_sar_den);
+ GetAR (fd, &es_fmt.video.sar.num, &es_fmt.video.sar.den);
msg_Dbg (demux, "color primaries: %u", fmt.fmt.pix.colorspace);
switch (fmt.fmt.pix.colorspace)
@@ -544,8 +544,8 @@ static int InitVideo (demux_t *demux, int fd, uint32_t caps)
es_fmt.video.i_width, es_fmt.video.i_height);
msg_Dbg (demux, " frame rate: %u/%u", es_fmt.video.frame_rate.num,
es_fmt.video.frame_rate.den);
- msg_Dbg (demux, " aspect ratio: %u/%u", es_fmt.video.i_sar_num,
- es_fmt.video.i_sar_den);
+ msg_Dbg (demux, " aspect ratio: %u/%u", es_fmt.video.sar.num,
+ es_fmt.video.sar.den);
sys->es = es_out_Add (demux->out, &es_fmt);
/* Init I/O method */
diff --git a/modules/access/vnc.c b/modules/access/vnc.c
index d5a88506ae..5dd78c11a7 100644
--- a/modules/access/vnc.c
+++ b/modules/access/vnc.c
@@ -216,7 +216,7 @@ static rfbBool mallocFrameBufferHandler( rfbClient* p_client )
fmt.video.i_gmask = p_client->format.greenMax << p_client->format.greenShift;
fmt.video.i_bmask = p_client->format.blueMax << p_client->format.blueShift;
- fmt.video.i_sar_num = fmt.video.i_sar_den = 1;
+ fmt.video.sar.num = fmt.video.sar.den = 1;
/* declare the new es */
p_sys->es = es_out_Add( p_demux->out, &fmt );
diff --git a/modules/codec/aom.c b/modules/codec/aom.c
index 2770b6deb0..7a26ca02a8 100644
--- a/modules/codec/aom.c
+++ b/modules/codec/aom.c
@@ -189,10 +189,10 @@ static int Decode(decoder_t *dec, block_t *block)
v->i_visible_height = img->d_h;
}
- if( !dec->fmt_out.video.i_sar_num || !dec->fmt_out.video.i_sar_den )
+ if( !dec->fmt_out.video.sar.num || !dec->fmt_out.video.sar.den )
{
- dec->fmt_out.video.i_sar_num = 1;
- dec->fmt_out.video.i_sar_den = 1;
+ dec->fmt_out.video.sar.num = 1;
+ dec->fmt_out.video.sar.den = 1;
}
v->b_color_range_full = img->range == AOM_CR_FULL_RANGE;
diff --git a/modules/codec/arib/substext.h b/modules/codec/arib/substext.h
index a1bba0ca61..c8c3db70cd 100644
--- a/modules/codec/arib/substext.h
+++ b/modules/codec/arib/substext.h
@@ -68,15 +68,15 @@ static void SubpictureTextUpdate(subpicture_t *subpic,
subpicture_updater_sys_t *sys = subpic->updater.p_sys;
VLC_UNUSED(fmt_src); VLC_UNUSED(ts);
- if (fmt_dst->i_sar_num <= 0 || fmt_dst->i_sar_den <= 0)
+ if (fmt_dst->sar.num <= 0 || fmt_dst->sar.den <= 0)
{
return;
}
video_format_t fmt;
video_format_Init(&fmt, VLC_CODEC_TEXT);
- fmt.i_sar_num = 1;
- fmt.i_sar_den = 1;
+ fmt.sar.num = 1;
+ fmt.sar.den = 1;
subpicture_region_t *r = NULL;
arib_text_region_t *p_region;
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 4504ec1c08..036cf50ce2 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -594,8 +594,8 @@ int OpenEncoder( vlc_object_t *p_this )
av_reduce( &p_context->sample_aspect_ratio.num,
&p_context->sample_aspect_ratio.den,
- p_enc->fmt_in.video.i_sar_num,
- p_enc->fmt_in.video.i_sar_den, 1 << 30 );
+ p_enc->fmt_in.video.sar.num,
+ p_enc->fmt_in.video.sar.den, 1 << 30 );
p_enc->fmt_in.i_codec = VLC_CODEC_I420;
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index ed3f2ae4d5..5b850001c3 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -159,18 +159,18 @@ static int lavc_GetVideoFormat(decoder_t *dec, video_format_t *restrict fmt,
fmt->i_visible_height = ctx->height;
/* If an aspect-ratio was specified in the input format then force it */
- if (dec->fmt_in.video.i_sar_num > 0 && dec->fmt_in.video.i_sar_den > 0)
+ if (dec->fmt_in.video.sar.num > 0 && dec->fmt_in.video.sar.den > 0)
{
- fmt->i_sar_num = dec->fmt_in.video.i_sar_num;
- fmt->i_sar_den = dec->fmt_in.video.i_sar_den;
+ fmt->sar.num = dec->fmt_in.video.sar.num;
+ fmt->sar.den = dec->fmt_in.video.sar.den;
}
else
{
- fmt->i_sar_num = ctx->sample_aspect_ratio.num;
- fmt->i_sar_den = ctx->sample_aspect_ratio.den;
+ fmt->sar.num = ctx->sample_aspect_ratio.num;
+ fmt->sar.den = ctx->sample_aspect_ratio.den;
- if (fmt->i_sar_num == 0 || fmt->i_sar_den == 0)
- fmt->i_sar_num = fmt->i_sar_den = 1;
+ if (fmt->sar.num == 0 || fmt->sar.den == 0)
+ fmt->sar.num = fmt->sar.den = 1;
}
if (dec->fmt_in.video.frame_rate.num && dec->fmt_in.video.frame_rate.den)
@@ -1009,18 +1009,18 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block, bool *error
picture_Hold( p_pic );
}
- if( !p_dec->fmt_in.video.i_sar_num || !p_dec->fmt_in.video.i_sar_den )
+ if( !p_dec->fmt_in.video.sar.num || !p_dec->fmt_in.video.sar.den )
{
/* Fetch again the aspect ratio in case it changed */
- p_dec->fmt_out.video.i_sar_num
+ p_dec->fmt_out.video.sar.num
= p_context->sample_aspect_ratio.num;
- p_dec->fmt_out.video.i_sar_den
+ p_dec->fmt_out.video.sar.den
= p_context->sample_aspect_ratio.den;
- if( !p_dec->fmt_out.video.i_sar_num || !p_dec->fmt_out.video.i_sar_den )
+ if( !p_dec->fmt_out.video.sar.num || !p_dec->fmt_out.video.sar.den )
{
- p_dec->fmt_out.video.i_sar_num = 1;
- p_dec->fmt_out.video.i_sar_den = 1;
+ p_dec->fmt_out.video.sar.num = 1;
+ p_dec->fmt_out.video.sar.den = 1;
}
}
diff --git a/modules/codec/bpg.c b/modules/codec/bpg.c
index 757c0c696f..a47939430c 100644
--- a/modules/codec/bpg.c
+++ b/modules/codec/bpg.c
@@ -126,8 +126,8 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
p_dec->fmt_out.i_codec = VLC_CODEC_RGB24;
p_dec->fmt_out.video.i_visible_width = p_dec->fmt_out.video.i_width = img_info.width;
p_dec->fmt_out.video.i_visible_height = p_dec->fmt_out.video.i_height = img_info.height;
- p_dec->fmt_out.video.i_sar_num = 1;
- p_dec->fmt_out.video.i_sar_den = 1;
+ p_dec->fmt_out.video.sar.num = 1;
+ p_dec->fmt_out.video.sar.den = 1;
/* Get a new picture */
if( decoder_UpdateVideoFormat( p_dec ) )
diff --git a/modules/codec/cdg.c b/modules/codec/cdg.c
index 3bb0c3141d..3305874304 100644
--- a/modules/codec/cdg.c
+++ b/modules/codec/cdg.c
@@ -117,8 +117,8 @@ static int Open( vlc_object_t *p_this )
p_dec->fmt_out.i_codec = VLC_CODEC_RGB32;
p_dec->fmt_out.video.i_width = CDG_DISPLAY_WIDTH;
p_dec->fmt_out.video.i_height = CDG_DISPLAY_HEIGHT;
- p_dec->fmt_out.video.i_sar_num = 1;
- p_dec->fmt_out.video.i_sar_den = 1;
+ p_dec->fmt_out.video.sar.num = 1;
+ p_dec->fmt_out.video.sar.den = 1;
p_dec->fmt_out.video.i_rmask = 0xff << CDG_COLOR_R_SHIFT;
p_dec->fmt_out.video.i_gmask = 0xff << CDG_COLOR_G_SHIFT;
p_dec->fmt_out.video.i_bmask = 0xff << CDG_COLOR_B_SHIFT;
diff --git a/modules/codec/crystalhd.c b/modules/codec/crystalhd.c
index 9a8d2e7acc..66a7db5e79 100644
--- a/modules/codec/crystalhd.c
+++ b/modules/codec/crystalhd.c
@@ -534,8 +534,8 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
p_dec->fmt_out.video.i_height = proc_out.PicInfo.height;
if( proc_out.PicInfo.height == 1088 )
p_dec->fmt_out.video.i_height = 1080;
-#define setAR( a, b, c ) case a: p_dec->fmt_out.video.i_sar_num = b; \
- p_dec->fmt_out.video.i_sar_den = c; break;
+#define setAR( a, b, c ) case a: p_dec->fmt_out.video.sar.num = b; \
+ p_dec->fmt_out.video.sar.den = c; break;
switch( proc_out.PicInfo.aspect_ratio )
{
setAR( vdecAspectRatioSquare, 1, 1 )
@@ -559,8 +559,8 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
#undef setAR
msg_Dbg( p_dec, "Format Change Detected [%i, %i], AR: %i/%i",
proc_out.PicInfo.width, proc_out.PicInfo.height,
- p_dec->fmt_out.video.i_sar_num,
- p_dec->fmt_out.video.i_sar_den );
+ p_dec->fmt_out.video.sar.num,
+ p_dec->fmt_out.video.sar.den );
break;
/* Nothing is documented here... */
diff --git a/modules/codec/cvdsub.c b/modules/codec/cvdsub.c
index 29fdae2507..da00d3d199 100644
--- a/modules/codec/cvdsub.c
+++ b/modules/codec/cvdsub.c
@@ -514,8 +514,8 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
/* Create new SPU region */
video_format_Init( &fmt, VLC_CODEC_YUVP );
- fmt.i_sar_num = 1;
- fmt.i_sar_den = 1;
+ fmt.sar.num = 1;
+ fmt.sar.den = 1;
fmt.i_width = fmt.i_visible_width = p_sys->i_width;
fmt.i_height = fmt.i_visible_height = p_sys->i_height;
fmt.i_x_offset = fmt.i_y_offset = 0;
diff --git a/modules/codec/daala.c b/modules/codec/daala.c
index 15b487423b..4123c2f31a 100644
--- a/modules/codec/daala.c
+++ b/modules/codec/daala.c
@@ -335,13 +335,13 @@ static int ProcessHeaders( decoder_t *p_dec )
if( p_sys->di.pixel_aspect_denominator && p_sys->di.pixel_aspect_numerator )
{
- p_dec->fmt_out.video.i_sar_num = p_sys->di.pixel_aspect_numerator;
- p_dec->fmt_out.video.i_sar_den = p_sys->di.pixel_aspect_denominator;
+ p_dec->fmt_out.video.sar.num = p_sys->di.pixel_aspect_numerator;
+ p_dec->fmt_out.video.sar.den = p_sys->di.pixel_aspect_denominator;
}
else
{
- p_dec->fmt_out.video.i_sar_num = 1;
- p_dec->fmt_out.video.i_sar_den = 1;
+ p_dec->fmt_out.video.sar.num = 1;
+ p_dec->fmt_out.video.sar.den = 1;
}
if( p_sys->di.timebase_numerator > 0 && p_sys->di.timebase_denominator > 0 )
@@ -638,8 +638,8 @@ static int OpenEncoder( vlc_object_t *p_this )
p_enc->fmt_in.video.i_height,
p_enc->fmt_in.video.i_visible_width,
p_enc->fmt_in.video.i_visible_height,
- p_enc->fmt_in.video.i_sar_num,
- p_enc->fmt_in.video.i_sar_den);
+ p_enc->fmt_in.video.sar.num,
+ p_enc->fmt_in.video.sar.den);
}
daala_info_init( &p_sys->di );
@@ -668,12 +668,12 @@ static int OpenEncoder( vlc_object_t *p_this )
p_sys->di.timebase_denominator = p_enc->fmt_in.video.frame_rate.den;
}
- if( p_enc->fmt_in.video.i_sar_num > 0 && p_enc->fmt_in.video.i_sar_den > 0 )
+ if( p_enc->fmt_in.video.sar.num > 0 && p_enc->fmt_in.video.sar.den > 0 )
{
unsigned i_dst_num, i_dst_den;
vlc_ureduce( &i_dst_num, &i_dst_den,
- p_enc->fmt_in.video.i_sar_num,
- p_enc->fmt_in.video.i_sar_den, 0 );
+ p_enc->fmt_in.video.sar.num,
+ p_enc->fmt_in.video.sar.den, 0 );
p_sys->di.pixel_aspect_numerator = i_dst_num;
p_sys->di.pixel_aspect_denominator = i_dst_den;
}
diff --git a/modules/codec/dmo/dmo.c b/modules/codec/dmo/dmo.c
index ef40f3859f..6550cfa54e 100644
--- a/modules/codec/dmo/dmo.c
+++ b/modules/codec/dmo/dmo.c
@@ -510,16 +510,16 @@ static int DecOpen( decoder_t *p_dec )
p_dec->fmt_out.video.i_bits_per_pixel = i_bpp;
/* If an aspect-ratio was specified in the input format then force it */
- if( p_dec->fmt_in.video.i_sar_num > 0 &&
- p_dec->fmt_in.video.i_sar_den > 0 )
+ if( p_dec->fmt_in.video.sar.num > 0 &&
+ p_dec->fmt_in.video.sar.den > 0 )
{
- p_dec->fmt_out.video.i_sar_num = p_dec->fmt_in.video.i_sar_num;
- p_dec->fmt_out.video.i_sar_den = p_dec->fmt_in.video.i_sar_den;
+ p_dec->fmt_out.video.sar.num = p_dec->fmt_in.video.sar.num;
+ p_dec->fmt_out.video.sar.den = p_dec->fmt_in.video.sar.den;
}
else
{
- p_dec->fmt_out.video.i_sar_num = 1;
- p_dec->fmt_out.video.i_sar_den = 1;
+ p_dec->fmt_out.video.sar.num = 1;
+ p_dec->fmt_out.video.sar.den = 1;
}
p_bih = &p_vih->bmiHeader;
diff --git a/modules/codec/dvbsub.c b/modules/codec/dvbsub.c
index 00a31edb04..7c945fd936 100644
--- a/modules/codec/dvbsub.c
+++ b/modules/codec/dvbsub.c
@@ -1601,8 +1601,8 @@ static subpicture_t *render( decoder_t *p_dec )
/* Create new SPU region */
video_format_Init( &fmt, VLC_CODEC_YUVP );
- fmt.i_sar_num = 0; /* 0 means use aspect ratio of background video */
- fmt.i_sar_den = 1;
+ fmt.sar.num = 0; /* 0 means use aspect ratio of background video */
+ fmt.sar.den = 1;
fmt.i_width = fmt.i_visible_width = p_region->i_width;
fmt.i_height = fmt.i_visible_height = p_region->i_height;
fmt.i_x_offset = fmt.i_y_offset = 0;
@@ -1656,8 +1656,8 @@ static subpicture_t *render( decoder_t *p_dec )
/* Create new SPU region */
video_format_Init( &fmt, VLC_CODEC_TEXT );
- fmt.i_sar_num = 1;
- fmt.i_sar_den = 1;
+ fmt.sar.num = 1;
+ fmt.sar.den = 1;
fmt.i_width = fmt.i_visible_width = p_region->i_width;
fmt.i_height = fmt.i_visible_height = p_region->i_height;
fmt.i_x_offset = fmt.i_y_offset = 0;
diff --git a/modules/codec/gstreamer/gstdecode.c b/modules/codec/gstreamer/gstdecode.c
index d6e86844db..e0b9d2a8ef 100644
--- a/modules/codec/gstreamer/gstdecode.c
+++ b/modules/codec/gstreamer/gstdecode.c
@@ -409,10 +409,10 @@ static GstStructure* vlc_to_gst_fmt( const es_format_t *p_fmt )
p_vfmt->frame_rate.num,
p_vfmt->frame_rate.den, NULL );
- if( p_vfmt->i_sar_num && p_vfmt->i_sar_den )
+ if( p_vfmt->sar.num && p_vfmt->sar.den )
gst_structure_set( p_str, "pixel-aspect-ratio", GST_TYPE_FRACTION,
- p_vfmt->i_sar_num,
- p_vfmt->i_sar_den, NULL );
+ p_vfmt->sar.num,
+ p_vfmt->sar.den, NULL );
if( p_fmt->i_extra )
{
diff --git a/modules/codec/jpeg.c b/modules/codec/jpeg.c
index 5c26d1fc69..c282a6e9c5 100644
--- a/modules/codec/jpeg.c
+++ b/modules/codec/jpeg.c
@@ -528,8 +528,8 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
p_dec->fmt_out.i_codec = VLC_CODEC_RGB24;
p_dec->fmt_out.video.i_visible_width = p_dec->fmt_out.video.i_width = p_sys->p_jpeg.output_width;
p_dec->fmt_out.video.i_visible_height = p_dec->fmt_out.video.i_height = p_sys->p_jpeg.output_height;
- p_dec->fmt_out.video.i_sar_num = 1;
- p_dec->fmt_out.video.i_sar_den = 1;
+ p_dec->fmt_out.video.sar.num = 1;
+ p_dec->fmt_out.video.sar.den = 1;
int i_otag; /* Orientation tag has valid range of 1-8. 1 is normal orientation, 0 = unspecified = normal */
i_otag = jpeg_GetOrientation( &p_sys->p_jpeg );
diff --git a/modules/codec/kate.c b/modules/codec/kate.c
index 10ea65fc74..8b792acebf 100644
--- a/modules/codec/kate.c
+++ b/modules/codec/kate.c
@@ -1186,8 +1186,8 @@ static subpicture_t *SetupSimpleKateSPU( decoder_t *p_dec, subpicture_t *p_spu,
/* text region */
video_format_Init( &fmt, VLC_CODEC_TEXT );
- fmt.i_sar_num = 0;
- fmt.i_sar_den = 1;
+ fmt.sar.num = 0;
+ fmt.sar.den = 1;
fmt.i_width = fmt.i_height = 0;
fmt.i_x_offset = fmt.i_y_offset = 0;
p_spu->p_region = subpicture_region_New( &fmt );
diff --git a/modules/codec/libmpeg2.c b/modules/codec/libmpeg2.c
index 1f26548f1b..6d9352948f 100644
--- a/modules/codec/libmpeg2.c
+++ b/modules/codec/libmpeg2.c
@@ -671,8 +671,8 @@ static picture_t *GetNewPicture( decoder_t *p_dec )
p_dec->fmt_out.video.i_height = p_sys->p_info->sequence->height;
p_dec->fmt_out.video.i_visible_height =
p_sys->p_info->sequence->picture_height;
- p_dec->fmt_out.video.i_sar_num = p_sys->sar.num;
- p_dec->fmt_out.video.i_sar_den = p_sys->sar.den;
+ p_dec->fmt_out.video.sar.num = p_sys->sar.num;
+ p_dec->fmt_out.video.sar.den = p_sys->sar.den;
if( p_sys->p_info->sequence->frame_period > 0 )
{
@@ -714,11 +714,11 @@ static void GetAR( decoder_t *p_dec )
vlc_rational_t old_sar = p_sys->sar;
/* Check whether the input gave a particular aspect ratio */
- if( p_dec->fmt_in.video.i_sar_num > 0 &&
- p_dec->fmt_in.video.i_sar_den > 0 )
+ if( p_dec->fmt_in.video.sar.num > 0 &&
+ p_dec->fmt_in.video.sar.den > 0 )
{
- p_sys->sar.num = p_dec->fmt_in.video.i_sar_num;
- p_sys->sar.den = p_dec->fmt_in.video.i_sar_den;
+ p_sys->sar.num = p_dec->fmt_in.video.sar.num;
+ p_sys->sar.den = p_dec->fmt_in.video.sar.den;
}
else
{
diff --git a/modules/codec/oggspots.c b/modules/codec/oggspots.c
index 213c46a054..ea99b211fa 100644
--- a/modules/codec/oggspots.c
+++ b/modules/codec/oggspots.c
@@ -260,8 +260,8 @@ static int ProcessHeader(decoder_t* p_dec)
GetWLE(&p_extra[42]);
/* We assume square pixels */
- p_dec->fmt_out.video.i_sar_num = 1;
- p_dec->fmt_out.video.i_sar_den = 1;
+ p_dec->fmt_out.video.sar.num = 1;
+ p_dec->fmt_out.video.sar.den = 1;
/* We don't implement background color, alignment and options at the
* moment because the former doesn't seem necessary right now and the
diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index 105bbb597c..bda25dec92 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -419,8 +419,8 @@ static OMX_ERRORTYPE UpdatePixelAspect(decoder_t *p_dec)
if (omx_err != OMX_ErrorNone) {
msg_Warn(p_dec, "Failed to retrieve aspect ratio");
} else {
- p_dec->fmt_out.video.i_sar_num = pixel_aspect.nX;
- p_dec->fmt_out.video.i_sar_den = pixel_aspect.nY;
+ p_dec->fmt_out.video.sar.num = pixel_aspect.nX;
+ p_dec->fmt_out.video.sar.den = pixel_aspect.nY;
}
return omx_err;
@@ -1078,10 +1078,10 @@ static int OpenGeneric( vlc_object_t *p_this, bool b_encode )
p_dec->fmt_out.i_codec = 0;
/* set default aspect of 1, if parser did not set it */
- if (p_dec->fmt_out.video.i_sar_num == 0)
- p_dec->fmt_out.video.i_sar_num = 1;
- if (p_dec->fmt_out.video.i_sar_den == 0)
- p_dec->fmt_out.video.i_sar_den = 1;
+ if (p_dec->fmt_out.video.sar.num == 0)
+ p_dec->fmt_out.video.sar.num = 1;
+ if (p_dec->fmt_out.video.sar.den == 0)
+ p_dec->fmt_out.video.sar.den = 1;
}
p_sys->b_enc = b_encode;
InitOmxEventQueue(&p_sys->event_queue);
@@ -1569,12 +1569,12 @@ static int DecodeVideo( decoder_t *p_dec, block_t *p_block )
* broadcom OMX implementation on RPi), don't let the packetizer values
* override what the decoder says, if anything - otherwise always update
* even if it already is set (since it can change within a stream). */
- if((p_dec->fmt_in.video.i_sar_num != 0 && p_dec->fmt_in.video.i_sar_den != 0) &&
- (p_dec->fmt_out.video.i_sar_num == 0 || p_dec->fmt_out.video.i_sar_den == 0 ||
+ if((p_dec->fmt_in.video.sar.num != 0 && p_dec->fmt_in.video.sar.den != 0) &&
+ (p_dec->fmt_out.video.sar.num == 0 || p_dec->fmt_out.video.sar.den == 0 ||
!p_sys->b_aspect_ratio_handled))
{
- p_dec->fmt_out.video.i_sar_num = p_dec->fmt_in.video.i_sar_num;
- p_dec->fmt_out.video.i_sar_den = p_dec->fmt_in.video.i_sar_den;
+ p_dec->fmt_out.video.sar.num = p_dec->fmt_in.video.sar.num;
+ p_dec->fmt_out.video.sar.den = p_dec->fmt_in.video.sar.den;
}
/* Loop as long as we haven't either got an input buffer (and cleared
diff --git a/modules/codec/png.c b/modules/codec/png.c
index dc91b775b5..07f657a79d 100644
--- a/modules/codec/png.c
+++ b/modules/codec/png.c
@@ -252,8 +252,8 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
p_dec->fmt_out.i_codec = VLC_CODEC_RGBA;
p_dec->fmt_out.video.i_visible_width = p_dec->fmt_out.video.i_width = i_width;
p_dec->fmt_out.video.i_visible_height = p_dec->fmt_out.video.i_height = i_height;
- p_dec->fmt_out.video.i_sar_num = 1;
- p_dec->fmt_out.video.i_sar_den = 1;
+ p_dec->fmt_out.video.sar.num = 1;
+ p_dec->fmt_out.video.sar.den = 1;
if( i_color_type == PNG_COLOR_TYPE_PALETTE )
png_set_palette_to_rgb( p_png );
diff --git a/modules/codec/schroedinger.c b/modules/codec/schroedinger.c
index a14d3915d9..3a98a946fe 100644
--- a/modules/codec/schroedinger.c
+++ b/modules/codec/schroedinger.c
@@ -627,8 +627,8 @@ static void SetVideoFormat( decoder_t *p_dec )
p_dec->fmt_out.video.i_height = p_sys->p_format->height;
/* aspect_ratio_[numerator|denominator] describes the pixel aspect ratio */
- p_dec->fmt_out.video.i_sar_num = p_sys->p_format->aspect_ratio_numerator;
- p_dec->fmt_out.video.i_sar_den = p_sys->p_format->aspect_ratio_denominator;
+ p_dec->fmt_out.video.sar.num = p_sys->p_format->aspect_ratio_numerator;
+ p_dec->fmt_out.video.sar.den = p_sys->p_format->aspect_ratio_denominator;
p_dec->fmt_out.video.frame_rate.num =
p_sys->p_format->frame_rate_numerator;
@@ -1154,8 +1154,8 @@ static int OpenEncoder( vlc_object_t *p_this )
p_sys->p_format->frame_rate_denominator = p_enc->fmt_in.video.frame_rate.den;
unsigned u_asr_num, u_asr_den;
vlc_ureduce( &u_asr_num, &u_asr_den,
- p_enc->fmt_in.video.i_sar_num,
- p_enc->fmt_in.video.i_sar_den, 0 );
+ p_enc->fmt_in.video.sar.num,
+ p_enc->fmt_in.video.sar.den, 0 );
p_sys->p_format->aspect_ratio_numerator = u_asr_num;
p_sys->p_format->aspect_ratio_denominator = u_asr_den;
diff --git a/modules/codec/scte27.c b/modules/codec/scte27.c
index fa15cf3f48..12b563eab2 100644
--- a/modules/codec/scte27.c
+++ b/modules/codec/scte27.c
@@ -255,8 +255,8 @@ static subpicture_region_t *DecodeSimpleBitmap(decoder_t *dec,
.i_visible_width = frame_h,
.i_height = frame_v,
.i_visible_height = frame_v,
- .i_sar_num = 0, /* Use video AR */
- .i_sar_den = 1,
+ .sar.num = 0, /* Use video AR */
+ .sar.den = 1,
.p_palette = &palette,
};
subpicture_region_t *r = subpicture_region_New(&fmt);
diff --git a/modules/codec/sdl_image.c b/modules/codec/sdl_image.c
index de7999ccec..5171ef8a9b 100644
--- a/modules/codec/sdl_image.c
+++ b/modules/codec/sdl_image.c
@@ -172,8 +172,8 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
}
p_dec->fmt_out.video.i_width = p_surface->w;
p_dec->fmt_out.video.i_height = p_surface->h;
- p_dec->fmt_out.video.i_sar_num = 1;
- p_dec->fmt_out.video.i_sar_den = 1;
+ p_dec->fmt_out.video.sar.num = 1;
+ p_dec->fmt_out.video.sar.den = 1;
/* Get a new picture. */
if( decoder_UpdateVideoFormat( p_dec ) )
diff --git a/modules/codec/spudec/parse.c b/modules/codec/spudec/parse.c
index 9ea200ff49..63cf014b3e 100644
--- a/modules/codec/spudec/parse.c
+++ b/modules/codec/spudec/parse.c
@@ -693,8 +693,8 @@ static void Render( decoder_t *p_dec, subpicture_t *p_spu,
/* Create a new subpicture region */
video_format_Init( &fmt, VLC_CODEC_YUVP );
- fmt.i_sar_num = 0; /* 0 means use aspect ratio of background video */
- fmt.i_sar_den = 1;
+ fmt.sar.num = 0; /* 0 means use aspect ratio of background video */
+ fmt.sar.den = 1;
fmt.i_width = fmt.i_visible_width = p_spu_properties->i_width;
fmt.i_height = fmt.i_visible_height = p_spu_properties->i_height -
p_spu_data->i_y_top_offset - p_spu_data->i_y_bottom_offset;
diff --git a/modules/codec/substext.h b/modules/codec/substext.h
index 93ab478d50..57c82a59ae 100644
--- a/modules/codec/substext.h
+++ b/modules/codec/substext.h
@@ -131,7 +131,7 @@ static void SubpictureTextUpdate(subpicture_t *subpic,
subpicture_updater_sys_t *sys = subpic->updater.p_sys;
VLC_UNUSED(fmt_src); VLC_UNUSED(ts);
- if (fmt_dst->i_sar_num <= 0 || fmt_dst->i_sar_den <= 0)
+ if (fmt_dst->sar.num <= 0 || fmt_dst->sar.den <= 0)
return;
video_format_t fmt;
@@ -139,17 +139,17 @@ static void SubpictureTextUpdate(subpicture_t *subpic,
if( sys->region.flags & UPDT_REGION_USES_GRID_COORDINATES )
{
- fmt.i_sar_num = 4;
- fmt.i_sar_den = 3;
- subpic->i_original_picture_width = fmt_dst->i_visible_height * fmt.i_sar_num / fmt.i_sar_den;
+ fmt.sar.num = 4;
+ fmt.sar.den = 3;
+ subpic->i_original_picture_width = fmt_dst->i_visible_height * fmt.sar.num / fmt.sar.den;
subpic->i_original_picture_height = fmt_dst->i_visible_height;
}
else
{
- subpic->i_original_picture_width = fmt_dst->i_width * fmt_dst->i_sar_num / fmt_dst->i_sar_den;
+ subpic->i_original_picture_width = fmt_dst->i_width * fmt_dst->sar.num / fmt_dst->sar.den;
subpic->i_original_picture_height = fmt_dst->i_height;
- fmt.i_sar_num = 1;
- fmt.i_sar_den = 1;
+ fmt.sar.num = 1;
+ fmt.sar.den = 1;
}
subpicture_region_t **pp_last_region = &subpic->p_region;
diff --git a/modules/codec/subsusf.c b/modules/codec/subsusf.c
index 1a94b6b4fd..132bf68548 100644
--- a/modules/codec/subsusf.c
+++ b/modules/codec/subsusf.c
@@ -1128,7 +1128,7 @@ static subpicture_region_t *LoadEmbeddedImage( decoder_t *p_dec,
memset( &fmt_out, 0, sizeof( video_format_t));
fmt_out.i_chroma = VLC_CODEC_YUVA;
- fmt_out.i_sar_num = fmt_out.i_sar_den = 1;
+ fmt_out.sar.num = fmt_out.sar.den = 1;
fmt_out.i_width =
fmt_out.i_visible_width = p_pic->format.i_visible_width;
fmt_out.i_height =
diff --git a/modules/codec/svcdsub.c b/modules/codec/svcdsub.c
index 259dced2f5..6036ea62d4 100644
--- a/modules/codec/svcdsub.c
+++ b/modules/codec/svcdsub.c
@@ -449,8 +449,8 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
Two candidates are the video and the other possibility would be
the access module.
*/
- fmt.i_sar_num = p_sys->i_height;
- fmt.i_sar_den = p_sys->i_width;
+ fmt.sar.num = p_sys->i_height;
+ fmt.sar.den = p_sys->i_width;
fmt.i_width = fmt.i_visible_width = p_sys->i_width;
fmt.i_height = fmt.i_visible_height = p_sys->i_height;
diff --git a/modules/codec/svg.c b/modules/codec/svg.c
index 3da62ad9ae..3e774b34c3 100644
--- a/modules/codec/svg.c
+++ b/modules/codec/svg.c
@@ -184,8 +184,8 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
p_dec->fmt_out.video.i_height = i_height;
p_dec->fmt_out.video.i_visible_width = i_width;
p_dec->fmt_out.video.i_visible_height = i_height;
- p_dec->fmt_out.video.i_sar_num = 1;
- p_dec->fmt_out.video.i_sar_den = 1;
+ p_dec->fmt_out.video.sar.num = 1;
+ p_dec->fmt_out.video.sar.den = 1;
p_dec->fmt_out.video.i_rmask = 0x80800000; /* Since librsvg v1.0 */
p_dec->fmt_out.video.i_gmask = 0x0000ff00;
p_dec->fmt_out.video.i_bmask = 0x000000ff;
@@ -230,8 +230,8 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
sw = sh = p_sys->f_scale;
else
{
- double aspect = (double) (dim.width * p_dec->fmt_out.video.i_sar_num) /
- (dim.height * p_dec->fmt_out.video.i_sar_den);
+ double aspect = (double) (dim.width * p_dec->fmt_out.video.sar.num) /
+ (dim.height * p_dec->fmt_out.video.sar.den);
sw = aspect * i_width / dim.width;
sh = aspect * i_height / dim.height;
}
diff --git a/modules/codec/theora.c b/modules/codec/theora.c
index 268f33642a..947b991fba 100644
--- a/modules/codec/theora.c
+++ b/modules/codec/theora.c
@@ -318,13 +318,13 @@ static int ProcessHeaders( decoder_t *p_dec )
if( p_sys->ti.aspect_denominator && p_sys->ti.aspect_numerator )
{
- p_dec->fmt_out.video.i_sar_num = p_sys->ti.aspect_numerator;
- p_dec->fmt_out.video.i_sar_den = p_sys->ti.aspect_denominator;
+ p_dec->fmt_out.video.sar.num = p_sys->ti.aspect_numerator;
+ p_dec->fmt_out.video.sar.den = p_sys->ti.aspect_denominator;
}
else
{
- p_dec->fmt_out.video.i_sar_num = 1;
- p_dec->fmt_out.video.i_sar_den = 1;
+ p_dec->fmt_out.video.sar.num = 1;
+ p_dec->fmt_out.video.sar.den = 1;
}
if( p_sys->ti.fps_numerator > 0 && p_sys->ti.fps_denominator > 0 )
@@ -743,12 +743,12 @@ static int OpenEncoder( vlc_object_t *p_this )
p_sys->ti.fps_denominator = p_enc->fmt_in.video.frame_rate.den;
}
- if( p_enc->fmt_in.video.i_sar_num > 0 && p_enc->fmt_in.video.i_sar_den > 0 )
+ if( p_enc->fmt_in.video.sar.num > 0 && p_enc->fmt_in.video.sar.den > 0 )
{
unsigned i_dst_num, i_dst_den;
vlc_ureduce( &i_dst_num, &i_dst_den,
- p_enc->fmt_in.video.i_sar_num,
- p_enc->fmt_in.video.i_sar_den, 0 );
+ p_enc->fmt_in.video.sar.num,
+ p_enc->fmt_in.video.sar.den, 0 );
p_sys->ti.aspect_numerator = i_dst_num;
p_sys->ti.aspect_denominator = i_dst_den;
}
diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index 3fb56525bb..b1a617e217 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -612,8 +612,8 @@ static int StartVideoToolbox(decoder_t *p_dec)
const unsigned i_video_width = p_dec->fmt_out.video.i_width;
const unsigned i_video_height = p_dec->fmt_out.video.i_height;
- const unsigned i_sar_num = p_dec->fmt_out.video.i_sar_num;
- const unsigned i_sar_den = p_dec->fmt_out.video.i_sar_den;
+ const unsigned i_sar_num = p_dec->fmt_out.video.sar.num;
+ const unsigned i_sar_den = p_dec->fmt_out.video.sar.den;
date_Init( &p_sys->pts, p_dec->fmt_in.video.frame_rate.num * 2, p_dec->fmt_in.video.frame_rate.den );
@@ -852,10 +852,10 @@ static int OpenDecoder(vlc_object_t *p_this)
/* return our proper VLC internal state */
p_dec->fmt_out.i_cat = p_dec->fmt_in.i_cat;
p_dec->fmt_out.video = p_dec->fmt_in.video;
- if (!p_dec->fmt_out.video.i_sar_num || !p_dec->fmt_out.video.i_sar_den)
+ if (!p_dec->fmt_out.video.sar.num || !p_dec->fmt_out.video.sar.den)
{
- p_dec->fmt_out.video.i_sar_num = 1;
- p_dec->fmt_out.video.i_sar_den = 1;
+ p_dec->fmt_out.video.sar.num = 1;
+ p_dec->fmt_out.video.sar.den = 1;
}
if (!p_dec->fmt_out.video.i_visible_width
|| !p_dec->fmt_out.video.i_visible_height)
@@ -1031,8 +1031,8 @@ static int avcCFromAnnexBCreate(decoder_t *p_dec)
p_dec->fmt_out.video.i_width = i_video_width;
p_dec->fmt_out.video.i_visible_height =
p_dec->fmt_out.video.i_height = i_video_height;
- p_dec->fmt_out.video.i_sar_num = i_sar_num;
- p_dec->fmt_out.video.i_sar_den = i_sar_den;
+ p_dec->fmt_out.video.sar.num = i_sar_num;
+ p_dec->fmt_out.video.sar.den = i_sar_den;
block_t *p_avcC = h264_helper_get_avcc_config(&p_sys->hh);
if (!p_avcC)
diff --git a/modules/codec/vpx.c b/modules/codec/vpx.c
index c1f3bf73a0..d7438e1d74 100644
--- a/modules/codec/vpx.c
+++ b/modules/codec/vpx.c
@@ -220,10 +220,10 @@ static int Decode(decoder_t *dec, block_t *block)
v->i_visible_height = dec->fmt_out.video.i_height = img->d_h;
}
- if( !dec->fmt_out.video.i_sar_num || !dec->fmt_out.video.i_sar_den )
+ if( !dec->fmt_out.video.sar.num || !dec->fmt_out.video.sar.den )
{
- dec->fmt_out.video.i_sar_num = 1;
- dec->fmt_out.video.i_sar_den = 1;
+ dec->fmt_out.video.sar.num = 1;
+ dec->fmt_out.video.sar.den = 1;
}
v->b_color_range_full = img->range == VPX_CR_FULL_RANGE;
@@ -327,9 +327,9 @@ static int OpenDecoder(vlc_object_t *p_this)
dec->fmt_out.video.i_width = dec->fmt_in.video.i_width;
dec->fmt_out.video.i_height = dec->fmt_in.video.i_height;
- if (dec->fmt_in.video.i_sar_num > 0 && dec->fmt_in.video.i_sar_den > 0) {
- dec->fmt_out.video.i_sar_num = dec->fmt_in.video.i_sar_num;
- dec->fmt_out.video.i_sar_den = dec->fmt_in.video.i_sar_den;
+ if (dec->fmt_in.video.sar.num > 0 && dec->fmt_in.video.sar.den > 0) {
+ dec->fmt_out.video.sar.num = dec->fmt_in.video.sar.num;
+ dec->fmt_out.video.sar.den = dec->fmt_in.video.sar.den;
}
return VLC_SUCCESS;
diff --git a/modules/codec/x264.c b/modules/codec/x264.c
index 57654f134c..d512af2112 100644
--- a/modules/codec/x264.c
+++ b/modules/codec/x264.c
@@ -1320,13 +1320,13 @@ static int Open ( vlc_object_t *p_this )
p_sys->param.analyse.b_transform_8x8 = var_GetBool( p_enc,
SOUT_CFG_PREFIX "8x8dct" );
- if( p_enc->fmt_in.video.i_sar_num > 0 &&
- p_enc->fmt_in.video.i_sar_den > 0 )
+ if( p_enc->fmt_in.video.sar.num > 0 &&
+ p_enc->fmt_in.video.sar.den > 0 )
{
unsigned int i_dst_num, i_dst_den;
vlc_ureduce( &i_dst_num, &i_dst_den,
- p_enc->fmt_in.video.i_sar_num,
- p_enc->fmt_in.video.i_sar_den, 0 );
+ p_enc->fmt_in.video.sar.num,
+ p_enc->fmt_in.video.sar.den, 0 );
p_sys->param.vui.i_sar_width = i_dst_num;
p_sys->param.vui.i_sar_height = i_dst_den;
}
diff --git a/modules/codec/xwd.c b/modules/codec/xwd.c
index dd3c8af7cb..5748bf523d 100644
--- a/modules/codec/xwd.c
+++ b/modules/codec/xwd.c
@@ -117,8 +117,8 @@ static int Decode (decoder_t *dec, block_t *block)
video_format_Setup(&dec->fmt_out.video, chroma,
ntohl(hdr->pixmap_width), ntohl(hdr->pixmap_height),
ntohl(hdr->pixmap_width), ntohl(hdr->pixmap_height),
- dec->fmt_in.video.i_sar_num,
- dec->fmt_in.video.i_sar_den);
+ dec->fmt_in.video.sar.num,
+ dec->fmt_in.video.sar.den);
const size_t copy = dec->fmt_out.video.i_width
* (dec->fmt_out.video.i_bits_per_pixel / 8);
diff --git a/modules/codec/zvbi.c b/modules/codec/zvbi.c
index 1941677ba6..6cd5788d19 100644
--- a/modules/codec/zvbi.c
+++ b/modules/codec/zvbi.c
@@ -547,7 +547,7 @@ static subpicture_t *Subpicture( decoder_t *p_dec, video_format_t *p_fmt,
fmt.i_width = fmt.i_visible_width = i_columns * 12;
fmt.i_height = fmt.i_visible_height = i_rows * 10;
fmt.i_bits_per_pixel = 32;
- fmt.i_sar_num = fmt.i_sar_den = 0; /* let the vout set the correct AR */
+ fmt.sar.num = fmt.sar.den = 0; /* let the vout set the correct AR */
}
fmt.i_x_offset = fmt.i_y_offset = 0;
diff --git a/modules/demux/asf/asf.c b/modules/demux/asf/asf.c
index 0034eab21e..d26141ba40 100644
--- a/modules/demux/asf/asf.c
+++ b/modules/demux/asf/asf.c
@@ -566,7 +566,7 @@ static void Packet_SetAR( asf_packet_sys_t *p_packetsys, uint8_t i_stream_number
{
demux_t *p_demux = p_packetsys->p_demux;
asf_track_t *tk = p_demux->p_sys->track[i_stream_number];
- if ( tk->p_fmt->video.i_sar_num == i_ratio_x && tk->p_fmt->video.i_sar_den == i_ratio_y )
+ if ( tk->p_fmt->video.sar.num == i_ratio_x && tk->p_fmt->video.sar.den == i_ratio_y )
return;
/* Only apply if origin pixel size >= 1x1, due to broken yacast */
@@ -580,8 +580,8 @@ static void Packet_SetAR( asf_packet_sys_t *p_packetsys, uint8_t i_stream_number
vlc_object_release( p_vout );
}
}
- tk->p_fmt->video.i_sar_num = i_ratio_x;
- tk->p_fmt->video.i_sar_den = i_ratio_y;
+ tk->p_fmt->video.sar.num = i_ratio_x;
+ tk->p_fmt->video.sar.den = i_ratio_y;
}
static void Packet_SetSendTime( asf_packet_sys_t *p_packetsys, mtime_t i_time )
@@ -1039,8 +1039,8 @@ static int DemuxInit( demux_t *p_demux )
if( i_aspect_x && i_aspect_y )
{
- fmt.video.i_sar_num = i_aspect_x;
- fmt.video.i_sar_den = i_aspect_y;
+ fmt.video.sar.num = i_aspect_x;
+ fmt.video.sar.den = i_aspect_y;
}
}
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 3aed520bbe..6fb7be51e7 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -447,11 +447,11 @@ int OpenDemux( vlc_object_t *p_this )
psz_type = "video";
fmt.video.frame_rate.num = s->codec->time_base.num;
fmt.video.frame_rate.den = s->codec->time_base.den * __MAX( s->codec->ticks_per_frame, 1 );
- fmt.video.i_sar_num = s->sample_aspect_ratio.num;
+ fmt.video.sar.num = s->sample_aspect_ratio.num;
if (s->sample_aspect_ratio.num > 0)
- fmt.video.i_sar_den = s->sample_aspect_ratio.den;
+ fmt.video.sar.den = s->sample_aspect_ratio.den;
else
- fmt.video.i_sar_den = 0;
+ fmt.video.sar.den = 0;
break;
case AVMEDIA_TYPE_SUBTITLE:
diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
index 691fcf0ce7..94572d6fba 100644
--- a/modules/demux/avformat/mux.c
+++ b/modules/demux/avformat/mux.c
@@ -268,10 +268,10 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
codec->height = fmt->video.i_visible_height;
av_reduce( &codec->sample_aspect_ratio.num,
&codec->sample_aspect_ratio.den,
- fmt->video.i_sar_num,
- fmt->video.i_sar_den, 1 << 30 /* something big */ );
+ fmt->video.sar.num,
+ fmt->video.sar.den, 1 << 30 /* something big */ );
msg_Dbg(p_mux, "Muxing aspect ratio will be %d/%d",
- fmt->video.i_sar_num, fmt->video.i_sar_den);
+ fmt->video.sar.num, fmt->video.sar.den);
stream->sample_aspect_ratio = codec->sample_aspect_ratio;
stream->time_base.den = fmt->video.frame_rate.num;
stream->time_base.num = fmt->video.frame_rate.den;
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index e6cc3dea9d..af67c50218 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -632,8 +632,8 @@ static int Open( vlc_object_t * p_this )
if( p_vprp->i_video_format_token >= 1 &&
p_vprp->i_video_format_token <= 4 )
i_frame_aspect_ratio = 0x00040003;
- fmt.video.i_sar_num = ((i_frame_aspect_ratio >> 16) & 0xffff) * fmt.video.i_height;
- fmt.video.i_sar_den = ((i_frame_aspect_ratio >> 0) & 0xffff) * fmt.video.i_width;
+ fmt.video.sar.num = ((i_frame_aspect_ratio >> 16) & 0xffff) * fmt.video.i_height;
+ fmt.video.sar.den = ((i_frame_aspect_ratio >> 0) & 0xffff) * fmt.video.i_width;
}
/* Extradata is the remainder of the chunk less the BIH */
if( p_vids->i_chunk_size <= INT_MAX - sizeof(VLC_BITMAPINFOHEADER) )
diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index 410354f922..4bba35ab3c 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -509,8 +509,8 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
if( i_display_height && i_display_width )
{
- tk->fmt.video.i_sar_num = i_display_width * tk->fmt.video.i_height;
- tk->fmt.video.i_sar_den = i_display_height * tk->fmt.video.i_width;
+ tk->fmt.video.sar.num = i_display_width * tk->fmt.video.i_height;
+ tk->fmt.video.sar.den = i_display_height * tk->fmt.video.i_width;
}
tk->fmt.video.i_visible_width = tk->fmt.video.i_width;
diff --git a/modules/demux/mp4/essetup.c b/modules/demux/mp4/essetup.c
index 5a7f36d343..7d9df927ee 100644
--- a/modules/demux/mp4/essetup.c
+++ b/modules/demux/mp4/essetup.c
@@ -327,8 +327,8 @@ int SetupVideoES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
/* Work-around buggy muxed files */
p_vide->i_width != p_track->i_width )
{
- p_track->fmt.video.i_sar_num = p_track->i_width * p_track->fmt.video.i_height;
- p_track->fmt.video.i_sar_den = p_track->i_height * p_track->fmt.video.i_width;
+ p_track->fmt.video.sar.num = p_track->i_width * p_track->fmt.video.i_height;
+ p_track->fmt.video.sar.den = p_track->i_height * p_track->fmt.video.i_width;
}
/* Support for cropping (eg. in H263 files) */
@@ -449,8 +449,8 @@ int SetupVideoES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
if( p_pasp && BOXDATA(p_pasp) && BOXDATA(p_pasp)->i_horizontal_spacing > 0 &&
BOXDATA(p_pasp)->i_vertical_spacing > 0 )
{
- p_track->fmt.video.i_sar_num = BOXDATA(p_pasp)->i_horizontal_spacing;
- p_track->fmt.video.i_sar_den = BOXDATA(p_pasp)->i_vertical_spacing;
+ p_track->fmt.video.sar.num = BOXDATA(p_pasp)->i_horizontal_spacing;
+ p_track->fmt.video.sar.den = BOXDATA(p_pasp)->i_vertical_spacing;
}
const MP4_Box_t *p_fiel = MP4_BoxGet( p_sample, "fiel" );
diff --git a/modules/demux/nuv.c b/modules/demux/nuv.c
index d19646329a..377cba9ee9 100644
--- a/modules/demux/nuv.c
+++ b/modules/demux/nuv.c
@@ -307,8 +307,8 @@ static int Open( vlc_object_t * p_this )
fmt.video.i_visible_height = fmt.video.i_height;
fmt.i_extra = p_sys->i_extra_f;
fmt.p_extra = p_sys->p_extra_f;
- fmt.video.i_sar_num = p_sys->hdr.d_aspect * fmt.video.i_height;
- fmt.video.i_sar_den = fmt.video.i_width;
+ fmt.video.sar.num = p_sys->hdr.d_aspect * fmt.video.i_height;
+ fmt.video.sar.den = fmt.video.i_width;
p_sys->p_es_video = es_out_Add( p_demux->out, &fmt );
}
diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index 69d910970e..e6de8971d1 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -2917,8 +2917,8 @@ static bool Ogg_ReadVP8Header( demux_t *p_demux, logical_stream_t *p_stream,
p_stream->fmt.video.i_height = GetWBE( &p_oggpacket->packet[10] );
p_stream->fmt.video.i_visible_width = p_stream->fmt.video.i_width;
p_stream->fmt.video.i_visible_height = p_stream->fmt.video.i_height;
- p_stream->fmt.video.i_sar_num = GetDWBE( &p_oggpacket->packet[12 - 1] ) & 0x0FFF;
- p_stream->fmt.video.i_sar_den = GetDWBE( &p_oggpacket->packet[15 - 1] ) & 0x0FFF;
+ p_stream->fmt.video.sar.num = GetDWBE( &p_oggpacket->packet[12 - 1] ) & 0x0FFF;
+ p_stream->fmt.video.sar.den = GetDWBE( &p_oggpacket->packet[15 - 1] ) & 0x0FFF;
p_stream->fmt.video.frame_rate.num = GetDWBE( &p_oggpacket->packet[18] );
p_stream->fmt.video.frame_rate.den = GetDWBE( &p_oggpacket->packet[22] );
p_stream->fmt.video.frame_rate.den =
diff --git a/modules/hw/mmal/codec.c b/modules/hw/mmal/codec.c
index b4103832f1..66a33f944a 100644
--- a/modules/hw/mmal/codec.c
+++ b/modules/hw/mmal/codec.c
@@ -392,8 +392,8 @@ apply_fmt:
dec->fmt_out.video.i_y_offset = sys->output->format->es->video.crop.y;
dec->fmt_out.video.i_visible_width = sys->output->format->es->video.crop.width;
dec->fmt_out.video.i_visible_height = sys->output->format->es->video.crop.height;
- dec->fmt_out.video.i_sar_num = sys->output->format->es->video.par.num;
- dec->fmt_out.video.i_sar_den = sys->output->format->es->video.par.den;
+ dec->fmt_out.video.sar.num = sys->output->format->es->video.par.num;
+ dec->fmt_out.video.sar.den = sys->output->format->es->video.par.den;
dec->fmt_out.video.frame_rate = sys->output->format->es->video.frame_rate;
/* Query interlaced type */
diff --git a/modules/hw/mmal/deinterlace.c b/modules/hw/mmal/deinterlace.c
index 08854df79a..e2e600c364 100644
--- a/modules/hw/mmal/deinterlace.c
+++ b/modules/hw/mmal/deinterlace.c
@@ -146,8 +146,8 @@ static int Open(filter_t *filter)
sys->input->format->es->video.crop.y = 0;
sys->input->format->es->video.crop.width = filter->fmt_in.video.i_width;
sys->input->format->es->video.crop.height = filter->fmt_in.video.i_height;
- sys->input->format->es->video.par.num = filter->fmt_in.video.i_sar_num;
- sys->input->format->es->video.par.den = filter->fmt_in.video.i_sar_den;
+ sys->input->format->es->video.par.num = filter->fmt_in.video.sar.num;
+ sys->input->format->es->video.par.den = filter->fmt_in.video.sar.den;
es_format_Copy(&filter->fmt_out, &filter->fmt_in);
filter->fmt_out.video.frame_rate.num *= 2;
diff --git a/modules/hw/mmal/vout.c b/modules/hw/mmal/vout.c
index f87990019a..a300920b42 100644
--- a/modules/hw/mmal/vout.c
+++ b/modules/hw/mmal/vout.c
@@ -237,8 +237,8 @@ static int Open(vlc_object_t *object)
sys->input->format->es->video.crop.y = 0;
sys->input->format->es->video.crop.width = vd->fmt.i_width;
sys->input->format->es->video.crop.height = vd->fmt.i_height;
- sys->input->format->es->video.par.num = vd->source.i_sar_num;
- sys->input->format->es->video.par.den = vd->source.i_sar_den;
+ sys->input->format->es->video.par.num = vd->source.sar.num;
+ sys->input->format->es->video.par.den = vd->source.sar.den;
status = mmal_port_format_commit(sys->input);
if (status != MMAL_SUCCESS) {
@@ -387,8 +387,8 @@ static int configure_display(vout_display_t *vd, const vout_display_cfg_t *cfg,
return -EINVAL;
if (fmt) {
- sys->input->format->es->video.par.num = fmt->i_sar_num;
- sys->input->format->es->video.par.den = fmt->i_sar_den;
+ sys->input->format->es->video.par.num = fmt->sar.num;
+ sys->input->format->es->video.par.den = fmt->sar.den;
status = mmal_port_format_commit(sys->input);
if (status != MMAL_SUCCESS) {
diff --git a/modules/misc/stats.c b/modules/misc/stats.c
index 85bd1d2594..e219c342ea 100644
--- a/modules/misc/stats.c
+++ b/modules/misc/stats.c
@@ -89,8 +89,8 @@ static int OpenDecoder ( vlc_object_t *p_this )
es_format_Init( &p_dec->fmt_out, VIDEO_ES, VLC_CODEC_I420 );
p_dec->fmt_out.video.i_width = 100;
p_dec->fmt_out.video.i_height = 100;
- p_dec->fmt_out.video.i_sar_num = 1;
- p_dec->fmt_out.video.i_sar_den = 1;
+ p_dec->fmt_out.video.sar.num = 1;
+ p_dec->fmt_out.video.sar.den = 1;
return VLC_SUCCESS;
}
diff --git a/modules/mux/asf.c b/modules/mux/asf.c
index ca5d172567..50adc0768d 100644
--- a/modules/mux/asf.c
+++ b/modules/mux/asf.c
@@ -888,8 +888,8 @@ static block_t *asf_header_create( sout_mux_t *p_mux, bool b_broadcast )
{
const asf_track_t *p_track = vlc_array_item_at_index( &p_sys->tracks, i );
if( p_track->i_cat == VIDEO_ES &&
- p_track->fmt.video.i_sar_num != 0 &&
- p_track->fmt.video.i_sar_den != 0 )
+ p_track->fmt.video.sar.num != 0 &&
+ p_track->fmt.video.sar.den != 0 )
{
i_cm_size = 26 + 2 * (16 + 2 * sizeof("AspectRatio?"));
}
@@ -994,15 +994,15 @@ static block_t *asf_header_create( sout_mux_t *p_mux, bool b_broadcast )
{
tk = vlc_array_item_at_index( &p_sys->tracks, i );
if( tk->i_cat == VIDEO_ES &&
- tk->fmt.video.i_sar_num != 0 &&
- tk->fmt.video.i_sar_den != 0 )
+ tk->fmt.video.sar.num != 0 &&
+ tk->fmt.video.sar.den != 0 )
break;
}
assert( tk != NULL );
vlc_ureduce( &i_dst_num, &i_dst_den,
- tk->fmt.video.i_sar_num,
- tk->fmt.video.i_sar_den, 0 );
+ tk->fmt.video.sar.num,
+ tk->fmt.video.sar.den, 0 );
msg_Dbg( p_mux, "pixel aspect-ratio: %i/%i", i_dst_num, i_dst_den );
diff --git a/modules/mux/mp4/libmp4mux.c b/modules/mux/mp4/libmp4mux.c
index 645a57d3df..00cf468f2f 100644
--- a/modules/mux/mp4/libmp4mux.c
+++ b/modules/mux/mp4/libmp4mux.c
@@ -1609,10 +1609,10 @@ bo_t * mp4mux_GetMoovBox(vlc_object_t *p_obj, mp4mux_trackinfo_t **pp_tracks, un
bo_add_32be(tkhd, 0); // height(presentation)
} else if (p_stream->fmt.i_cat == VIDEO_ES) {
int i_width = p_stream->fmt.video.i_width << 16;
- if (p_stream->fmt.video.i_sar_num > 0 && p_stream->fmt.video.i_sar_den > 0) {
- i_width = (int64_t)p_stream->fmt.video.i_sar_num *
+ if (p_stream->fmt.video.sar.num > 0 && p_stream->fmt.video.sar.den > 0) {
+ i_width = (int64_t)p_stream->fmt.video.sar.num *
((int64_t)p_stream->fmt.video.i_width << 16) /
- p_stream->fmt.video.i_sar_den;
+ p_stream->fmt.video.sar.den;
}
// width (presentation)
bo_add_32be(tkhd, i_width);
@@ -1624,11 +1624,11 @@ bo_t * mp4mux_GetMoovBox(vlc_object_t *p_obj, mp4mux_trackinfo_t **pp_tracks, un
for (unsigned int i = 0; i < i_tracks; i++) {
mp4mux_trackinfo_t *tk = pp_tracks[i];
if (tk->fmt.i_cat == VIDEO_ES) {
- if (tk->fmt.video.i_sar_num > 0 &&
- tk->fmt.video.i_sar_den > 0)
- i_width = (int64_t)tk->fmt.video.i_sar_num *
+ if (tk->fmt.video.sar.num > 0 &&
+ tk->fmt.video.sar.den > 0)
+ i_width = (int64_t)tk->fmt.video.sar.num *
((int64_t)tk->fmt.video.i_width << 16) /
- tk->fmt.video.i_sar_den;
+ tk->fmt.video.sar.den;
else
i_width = tk->fmt.video.i_width << 16;
i_height = tk->fmt.video.i_height;
diff --git a/modules/mux/ogg.c b/modules/mux/ogg.c
index 31adf532d6..8955c8528b 100644
--- a/modules/mux/ogg.c
+++ b/modules/mux/ogg.c
@@ -926,8 +926,8 @@ static void OggFillVP8Header( uint8_t *p_buffer, sout_input_t *p_input )
{
memcpy( p_buffer, "OVP80\x01\x01\x00", 8 );
SetWBE( &p_buffer[8], p_input->p_fmt->video.i_width );
- SetDWBE( &p_buffer[14], p_input->p_fmt->video.i_sar_den );/* 24 bits, 15~ */
- SetDWBE( &p_buffer[11], p_input->p_fmt->video.i_sar_num );/* 24 bits, 12~ */
+ SetDWBE( &p_buffer[14], p_input->p_fmt->video.sar.den );/* 24 bits, 15~ */
+ SetDWBE( &p_buffer[11], p_input->p_fmt->video.sar.num );/* 24 bits, 12~ */
SetWBE( &p_buffer[10], p_input->p_fmt->video.i_height );
SetDWBE( &p_buffer[18], p_input->p_fmt->video.frame_rate.num );
SetDWBE( &p_buffer[22], p_input->p_fmt->video.frame_rate.den );
diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index 37db73fe66..542663d1b3 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -201,8 +201,8 @@ static void ActivateSets( decoder_t *p_dec, const h264_sequence_parameter_set_t
if( p_sps->vui.sar.num != 0 && p_sps->vui.sar.den != 0 )
{
- p_dec->fmt_out.video.i_sar_num = p_sps->vui.sar.num;
- p_dec->fmt_out.video.i_sar_den = p_sps->vui.sar.den;
+ p_dec->fmt_out.video.sar.num = p_sps->vui.sar.num;
+ p_dec->fmt_out.video.sar.den = p_sps->vui.sar.den;
}
if( p_sps->vui.b_valid )
diff --git a/modules/packetizer/mpegvideo.c b/modules/packetizer/mpegvideo.c
index 1158365447..28d35593c8 100644
--- a/modules/packetizer/mpegvideo.c
+++ b/modules/packetizer/mpegvideo.c
@@ -716,10 +716,10 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
* of aspect ratio change, we're screwed. --Meuuh
*/
#if 0
- p_dec->fmt_out.video.i_sar_num =
+ p_dec->fmt_out.video.sar.num =
mpeg2_aspect[p_sys->i_aspect_ratio_info][0] *
p_dec->fmt_out.video.i_height;
- p_dec->fmt_out.video.i_sar_den =
+ p_dec->fmt_out.video.sar.den =
mpeg2_aspect[p_sys->i_aspect_ratio_info][1] *
p_dec->fmt_out.video.i_width;
#endif
diff --git a/modules/packetizer/vc1.c b/modules/packetizer/vc1.c
index 19c1fbdcee..cc2d2b34d3 100644
--- a/modules/packetizer/vc1.c
+++ b/modules/packetizer/vc1.c
@@ -508,8 +508,8 @@ static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag )
const int i_display_width = bs_read( &s, 14 )+1;
const int i_display_height = bs_read( &s, 14 )+1;
- p_es->video.i_sar_num = i_display_width * p_es->video.i_height;
- p_es->video.i_sar_den = i_display_height * p_es->video.i_width;
+ p_es->video.sar.num = i_display_width * p_es->video.i_height;
+ p_es->video.sar.den = i_display_height * p_es->video.i_width;
if( !p_sys->b_sequence_header )
msg_Dbg( p_dec, "display size %dx%d", i_display_width, i_display_height );
diff --git a/modules/spu/audiobargraph_v.c b/modules/spu/audiobargraph_v.c
index 8e6623db62..4f67cc506a 100644
--- a/modules/spu/audiobargraph_v.c
+++ b/modules/spu/audiobargraph_v.c
@@ -393,7 +393,7 @@ static subpicture_t *FilterSub(filter_t *p_filter, mtime_t date)
/* Create new SPU region */
memset(&fmt, 0, sizeof(video_format_t));
fmt.i_chroma = VLC_CODEC_YUVA;
- fmt.i_sar_num = fmt.i_sar_den = 1;
+ fmt.sar.num = fmt.sar.den = 1;
fmt.i_width = fmt.i_visible_width = p_pic->p[Y_PLANE].i_visible_pitch;
fmt.i_height = fmt.i_visible_height = p_pic->p[Y_PLANE].i_visible_lines;
fmt.i_x_offset = fmt.i_y_offset = 0;
diff --git a/modules/spu/logo.c b/modules/spu/logo.c
index edc5936dee..429f246852 100644
--- a/modules/spu/logo.c
+++ b/modules/spu/logo.c
@@ -383,7 +383,7 @@ static subpicture_t *FilterSub( filter_t *p_filter, mtime_t date )
/* Create new SPU region */
memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_CODEC_YUVA;
- fmt.i_sar_num = fmt.i_sar_den = 1;
+ fmt.sar.num = fmt.sar.den = 1;
fmt.i_width = fmt.i_visible_width = p_pic->p[Y_PLANE].i_visible_pitch;
fmt.i_height = fmt.i_visible_height = p_pic->p[Y_PLANE].i_visible_lines;
fmt.i_x_offset = fmt.i_y_offset = 0;
diff --git a/modules/spu/marq.c b/modules/spu/marq.c
index 28c04f8a35..2d5b2162b1 100644
--- a/modules/spu/marq.c
+++ b/modules/spu/marq.c
@@ -308,7 +308,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
fmt.i_width = fmt.i_height = 0;
fmt.i_x_offset = 0;
fmt.i_y_offset = 0;
- fmt.i_sar_den = fmt.i_sar_num = 1;
+ fmt.sar.den = fmt.sar.num = 1;
p_spu->p_region = subpicture_region_New( &fmt );
if( !p_spu->p_region )
{
diff --git a/modules/spu/remoteosd.c b/modules/spu/remoteosd.c
index 1e23a3e234..82645cb706 100644
--- a/modules/spu/remoteosd.c
+++ b/modules/spu/remoteosd.c
@@ -1004,7 +1004,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
/* Create new SPU region */
memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_CODEC_YUVA;
- fmt.i_sar_num = fmt.i_sar_den = 1;
+ fmt.sar.num = fmt.sar.den = 1;
fmt.i_width = fmt.i_visible_width = p_pic->p[Y_PLANE].i_visible_pitch;
fmt.i_height = fmt.i_visible_height = p_pic->p[Y_PLANE].i_visible_lines;
fmt.i_x_offset = fmt.i_y_offset = 0;
diff --git a/modules/spu/rss.c b/modules/spu/rss.c
index 751bba8889..dc727f138f 100644
--- a/modules/spu/rss.c
+++ b/modules/spu/rss.c
@@ -510,7 +510,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
memset( &fmt_out, 0, sizeof(video_format_t) );
fmt_out.i_chroma = VLC_CODEC_YUVA;
- fmt_out.i_sar_num = fmt_out.i_sar_den = 1;
+ fmt_out.sar.num = fmt_out.sar.den = 1;
fmt_out.i_width =
fmt_out.i_visible_width = p_pic->p[Y_PLANE].i_visible_pitch;
fmt_out.i_height =
diff --git a/modules/stream_out/mosaic_bridge.c b/modules/stream_out/mosaic_bridge.c
index 8648055225..d6c3008702 100644
--- a/modules/stream_out/mosaic_bridge.c
+++ b/modules/stream_out/mosaic_bridge.c
@@ -512,8 +512,8 @@ static int decoder_queue_video( decoder_t *p_dec, picture_t *p_pic,
const unsigned i_fmt_in_aspect =
(int64_t)VOUT_ASPECT_FACTOR *
- fmt_in.i_sar_num * fmt_in.i_width /
- (fmt_in.i_sar_den * fmt_in.i_height);
+ fmt_in.sar.num * fmt_in.i_width /
+ (fmt_in.sar.den * fmt_in.i_height);
if ( !p_sys->i_height )
{
fmt_out.i_width = p_sys->i_width;
@@ -551,8 +551,8 @@ static int decoder_queue_video( decoder_t *p_dec, picture_t *p_pic,
p_new_pic = picture_New( p_pic->format.i_chroma,
p_pic->format.i_width, p_pic->format.i_height,
- p_sys->p_decoder->fmt_out.video.i_sar_num,
- p_sys->p_decoder->fmt_out.video.i_sar_den );
+ p_sys->p_decoder->fmt_out.video.sar.num,
+ p_sys->p_decoder->fmt_out.video.sar.den );
if( !p_new_pic )
{
picture_Release( p_pic );
@@ -623,13 +623,13 @@ static int video_update_format( vlc_object_t *p_this,
if( fmt_out->video.i_width != p_sys->video.i_width ||
fmt_out->video.i_height != p_sys->video.i_height ||
fmt_out->video.i_chroma != p_sys->video.i_chroma ||
- (int64_t)fmt_out->video.i_sar_num * p_sys->video.i_sar_den !=
- (int64_t)fmt_out->video.i_sar_den * p_sys->video.i_sar_num )
+ (int64_t)fmt_out->video.sar.num * p_sys->video.sar.den !=
+ (int64_t)fmt_out->video.sar.den * p_sys->video.sar.num )
{
- vlc_ureduce( &fmt_out->video.i_sar_num,
- &fmt_out->video.i_sar_den,
- fmt_out->video.i_sar_num,
- fmt_out->video.i_sar_den, 0 );
+ vlc_ureduce( &fmt_out->video.sar.num,
+ &fmt_out->video.sar.den,
+ fmt_out->video.sar.num,
+ fmt_out->video.sar.den, 0 );
if( !fmt_out->video.i_visible_width ||
!fmt_out->video.i_visible_height )
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index ce870153b3..a5c882b353 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -367,10 +367,10 @@ static void transcode_video_filter_init( sout_stream_t *p_stream,
id->p_encoder->fmt_in.video.i_width;
id->p_encoder->fmt_out.video.i_height =
id->p_encoder->fmt_in.video.i_height;
- id->p_encoder->fmt_out.video.i_sar_num =
- id->p_encoder->fmt_in.video.i_sar_num;
- id->p_encoder->fmt_out.video.i_sar_den =
- id->p_encoder->fmt_in.video.i_sar_den;
+ id->p_encoder->fmt_out.video.sar.num =
+ id->p_encoder->fmt_in.video.sar.num;
+ id->p_encoder->fmt_out.video.sar.den =
+ id->p_encoder->fmt_in.video.sar.den;
}
/* Keep colorspace etc info along */
@@ -459,9 +459,9 @@ static void transcode_video_size_init( sout_stream_t *p_stream,
float f_scale_height = 1;
/* aspect ratio */
- float f_aspect = (double)p_fmt_out->video.i_sar_num *
+ float f_aspect = (double)p_fmt_out->video.sar.num *
p_fmt_out->video.i_width /
- p_fmt_out->video.i_sar_den /
+ p_fmt_out->video.sar.den /
p_fmt_out->video.i_height;
msg_Dbg( p_stream, "decoder aspect is %f:1", (double) f_aspect );
@@ -574,32 +574,32 @@ static void transcode_video_sar_init( sout_stream_t *p_stream,
i_src_visible_height = p_fmt_out->video.i_height;
/* Check whether a particular aspect ratio was requested */
- if( id->p_encoder->fmt_out.video.i_sar_num <= 0 ||
- id->p_encoder->fmt_out.video.i_sar_den <= 0 )
+ if( id->p_encoder->fmt_out.video.sar.num <= 0 ||
+ id->p_encoder->fmt_out.video.sar.den <= 0 )
{
- vlc_ureduce( &id->p_encoder->fmt_out.video.i_sar_num,
- &id->p_encoder->fmt_out.video.i_sar_den,
- (uint64_t)p_fmt_out->video.i_sar_num * id->p_encoder->fmt_out.video.i_width * p_fmt_out->video.i_height,
- (uint64_t)p_fmt_out->video.i_sar_den * id->p_encoder->fmt_out.video.i_height * p_fmt_out->video.i_width,
+ vlc_ureduce( &id->p_encoder->fmt_out.video.sar.num,
+ &id->p_encoder->fmt_out.video.sar.den,
+ (uint64_t)p_fmt_out->video.sar.num * id->p_encoder->fmt_out.video.i_width * p_fmt_out->video.i_height,
+ (uint64_t)p_fmt_out->video.sar.den * id->p_encoder->fmt_out.video.i_height * p_fmt_out->video.i_width,
0 );
}
else
{
- vlc_ureduce( &id->p_encoder->fmt_out.video.i_sar_num,
- &id->p_encoder->fmt_out.video.i_sar_den,
- id->p_encoder->fmt_out.video.i_sar_num,
- id->p_encoder->fmt_out.video.i_sar_den,
+ vlc_ureduce( &id->p_encoder->fmt_out.video.sar.num,
+ &id->p_encoder->fmt_out.video.sar.den,
+ id->p_encoder->fmt_out.video.sar.num,
+ id->p_encoder->fmt_out.video.sar.den,
0 );
}
- id->p_encoder->fmt_in.video.i_sar_num =
- id->p_encoder->fmt_out.video.i_sar_num;
- id->p_encoder->fmt_in.video.i_sar_den =
- id->p_encoder->fmt_out.video.i_sar_den;
+ id->p_encoder->fmt_in.video.sar.num =
+ id->p_encoder->fmt_out.video.sar.num;
+ id->p_encoder->fmt_in.video.sar.den =
+ id->p_encoder->fmt_out.video.sar.den;
msg_Dbg( p_stream, "encoder aspect is %i:%i",
- id->p_encoder->fmt_out.video.i_sar_num * id->p_encoder->fmt_out.video.i_width,
- id->p_encoder->fmt_out.video.i_sar_den * id->p_encoder->fmt_out.video.i_height );
+ id->p_encoder->fmt_out.video.sar.num * id->p_encoder->fmt_out.video.i_width,
+ id->p_encoder->fmt_out.video.sar.den * id->p_encoder->fmt_out.video.i_height );
}
@@ -803,8 +803,8 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
)
{
msg_Info( p_stream, "aspect-ratio changed, reiniting. %i -> %i : %i -> %i.",
- id->fmt_input_video.i_sar_num, id->p_decoder->fmt_out.video.i_sar_num,
- id->fmt_input_video.i_sar_den, id->p_decoder->fmt_out.video.i_sar_den
+ id->fmt_input_video.sar.num, id->p_decoder->fmt_out.video.sar.num,
+ id->fmt_input_video.sar.den, id->p_decoder->fmt_out.video.sar.den
);
/* Close filters */
if( id->p_f_chain )
@@ -817,7 +817,7 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
/* Reinitialize filters */
id->p_encoder->fmt_out.video.i_visible_width = p_sys->i_width & ~1;
id->p_encoder->fmt_out.video.i_visible_height = p_sys->i_height & ~1;
- id->p_encoder->fmt_out.video.i_sar_num = id->p_encoder->fmt_out.video.i_sar_den = 0;
+ id->p_encoder->fmt_out.video.sar.num = id->p_encoder->fmt_out.video.sar.den = 0;
transcode_video_encoder_init( p_stream, id );
transcode_video_filter_init( p_stream, id );
diff --git a/modules/text_renderer/freetype/freetype.c b/modules/text_renderer/freetype/freetype.c
index 582eb5d40f..43eea2d1bc 100644
--- a/modules/text_renderer/freetype/freetype.c
+++ b/modules/text_renderer/freetype/freetype.c
@@ -424,7 +424,7 @@ static int RenderYUVP( filter_t *p_filter, subpicture_region_t *p_region,
fmt.i_visible_width = p_bbox->xMax - p_bbox->xMin + 4;
fmt.i_height =
fmt.i_visible_height = p_bbox->yMax - p_bbox->yMin + 4;
- fmt.i_sar_num = fmt.i_sar_den = 1;
+ fmt.sar.num = fmt.sar.den = 1;
assert( !p_region->p_picture );
p_region->p_picture = picture_NewFromFormat( &fmt );
@@ -825,7 +825,7 @@ static inline int RenderAXYZ( filter_t *p_filter,
fmt.i_visible_width = i_text_width + 2 * i_margin;
fmt.i_height =
fmt.i_visible_height = i_text_height + 2 * i_margin;
- fmt.i_sar_num = fmt.i_sar_den = 1;
+ fmt.sar.num = fmt.sar.den = 1;
picture_t *p_picture = p_region->p_picture = picture_NewFromFormat( &fmt );
if( !p_region->p_picture )
diff --git a/modules/video_chroma/swscale.c b/modules/video_chroma/swscale.c
index 8993d11ec5..3996f0c08f 100644
--- a/modules/video_chroma/swscale.c
+++ b/modules/video_chroma/swscale.c
@@ -446,14 +446,14 @@ static int Init( filter_t *p_filter )
* WARNING: this is a hack, ideally this should not be needed
* and the vout should update its video format instead.
*/
- unsigned i_sar_num = p_fmti->i_sar_num * p_fmti->i_visible_width;
- unsigned i_sar_den = p_fmti->i_sar_den * p_fmto->i_visible_width;
+ unsigned i_sar_num = p_fmti->sar.num * p_fmti->i_visible_width;
+ unsigned i_sar_den = p_fmti->sar.den * p_fmto->i_visible_width;
vlc_ureduce(&i_sar_num, &i_sar_den, i_sar_num, i_sar_den, 65536);
i_sar_num *= p_fmto->i_visible_height;
i_sar_den *= p_fmti->i_visible_height;
vlc_ureduce(&i_sar_num, &i_sar_den, i_sar_num, i_sar_den, 65536);
- p_fmto->i_sar_num = i_sar_num;
- p_fmto->i_sar_den = i_sar_den;
+ p_fmto->sar.num = i_sar_num;
+ p_fmto->sar.den = i_sar_den;
}
p_sys->b_add_a = cfg.b_add_a;
diff --git a/modules/video_filter/canvas.c b/modules/video_filter/canvas.c
index b3096d2ede..03bec66d0c 100644
--- a/modules/video_filter/canvas.c
+++ b/modules/video_filter/canvas.c
@@ -185,11 +185,11 @@ static int Activate( vlc_object_t *p_this )
return VLC_EGENERIC;
}
- if( p_filter->fmt_in.video.i_sar_num )
- i_fmt_in_aspect = (int64_t)p_filter->fmt_in.video.i_sar_num *
+ if( p_filter->fmt_in.video.sar.num )
+ i_fmt_in_aspect = (int64_t)p_filter->fmt_in.video.sar.num *
p_filter->fmt_in.video.i_visible_width *
VOUT_ASPECT_FACTOR /
- p_filter->fmt_in.video.i_sar_den /
+ p_filter->fmt_in.video.sar.den /
p_filter->fmt_in.video.i_visible_height;
else
i_fmt_in_aspect = (int64_t)p_filter->fmt_in.video.i_visible_width *
@@ -352,8 +352,8 @@ static int Activate( vlc_object_t *p_this )
fmt = *filter_chain_GetFmtOut( p_sys->p_chain );
es_format_Copy( &p_filter->fmt_out, &fmt );
- vlc_ureduce( &p_filter->fmt_out.video.i_sar_num,
- &p_filter->fmt_out.video.i_sar_den,
+ vlc_ureduce( &p_filter->fmt_out.video.sar.num,
+ &p_filter->fmt_out.video.sar.den,
i_canvas_aspect * p_filter->fmt_out.video.i_visible_height,
VOUT_ASPECT_FACTOR * p_filter->fmt_out.video.i_visible_width,
0);
diff --git a/modules/video_filter/deinterlace/deinterlace.c b/modules/video_filter/deinterlace/deinterlace.c
index d260491921..9ed18055cd 100644
--- a/modules/video_filter/deinterlace/deinterlace.c
+++ b/modules/video_filter/deinterlace/deinterlace.c
@@ -246,7 +246,7 @@ static void GetOutputFormat( filter_t *p_filter,
p_dst->i_height /= 2;
p_dst->i_visible_height /= 2;
p_dst->i_y_offset /= 2;
- p_dst->i_sar_den *= 2;
+ p_dst->sar.den *= 2;
}
if( p_sys->b_double_rate )
diff --git a/modules/video_filter/scene.c b/modules/video_filter/scene.c
index 9f920bf231..68c822ca24 100644
--- a/modules/video_filter/scene.c
+++ b/modules/video_filter/scene.c
@@ -285,7 +285,7 @@ static void SavePicture( filter_t *p_filter, picture_t *p_pic )
/* Save snapshot psz_format to a memory zone */
fmt_in = p_pic->format;
- fmt_out.i_sar_num = fmt_out.i_sar_den = 1;
+ fmt_out.sar.num = fmt_out.sar.den = 1;
fmt_out.i_width = p_sys->i_width;
fmt_out.i_height = p_sys->i_height;
fmt_out.i_chroma = p_sys->i_format;
diff --git a/modules/video_filter/transform.c b/modules/video_filter/transform.c
index 7c88f234ef..11c280c542 100644
--- a/modules/video_filter/transform.c
+++ b/modules/video_filter/transform.c
@@ -392,8 +392,8 @@ static int Open(vlc_object_t *object)
dst->i_visible_width != src_trans.i_visible_width ||
dst->i_height != src_trans.i_height ||
dst->i_visible_height != src_trans.i_visible_height ||
- dst->i_sar_num != src_trans.i_sar_num ||
- dst->i_sar_den != src_trans.i_sar_den ||
+ dst->sar.num != src_trans.sar.num ||
+ dst->sar.den != src_trans.sar.den ||
dst->i_x_offset != src_trans.i_x_offset ||
dst->i_y_offset != src_trans.i_y_offset)) {
@@ -406,8 +406,8 @@ static int Open(vlc_object_t *object)
dst->i_visible_width = src_trans.i_visible_width;
dst->i_height = src_trans.i_height;
dst->i_visible_height = src_trans.i_visible_height;
- dst->i_sar_num = src_trans.i_sar_num;
- dst->i_sar_den = src_trans.i_sar_den;
+ dst->sar.num = src_trans.sar.num;
+ dst->sar.den = src_trans.sar.den;
dst->i_x_offset = src_trans.i_x_offset;
dst->i_y_offset = src_trans.i_y_offset;
}
diff --git a/modules/video_output/android/display.c b/modules/video_output/android/display.c
index 8161f6e1c3..14b2518284 100644
--- a/modules/video_output/android/display.c
+++ b/modules/video_output/android/display.c
@@ -167,9 +167,9 @@ static int UpdateVideoSize(vout_display_sys_t *sys, video_format_t *p_fmt,
video_format_ApplyRotation(&rot_fmt, p_fmt);
- if (rot_fmt.i_sar_num != 0 && rot_fmt.i_sar_den != 0) {
- i_sar_num = rot_fmt.i_sar_num;
- i_sar_den = rot_fmt.i_sar_den;
+ if (rot_fmt.sar.num != 0 && rot_fmt.sar.den != 0) {
+ i_sar_num = rot_fmt.sar.num;
+ i_sar_den = rot_fmt.sar.den;
}
if (b_cropped) {
i_width = rot_fmt.i_visible_width;
@@ -244,11 +244,11 @@ static void FixSubtitleFormat(vout_display_sys_t *sys)
i_video_height = fmt.i_visible_height;
}
- if (fmt.i_sar_num > 0 && fmt.i_sar_den > 0) {
- if (fmt.i_sar_num >= fmt.i_sar_den)
- i_video_width = i_video_width * fmt.i_sar_num / fmt.i_sar_den;
+ if (fmt.sar.num > 0 && fmt.sar.den > 0) {
+ if (fmt.sar.num >= fmt.sar.den)
+ i_video_width = i_video_width * fmt.sar.num / fmt.sar.den;
else
- i_video_height = i_video_height * fmt.i_sar_den / fmt.i_sar_num;
+ i_video_height = i_video_height * fmt.sar.den / fmt.sar.num;
}
if (sys->p_window->i_angle == 90 || sys->p_window->i_angle == 180) {
@@ -281,8 +281,8 @@ static void FixSubtitleFormat(vout_display_sys_t *sys)
p_subfmt->i_visible_height = i_height;
p_subfmt->i_x_offset = 0;
p_subfmt->i_y_offset = 0;
- p_subfmt->i_sar_num = 1;
- p_subfmt->i_sar_den = 1;
+ p_subfmt->sar.num = 1;
+ p_subfmt->sar.den = 1;
sys->b_sub_invalid = true;
}
@@ -1164,8 +1164,8 @@ static void Display(vout_display_t *vd, picture_t *picture,
static void CopySourceAspect(video_format_t *p_dest,
const video_format_t *p_src)
{
- p_dest->i_sar_num = p_src->i_sar_num;
- p_dest->i_sar_den = p_src->i_sar_den;
+ p_dest->sar.num = p_src->sar.num;
+ p_dest->sar.den = p_src->sar.den;
}
static int Control(vout_display_t *vd, int query, va_list args)
diff --git a/modules/video_output/decklink.cpp b/modules/video_output/decklink.cpp
index cdd87ad83b..785e00162a 100644
--- a/modules/video_output/decklink.cpp
+++ b/modules/video_output/decklink.cpp
@@ -704,8 +704,8 @@ static int OpenDecklink(vout_display_t *vd, decklink_sys_t *sys)
fmt->i_height = fmt->i_visible_height = p_display_mode->GetHeight();
fmt->i_x_offset = 0;
fmt->i_y_offset = 0;
- fmt->i_sar_num = 0;
- fmt->i_sar_den = 0;
+ fmt->sar.num = 0;
+ fmt->sar.den = 0;
fmt->i_chroma = !sys->video.tenbits ? VLC_CODEC_UYVY : VLC_CODEC_I422_10L; /* we will convert to v210 */
fmt->frame_rate.num = (unsigned) sys->frameduration;
fmt->frame_rate.den = (unsigned) sys->timescale;
diff --git a/modules/video_output/yuv.c b/modules/video_output/yuv.c
index fe61a7c93b..ef02af91c4 100644
--- a/modules/video_output/yuv.c
+++ b/modules/video_output/yuv.c
@@ -202,13 +202,13 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
if (ORIENT_IS_SWAP(vd->source.orientation))
{
- fmt.i_sar_num = vd->source.i_sar_den;
- fmt.i_sar_den = vd->source.i_sar_num;
+ fmt.sar.num = vd->source.sar.den;
+ fmt.sar.den = vd->source.sar.num;
}
else
{
- fmt.i_sar_num = vd->source.i_sar_num;
- fmt.i_sar_den = vd->source.i_sar_den;
+ fmt.sar.num = vd->source.sar.num;
+ fmt.sar.den = vd->source.sar.den;
}
/* */
@@ -245,7 +245,7 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
fmt.i_visible_width, fmt.i_visible_height,
fmt.frame_rate.num, fmt.frame_rate.den,
type,
- fmt.i_sar_num, fmt.i_sar_den);
+ fmt.sar.num, fmt.sar.den);
sys->is_first = true;
}
diff --git a/modules/video_splitter/wall.c b/modules/video_splitter/wall.c
index 3e95f91e15..a61c6d1344 100644
--- a/modules/video_splitter/wall.c
+++ b/modules/video_splitter/wall.c
@@ -359,8 +359,8 @@ static int Open( vlc_object_t *p_this )
p_cfg->fmt.i_width = p_output->i_width;
p_cfg->fmt.i_visible_height =
p_cfg->fmt.i_height = p_output->i_height;
- p_cfg->fmt.i_sar_num = (int64_t)i_aspect * i_target_height;
- p_cfg->fmt.i_sar_den = VOUT_ASPECT_FACTOR * i_target_width;
+ p_cfg->fmt.sar.num = (int64_t)i_aspect * i_target_height;
+ p_cfg->fmt.sar.den = VOUT_ASPECT_FACTOR * i_target_width;
p_cfg->window.i_x = p_output->i_left;
p_cfg->window.i_y = p_output->i_top;
p_cfg->window.i_align = p_output->i_align;
diff --git a/modules/visualization/goom.c b/modules/visualization/goom.c
index 8d5538bb1a..1ee3791c38 100644
--- a/modules/visualization/goom.c
+++ b/modules/visualization/goom.c
@@ -134,7 +134,7 @@ static int Open( vlc_object_t *p_this )
fmt.i_width = fmt.i_visible_width = width;
fmt.i_height = fmt.i_visible_height = height;
fmt.i_chroma = VLC_CODEC_RGB32;
- fmt.i_sar_num = fmt.i_sar_den = 1;
+ fmt.sar.num = fmt.sar.den = 1;
p_thread->p_vout = aout_filter_RequestVout( p_filter, NULL, &fmt );
if( p_thread->p_vout == NULL )
diff --git a/modules/visualization/visual/visual.c b/modules/visualization/visual/visual.c
index e3239789c1..5a307b1ecc 100644
--- a/modules/visualization/visual/visual.c
+++ b/modules/visualization/visual/visual.c
@@ -296,8 +296,8 @@ static int Open( vlc_object_t *p_this )
.i_height = height,
.i_visible_width = width,
.i_visible_height = height,
- .i_sar_num = 1,
- .i_sar_den = 1,
+ .sar.num = 1,
+ .sar.den = 1,
};
p_sys->p_vout = aout_filter_RequestVout( p_filter, NULL, &fmt );
if( p_sys->p_vout == NULL )
diff --git a/src/input/decoder.c b/src/input/decoder.c
index cc6f210505..1264eb7ba0 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -381,8 +381,8 @@ static int vout_update_format( decoder_t *p_dec )
|| p_dec->fmt_out.video.i_x_offset != p_owner->fmt.video.i_x_offset
|| p_dec->fmt_out.video.i_y_offset != p_owner->fmt.video.i_y_offset
|| p_dec->fmt_out.i_codec != p_owner->fmt.video.i_chroma
- || (int64_t)p_dec->fmt_out.video.i_sar_num * p_owner->fmt.video.i_sar_den !=
- (int64_t)p_dec->fmt_out.video.i_sar_den * p_owner->fmt.video.i_sar_num ||
+ || (int64_t)p_dec->fmt_out.video.sar.num * p_owner->fmt.video.sar.den !=
+ (int64_t)p_dec->fmt_out.video.sar.den * p_owner->fmt.video.sar.num ||
p_dec->fmt_out.video.orientation != p_owner->fmt.video.orientation ||
p_dec->fmt_out.video.multiview_mode != p_owner->fmt.video.multiview_mode )
{
@@ -433,22 +433,22 @@ static int vout_update_format( decoder_t *p_dec )
var_CreateGetBool( p_dec, "hdtv-fix" ) )
{
fmt.i_visible_height = 1080;
- if( !(fmt.i_sar_num % 136))
+ if( !(fmt.sar.num % 136))
{
- fmt.i_sar_num *= 135;
- fmt.i_sar_den *= 136;
+ fmt.sar.num *= 135;
+ fmt.sar.den *= 136;
}
msg_Warn( p_dec, "Fixing broken HDTV stream (display_height=1088)");
}
- if( !fmt.i_sar_num || !fmt.i_sar_den )
+ if( !fmt.sar.num || !fmt.sar.den )
{
- fmt.i_sar_num = 1;
- fmt.i_sar_den = 1;
+ fmt.sar.num = 1;
+ fmt.sar.den = 1;
}
- vlc_ureduce( &fmt.i_sar_num, &fmt.i_sar_den,
- fmt.i_sar_num, fmt.i_sar_den, 50000 );
+ vlc_ureduce( &fmt.sar.num, &fmt.sar.den,
+ fmt.sar.num, fmt.sar.den, 50000 );
video_format_AdjustColorSpace( &fmt );
diff --git a/src/misc/es_format.c b/src/misc/es_format.c
index ab27a32ae8..90e059ac60 100644
--- a/src/misc/es_format.c
+++ b/src/misc/es_format.c
@@ -142,7 +142,7 @@ void video_format_Setup( video_format_t *p_fmt, vlc_fourcc_t i_chroma,
p_fmt->i_visible_height = i_visible_height;
p_fmt->i_x_offset =
p_fmt->i_y_offset = 0;
- vlc_ureduce( &p_fmt->i_sar_num, &p_fmt->i_sar_den,
+ vlc_ureduce( &p_fmt->sar.num, &p_fmt->sar.den,
i_sar_num, i_sar_den, 0 );
switch( p_fmt->i_chroma )
@@ -240,15 +240,15 @@ void video_format_ScaleCropAr( video_format_t *p_dst, const video_format_t *p_sr
p_dst->i_visible_width = (uint64_t)p_src->i_visible_width * p_dst->i_width / p_src->i_width;
p_dst->i_visible_height = (uint64_t)p_src->i_visible_height * p_dst->i_height / p_src->i_height;
- p_dst->i_sar_num *= p_src->i_width;
- p_dst->i_sar_den *= p_dst->i_width;
- vlc_ureduce(&p_dst->i_sar_num, &p_dst->i_sar_den,
- p_dst->i_sar_num, p_dst->i_sar_den, 65536);
+ p_dst->sar.num *= p_src->i_width;
+ p_dst->sar.den *= p_dst->i_width;
+ vlc_ureduce(&p_dst->sar.num, &p_dst->sar.den,
+ p_dst->sar.num, p_dst->sar.den, 65536);
- p_dst->i_sar_num *= p_dst->i_height;
- p_dst->i_sar_den *= p_src->i_height;
- vlc_ureduce(&p_dst->i_sar_num, &p_dst->i_sar_den,
- p_dst->i_sar_num, p_dst->i_sar_den, 65536);
+ p_dst->sar.num *= p_dst->i_height;
+ p_dst->sar.den *= p_src->i_height;
+ vlc_ureduce(&p_dst->sar.num, &p_dst->sar.den,
+ p_dst->sar.num, p_dst->sar.den, 65536);
}
//Simplify transforms to have something more manageable. Order: angle, hflip.
@@ -358,8 +358,8 @@ void video_format_TransformBy( video_format_t *fmt, video_transform_t transform
fmt->i_visible_height = scratch.i_visible_width;
fmt->i_x_offset = scratch.i_y_offset;
fmt->i_y_offset = scratch.i_x_offset;
- fmt->i_sar_num = scratch.i_sar_den;
- fmt->i_sar_den = scratch.i_sar_num;
+ fmt->sar.num = scratch.sar.den;
+ fmt->sar.den = scratch.sar.num;
}
fmt->orientation = dst_orient;
@@ -392,7 +392,7 @@ bool video_format_IsSimilar( const video_format_t *f1,
f1->i_visible_height != f2->i_visible_height ||
f1->i_x_offset != f2->i_x_offset || f1->i_y_offset != f2->i_y_offset )
return false;
- if( f1->i_sar_num * f2->i_sar_den != f2->i_sar_num * f1->i_sar_den )
+ if( f1->sar.num * f2->sar.den != f2->sar.num * f1->sar.den )
return false;
if( f1->orientation != f2->orientation)
@@ -428,7 +428,7 @@ void video_format_Print( vlc_object_t *p_this,
fmt->i_width, fmt->i_height, fmt->i_x_offset, fmt->i_y_offset,
fmt->i_visible_width, fmt->i_visible_height,
(char*)&fmt->i_chroma,
- fmt->i_sar_num, fmt->i_sar_den,
+ fmt->sar.num, fmt->sar.den,
fmt->i_rmask, fmt->i_gmask, fmt->i_bmask );
}
diff --git a/src/misc/image.c b/src/misc/image.c
index 735801fcf2..06e9e7c927 100644
--- a/src/misc/image.c
+++ b/src/misc/image.c
@@ -198,17 +198,17 @@ static picture_t *ImageRead( image_handler_t *p_image, block_t *p_block,
p_fmt_out->i_chroma = p_image->p_dec->fmt_out.video.i_chroma;
if( !p_fmt_out->i_width && p_fmt_out->i_height )
p_fmt_out->i_width = (int64_t)p_image->p_dec->fmt_out.video.i_width *
- p_image->p_dec->fmt_out.video.i_sar_num *
+ p_image->p_dec->fmt_out.video.sar.num *
p_fmt_out->i_height /
p_image->p_dec->fmt_out.video.i_height /
- p_image->p_dec->fmt_out.video.i_sar_den;
+ p_image->p_dec->fmt_out.video.sar.den;
if( !p_fmt_out->i_height && p_fmt_out->i_width )
p_fmt_out->i_height = (int64_t)p_image->p_dec->fmt_out.video.i_height *
- p_image->p_dec->fmt_out.video.i_sar_den *
+ p_image->p_dec->fmt_out.video.sar.den *
p_fmt_out->i_width /
p_image->p_dec->fmt_out.video.i_width /
- p_image->p_dec->fmt_out.video.i_sar_num;
+ p_image->p_dec->fmt_out.video.sar.num;
if( !p_fmt_out->i_width )
p_fmt_out->i_width = p_image->p_dec->fmt_out.video.i_width;
if( !p_fmt_out->i_height )
@@ -469,17 +469,17 @@ static picture_t *ImageConvert( image_handler_t *p_image, picture_t *p_pic,
picture_t *p_pif;
if( !p_fmt_out->i_width && !p_fmt_out->i_height &&
- p_fmt_out->i_sar_num && p_fmt_out->i_sar_den &&
- p_fmt_out->i_sar_num * p_fmt_in->i_sar_den !=
- p_fmt_out->i_sar_den * p_fmt_in->i_sar_num )
+ p_fmt_out->sar.num && p_fmt_out->sar.den &&
+ p_fmt_out->sar.num * p_fmt_in->sar.den !=
+ p_fmt_out->sar.den * p_fmt_in->sar.num )
{
p_fmt_out->i_width =
- p_fmt_in->i_sar_num * (int64_t)p_fmt_out->i_sar_den *
- p_fmt_in->i_width / p_fmt_in->i_sar_den / p_fmt_out->i_sar_num;
+ p_fmt_in->sar.num * (int64_t)p_fmt_out->sar.den *
+ p_fmt_in->i_width / p_fmt_in->sar.den / p_fmt_out->sar.num;
p_fmt_out->i_visible_width =
- p_fmt_in->i_sar_num * (int64_t)p_fmt_out->i_sar_den *
- p_fmt_in->i_visible_width / p_fmt_in->i_sar_den /
- p_fmt_out->i_sar_num;
+ p_fmt_in->sar.num * (int64_t)p_fmt_out->sar.den *
+ p_fmt_in->i_visible_width / p_fmt_in->sar.den /
+ p_fmt_out->sar.num;
}
if( !p_fmt_out->i_chroma ) p_fmt_out->i_chroma = p_fmt_in->i_chroma;
@@ -487,8 +487,8 @@ static picture_t *ImageConvert( image_handler_t *p_image, picture_t *p_pic,
p_fmt_out->i_width = p_fmt_out->i_visible_width = p_fmt_in->i_width;
if( !p_fmt_out->i_height )
p_fmt_out->i_height = p_fmt_out->i_visible_height = p_fmt_in->i_height;
- if( !p_fmt_out->i_sar_num ) p_fmt_out->i_sar_num = p_fmt_in->i_sar_num;
- if( !p_fmt_out->i_sar_den ) p_fmt_out->i_sar_den = p_fmt_in->i_sar_den;
+ if( !p_fmt_out->sar.num ) p_fmt_out->sar.num = p_fmt_in->sar.num;
+ if( !p_fmt_out->sar.den ) p_fmt_out->sar.den = p_fmt_in->sar.den;
if( p_image->p_filter )
if( p_image->p_filter->fmt_in.video.i_chroma != p_fmt_in->i_chroma ||
@@ -717,16 +717,16 @@ static encoder_t *CreateEncoder( vlc_object_t *p_this, video_format_t *fmt_in,
p_enc->fmt_in.video.i_visible_height = fmt_out->i_height;
}
}
- } else if( fmt_out->i_sar_num && fmt_out->i_sar_den &&
- fmt_out->i_sar_num * fmt_in->i_sar_den !=
- fmt_out->i_sar_den * fmt_in->i_sar_num )
+ } else if( fmt_out->sar.num && fmt_out->sar.den &&
+ fmt_out->sar.num * fmt_in->sar.den !=
+ fmt_out->sar.den * fmt_in->sar.num )
{
p_enc->fmt_in.video.i_width =
- fmt_in->i_sar_num * (int64_t)fmt_out->i_sar_den * fmt_in->i_width /
- fmt_in->i_sar_den / fmt_out->i_sar_num;
+ fmt_in->sar.num * (int64_t)fmt_out->sar.den * fmt_in->i_width /
+ fmt_in->sar.den / fmt_out->sar.num;
p_enc->fmt_in.video.i_visible_width =
- fmt_in->i_sar_num * (int64_t)fmt_out->i_sar_den *
- fmt_in->i_visible_width / fmt_in->i_sar_den / fmt_out->i_sar_num;
+ fmt_in->sar.num * (int64_t)fmt_out->sar.den *
+ fmt_in->i_visible_width / fmt_in->sar.den / fmt_out->sar.num;
}
p_enc->fmt_in.video.frame_rate.num = 25;
diff --git a/src/misc/picture.c b/src/misc/picture.c
index 0a2dc8f69a..c051e8a0b4 100644
--- a/src/misc/picture.c
+++ b/src/misc/picture.c
@@ -152,7 +152,7 @@ int picture_Setup( picture_t *p_picture, const video_format_t *restrict fmt )
video_format_Setup( &p_picture->format, fmt->i_chroma, fmt->i_width, fmt->i_height,
fmt->i_visible_width, fmt->i_visible_height,
- fmt->i_sar_num, fmt->i_sar_den );
+ fmt->sar.num, fmt->sar.den );
const vlc_chroma_description_t *p_dsc =
vlc_fourcc_GetChromaDescription( p_picture->format.i_chroma );
@@ -208,7 +208,7 @@ picture_t *picture_NewFromResource( const video_format_t *p_fmt, const picture_r
video_format_Setup( &fmt, p_fmt->i_chroma,
p_fmt->i_width, p_fmt->i_height,
p_fmt->i_visible_width, p_fmt->i_visible_height,
- p_fmt->i_sar_num, p_fmt->i_sar_den );
+ p_fmt->sar.num, p_fmt->sar.den );
if( p_fmt->i_x_offset < p_fmt->i_width &&
p_fmt->i_y_offset < p_fmt->i_height &&
p_fmt->i_visible_width > 0 && p_fmt->i_x_offset + p_fmt->i_visible_width <= p_fmt->i_width &&
@@ -390,17 +390,17 @@ int picture_Export( vlc_object_t *p_obj,
{
/* */
video_format_t fmt_in = p_picture->format;
- if( fmt_in.i_sar_num <= 0 || fmt_in.i_sar_den <= 0 )
+ if( fmt_in.sar.num <= 0 || fmt_in.sar.den <= 0 )
{
- fmt_in.i_sar_num =
- fmt_in.i_sar_den = 1;
+ fmt_in.sar.num =
+ fmt_in.sar.den = 1;
}
/* */
video_format_t fmt_out;
memset( &fmt_out, 0, sizeof(fmt_out) );
- fmt_out.i_sar_num =
- fmt_out.i_sar_den = 1;
+ fmt_out.sar.num =
+ fmt_out.sar.den = 1;
fmt_out.i_chroma = i_format;
/* compute original width/height */
@@ -415,15 +415,15 @@ int picture_Export( vlc_object_t *p_obj,
i_width = fmt_in.i_width;
i_height = fmt_in.i_height;
}
- if( fmt_in.i_sar_num >= fmt_in.i_sar_den )
+ if( fmt_in.sar.num >= fmt_in.sar.den )
{
- i_original_width = (int64_t)i_width * fmt_in.i_sar_num / fmt_in.i_sar_den;
+ i_original_width = (int64_t)i_width * fmt_in.sar.num / fmt_in.sar.den;
i_original_height = i_height;
}
else
{
i_original_width = i_width;
- i_original_height = i_height * fmt_in.i_sar_den / fmt_in.i_sar_num;
+ i_original_height = i_height * fmt_in.sar.den / fmt_in.sar.num;
}
/* */
@@ -436,12 +436,12 @@ int picture_Export( vlc_object_t *p_obj,
if( fmt_out.i_height == 0 && fmt_out.i_width > 0 )
{
fmt_out.i_height = i_height * fmt_out.i_width
- * fmt_in.i_sar_den / fmt_in.i_width / fmt_in.i_sar_num;
+ * fmt_in.sar.den / fmt_in.i_width / fmt_in.sar.num;
}
else if( fmt_out.i_width == 0 && fmt_out.i_height > 0 )
{
fmt_out.i_width = i_width * fmt_out.i_height
- * fmt_in.i_sar_num / fmt_in.i_height / fmt_in.i_sar_den;
+ * fmt_in.sar.num / fmt_in.i_height / fmt_in.sar.den;
}
image_handler_t *p_image = image_HandlerCreate( p_obj );
diff --git a/src/misc/subpicture.c b/src/misc/subpicture.c
index f18be17aa0..98d026613c 100644
--- a/src/misc/subpicture.c
+++ b/src/misc/subpicture.c
@@ -131,8 +131,8 @@ subpicture_t *subpicture_NewFromPicture( vlc_object_t *p_obj,
p_subpic->i_original_picture_width = fmt_out.i_width;
p_subpic->i_original_picture_height = fmt_out.i_height;
- fmt_out.i_sar_num =
- fmt_out.i_sar_den = 0;
+ fmt_out.sar.num =
+ fmt_out.sar.den = 0;
p_subpic->p_region = subpicture_region_New( &fmt_out );
if( p_subpic->p_region )
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 95ed200606..8af0cca708 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -87,8 +87,8 @@ static vout_display_t *vout_display_New(vlc_object_t *obj,
/* Picture buffer does not have the concept of aspect ratio */
video_format_Copy(&vd->fmt, fmt);
- vd->fmt.i_sar_num = 0;
- vd->fmt.i_sar_den = 0;
+ vd->fmt.sar.num = 0;
+ vd->fmt.sar.den = 0;
vd->info.is_slow = false;
vd->info.has_double_click = false;
@@ -164,18 +164,18 @@ void vout_display_GetDefaultDisplaySize(unsigned *width, unsigned *height,
*height = cfg->display.height;
} else if (cfg->display.width > 0) {
*width = cfg->display.width;
- *height = (int64_t)source->i_visible_height * source->i_sar_den * cfg->display.width * cfg->display.sar.num /
- source->i_visible_width / source->i_sar_num / cfg->display.sar.den;
+ *height = (int64_t)source->i_visible_height * source->sar.den * cfg->display.width * cfg->display.sar.num /
+ source->i_visible_width / source->sar.num / cfg->display.sar.den;
} else if (cfg->display.height > 0) {
- *width = (int64_t)source->i_visible_width * source->i_sar_num * cfg->display.height * cfg->display.sar.den /
- source->i_visible_height / source->i_sar_den / cfg->display.sar.num;
+ *width = (int64_t)source->i_visible_width * source->sar.num * cfg->display.height * cfg->display.sar.den /
+ source->i_visible_height / source->sar.den / cfg->display.sar.num;
*height = cfg->display.height;
- } else if (source->i_sar_num >= source->i_sar_den) {
- *width = (int64_t)source->i_visible_width * source->i_sar_num * cfg->display.sar.den / source->i_sar_den / cfg->display.sar.num;
+ } else if (source->sar.num >= source->sar.den) {
+ *width = (int64_t)source->i_visible_width * source->sar.num * cfg->display.sar.den / source->sar.den / cfg->display.sar.num;
*height = source->i_visible_height;
} else {
*width = source->i_visible_width;
- *height = (int64_t)source->i_visible_height * source->i_sar_den * cfg->display.sar.num / source->i_sar_num / cfg->display.sar.den;
+ *height = (int64_t)source->i_visible_height * source->sar.den * cfg->display.sar.num / source->sar.num / cfg->display.sar.den;
}
*width = *width * cfg->zoom.num / cfg->zoom.den;
@@ -228,9 +228,9 @@ void vout_display_PlacePicture(vout_display_place_t *place,
const unsigned width = source->i_visible_width;
const unsigned height = source->i_visible_height;
/* Compute the height if we use the width to fill up display_width */
- const int64_t scaled_height = (int64_t)height * display_width * cfg->display.sar.num * source->i_sar_den / width / source->i_sar_num / cfg->display.sar.den;
+ const int64_t scaled_height = (int64_t)height * display_width * cfg->display.sar.num * source->sar.den / width / source->sar.num / cfg->display.sar.den;
/* And the same but switching width/height */
- const int64_t scaled_width = (int64_t)width * display_height * cfg->display.sar.den * source->i_sar_num / height / source->i_sar_den / cfg->display.sar.num;
+ const int64_t scaled_width = (int64_t)width * display_height * cfg->display.sar.den * source->sar.num / height / source->sar.den / cfg->display.sar.num;
if (source->projection_mode == PROJECTION_MODE_RECTANGULAR) {
/* We keep the solution that avoid filling outside the display */
@@ -418,12 +418,12 @@ static int VoutDisplayCreateRender(vout_display_t *vd)
osys->filters = NULL;
video_format_t v_src = vd->source;
- v_src.i_sar_num = 0;
- v_src.i_sar_den = 0;
+ v_src.sar.num = 0;
+ v_src.sar.den = 0;
video_format_t v_dst = vd->fmt;
- v_dst.i_sar_num = 0;
- v_dst.i_sar_den = 0;
+ v_dst.sar.num = 0;
+ v_dst.sar.den = 0;
video_format_t v_dst_cmp = v_dst;
if ((v_src.i_chroma == VLC_CODEC_J420 && v_dst.i_chroma == VLC_CODEC_I420) ||
@@ -763,8 +763,8 @@ static void VoutDisplayCropRatio(int *left, int *top, int *right, int *bottom,
const video_format_t *source,
unsigned num, unsigned den)
{
- unsigned scaled_width = (uint64_t)source->i_visible_height * num * source->i_sar_den / den / source->i_sar_num;
- unsigned scaled_height = (uint64_t)source->i_visible_width * den * source->i_sar_num / num / source->i_sar_den;
+ unsigned scaled_width = (uint64_t)source->i_visible_height * num * source->sar.den / den / source->sar.num;
+ unsigned scaled_height = (uint64_t)source->i_visible_width * den * source->sar.num / num / source->sar.den;
if (scaled_width < source->i_visible_width) {
*left = (source->i_visible_width - scaled_width) / 2;
@@ -945,11 +945,11 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
video_format_t source = vd->source;
if (osys->sar.num > 0 && osys->sar.den > 0) {
- source.i_sar_num = osys->sar.num;
- source.i_sar_den = osys->sar.den;
+ source.sar.num = osys->sar.num;
+ source.sar.den = osys->sar.den;
} else {
- source.i_sar_num = osys->source.i_sar_num;
- source.i_sar_den = osys->source.i_sar_den;
+ source.sar.num = osys->source.sar.num;
+ source.sar.den = osys->source.sar.den;
}
if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_ASPECT, &source)) {
@@ -964,8 +964,8 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
osys->fit_window = 1;
}
vd->source = source;
- osys->sar.num = source.i_sar_num;
- osys->sar.den = source.i_sar_den;
+ osys->sar.num = source.sar.num;
+ osys->sar.den = source.sar.den;
osys->ch_sar = false;
/* If a crop ratio is requested, recompute the parameters */
@@ -980,8 +980,8 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
unsigned crop_den = osys->crop.den;
if (crop_num > 0 && crop_den > 0) {
video_format_t fmt = osys->source;
- fmt.i_sar_num = source.i_sar_num;
- fmt.i_sar_den = source.i_sar_den;
+ fmt.sar.num = source.sar.num;
+ fmt.sar.den = source.sar.den;
VoutDisplayCropRatio(&osys->crop.left, &osys->crop.top,
&osys->crop.right, &osys->crop.bottom,
&fmt, crop_num, crop_den);
@@ -1096,18 +1096,18 @@ void vout_UpdateDisplaySourceProperties(vout_display_t *vd, const video_format_t
{
vout_display_owner_sys_t *osys = vd->owner.sys;
- if (source->i_sar_num * osys->source.i_sar_den !=
- source->i_sar_den * osys->source.i_sar_num) {
+ if (source->sar.num * osys->source.sar.den !=
+ source->sar.den * osys->source.sar.num) {
- osys->source.i_sar_num = source->i_sar_num;
- osys->source.i_sar_den = source->i_sar_den;
- vlc_ureduce(&osys->source.i_sar_num, &osys->source.i_sar_den,
- osys->source.i_sar_num, osys->source.i_sar_den, 0);
+ osys->source.sar.num = source->sar.num;
+ osys->source.sar.den = source->sar.den;
+ vlc_ureduce(&osys->source.sar.num, &osys->source.sar.den,
+ osys->source.sar.num, osys->source.sar.den, 0);
/* FIXME it will override any AR that the user would have forced */
osys->ch_sar = true;
- osys->sar.num = osys->source.i_sar_num;
- osys->sar.den = osys->source.i_sar_den;
+ osys->sar.num = osys->source.sar.num;
+ osys->sar.den = osys->source.sar.den;
}
if (source->i_x_offset != osys->source.i_x_offset ||
source->i_y_offset != osys->source.i_y_offset ||
@@ -1272,8 +1272,8 @@ static vout_display_t *DisplayNew(vout_thread_t *vout,
osys->crop.num = 0;
osys->crop.den = 0;
- osys->sar.num = osys->sar_initial.num ? osys->sar_initial.num : source->i_sar_num;
- osys->sar.den = osys->sar_initial.den ? osys->sar_initial.den : source->i_sar_den;
+ osys->sar.num = osys->sar_initial.num ? osys->sar_initial.num : source->sar.num;
+ osys->sar.den = osys->sar_initial.den ? osys->sar_initial.den : source->sar.den;
vout_display_owner_t owner;
if (owner_ptr) {
@@ -1297,8 +1297,8 @@ static vout_display_t *DisplayNew(vout_thread_t *vout,
}
/* Setup delayed request */
- if (osys->sar.num != source->i_sar_num ||
- osys->sar.den != source->i_sar_den)
+ if (osys->sar.num != source->sar.num ||
+ osys->sar.den != source->sar.den)
osys->ch_sar = true;
vout_SendEventViewpointChangeable(osys->vout,
diff --git a/src/video_output/video_epg.c b/src/video_output/video_epg.c
index fe62c5fe50..305279c02d 100644
--- a/src/video_output/video_epg.c
+++ b/src/video_output/video_epg.c
@@ -58,8 +58,8 @@ static subpicture_region_t * vout_OSDEpgSlider(int x, int y,
video_format_Init(&fmt, VLC_CODEC_YUVP);
fmt.i_width = fmt.i_visible_width = width;
fmt.i_height = fmt.i_visible_height = height;
- fmt.i_sar_num = 1;
- fmt.i_sar_den = 1;
+ fmt.sar.num = 1;
+ fmt.sar.den = 1;
fmt.p_palette = &palette;
subpicture_region_t *region = subpicture_region_New(&fmt);
@@ -105,8 +105,8 @@ static subpicture_region_t * vout_OSDEpgText(const char *text,
/* Create a new subpicture region */
video_format_Init(&fmt, VLC_CODEC_TEXT);
- fmt.i_sar_num = 1;
- fmt.i_sar_den = 1;
+ fmt.sar.num = 1;
+ fmt.sar.den = 1;
region = subpicture_region_New(&fmt);
if (!region)
@@ -253,9 +253,9 @@ static void OSDEpgUpdate(subpicture_t *subpic,
VLC_UNUSED(fmt_src); VLC_UNUSED(ts);
video_format_t fmt = *fmt_dst;
- fmt.i_width = fmt.i_width * fmt.i_sar_num / fmt.i_sar_den;
- fmt.i_visible_width = fmt.i_visible_width * fmt.i_sar_num / fmt.i_sar_den;
- fmt.i_x_offset = fmt.i_x_offset * fmt.i_sar_num / fmt.i_sar_den;
+ fmt.i_width = fmt.i_width * fmt.sar.num / fmt.sar.den;
+ fmt.i_visible_width = fmt.i_visible_width * fmt.sar.num / fmt.sar.den;
+ fmt.i_x_offset = fmt.i_x_offset * fmt.sar.num / fmt.sar.den;
subpic->i_original_picture_width = fmt.i_width;
subpic->i_original_picture_height = fmt.i_height;
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index ec052f9585..6150a7061e 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -79,17 +79,17 @@ static int VoutValidateFormat(video_format_t *dst,
if (src->i_width <= 0 || src->i_width > 8192 ||
src->i_height <= 0 || src->i_height > 8192)
return VLC_EGENERIC;
- if (src->i_sar_num <= 0 || src->i_sar_den <= 0)
+ if (src->sar.num <= 0 || src->sar.den <= 0)
return VLC_EGENERIC;
/* */
video_format_Copy(dst, src);
dst->i_chroma = vlc_fourcc_GetCodec(VIDEO_ES, src->i_chroma);
- vlc_ureduce( &dst->i_sar_num, &dst->i_sar_den,
- src->i_sar_num, src->i_sar_den, 50000 );
- if (dst->i_sar_num <= 0 || dst->i_sar_den <= 0) {
- dst->i_sar_num = 1;
- dst->i_sar_den = 1;
+ vlc_ureduce( &dst->sar.num, &dst->sar.den,
+ src->sar.num, src->sar.den, 50000 );
+ if (dst->sar.num <= 0 || dst->sar.den <= 0) {
+ dst->sar.num = 1;
+ dst->sar.den = 1;
}
video_format_FixRgb(dst);
return VLC_SUCCESS;
@@ -98,13 +98,13 @@ static void VideoFormatCopyCropAr(video_format_t *dst,
const video_format_t *src)
{
video_format_CopyCrop(dst, src);
- dst->i_sar_num = src->i_sar_num;
- dst->i_sar_den = src->i_sar_den;
+ dst->sar.num = src->sar.num;
+ dst->sar.den = src->sar.den;
}
static bool VideoFormatIsCropArEqual(video_format_t *dst,
const video_format_t *src)
{
- return dst->i_sar_num * src->i_sar_den == dst->i_sar_den * src->i_sar_num &&
+ return dst->sar.num * src->sar.den == dst->sar.den * src->sar.num &&
dst->i_x_offset == src->i_x_offset &&
dst->i_y_offset == src->i_y_offset &&
dst->i_visible_width == src->i_visible_width &&
@@ -902,8 +902,8 @@ static int ThreadDisplayRenderPicture(vout_thread_t *vout, bool is_forced)
fmt_spu = vd->source;
if (fmt_spu.i_width * fmt_spu.i_height < place.width * place.height) {
- fmt_spu.i_sar_num = vd->cfg->display.sar.num;
- fmt_spu.i_sar_den = vd->cfg->display.sar.den;
+ fmt_spu.sar.num = vd->cfg->display.sar.num;
+ fmt_spu.sar.den = vd->cfg->display.sar.den;
fmt_spu.i_width =
fmt_spu.i_visible_width = place.width;
fmt_spu.i_height =
@@ -915,8 +915,8 @@ static int ThreadDisplayRenderPicture(vout_thread_t *vout, bool is_forced)
fmt_spu = vd->source;
} else {
fmt_spu = vd->fmt;
- fmt_spu.i_sar_num = vd->cfg->display.sar.num;
- fmt_spu.i_sar_den = vd->cfg->display.sar.den;
+ fmt_spu.sar.num = vd->cfg->display.sar.num;
+ fmt_spu.sar.den = vd->cfg->display.sar.den;
}
subpicture_chromas = NULL;
diff --git a/src/video_output/video_text.c b/src/video_output/video_text.c
index eb20c9a0b9..cc2ca49c8d 100644
--- a/src/video_output/video_text.c
+++ b/src/video_output/video_text.c
@@ -58,17 +58,17 @@ static void OSDTextUpdate(subpicture_t *subpic,
subpicture_updater_sys_t *sys = subpic->updater.p_sys;
VLC_UNUSED(fmt_src); VLC_UNUSED(ts);
- if( fmt_dst->i_sar_num <= 0 || fmt_dst->i_sar_den <= 0 )
+ if( fmt_dst->sar.num <= 0 || fmt_dst->sar.den <= 0 )
return;
subpic->b_absolute = false;
- subpic->i_original_picture_width = fmt_dst->i_visible_width * fmt_dst->i_sar_num / fmt_dst->i_sar_den;
+ subpic->i_original_picture_width = fmt_dst->i_visible_width * fmt_dst->sar.num / fmt_dst->sar.den;
subpic->i_original_picture_height = fmt_dst->i_visible_height;
video_format_t fmt;
video_format_Init( &fmt, VLC_CODEC_TEXT);
- fmt.i_sar_num = 1;
- fmt.i_sar_den = 1;
+ fmt.sar.num = 1;
+ fmt.sar.den = 1;
subpicture_region_t *r = subpic->p_region = subpicture_region_New(&fmt);
if (!r)
diff --git a/src/video_output/video_widgets.c b/src/video_output/video_widgets.c
index 201f90773c..f6c0298291 100644
--- a/src/video_output/video_widgets.c
+++ b/src/video_output/video_widgets.c
@@ -136,8 +136,8 @@ static subpicture_region_t *OSDRegion(int x, int y, int width, int height)
fmt.i_visible_width = width;
fmt.i_height =
fmt.i_visible_height = height;
- fmt.i_sar_num = 1;
- fmt.i_sar_den = 1;
+ fmt.sar.num = 1;
+ fmt.sar.den = 1;
fmt.p_palette = &palette;
subpicture_region_t *r = subpicture_region_New(&fmt);
@@ -269,11 +269,11 @@ static void OSDWidgetUpdate(subpicture_t *subpic,
VLC_UNUSED(fmt_src); VLC_UNUSED(ts);
video_format_t fmt = *fmt_dst;
- fmt.i_width = fmt.i_width * fmt.i_sar_num / fmt.i_sar_den;
- fmt.i_visible_width = fmt.i_visible_width * fmt.i_sar_num / fmt.i_sar_den;
- fmt.i_x_offset = fmt.i_x_offset * fmt.i_sar_num / fmt.i_sar_den;
- fmt.i_sar_num = 1;
- fmt.i_sar_den = 1;
+ fmt.i_width = fmt.i_width * fmt.sar.num / fmt.sar.den;
+ fmt.i_visible_width = fmt.i_visible_width * fmt.sar.num / fmt.sar.den;
+ fmt.i_x_offset = fmt.i_x_offset * fmt.sar.num / fmt.sar.den;
+ fmt.sar.num = 1;
+ fmt.sar.den = 1;
subpic->i_original_picture_width = fmt.i_visible_width;
subpic->i_original_picture_height = fmt.i_visible_height;
diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index bbccaf4c10..ccd71baee1 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -1033,19 +1033,19 @@ static subpicture_t *SpuRenderSubpictures(spu_t *spu,
/* Compute region scale AR */
video_format_t region_fmt = region->fmt;
- if (region_fmt.i_sar_num <= 0 || region_fmt.i_sar_den <= 0) {
- region_fmt.i_sar_num = (int64_t)fmt_dst->i_visible_width * fmt_dst->i_sar_num * subpic->i_original_picture_height;
- region_fmt.i_sar_den = (int64_t)fmt_dst->i_visible_height * fmt_dst->i_sar_den * subpic->i_original_picture_width;
- vlc_ureduce(®ion_fmt.i_sar_num, ®ion_fmt.i_sar_den,
- region_fmt.i_sar_num, region_fmt.i_sar_den, 65536);
+ if (region_fmt.sar.num <= 0 || region_fmt.sar.den <= 0) {
+ region_fmt.sar.num = (int64_t)fmt_dst->i_visible_width * fmt_dst->sar.num * subpic->i_original_picture_height;
+ region_fmt.sar.den = (int64_t)fmt_dst->i_visible_height * fmt_dst->sar.den * subpic->i_original_picture_width;
+ vlc_ureduce(®ion_fmt.sar.num, ®ion_fmt.sar.den,
+ region_fmt.sar.num, region_fmt.sar.den, 65536);
}
/* Compute scaling from original size to destination size
* FIXME The current scaling ensure that the heights match, the width being
* cropped.
*/
- spu_scale_t scale = spu_scale_createq((int64_t)fmt_dst->i_visible_height * fmt_dst->i_sar_den * region_fmt.i_sar_num,
- (int64_t)subpic->i_original_picture_height * fmt_dst->i_sar_num * region_fmt.i_sar_den,
+ spu_scale_t scale = spu_scale_createq((int64_t)fmt_dst->i_visible_height * fmt_dst->sar.den * region_fmt.sar.num,
+ (int64_t)subpic->i_original_picture_height * fmt_dst->sar.num * region_fmt.sar.den,
fmt_dst->i_visible_height,
subpic->i_original_picture_height);
diff --git a/test/libvlc/media.c b/test/libvlc/media.c
index c51cf886ec..180c437c4d 100644
--- a/test/libvlc/media.c
+++ b/test/libvlc/media.c
@@ -61,7 +61,7 @@ static void print_media(libvlc_media_t *media)
case libvlc_track_video:
printf("video: %ux%u, sar: %u/%u, fps: %u/%u\n",
p_track->video->i_width, p_track->video->i_height,
- p_track->video->i_sar_num, p_track->video->i_sar_den,
+ p_track->video->sar.num, p_track->video->sar.den,
p_track->video->i_frame_rate_num, p_track->video->i_frame_rate_den);
break;
case libvlc_track_text:
--
2.11.1
More information about the vlc-devel
mailing list