mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-06 10:42:22 +00:00
ffmpeg: CodecType => AVMediaType
This commit is contained in:
parent
446c50e052
commit
2f81d0d63b
7 changed files with 58 additions and 57 deletions
|
@ -758,7 +758,8 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CODEC_ID_RAWVIDEO:
|
case CODEC_ID_RAWVIDEO:
|
||||||
caps = gst_ffmpeg_codectype_to_caps (CODEC_TYPE_VIDEO, context, codec_id,
|
caps =
|
||||||
|
gst_ffmpeg_codectype_to_caps (AVMEDIA_TYPE_VIDEO, context, codec_id,
|
||||||
encode);
|
encode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1601,12 +1602,12 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
|
||||||
GST_LOG ("Could not create stream format caps for %s", codec->name);
|
GST_LOG ("Could not create stream format caps for %s", codec->name);
|
||||||
|
|
||||||
switch (codec->type) {
|
switch (codec->type) {
|
||||||
case CODEC_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
mime = g_strdup_printf ("video/x-gst_ff-%s", codec->name);
|
mime = g_strdup_printf ("video/x-gst_ff-%s", codec->name);
|
||||||
caps = gst_ff_vid_caps_new (context, codec_id, mime, NULL);
|
caps = gst_ff_vid_caps_new (context, codec_id, mime, NULL);
|
||||||
g_free (mime);
|
g_free (mime);
|
||||||
break;
|
break;
|
||||||
case CODEC_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
mime = g_strdup_printf ("audio/x-gst_ff-%s", codec->name);
|
mime = g_strdup_printf ("audio/x-gst_ff-%s", codec->name);
|
||||||
caps = gst_ff_aud_caps_new (context, codec_id, mime, NULL);
|
caps = gst_ff_aud_caps_new (context, codec_id, mime, NULL);
|
||||||
if (context)
|
if (context)
|
||||||
|
@ -1933,21 +1934,21 @@ gst_ffmpeg_codectype_to_video_caps (AVCodecContext * context,
|
||||||
* to a GstCaps. If the context is ommitted, no fixed values
|
* to a GstCaps. If the context is ommitted, no fixed values
|
||||||
* for video/audio size will be included in the GstCaps
|
* for video/audio size will be included in the GstCaps
|
||||||
*
|
*
|
||||||
* CodecType is primarily meant for uncompressed data GstCaps!
|
* AVMediaType is primarily meant for uncompressed data GstCaps!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GstCaps *
|
GstCaps *
|
||||||
gst_ffmpeg_codectype_to_caps (enum CodecType codec_type,
|
gst_ffmpeg_codectype_to_caps (enum AVMediaType codec_type,
|
||||||
AVCodecContext * context, enum CodecID codec_id, gboolean encode)
|
AVCodecContext * context, enum CodecID codec_id, gboolean encode)
|
||||||
{
|
{
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
|
||||||
switch (codec_type) {
|
switch (codec_type) {
|
||||||
case CODEC_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
caps =
|
caps =
|
||||||
gst_ffmpeg_codectype_to_video_caps (context, codec_id, encode, NULL);
|
gst_ffmpeg_codectype_to_video_caps (context, codec_id, encode, NULL);
|
||||||
break;
|
break;
|
||||||
case CODEC_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
caps =
|
caps =
|
||||||
gst_ffmpeg_codectype_to_audio_caps (context, codec_id, encode, NULL);
|
gst_ffmpeg_codectype_to_audio_caps (context, codec_id, encode, NULL);
|
||||||
break;
|
break;
|
||||||
|
@ -2156,22 +2157,22 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps,
|
||||||
* AVCodecContext. If the context is ommitted, no fixed values
|
* AVCodecContext. If the context is ommitted, no fixed values
|
||||||
* for video/audio size will be included in the context
|
* for video/audio size will be included in the context
|
||||||
*
|
*
|
||||||
* CodecType is primarily meant for uncompressed data GstCaps!
|
* AVMediaType is primarily meant for uncompressed data GstCaps!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_ffmpeg_caps_with_codectype (enum CodecType type,
|
gst_ffmpeg_caps_with_codectype (enum AVMediaType type,
|
||||||
const GstCaps * caps, AVCodecContext * context)
|
const GstCaps * caps, AVCodecContext * context)
|
||||||
{
|
{
|
||||||
if (context == NULL)
|
if (context == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case CODEC_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
gst_ffmpeg_caps_to_pixfmt (caps, context, TRUE);
|
gst_ffmpeg_caps_to_pixfmt (caps, context, TRUE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CODEC_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
gst_ffmpeg_caps_to_smpfmt (caps, context, TRUE);
|
gst_ffmpeg_caps_to_smpfmt (caps, context, TRUE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2278,7 +2279,7 @@ full_copy:
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
|
gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
|
||||||
enum CodecType codec_type, const GstCaps * caps, AVCodecContext * context)
|
enum AVMediaType codec_type, const GstCaps * caps, AVCodecContext * context)
|
||||||
{
|
{
|
||||||
GstStructure *str;
|
GstStructure *str;
|
||||||
const GValue *value;
|
const GValue *value;
|
||||||
|
@ -2517,11 +2518,11 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
|
||||||
|
|
||||||
/* common properties (width, height, fps) */
|
/* common properties (width, height, fps) */
|
||||||
switch (codec_type) {
|
switch (codec_type) {
|
||||||
case CODEC_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
gst_ffmpeg_caps_to_pixfmt (caps, context, codec_id == CODEC_ID_RAWVIDEO);
|
gst_ffmpeg_caps_to_pixfmt (caps, context, codec_id == CODEC_ID_RAWVIDEO);
|
||||||
gst_ffmpeg_get_palette (caps, context);
|
gst_ffmpeg_get_palette (caps, context);
|
||||||
break;
|
break;
|
||||||
case CODEC_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
gst_ffmpeg_caps_to_smpfmt (caps, context, FALSE);
|
gst_ffmpeg_caps_to_smpfmt (caps, context, FALSE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -3370,11 +3371,11 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context)
|
||||||
|
|
||||||
if (context != NULL) {
|
if (context != NULL) {
|
||||||
if (video == TRUE) {
|
if (video == TRUE) {
|
||||||
context->codec_type = CODEC_TYPE_VIDEO;
|
context->codec_type = AVMEDIA_TYPE_VIDEO;
|
||||||
} else if (audio == TRUE) {
|
} else if (audio == TRUE) {
|
||||||
context->codec_type = CODEC_TYPE_AUDIO;
|
context->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||||
} else {
|
} else {
|
||||||
context->codec_type = CODEC_TYPE_UNKNOWN;
|
context->codec_type = AVMEDIA_TYPE_UNKNOWN;
|
||||||
}
|
}
|
||||||
context->codec_id = id;
|
context->codec_id = id;
|
||||||
gst_ffmpeg_caps_with_codecid (id, context->codec_type, caps, context);
|
gst_ffmpeg_caps_with_codecid (id, context->codec_type, caps, context);
|
||||||
|
|
|
@ -41,11 +41,11 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* _codectype_to_caps () gets the GstCaps that belongs to
|
* _codectype_to_caps () gets the GstCaps that belongs to
|
||||||
* a certain CodecType for a pad with uncompressed data.
|
* a certain AVMediaType for a pad with uncompressed data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GstCaps *
|
GstCaps *
|
||||||
gst_ffmpeg_codectype_to_caps (enum CodecType codec_type,
|
gst_ffmpeg_codectype_to_caps (enum AVMediaType codec_type,
|
||||||
AVCodecContext *context,
|
AVCodecContext *context,
|
||||||
enum CodecID codec_id,
|
enum CodecID codec_id,
|
||||||
gboolean encode);
|
gboolean encode);
|
||||||
|
@ -77,7 +77,7 @@ gst_ffmpeg_caps_to_codecid (const GstCaps *caps,
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
|
gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
|
||||||
enum CodecType codec_type,
|
enum AVMediaType codec_type,
|
||||||
const GstCaps *caps,
|
const GstCaps *caps,
|
||||||
AVCodecContext *context);
|
AVCodecContext *context);
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_ffmpeg_caps_with_codectype (enum CodecType type,
|
gst_ffmpeg_caps_with_codectype (enum AVMediaType type,
|
||||||
const GstCaps *caps,
|
const GstCaps *caps,
|
||||||
AVCodecContext *context);
|
AVCodecContext *context);
|
||||||
|
|
||||||
|
|
|
@ -303,7 +303,7 @@ gst_ffmpegdec_base_init (GstFFMpegDecClass * klass)
|
||||||
/* construct the element details struct */
|
/* construct the element details struct */
|
||||||
longname = g_strdup_printf ("FFmpeg %s decoder", in_plugin->long_name);
|
longname = g_strdup_printf ("FFmpeg %s decoder", in_plugin->long_name);
|
||||||
classification = g_strdup_printf ("Codec/Decoder/%s",
|
classification = g_strdup_printf ("Codec/Decoder/%s",
|
||||||
(in_plugin->type == CODEC_TYPE_VIDEO) ? "Video" : "Audio");
|
(in_plugin->type == AVMEDIA_TYPE_VIDEO) ? "Video" : "Audio");
|
||||||
description = g_strdup_printf ("FFmpeg %s decoder", in_plugin->name);
|
description = g_strdup_printf ("FFmpeg %s decoder", in_plugin->name);
|
||||||
gst_element_class_set_details_simple (element_class, longname, classification,
|
gst_element_class_set_details_simple (element_class, longname, classification,
|
||||||
description,
|
description,
|
||||||
|
@ -320,7 +320,7 @@ gst_ffmpegdec_base_init (GstFFMpegDecClass * klass)
|
||||||
GST_DEBUG ("Couldn't get sink caps for decoder '%s'", in_plugin->name);
|
GST_DEBUG ("Couldn't get sink caps for decoder '%s'", in_plugin->name);
|
||||||
sinkcaps = gst_caps_from_string ("unknown/unknown");
|
sinkcaps = gst_caps_from_string ("unknown/unknown");
|
||||||
}
|
}
|
||||||
if (in_plugin->type == CODEC_TYPE_VIDEO) {
|
if (in_plugin->type == AVMEDIA_TYPE_VIDEO) {
|
||||||
srccaps = gst_caps_from_string ("video/x-raw-rgb; video/x-raw-yuv");
|
srccaps = gst_caps_from_string ("video/x-raw-rgb; video/x-raw-yuv");
|
||||||
} else {
|
} else {
|
||||||
srccaps = gst_ffmpeg_codectype_to_audio_caps (NULL,
|
srccaps = gst_ffmpeg_codectype_to_audio_caps (NULL,
|
||||||
|
@ -357,7 +357,7 @@ gst_ffmpegdec_class_init (GstFFMpegDecClass * klass)
|
||||||
gobject_class->set_property = gst_ffmpegdec_set_property;
|
gobject_class->set_property = gst_ffmpegdec_set_property;
|
||||||
gobject_class->get_property = gst_ffmpegdec_get_property;
|
gobject_class->get_property = gst_ffmpegdec_get_property;
|
||||||
|
|
||||||
if (klass->in_plugin->type == CODEC_TYPE_VIDEO) {
|
if (klass->in_plugin->type == AVMEDIA_TYPE_VIDEO) {
|
||||||
g_object_class_install_property (gobject_class, PROP_SKIPFRAME,
|
g_object_class_install_property (gobject_class, PROP_SKIPFRAME,
|
||||||
g_param_spec_enum ("skip-frame", "Skip frames",
|
g_param_spec_enum ("skip-frame", "Skip frames",
|
||||||
"Which types of frames to skip during decoding",
|
"Which types of frames to skip during decoding",
|
||||||
|
@ -671,7 +671,7 @@ gst_ffmpegdec_open (GstFFMpegDec * ffmpegdec)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (oclass->in_plugin->type) {
|
switch (oclass->in_plugin->type) {
|
||||||
case CODEC_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
ffmpegdec->format.video.width = 0;
|
ffmpegdec->format.video.width = 0;
|
||||||
ffmpegdec->format.video.height = 0;
|
ffmpegdec->format.video.height = 0;
|
||||||
ffmpegdec->format.video.clip_width = -1;
|
ffmpegdec->format.video.clip_width = -1;
|
||||||
|
@ -679,7 +679,7 @@ gst_ffmpegdec_open (GstFFMpegDec * ffmpegdec)
|
||||||
ffmpegdec->format.video.pix_fmt = PIX_FMT_NB;
|
ffmpegdec->format.video.pix_fmt = PIX_FMT_NB;
|
||||||
ffmpegdec->format.video.interlaced = FALSE;
|
ffmpegdec->format.video.interlaced = FALSE;
|
||||||
break;
|
break;
|
||||||
case CODEC_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
ffmpegdec->format.audio.samplerate = 0;
|
ffmpegdec->format.audio.samplerate = 0;
|
||||||
ffmpegdec->format.audio.channels = 0;
|
ffmpegdec->format.audio.channels = 0;
|
||||||
ffmpegdec->format.audio.depth = 0;
|
ffmpegdec->format.audio.depth = 0;
|
||||||
|
@ -1001,9 +1001,9 @@ gst_ffmpegdec_get_buffer (AVCodecContext * context, AVFrame * picture)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (context->codec_type) {
|
switch (context->codec_type) {
|
||||||
case CODEC_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
/* some ffmpeg video plugins don't see the point in setting codec_type ... */
|
/* some ffmpeg video plugins don't see the point in setting codec_type ... */
|
||||||
case CODEC_TYPE_UNKNOWN:
|
case AVMEDIA_TYPE_UNKNOWN:
|
||||||
{
|
{
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
gint clip_width, clip_height;
|
gint clip_width, clip_height;
|
||||||
|
@ -1041,7 +1041,7 @@ gst_ffmpegdec_get_buffer (AVCodecContext * context, AVFrame * picture)
|
||||||
GST_BUFFER_DATA (buf), context->pix_fmt, width, height);
|
GST_BUFFER_DATA (buf), context->pix_fmt, width, height);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CODEC_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
default:
|
default:
|
||||||
GST_ERROR_OBJECT (ffmpegdec,
|
GST_ERROR_OBJECT (ffmpegdec,
|
||||||
"_get_buffer() should never get called for non-video buffers !");
|
"_get_buffer() should never get called for non-video buffers !");
|
||||||
|
@ -1191,7 +1191,7 @@ gst_ffmpegdec_negotiate (GstFFMpegDec * ffmpegdec, gboolean force)
|
||||||
oclass = (GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
|
oclass = (GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
|
||||||
|
|
||||||
switch (oclass->in_plugin->type) {
|
switch (oclass->in_plugin->type) {
|
||||||
case CODEC_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
if (!force && ffmpegdec->format.video.width == ffmpegdec->context->width
|
if (!force && ffmpegdec->format.video.width == ffmpegdec->context->width
|
||||||
&& ffmpegdec->format.video.height == ffmpegdec->context->height
|
&& ffmpegdec->format.video.height == ffmpegdec->context->height
|
||||||
&& ffmpegdec->format.video.fps_n == ffmpegdec->format.video.old_fps_n
|
&& ffmpegdec->format.video.fps_n == ffmpegdec->format.video.old_fps_n
|
||||||
|
@ -1221,7 +1221,7 @@ gst_ffmpegdec_negotiate (GstFFMpegDec * ffmpegdec, gboolean force)
|
||||||
ffmpegdec->format.video.par_d =
|
ffmpegdec->format.video.par_d =
|
||||||
ffmpegdec->context->sample_aspect_ratio.den;
|
ffmpegdec->context->sample_aspect_ratio.den;
|
||||||
break;
|
break;
|
||||||
case CODEC_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
{
|
{
|
||||||
gint depth = av_smp_format_depth (ffmpegdec->context->sample_fmt);
|
gint depth = av_smp_format_depth (ffmpegdec->context->sample_fmt);
|
||||||
if (!force && ffmpegdec->format.audio.samplerate ==
|
if (!force && ffmpegdec->format.audio.samplerate ==
|
||||||
|
@ -1250,7 +1250,7 @@ gst_ffmpegdec_negotiate (GstFFMpegDec * ffmpegdec, gboolean force)
|
||||||
goto no_caps;
|
goto no_caps;
|
||||||
|
|
||||||
switch (oclass->in_plugin->type) {
|
switch (oclass->in_plugin->type) {
|
||||||
case CODEC_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
{
|
{
|
||||||
gint width, height;
|
gint width, height;
|
||||||
gboolean interlaced;
|
gboolean interlaced;
|
||||||
|
@ -1280,7 +1280,7 @@ gst_ffmpegdec_negotiate (GstFFMpegDec * ffmpegdec, gboolean force)
|
||||||
gst_caps_get_structure (caps, 0));
|
gst_caps_get_structure (caps, 0));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CODEC_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2189,12 +2189,12 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec,
|
||||||
oclass = (GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
|
oclass = (GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
|
||||||
|
|
||||||
switch (oclass->in_plugin->type) {
|
switch (oclass->in_plugin->type) {
|
||||||
case CODEC_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
len =
|
len =
|
||||||
gst_ffmpegdec_video_frame (ffmpegdec, data, size, dec_info, &outbuf,
|
gst_ffmpegdec_video_frame (ffmpegdec, data, size, dec_info, &outbuf,
|
||||||
ret);
|
ret);
|
||||||
break;
|
break;
|
||||||
case CODEC_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
len =
|
len =
|
||||||
gst_ffmpegdec_audio_frame (ffmpegdec, oclass->in_plugin, data, size,
|
gst_ffmpegdec_audio_frame (ffmpegdec, oclass->in_plugin, data, size,
|
||||||
dec_info, &outbuf, ret);
|
dec_info, &outbuf, ret);
|
||||||
|
@ -2490,7 +2490,7 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf)
|
||||||
if (G_UNLIKELY (ffmpegdec->waiting_for_key)) {
|
if (G_UNLIKELY (ffmpegdec->waiting_for_key)) {
|
||||||
GST_DEBUG_OBJECT (ffmpegdec, "waiting for keyframe");
|
GST_DEBUG_OBJECT (ffmpegdec, "waiting for keyframe");
|
||||||
if (GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_DELTA_UNIT) &&
|
if (GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_DELTA_UNIT) &&
|
||||||
oclass->in_plugin->type != CODEC_TYPE_AUDIO)
|
oclass->in_plugin->type != AVMEDIA_TYPE_AUDIO)
|
||||||
goto skip_keyframe;
|
goto skip_keyframe;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (ffmpegdec, "got keyframe");
|
GST_DEBUG_OBJECT (ffmpegdec, "got keyframe");
|
||||||
|
|
|
@ -124,7 +124,7 @@ gst_ffmpegdeinterlace_sink_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
ctx->width = deinterlace->width;
|
ctx->width = deinterlace->width;
|
||||||
ctx->height = deinterlace->height;
|
ctx->height = deinterlace->height;
|
||||||
ctx->pix_fmt = PIX_FMT_NB;
|
ctx->pix_fmt = PIX_FMT_NB;
|
||||||
gst_ffmpeg_caps_with_codectype (CODEC_TYPE_VIDEO, caps, ctx);
|
gst_ffmpeg_caps_with_codectype (AVMEDIA_TYPE_VIDEO, caps, ctx);
|
||||||
if (ctx->pix_fmt == PIX_FMT_NB) {
|
if (ctx->pix_fmt == PIX_FMT_NB) {
|
||||||
av_free (ctx);
|
av_free (ctx);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -867,7 +867,7 @@ gst_ffmpegdemux_src_convert (GstPad * pad,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
avstream = stream->avstream;
|
avstream = stream->avstream;
|
||||||
if (avstream->codec->codec_type != CODEC_TYPE_VIDEO)
|
if (avstream->codec->codec_type != AVMEDIA_TYPE_VIDEO)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
switch (src_fmt) {
|
switch (src_fmt) {
|
||||||
|
@ -977,11 +977,11 @@ gst_ffmpegdemux_get_stream (GstFFMpegDemux * demux, AVStream * avstream)
|
||||||
stream->tags = NULL;
|
stream->tags = NULL;
|
||||||
|
|
||||||
switch (ctx->codec_type) {
|
switch (ctx->codec_type) {
|
||||||
case CODEC_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
templ = oclass->videosrctempl;
|
templ = oclass->videosrctempl;
|
||||||
num = demux->videopads++;
|
num = demux->videopads++;
|
||||||
break;
|
break;
|
||||||
case CODEC_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
templ = oclass->audiosrctempl;
|
templ = oclass->audiosrctempl;
|
||||||
num = demux->audiopads++;
|
num = demux->audiopads++;
|
||||||
break;
|
break;
|
||||||
|
@ -1041,7 +1041,7 @@ gst_ffmpegdemux_get_stream (GstFFMpegDemux * demux, AVStream * avstream)
|
||||||
stream->tags = gst_tag_list_new ();
|
stream->tags = gst_tag_list_new ();
|
||||||
|
|
||||||
gst_tag_list_add (stream->tags, GST_TAG_MERGE_REPLACE,
|
gst_tag_list_add (stream->tags, GST_TAG_MERGE_REPLACE,
|
||||||
(ctx->codec_type == CODEC_TYPE_VIDEO) ?
|
(ctx->codec_type == AVMEDIA_TYPE_VIDEO) ?
|
||||||
GST_TAG_VIDEO_CODEC : GST_TAG_AUDIO_CODEC, codec, NULL);
|
GST_TAG_VIDEO_CODEC : GST_TAG_AUDIO_CODEC, codec, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1389,7 +1389,7 @@ gst_ffmpegdemux_loop (GstFFMpegDemux * demux)
|
||||||
/* prepare to push packet to peer */
|
/* prepare to push packet to peer */
|
||||||
srcpad = stream->pad;
|
srcpad = stream->pad;
|
||||||
|
|
||||||
rawvideo = (avstream->codec->codec_type == CODEC_TYPE_VIDEO &&
|
rawvideo = (avstream->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
|
||||||
avstream->codec->codec_id == CODEC_ID_RAWVIDEO);
|
avstream->codec->codec_id == CODEC_ID_RAWVIDEO);
|
||||||
|
|
||||||
if (rawvideo)
|
if (rawvideo)
|
||||||
|
|
|
@ -136,7 +136,7 @@ gst_ffmpegenc_base_init (GstFFMpegEncClass * klass)
|
||||||
/* construct the element details struct */
|
/* construct the element details struct */
|
||||||
longname = g_strdup_printf ("FFmpeg %s encoder", in_plugin->long_name);
|
longname = g_strdup_printf ("FFmpeg %s encoder", in_plugin->long_name);
|
||||||
classification = g_strdup_printf ("Codec/Encoder/%s",
|
classification = g_strdup_printf ("Codec/Encoder/%s",
|
||||||
(in_plugin->type == CODEC_TYPE_VIDEO) ? "Video" : "Audio");
|
(in_plugin->type == AVMEDIA_TYPE_VIDEO) ? "Video" : "Audio");
|
||||||
description = g_strdup_printf ("FFmpeg %s encoder", in_plugin->name);
|
description = g_strdup_printf ("FFmpeg %s encoder", in_plugin->name);
|
||||||
gst_element_class_set_details_simple (element_class, longname, classification,
|
gst_element_class_set_details_simple (element_class, longname, classification,
|
||||||
description,
|
description,
|
||||||
|
@ -151,7 +151,7 @@ gst_ffmpegenc_base_init (GstFFMpegEncClass * klass)
|
||||||
srccaps = gst_caps_new_simple ("unknown/unknown", NULL);
|
srccaps = gst_caps_new_simple ("unknown/unknown", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_plugin->type == CODEC_TYPE_VIDEO) {
|
if (in_plugin->type == AVMEDIA_TYPE_VIDEO) {
|
||||||
sinkcaps = gst_caps_from_string
|
sinkcaps = gst_caps_from_string
|
||||||
("video/x-raw-rgb; video/x-raw-yuv; video/x-raw-gray");
|
("video/x-raw-rgb; video/x-raw-yuv; video/x-raw-gray");
|
||||||
} else {
|
} else {
|
||||||
|
@ -193,7 +193,7 @@ gst_ffmpegenc_class_init (GstFFMpegEncClass * klass)
|
||||||
gobject_class->set_property = gst_ffmpegenc_set_property;
|
gobject_class->set_property = gst_ffmpegenc_set_property;
|
||||||
gobject_class->get_property = gst_ffmpegenc_get_property;
|
gobject_class->get_property = gst_ffmpegenc_get_property;
|
||||||
|
|
||||||
if (klass->in_plugin->type == CODEC_TYPE_VIDEO) {
|
if (klass->in_plugin->type == AVMEDIA_TYPE_VIDEO) {
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIT_RATE,
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIT_RATE,
|
||||||
g_param_spec_ulong ("bitrate", "Bit Rate",
|
g_param_spec_ulong ("bitrate", "Bit Rate",
|
||||||
"Target Video Bitrate", 0, G_MAXULONG, DEFAULT_VIDEO_BITRATE,
|
"Target Video Bitrate", 0, G_MAXULONG, DEFAULT_VIDEO_BITRATE,
|
||||||
|
@ -222,7 +222,7 @@ gst_ffmpegenc_class_init (GstFFMpegEncClass * klass)
|
||||||
|
|
||||||
/* register additional properties, possibly dependent on the exact CODEC */
|
/* register additional properties, possibly dependent on the exact CODEC */
|
||||||
gst_ffmpeg_cfg_install_property (klass, ARG_CFG_BASE);
|
gst_ffmpeg_cfg_install_property (klass, ARG_CFG_BASE);
|
||||||
} else if (klass->in_plugin->type == CODEC_TYPE_AUDIO) {
|
} else if (klass->in_plugin->type == AVMEDIA_TYPE_AUDIO) {
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIT_RATE,
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIT_RATE,
|
||||||
g_param_spec_ulong ("bitrate", "Bit Rate",
|
g_param_spec_ulong ("bitrate", "Bit Rate",
|
||||||
"Target Audio Bitrate", 0, G_MAXULONG, DEFAULT_AUDIO_BITRATE,
|
"Target Audio Bitrate", 0, G_MAXULONG, DEFAULT_AUDIO_BITRATE,
|
||||||
|
@ -255,7 +255,7 @@ gst_ffmpegenc_init (GstFFMpegEnc * ffmpegenc)
|
||||||
ffmpegenc->file = NULL;
|
ffmpegenc->file = NULL;
|
||||||
ffmpegenc->delay = g_queue_new ();
|
ffmpegenc->delay = g_queue_new ();
|
||||||
|
|
||||||
if (oclass->in_plugin->type == CODEC_TYPE_VIDEO) {
|
if (oclass->in_plugin->type == AVMEDIA_TYPE_VIDEO) {
|
||||||
gst_pad_set_chain_function (ffmpegenc->sinkpad, gst_ffmpegenc_chain_video);
|
gst_pad_set_chain_function (ffmpegenc->sinkpad, gst_ffmpegenc_chain_video);
|
||||||
/* so we know when to flush the buffers on EOS */
|
/* so we know when to flush the buffers on EOS */
|
||||||
gst_pad_set_event_function (ffmpegenc->sinkpad, gst_ffmpegenc_event_video);
|
gst_pad_set_event_function (ffmpegenc->sinkpad, gst_ffmpegenc_event_video);
|
||||||
|
@ -272,7 +272,7 @@ gst_ffmpegenc_init (GstFFMpegEnc * ffmpegenc)
|
||||||
ffmpegenc->max_key_interval = 0;
|
ffmpegenc->max_key_interval = 0;
|
||||||
|
|
||||||
gst_ffmpeg_cfg_set_defaults (ffmpegenc);
|
gst_ffmpeg_cfg_set_defaults (ffmpegenc);
|
||||||
} else if (oclass->in_plugin->type == CODEC_TYPE_AUDIO) {
|
} else if (oclass->in_plugin->type == AVMEDIA_TYPE_AUDIO) {
|
||||||
gst_pad_set_chain_function (ffmpegenc->sinkpad, gst_ffmpegenc_chain_audio);
|
gst_pad_set_chain_function (ffmpegenc->sinkpad, gst_ffmpegenc_chain_audio);
|
||||||
|
|
||||||
ffmpegenc->bitrate = DEFAULT_AUDIO_BITRATE;
|
ffmpegenc->bitrate = DEFAULT_AUDIO_BITRATE;
|
||||||
|
@ -385,7 +385,7 @@ gst_ffmpegenc_getcaps (GstPad * pad)
|
||||||
GST_DEBUG_OBJECT (ffmpegenc, "getting caps");
|
GST_DEBUG_OBJECT (ffmpegenc, "getting caps");
|
||||||
|
|
||||||
/* audio needs no special care */
|
/* audio needs no special care */
|
||||||
if (oclass->in_plugin->type == CODEC_TYPE_AUDIO) {
|
if (oclass->in_plugin->type == AVMEDIA_TYPE_AUDIO) {
|
||||||
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
|
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (ffmpegenc, "audio caps, return template %" GST_PTR_FORMAT,
|
GST_DEBUG_OBJECT (ffmpegenc, "audio caps, return template %" GST_PTR_FORMAT,
|
||||||
|
@ -672,7 +672,7 @@ gst_ffmpegenc_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
/* we may have failed mapping caps to a pixfmt,
|
/* we may have failed mapping caps to a pixfmt,
|
||||||
* and quite some codecs do not make up their own mind about that
|
* and quite some codecs do not make up their own mind about that
|
||||||
* in any case, _NONE can never work out later on */
|
* in any case, _NONE can never work out later on */
|
||||||
if (oclass->in_plugin->type == CODEC_TYPE_VIDEO && pix_fmt == PIX_FMT_NONE) {
|
if (oclass->in_plugin->type == AVMEDIA_TYPE_VIDEO && pix_fmt == PIX_FMT_NONE) {
|
||||||
GST_DEBUG_OBJECT (ffmpegenc, "ffenc_%s: Failed to determine input format",
|
GST_DEBUG_OBJECT (ffmpegenc, "ffenc_%s: Failed to determine input format",
|
||||||
oclass->in_plugin->name);
|
oclass->in_plugin->name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1313,8 +1313,8 @@ gst_ffmpegenc_register (GstPlugin * plugin)
|
||||||
gchar *type_name;
|
gchar *type_name;
|
||||||
|
|
||||||
/* Skip non-AV codecs */
|
/* Skip non-AV codecs */
|
||||||
if (in_plugin->type != CODEC_TYPE_AUDIO &&
|
if (in_plugin->type != AVMEDIA_TYPE_AUDIO &&
|
||||||
in_plugin->type != CODEC_TYPE_VIDEO)
|
in_plugin->type != AVMEDIA_TYPE_VIDEO)
|
||||||
goto next;
|
goto next;
|
||||||
|
|
||||||
/* no quasi codecs, please */
|
/* no quasi codecs, please */
|
||||||
|
|
|
@ -412,7 +412,7 @@ gst_ffmpegmux_request_new_pad (GstElement * element,
|
||||||
gchar *padname;
|
gchar *padname;
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
AVStream *st;
|
AVStream *st;
|
||||||
enum CodecType type;
|
enum AVMediaType type;
|
||||||
gint bitrate = 0, framesize = 0;
|
gint bitrate = 0, framesize = 0;
|
||||||
|
|
||||||
g_return_val_if_fail (templ != NULL, NULL);
|
g_return_val_if_fail (templ != NULL, NULL);
|
||||||
|
@ -422,12 +422,12 @@ gst_ffmpegmux_request_new_pad (GstElement * element,
|
||||||
/* figure out a name that *we* like */
|
/* figure out a name that *we* like */
|
||||||
if (templ == gst_element_class_get_pad_template (klass, "video_%d")) {
|
if (templ == gst_element_class_get_pad_template (klass, "video_%d")) {
|
||||||
padname = g_strdup_printf ("video_%d", ffmpegmux->videopads++);
|
padname = g_strdup_printf ("video_%d", ffmpegmux->videopads++);
|
||||||
type = CODEC_TYPE_VIDEO;
|
type = AVMEDIA_TYPE_VIDEO;
|
||||||
bitrate = 64 * 1024;
|
bitrate = 64 * 1024;
|
||||||
framesize = 1152;
|
framesize = 1152;
|
||||||
} else if (templ == gst_element_class_get_pad_template (klass, "audio_%d")) {
|
} else if (templ == gst_element_class_get_pad_template (klass, "audio_%d")) {
|
||||||
padname = g_strdup_printf ("audio_%d", ffmpegmux->audiopads++);
|
padname = g_strdup_printf ("audio_%d", ffmpegmux->audiopads++);
|
||||||
type = CODEC_TYPE_AUDIO;
|
type = AVMEDIA_TYPE_AUDIO;
|
||||||
bitrate = 285 * 1024;
|
bitrate = 285 * 1024;
|
||||||
} else {
|
} else {
|
||||||
g_warning ("ffmux: unknown pad template!");
|
g_warning ("ffmux: unknown pad template!");
|
||||||
|
@ -560,12 +560,12 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data)
|
||||||
if (st->codec->codec_id == CODEC_ID_NONE) {
|
if (st->codec->codec_id == CODEC_ID_NONE) {
|
||||||
GST_ELEMENT_ERROR (ffmpegmux, CORE, NEGOTIATION, (NULL),
|
GST_ELEMENT_ERROR (ffmpegmux, CORE, NEGOTIATION, (NULL),
|
||||||
("no caps set on stream %d (%s)", collect_pad->padnum,
|
("no caps set on stream %d (%s)", collect_pad->padnum,
|
||||||
(st->codec->codec_type == CODEC_TYPE_VIDEO) ?
|
(st->codec->codec_type == AVMEDIA_TYPE_VIDEO) ?
|
||||||
"video" : "audio"));
|
"video" : "audio"));
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
/* set framerate for audio */
|
/* set framerate for audio */
|
||||||
if (st->codec->codec_type == CODEC_TYPE_AUDIO) {
|
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||||
switch (st->codec->codec_id) {
|
switch (st->codec->codec_id) {
|
||||||
case CODEC_ID_PCM_S16LE:
|
case CODEC_ID_PCM_S16LE:
|
||||||
case CODEC_ID_PCM_S16BE:
|
case CODEC_ID_PCM_S16BE:
|
||||||
|
|
Loading…
Reference in a new issue