ext/ffmpeg/: respect pixel-aspect-ratio when encoding.

Original commit message from CVS:

* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_to_pixfmt):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_getcaps):
respect pixel-aspect-ratio when encoding.
This commit is contained in:
Thomas Vander Stichele 2006-02-12 19:54:16 +00:00
parent 76083c9e99
commit 231adecd88
3 changed files with 28 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2006-02-12 Thomas Vander Stichele <thomas at apestaart dot org>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_to_pixfmt):
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_getcaps):
respect pixel-aspect-ratio when encoding.
2006-02-12 Edward Hervey <edward@fluendo.com>
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_init),

View file

@ -1141,7 +1141,9 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps,
{
GstStructure *structure;
const GValue *fps;
const GValue *par;
GST_DEBUG ("converting caps %" GST_PTR_FORMAT, caps);
g_return_if_fail (gst_caps_get_size (caps) == 1);
structure = gst_caps_get_structure (caps, 0);
@ -1161,10 +1163,22 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps,
1. * context->time_base.den / context->time_base.num);
}
par = gst_structure_get_value (structure, "pixel-aspect-ratio");
if (par != NULL && GST_VALUE_HOLDS_FRACTION (par)) {
context->sample_aspect_ratio.num = gst_value_get_fraction_numerator (par);
context->sample_aspect_ratio.den = gst_value_get_fraction_denominator (par);
GST_DEBUG ("setting pixel-aspect-ratio %d/%d = %lf",
context->sample_aspect_ratio.den, context->sample_aspect_ratio.num,
1. * context->sample_aspect_ratio.den / context->sample_aspect_ratio.num);
}
if (!raw)
return;
g_return_if_fail (fps != NULL && GST_VALUE_HOLDS_FRACTION (fps));
g_return_if_fail (par != NULL && GST_VALUE_HOLDS_FRACTION (par));
if (strcmp (gst_structure_get_name (structure), "video/x-raw-yuv") == 0) {
guint32 fourcc;

View file

@ -39,6 +39,9 @@
#define DEFAULT_VIDEO_GOP_SIZE 15
#define DEFAULT_AUDIO_BITRATE 128000
#define DEFAULT_WIDTH 352
#define DEFAULT_HEIGHT 288
typedef struct _GstFFMpegEnc GstFFMpegEnc;
struct _GstFFMpegEnc
@ -325,11 +328,11 @@ gst_ffmpegenc_getcaps (GstPad * pad)
}
/* set some default properties */
ctx->width = 352;
ctx->height = 288;
ctx->width = DEFAULT_WIDTH;
ctx->height = DEFAULT_HEIGHT;
ctx->time_base.num = DEFAULT_FRAME_RATE_BASE;
ctx->time_base.den = 25 * DEFAULT_FRAME_RATE_BASE;
ctx->bit_rate = 350 * 1000;
ctx->bit_rate = DEFAULT_VIDEO_BITRATE;
/* makes it silent */
ctx->strict_std_compliance = -1;