pixel aspect ratio handling

Original commit message from CVS:
pixel aspect ratio handling
This commit is contained in:
Thomas Vander Stichele 2004-07-27 16:43:20 +00:00
parent c2f831741b
commit f8e224d950
2 changed files with 46 additions and 13 deletions

View file

@ -1,3 +1,36 @@
2004-07-27 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_video_caps), (gst_matroska_demux_plugin_init):
* gst/mpegaudio/common.c:
* gst/videoscale/gstvideoscale.c: (gst_videoscale_class_init),
(gst_videoscale_getcaps), (gst_videoscale_link),
(gst_videoscale_src_fixate), (gst_videoscale_init),
(gst_videoscale_finalize):
* gst/videoscale/gstvideoscale.h:
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_get_capslist):
* gst/wavenc/gstwavenc.c:
* sys/oss/gstossmixer.c: (fill_labels):
* sys/ximage/ximagesink.c: (gst_ximagesink_renegotiate_size),
(gst_ximagesink_handle_xevents),
(gst_ximagesink_calculate_pixel_aspect_ratio),
(gst_ximagesink_xcontext_get), (gst_ximagesink_fixate),
(gst_ximagesink_getcaps), (gst_ximagesink_sink_link),
(gst_ximagesink_chain), (gst_ximagesink_set_xwindow_id),
(gst_ximagesink_set_property), (gst_ximagesink_get_property),
(gst_ximagesink_init), (gst_ximagesink_class_init):
* sys/ximage/ximagesink.h:
* sys/xvimage/xvimagesink.c:
(gst_xvimagesink_calculate_pixel_aspect_ratio),
(gst_xvimagesink_xcontext_get), (gst_xvimagesink_sink_link),
(gst_xvimagesink_chain), (gst_xvimagesink_buffer_alloc),
(gst_xvimagesink_set_property), (gst_xvimagesink_get_property),
(gst_xvimagesink_init), (gst_xvimagesink_class_init):
* sys/xvimage/xvimagesink.h:
first batch of pixel aspect ratio commits.
2004-07-27 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:

View file

@ -2462,6 +2462,11 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext * videocontext,
for (i = 0; i < gst_caps_get_size (caps); i++) {
structure = gst_caps_get_structure (caps, i);
if (videocontext != NULL) {
GST_DEBUG ("video size %dx%d, target display size %dx%d (any unit)",
videocontext->pixel_width,
videocontext->pixel_height,
videocontext->display_width, videocontext->display_height);
/* pixel width and height are the w and h of the video in pixels */
if (videocontext->pixel_width > 0 && videocontext->pixel_height > 0) {
gint w = videocontext->pixel_width;
gint h = videocontext->pixel_height;
@ -2475,18 +2480,15 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext * videocontext,
}
if (videocontext->display_width > 0 && videocontext->display_height > 0) {
gint w =
100 * videocontext->display_width / videocontext->pixel_width;
gint h =
100 * videocontext->display_height / videocontext->pixel_height;
int n, d;
gst_structure_set (structure,
"pixel_width", G_TYPE_INT, w,
"pixel_height", G_TYPE_INT, h, NULL);
} else {
gst_structure_set (structure,
"pixel_width", G_TYPE_INT, 1,
"pixel_height", G_TYPE_INT, 1, NULL);
/* calculate the pixel aspect ratio using the display and pixel w/h */
n = videocontext->display_width * videocontext->pixel_height;
d = videocontext->display_height * videocontext->pixel_width;
GST_DEBUG ("setting PAR to %d/%d", n, d);
gst_structure_set (structure, "pixel-aspect-ratio", GST_TYPE_FRACTION,
videocontext->display_width * videocontext->pixel_height,
videocontext->display_height * videocontext->pixel_width, NULL);
}
if (context->default_duration > 0) {
@ -2503,8 +2505,6 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext * videocontext,
gst_structure_set (structure,
"width", GST_TYPE_INT_RANGE, 16, 4096,
"height", GST_TYPE_INT_RANGE, 16, 4096,
"pixel_width", GST_TYPE_INT_RANGE, 0, 255,
"pixel_height", GST_TYPE_INT_RANGE, 0, 255,
"framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL);
}
}