caps =
gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-wma",
"wmaversion", G_TYPE_INT, version, "block_align", G_TYPE_INT,
- context->block_align, "bitrate", G_TYPE_INT, context->bit_rate,
- NULL);
+ context->block_align, "bitrate", G_TYPE_INT,
+ (guint) context->bit_rate, NULL);
} else {
caps =
gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/x-wma",
if (context)
gst_caps_set_simple (caps,
"block_align", G_TYPE_INT, context->block_align,
- "bitrate", G_TYPE_INT, context->bit_rate, NULL);
+ "bitrate", G_TYPE_INT, (guint) context->bit_rate, NULL);
break;
case AV_CODEC_ID_ADPCM_G726:
if (context)
gst_caps_set_simple (caps,
"block_align", G_TYPE_INT, context->block_align,
- "bitrate", G_TYPE_INT, context->bit_rate, NULL);
+ "bitrate", G_TYPE_INT, (guint) context->bit_rate, NULL);
if (!encode) {
gst_caps_append (caps, gst_caps_new_simple ("audio/x-adpcm",
if (context)
gst_caps_set_simple (caps,
"block_align", G_TYPE_INT, context->block_align,
- "bitrate", G_TYPE_INT, context->bit_rate, NULL);
+ "bitrate", G_TYPE_INT, (guint) context->bit_rate, NULL);
}
break;
if (context) {
gst_caps_set_simple (caps,
"leaf_size", G_TYPE_INT, context->block_align,
- "bitrate", G_TYPE_INT, context->bit_rate, NULL);
+ "bitrate", G_TYPE_INT, (guint) context->bit_rate, NULL);
}
}
break;
if (context) {
gst_caps_set_simple (caps,
"leaf_size", G_TYPE_INT, context->block_align,
- "bitrate", G_TYPE_INT, context->bit_rate, NULL);
+ "bitrate", G_TYPE_INT, (guint) context->bit_rate, NULL);
}
}
break;
if (context)
gst_caps_set_simple (caps,
"block_align", G_TYPE_INT, context->block_align,
- "bitrate", G_TYPE_INT, context->bit_rate, NULL);
+ "bitrate", G_TYPE_INT, (guint) context->bit_rate, NULL);
}
break;
}
break;
+ case AV_CODEC_ID_OPUS:
+ /* Note that ffmpeg has no encoder yet, but just for safety. In the
+ * encoder case, we want to add things like samplerate, channels... */
+ if (!encode) {
+ /* FIXME: can ffmpeg handle multichannel Opus? */
+ caps = gst_caps_new_simple ("audio/x-opus",
+ "channel-mapping-family", G_TYPE_INT, 0, NULL);
+ }
+ break;
+
case AV_CODEC_ID_S302M:
caps = gst_caps_new_empty_simple ("audio/x-smpte-302m");
break;
gst_ff_aud_caps_new (context, NULL, codec_id, encode,
"audio/x-twin-vq", NULL);
break;
+ case AV_CODEC_ID_G729:
+ caps =
+ gst_ff_aud_caps_new (context, NULL, codec_id, encode, "audio/G729",
+ NULL);
+ break;
default:
GST_DEBUG ("Unknown codec ID %d, please add mapping here", codec_id);
break;
if (context)
gst_caps_set_simple (caps,
"block_align", G_TYPE_INT, context->block_align,
- "bitrate", G_TYPE_INT, context->bit_rate, NULL);
+ "bitrate", G_TYPE_INT, (guint) context->bit_rate, NULL);
g_free (mime);
break;
default:
gst_structure_get_int (structure, "channels", &context->channels);
gst_structure_get_int (structure, "rate", &context->sample_rate);
gst_structure_get_int (structure, "block_align", &context->block_align);
- gst_structure_get_int (structure, "bitrate", &bitrate);
- context->bit_rate = bitrate;
+ if (gst_structure_get_int (structure, "bitrate", &bitrate))
+ context->bit_rate = bitrate;
if (!raw)
return;
context->time_base.den, context->time_base.num,
1. * context->time_base.den / context->time_base.num);
} else {
- GST_WARNING ("ignoring insane framerate %d/%d",
- context->time_base.den, context->time_base.num);
+ GST_INFO ("ignoring framerate %d/%d (probably variable framerate)",
+ context->time_base.num, context->time_base.den);
}
}
context->pix_fmt =
gst_ffmpeg_videoformat_to_pixfmt_for_codec (GST_VIDEO_INFO_FORMAT (info),
context->codec);
+
+ switch (info->chroma_site) {
+ case GST_VIDEO_CHROMA_SITE_MPEG2:
+ context->chroma_sample_location = AVCHROMA_LOC_LEFT;
+ break;
+ case GST_VIDEO_CHROMA_SITE_JPEG:
+ context->chroma_sample_location = AVCHROMA_LOC_CENTER;
+ break;
+ case GST_VIDEO_CHROMA_SITE_DV:
+ context->chroma_sample_location = AVCHROMA_LOC_TOPLEFT;
+ break;
+ case GST_VIDEO_CHROMA_SITE_V_COSITED:
+ context->chroma_sample_location = AVCHROMA_LOC_TOP;
+ break;
+ default:
+ break;
+ }
+
+ switch (info->colorimetry.primaries) {
+ case GST_VIDEO_COLOR_PRIMARIES_BT709:
+ context->color_primaries = AVCOL_PRI_BT709;
+ break;
+ case GST_VIDEO_COLOR_PRIMARIES_BT470M:
+ context->color_primaries = AVCOL_PRI_BT470M;
+ break;
+ case GST_VIDEO_COLOR_PRIMARIES_BT470BG:
+ context->color_primaries = AVCOL_PRI_BT470BG;
+ break;
+ case GST_VIDEO_COLOR_PRIMARIES_SMPTE170M:
+ context->color_primaries = AVCOL_PRI_SMPTE170M;
+ break;
+ case GST_VIDEO_COLOR_PRIMARIES_SMPTE240M:
+ context->color_primaries = AVCOL_PRI_SMPTE240M;
+ break;
+ case GST_VIDEO_COLOR_PRIMARIES_FILM:
+ context->color_primaries = AVCOL_PRI_FILM;
+ break;
+ case GST_VIDEO_COLOR_PRIMARIES_BT2020:
+ context->color_primaries = AVCOL_PRI_BT2020;
+ break;
+ default:
+ break;
+ }
+
+ switch (info->colorimetry.transfer) {
+ case GST_VIDEO_TRANSFER_BT709:
+ context->color_trc = AVCOL_TRC_BT709;
+ break;
+ case GST_VIDEO_TRANSFER_GAMMA22:
+ context->color_trc = AVCOL_TRC_GAMMA22;
+ break;
+ case GST_VIDEO_TRANSFER_GAMMA28:
+ context->color_trc = AVCOL_TRC_GAMMA28;
+ break;
+ case GST_VIDEO_TRANSFER_SMPTE240M:
+ context->color_trc = AVCOL_TRC_SMPTE240M;
+ break;
+ case GST_VIDEO_TRANSFER_GAMMA10:
+ context->color_trc = AVCOL_TRC_LINEAR;
+ break;
+ case GST_VIDEO_TRANSFER_LOG100:
+ context->color_trc = AVCOL_TRC_LOG;
+ break;
+ case GST_VIDEO_TRANSFER_LOG316:
+ context->color_trc = AVCOL_TRC_LOG_SQRT;
+ break;
+ case GST_VIDEO_TRANSFER_BT2020_12:
+ context->color_trc = AVCOL_TRC_BT2020_12;
+ break;
+ default:
+ break;
+ }
+
+ switch (info->colorimetry.matrix) {
+ case GST_VIDEO_COLOR_MATRIX_RGB:
+ context->colorspace = AVCOL_SPC_RGB;
+ break;
+ case GST_VIDEO_COLOR_MATRIX_BT709:
+ context->colorspace = AVCOL_SPC_BT709;
+ break;
+ case GST_VIDEO_COLOR_MATRIX_FCC:
+ context->colorspace = AVCOL_SPC_FCC;
+ break;
+ case GST_VIDEO_COLOR_MATRIX_BT601:
+ context->colorspace = AVCOL_SPC_BT470BG;
+ break;
+ case GST_VIDEO_COLOR_MATRIX_SMPTE240M:
+ context->colorspace = AVCOL_SPC_SMPTE240M;
+ break;
+ case GST_VIDEO_COLOR_MATRIX_BT2020:
+ context->colorspace = AVCOL_SPC_BT2020_NCL;
+ break;
+ default:
+ break;
+ }
+
+ if (info->colorimetry.range == GST_VIDEO_COLOR_RANGE_0_255) {
+ context->color_range = AVCOL_RANGE_JPEG;
+ } else {
+ context->color_range = AVCOL_RANGE_MPEG;
+ }
}
void