...
 
Commits (4)
common @ cd5507ae
Subproject commit 2c2bce01ed5ed1d1684bd76a334477398009ef4a
Subproject commit cd5507ae3df8dc48c07df9e37878846b6b79faa1
......@@ -69,7 +69,6 @@ GST_PLUGIN_DEFINE (
plugin_init,
FFMPEG_VERSION,
"LGPL",
"(c) 2003 The FFMPEG team",
"FFMpeg",
"http://ffmpeg.sourceforge.net/"
)
......@@ -36,39 +36,33 @@
* See below for why we use this.
*/
#define GST_FF_VID_CAPS_NEW(name, mimetype, props...) \
(context != NULL) ? \
GST_CAPS_NEW (name, \
mimetype, \
"width", GST_PROPS_INT (context->width), \
"height", GST_PROPS_INT (context->height),\
"framerate", GST_PROPS_FLOAT ( \
1.*context->frame_rate/ \
context->frame_rate_base) , \
##props) \
: \
GST_CAPS_NEW (name, \
mimetype, \
"width", GST_PROPS_INT_RANGE (16, 4096), \
"height", GST_PROPS_INT_RANGE (16, 4096), \
"framerate", GST_PROPS_FLOAT_RANGE (0, \
G_MAXFLOAT) , \
##props)
#define GST_FF_VID_CAPS_NEW(mimetype, props...) \
(context != NULL) ? \
gst_caps_new_simple (mimetype, \
"width", G_TYPE_INT, context->width, \
"height", G_TYPE_INT, context->height, \
"framerate", G_TYPE_DOUBLE, 1. * context->frame_rate / \
context->frame_rate_base, \
##props, NULL) \
: \
gst_caps_new_simple (mimetype, \
"width", GST_TYPE_INT_RANGE, 16, 4096, \
"height", GST_TYPE_INT_RANGE, 16, 4096, \
"framerate", GST_TYPE_DOUBLE_RANGE, 0., G_MAXDOUBLE, \
##props, NULL)
/* same for audio - now with channels/sample rate
*/
#define GST_FF_AUD_CAPS_NEW(name, mimetype, props...) \
(context != NULL) ? \
GST_CAPS_NEW (name, \
mimetype, \
"rate", GST_PROPS_INT (context->sample_rate), \
"channels", GST_PROPS_INT (context->channels) , \
##props) \
: \
GST_CAPS_NEW (name, \
mimetype, \
##props)
#define GST_FF_AUD_CAPS_NEW(mimetype, props...) \
(context != NULL) ? \
gst_caps_new_simple (mimetype, \
"rate", G_TYPE_INT, context->sample_rate, \
"channels", G_TYPE_INT, context->channels, \
##props, NULL) \
: \
gst_caps_new_simple (mimetype, \
##props, NULL)
/* Convert a FFMPEG codec ID and optional AVCodecContext
* to a GstCaps. If the context is ommitted, no fixed values
......@@ -86,88 +80,66 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
switch (codec_id) {
case CODEC_ID_MPEG1VIDEO:
/* this caps doesn't need width/height/framerate */
caps = GST_CAPS_NEW ("ffmpeg_mpeg1video",
"video/mpeg",
"mpegversion", GST_PROPS_INT (1),
"systemstream", GST_PROPS_BOOLEAN (FALSE)
);
caps = gst_caps_new_simple ("video/mpeg",
"mpegversion", G_TYPE_INT, 1,
"systemstream", G_TYPE_BOOLEAN, FALSE,
NULL);
break;
case CODEC_ID_H263P:
case CODEC_ID_H263I:
case CODEC_ID_H263:
caps = GST_FF_VID_CAPS_NEW ("ffmpeg_h263",
"video/x-h263"
);
caps = GST_FF_VID_CAPS_NEW ("video/x-h263");
break;
case CODEC_ID_RV10:
caps = GST_FF_VID_CAPS_NEW ("ffmpeg_rv10",
"video/x-pn-realvideo",
"systemstream", GST_PROPS_BOOLEAN (FALSE)
);
caps = GST_FF_VID_CAPS_NEW ("video/x-pn-realvideo",
"systemstream", G_TYPE_BOOLEAN, FALSE,
NULL);
break;
case CODEC_ID_MP2:
caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_mp2",
"audio/mpeg",
"layer", GST_PROPS_INT (2)
);
caps = GST_FF_AUD_CAPS_NEW ("audio/mpeg",
"layer", G_TYPE_INT, 2,
NULL);
break;
case CODEC_ID_MP3LAME:
caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_mp3",
"audio/mpeg",
"layer", GST_PROPS_INT (3)
);
caps = GST_FF_AUD_CAPS_NEW ("audio/mpeg",
"layer", G_TYPE_INT, 3,
NULL);
break;
case CODEC_ID_VORBIS: /* FIXME? vorbis or ogg? */
caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_vorbis",
"application/ogg",
NULL
);
/* FIXME: This could become problematic when we fully switched to seperation
of ogg and vorbis, because ffmpeg does ass ume ogg == ogg/vorbis
Maybe we want to disable this? */
case CODEC_ID_VORBIS:
caps = GST_FF_AUD_CAPS_NEW ("application/ogg");
break;
case CODEC_ID_AC3:
caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_ac3",
"audio/x-ac3",
NULL
);
caps = GST_FF_AUD_CAPS_NEW ("audio/x-ac3");
break;
case CODEC_ID_MJPEG:
case CODEC_ID_MJPEGB:
/*case CODEC_ID_LJPEG:*/
caps = GST_FF_VID_CAPS_NEW ("ffmpeg_mjpeg",
"video/x-jpeg"
);
caps = GST_FF_VID_CAPS_NEW ("video/x-jpeg");
break;
case CODEC_ID_MPEG4:
caps = GST_FF_VID_CAPS_NEW ("ffmpeg_mpeg4",
"video/mpeg",
"mpegversion", GST_PROPS_INT (4),
"systemstream", GST_PROPS_BOOLEAN (FALSE)
);
caps = gst_caps_append(caps,
GST_FF_VID_CAPS_NEW ("ffmpeg_divx",
"video/x-divx",
"divxversion", GST_PROPS_INT (5)
));
caps = gst_caps_append(caps,
GST_FF_VID_CAPS_NEW ("ffmpeg_divx",
"video/x-divx",
"divxversion", GST_PROPS_INT (4)
));
caps = gst_caps_append(caps,
GST_FF_VID_CAPS_NEW ("ffmpeg_xvid",
"video/x-xvid"
));
caps = gst_caps_append(caps,
GST_FF_VID_CAPS_NEW ("ffmpeg_3ivx",
"video/x-3ivx"
));
caps = GST_FF_VID_CAPS_NEW ("video/mpeg",
"mpegversion", G_TYPE_INT, 4,
"systemstream", G_TYPE_BOOLEAN, FALSE,
NULL);
gst_caps_append(caps,
GST_FF_VID_CAPS_NEW ("video/x-divx",
"divxversion", GST_TYPE_INT_RANGE, 4, 5,
NULL));
gst_caps_append(caps,
GST_FF_VID_CAPS_NEW ("video/x-xvid"));
gst_caps_append(caps,
GST_FF_VID_CAPS_NEW ("video/x-3ivx"));
break;
/* weird quasi-codecs for the demuxers only */
......@@ -176,112 +148,93 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
return gst_ffmpeg_codectype_to_caps (CODEC_TYPE_VIDEO, context);
case CODEC_ID_MSMPEG4V1:
caps = GST_FF_VID_CAPS_NEW ("ffmpeg_msmpeg4v1",
"video/x-msmpeg",
"msmpegversion", GST_PROPS_INT (41)
);
caps = GST_FF_VID_CAPS_NEW ("video/x-msmpeg",
"msmpegversion", G_TYPE_INT, 41,
NULL);
break;
case CODEC_ID_MSMPEG4V2:
caps = GST_FF_VID_CAPS_NEW ("ffmpeg_msmpeg4v2",
"video/x-msmpeg",
"msmpegversion", GST_PROPS_INT (42)
);
caps = GST_FF_VID_CAPS_NEW ("video/x-msmpeg",
"msmpegversion", G_TYPE_INT, 42,
NULL);
break;
case CODEC_ID_MSMPEG4V3:
caps = GST_FF_VID_CAPS_NEW ("ffmpeg_msmpeg4v3",
"video/x-msmpeg",
"msmpegversion", GST_PROPS_INT (43)
);
caps = gst_caps_append(caps,
GST_FF_VID_CAPS_NEW ("ffmpeg_msmpeg4v3_divx3",
"video/x-divx",
"divxversion", GST_PROPS_INT (3)
));
caps = GST_FF_VID_CAPS_NEW ("video/x-msmpeg",
"msmpegversion", G_TYPE_INT, 43,
NULL);
gst_caps_append(caps,
GST_FF_VID_CAPS_NEW ("video/x-divx",
"divxversion", G_TYPE_INT, 3,
NULL));
break;
case CODEC_ID_WMV1:
caps = GST_FF_VID_CAPS_NEW ("ffmpeg_wmv1",
"video/x-wmv",
"wmvversion", GST_PROPS_INT (1)
);
caps = GST_FF_VID_CAPS_NEW ("video/x-wmv",
"wmvversion", G_TYPE_INT, 1,
NULL);
break;
case CODEC_ID_WMV2:
caps = GST_FF_VID_CAPS_NEW ("ffmpeg_wmv2",
"video/x-wmv",
"wmvversion", GST_PROPS_INT (2)
);
caps = GST_FF_VID_CAPS_NEW ("video/x-wmv",
"wmvversion", G_TYPE_INT, 2,
NULL);
break;
case CODEC_ID_SVQ1:
caps = GST_FF_VID_CAPS_NEW ("ffmpeg_svq1",
"video/x-svq",
"svqversion", GST_PROPS_INT (1)
);
caps = GST_FF_VID_CAPS_NEW ("video/x-svq",
"svqversion", G_TYPE_INT, 1,
NULL);
break;
case CODEC_ID_SVQ3:
caps = GST_FF_VID_CAPS_NEW ("ffmpeg_svq3",
"video/x-svq",
"svqversion", GST_PROPS_INT (3)
);
caps = GST_FF_VID_CAPS_NEW ("video/x-svq",
"svqversion", G_TYPE_INT, 1,
NULL);
break;
case CODEC_ID_DVAUDIO:
caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_dvaudio",
"audio/x-dv",
NULL
);
caps = GST_FF_AUD_CAPS_NEW ("audio/x-dv");
break;
case CODEC_ID_DVVIDEO:
caps = GST_FF_VID_CAPS_NEW ("ffmpeg_dvvideo",
"video/dv"
);
caps = GST_FF_VID_CAPS_NEW ("video/dv");
break;
case CODEC_ID_WMAV1:
caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_wma1",
"audio/x-wma",
"wmaversion", GST_PROPS_INT (1),
"flags1", GST_PROPS_INT_RANGE (G_MININT, G_MAXINT),
"flags2", GST_PROPS_INT_RANGE (G_MININT, G_MAXINT),
"block_align", GST_PROPS_INT_RANGE (0, G_MAXINT),
"bitrate", GST_PROPS_INT_RANGE (0, G_MAXINT)
);
caps = GST_FF_AUD_CAPS_NEW ("audio/x-wma",
"wmaversion", G_TYPE_INT, 1,
"flags1", GST_TYPE_INT_RANGE, G_MININT, G_MAXINT,
"flags2", GST_TYPE_INT_RANGE, G_MININT, G_MAXINT,
"block_align", GST_TYPE_INT_RANGE, 0, G_MAXINT,
"bitrate", GST_TYPE_INT_RANGE, 0, G_MAXINT,
NULL);
break;
case CODEC_ID_WMAV2:
caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_wma2",
"audio/x-wma",
"wmaversion", GST_PROPS_INT (2),
"flags1", GST_PROPS_INT_RANGE (G_MININT, G_MAXINT),
"flags2", GST_PROPS_INT_RANGE (G_MININT, G_MAXINT),
"block_align", GST_PROPS_INT_RANGE (0, G_MAXINT),
"bitrate", GST_PROPS_INT_RANGE (0, G_MAXINT)
);
caps = GST_FF_AUD_CAPS_NEW ("audio/x-wma",
"wmaversion", G_TYPE_INT, 2,
"flags1", GST_TYPE_INT_RANGE, G_MININT, G_MAXINT,
"flags2", GST_TYPE_INT_RANGE, G_MININT, G_MAXINT,
"block_align", GST_TYPE_INT_RANGE, 0, G_MAXINT,
"bitrate", GST_TYPE_INT_RANGE, 0, G_MAXINT,
NULL);
break;
case CODEC_ID_MACE3:
caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_mace3",
"audio/x-mace",
"maceversion", GST_PROPS_INT (3)
);
caps = GST_FF_AUD_CAPS_NEW ("audio/x-mace",
"maceversion", G_TYPE_INT, 3,
NULL);
break;
case CODEC_ID_MACE6:
caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_mace6",
"audio/x-mace",
"maceversion", GST_PROPS_INT (6)
);
caps = GST_FF_AUD_CAPS_NEW ("audio/x-mace",
"maceversion", G_TYPE_INT, 6,
NULL);
break;
case CODEC_ID_HUFFYUV:
caps = GST_FF_VID_CAPS_NEW ("ffmpeg_huffyuv",
"video/x-huffyuv"
);
caps = GST_FF_VID_CAPS_NEW ("video/x-huffyuv");
break;
case CODEC_ID_CYUV:
......@@ -289,42 +242,33 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
break;
case CODEC_ID_H264:
caps = GST_FF_VID_CAPS_NEW ("ffmpeg_h264",
"video/x-h264"
);
caps = GST_FF_VID_CAPS_NEW ("video/x-h264");
break;
case CODEC_ID_INDEO3:
caps = GST_FF_VID_CAPS_NEW ("ffmpeg_indeo3",
"video/x-indeo",
"indeoversion", GST_PROPS_INT (3)
);
caps = GST_FF_VID_CAPS_NEW ("video/x-indeo",
"indeoversion", G_TYPE_INT, 3,
NULL);
break;
case CODEC_ID_VP3:
caps = GST_FF_VID_CAPS_NEW ("ffmpeg_vp3",
"video/x-vp3"
);
caps = gst_caps_append(caps,
GST_FF_VID_CAPS_NEW ("ffmpeg_theora",
"video/x-theora"
));
caps = GST_FF_VID_CAPS_NEW ("video/x-vp3");
gst_caps_append(caps,
GST_FF_VID_CAPS_NEW ("video/x-theora"));
break;
case CODEC_ID_AAC:
caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_mpeg2aac",
"audio/mpeg",
"systemstream", GST_PROPS_BOOLEAN (FALSE),
"mpegversion", GST_PROPS_INT (2)
);
caps = GST_FF_AUD_CAPS_NEW ("audio/mpeg",
"systemstream", G_TYPE_BOOLEAN, FALSE,
"mpegversion", G_TYPE_INT, 2,
NULL);
break;
case CODEC_ID_MPEG4AAC:
caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_mpeg4aac",
"audio/mpeg",
"systemstream", GST_PROPS_BOOLEAN (FALSE),
"mpegversion", GST_PROPS_INT (4)
);
caps = GST_FF_AUD_CAPS_NEW ("audio/mpeg",
"systemstream", G_TYPE_BOOLEAN, FALSE,
"mpegversion", G_TYPE_INT, 4,
NULL);
break;
case CODEC_ID_ASV1:
......@@ -332,16 +276,13 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
break;
case CODEC_ID_FFV1:
caps = GST_FF_VID_CAPS_NEW ("ffmpeg_ffv1",
"video/x-ffv",
"ffvversion", GST_PROPS_INT (1)
);
caps = GST_FF_VID_CAPS_NEW ("video/x-ffv",
"ffvversion", G_TYPE_INT, 1,
NULL);
break;
case CODEC_ID_4XM:
caps = GST_FF_VID_CAPS_NEW ("ffmpeg_4xmvideo",
"video/x-4xm"
);
caps = GST_FF_VID_CAPS_NEW ("video/x-4xm");
break;
/* weird quasi-codecs for the demuxers only */
......@@ -391,55 +332,45 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
break;
}
caps = GST_FF_AUD_CAPS_NEW (
"ffmpeg_pcmaudio",
"audio/x-raw-int",
"width", GST_PROPS_INT (width),
"depth", GST_PROPS_INT (depth),
"endianness", GST_PROPS_INT (endianness),
"signed", GST_PROPS_BOOLEAN (signedness)
);
caps = GST_FF_AUD_CAPS_NEW ("audio/x-raw-int",
"width", G_TYPE_INT, width,
"depth", G_TYPE_INT, depth,
"endianness", G_TYPE_INT, endianness,
"signed", G_TYPE_BOOLEAN, signedness,
NULL);
} while (0);
break;
case CODEC_ID_PCM_MULAW:
caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_mulawaudio",
"audio/x-mulaw",
NULL);
caps = GST_FF_AUD_CAPS_NEW ("audio/x-mulaw");
break;
case CODEC_ID_PCM_ALAW:
caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_alawaudio",
"audio/x-alaw",
NULL);
caps = GST_FF_AUD_CAPS_NEW ("audio/x-alaw");
break;
case CODEC_ID_ADPCM_IMA_QT:
caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_adpcm_ima_qt",
"audio/x-adpcm",
"layout", GST_PROPS_STRING ("quicktime")
);
caps = GST_FF_AUD_CAPS_NEW ("audio/x-adpcm",
"layout", G_TYPE_STRING, "quicktime",
NULL);
break;
case CODEC_ID_ADPCM_IMA_WAV:
caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_adpcm_ima_wav",
"audio/x-adpcm",
"layout", GST_PROPS_STRING ("wav")
);
caps = GST_FF_AUD_CAPS_NEW ("audio/x-adpcm",
"layout", G_TYPE_STRING, "wav",
NULL);
break;
case CODEC_ID_ADPCM_MS:
caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_adpcm_ms",
"audio/x-adpcm",
"layout", GST_PROPS_STRING ("microsoft")
);
caps = GST_FF_AUD_CAPS_NEW ("audio/x-adpcm",
"layout", G_TYPE_STRING, "microsoft",
NULL);
break;
case CODEC_ID_ADPCM_4XM:
caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_adpcm_4xm",
"audio/x-adpcm",
"layout", GST_PROPS_STRING ("4xm")
);
caps = GST_FF_AUD_CAPS_NEW ("audio/x-adpcm",
"layout", G_TYPE_STRING, "4xm",
NULL);
break;
case CODEC_ID_AMR_NB:
......@@ -447,17 +378,15 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
break;
case CODEC_ID_RA_144:
caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_realaudio_144",
"audio/x-pn-realaudio",
"bitrate", GST_PROPS_INT (14400)
);
caps = GST_FF_AUD_CAPS_NEW ("audio/x-pn-realaudio",
"bitrate", G_TYPE_INT, 14400,
NULL);
break;
case CODEC_ID_RA_288:
caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_realaudio_288",
"audio/x-pn-realaudio",
"bitrate", GST_PROPS_INT (28800)
);
caps = GST_FF_AUD_CAPS_NEW ("audio/x-pn-realaudio",
"bitrate", G_TYPE_INT, 28800,
NULL);
break;
default:
......@@ -466,15 +395,11 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
}
if (caps != NULL) {
char *str = g_strdup_printf("The caps that belongs to codec_id=%d",
codec_id);
gst_caps_debug(caps, str);
char *str = gst_caps_to_string (caps);
GST_DEBUG ("caps for codec_id=%d: %s", codec_id, str);
g_free(str);
} else {
char *str = g_strdup_printf("No caps found for codec_id=%d",
codec_id);
gst_caps_debug(caps, str);
g_free(str);
GST_WARNING ("No caps found for codec_id=%d", codec_id);
}
return caps;
......@@ -521,7 +446,7 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt,
/* .. */
break;
case PIX_FMT_RGBA32:
bpp = depth = 32;
bpp = 32; depth = 24;
endianness = G_BIG_ENDIAN;
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
r_mask = 0x00ff0000; g_mask = 0x0000ff00; b_mask = 0x000000ff;
......@@ -551,32 +476,26 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt,
}
if (bpp != 0) {
caps = GST_FF_VID_CAPS_NEW ("ffmpeg_rawvideo",
"video/x-raw-rgb",
"bpp", GST_PROPS_INT (bpp),
"depth", GST_PROPS_INT (depth),
"red_mask", GST_PROPS_INT (r_mask),
"green_mask", GST_PROPS_INT (g_mask),
"blue_mask", GST_PROPS_INT (b_mask),
"endianness", GST_PROPS_INT (endianness)
);
caps = GST_FF_VID_CAPS_NEW ("video/x-raw-rgb",
"bpp", G_TYPE_INT, bpp,
"depth", G_TYPE_INT, depth,
"red_mask", G_TYPE_INT, r_mask,
"green_mask", G_TYPE_INT, g_mask,
"blue_mask", G_TYPE_INT, b_mask,
"endianness", G_TYPE_INT, endianness,
NULL);
} else if (fmt) {
caps = GST_FF_VID_CAPS_NEW ("ffmpeg_rawvideo",
"video/x-raw-yuv",
"format", GST_PROPS_FOURCC (fmt)
);
caps = GST_FF_VID_CAPS_NEW ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, fmt,
NULL);
}
if (caps != NULL) {
char *str = g_strdup_printf("The caps that belongs to pix_fmt=%d",
pix_fmt);
gst_caps_debug(caps, str);
char *str = gst_caps_to_string (caps);
GST_DEBUG ("caps for pix_fmt=%d: %s", pix_fmt, str);
g_free(str);
} else {
char *str = g_strdup_printf("No caps found for pix_fmt=%d",
pix_fmt);
gst_caps_debug(caps, str);
g_free(str);
GST_WARNING ("No caps found for pix_fmt=%d", pix_fmt);
}
return caps;
......@@ -610,25 +529,20 @@ gst_ffmpeg_smpfmt_to_caps (enum SampleFormat sample_fmt,
}
if (bpp) {
caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_rawaudio",
"audio/x-raw-int",
"signed", GST_PROPS_BOOLEAN (signedness),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"width", GST_PROPS_INT (bpp),
"depth", GST_PROPS_INT (bpp)
);
caps = GST_FF_AUD_CAPS_NEW ("audio/x-raw-int",
"signed", G_TYPE_BOOLEAN, signedness,
"endianness", G_TYPE_INT, G_BYTE_ORDER,
"width", G_TYPE_INT, bpp,
"depth", G_TYPE_INT, bpp,
NULL);
}
if (caps != NULL) {
char *str = g_strdup_printf("The caps that belongs to sample_fmt=%d",
sample_fmt);
gst_caps_debug(caps, str);
char *str = gst_caps_to_string (caps);
GST_DEBUG ("caps for sample_fmt=%d: %s", sample_fmt, str);
g_free(str);
} else {
char *str = g_strdup_printf("No caps found for sample_fmt=%d",
sample_fmt);
gst_caps_debug(caps, str);
g_free(str);
GST_WARNING ("No caps found for sample_fmt=%d", sample_fmt);
}
return caps;
......@@ -645,7 +559,7 @@ GstCaps *
gst_ffmpeg_codectype_to_caps (enum CodecType codec_type,
AVCodecContext *context)
{
GstCaps *caps = NULL;
GstCaps *caps;
switch (codec_type) {
case CODEC_TYPE_VIDEO:
......@@ -655,10 +569,11 @@ gst_ffmpeg_codectype_to_caps (enum CodecType codec_type,
GstCaps *temp;
enum PixelFormat i;
caps = gst_caps_new_empty ();
for (i = 0; i < PIX_FMT_NB; i++) {
temp = gst_ffmpeg_pixfmt_to_caps (i, NULL);
if (temp != NULL) {
caps = gst_caps_append (caps, temp);
gst_caps_append (caps, temp);
}
}
}
......@@ -671,10 +586,11 @@ gst_ffmpeg_codectype_to_caps (enum CodecType codec_type,
GstCaps *temp;
enum SampleFormat i;
caps = gst_caps_new_empty ();
for (i = 0; i <= SAMPLE_FMT_S16; i++) {
temp = gst_ffmpeg_smpfmt_to_caps (i, NULL);
if (temp != NULL) {
caps = gst_caps_append (caps, temp);
gst_caps_append (caps, temp);
}
}
}
......@@ -682,6 +598,7 @@ gst_ffmpeg_codectype_to_caps (enum CodecType codec_type,
default:
/* .. */
caps = NULL;
break;
}
......@@ -693,59 +610,54 @@ gst_ffmpeg_codectype_to_caps (enum CodecType codec_type,
* when needed.
*/
static void
gst_ffmpeg_caps_to_extradata (GstCaps *caps,
gst_ffmpeg_caps_to_extradata (const GstCaps *caps,
AVCodecContext *context)
{
GstStructure *structure;
const gchar *mimetype;
mimetype = gst_caps_get_mime(caps);
g_return_if_fail (gst_caps_get_size (caps) == 1);
structure = gst_caps_get_structure (caps, 0);
mimetype = gst_structure_get_name (structure);
if (!strcmp(mimetype, "audio/x-wma")) {
gint flags1, flags2, wmaversion = 0;
if (!gst_caps_has_property (caps, "flags1")) {
g_warning ("Caps without flags1 property for %s", mimetype);
return;
}
if (!gst_caps_has_property (caps, "flags2")) {
g_warning ("Caps without flags2 property for %s", mimetype);
if (!gst_structure_get_int (structure, "flags1", &flags1) &&
!gst_structure_get_int (structure, "flags2", &flags2) &&
!gst_structure_get_int (structure, "wmaversion", &wmaversion)) {
g_warning ("invalid caps for audio/x-wma");
return;
}
if (gst_caps_has_property (caps, "wmaversion")) {
gint wmaversion = 0;
gint value;
/*
* Rebuild context data from flags1 & flags2
* see wmadec in ffmpeg/libavcodec/wmadec.c
*/
gst_caps_get_int (caps, "wmaversion", &wmaversion);
switch (wmaversion) {
case 1:
context->extradata = (guint8 *) g_malloc0 (4);
gst_caps_get_int (caps, "flags1", &value);
((guint8 *)context->extradata)[0] = value;
gst_caps_get_int (caps, "flags2", &value);
((guint8 *)context->extradata)[2] = value;
context->extradata_size = 4;
break;
case 2:
context->extradata = (guint8 *) g_malloc0 (6);
gst_caps_get_int (caps, "flags1", &value);
((guint8 *) context->extradata)[0] = value;
((guint8 *) context->extradata)[1] = value >> 8;
((guint8 *) context->extradata)[2] = value >> 16;
((guint8 *) context->extradata)[3] = value >> 24;
gst_caps_get_int (caps, "flags2", &value);
((guint8 *) context->extradata)[4] = value;
((guint8 *) context->extradata)[5] = value >> 8;
context->extradata_size = 6;
break;
default:
g_warning ("Unknown wma version %d\n", wmaversion);
break;
}
/*
* Rebuild context data from flags1 & flags2
* see wmadec in ffmpeg/libavcodec/wmadec.c
*/
gst_structure_get_int (structure, "wmaversion", &wmaversion);
switch (wmaversion) {
case 1:
/* FIXME: is this freed with g_free? If not, don't use g_malloc */
context->extradata = (guint8 *) g_malloc0 (4);
((guint8 *)context->extradata)[0] = flags1;
((guint8 *)context->extradata)[2] = flags2;
context->extradata_size = 4;
break;
case 2:
/* FIXME: is this freed with g_free? If not, don't use g_malloc */
context->extradata = (guint8 *) g_malloc0 (6);
((guint8 *) context->extradata)[0] = flags1;
((guint8 *) context->extradata)[1] = flags1 >> 8;
((guint8 *) context->extradata)[2] = flags1 >> 16;
((guint8 *) context->extradata)[3] = flags1 >> 24;
((guint8 *) context->extradata)[4] = flags2;
((guint8 *) context->extradata)[5] = flags2 >> 8;
context->extradata_size = 6;
break;
default:
g_warning ("Unknown wma version %d\n", wmaversion);
break;
}
}
}
......@@ -758,50 +670,30 @@ gst_ffmpeg_caps_to_extradata (GstCaps *caps,
*/
static void
gst_ffmpeg_caps_to_smpfmt (GstCaps *caps,
gst_ffmpeg_caps_to_smpfmt (const GstCaps *caps,
AVCodecContext *context)
{
if (gst_caps_has_property_typed (caps, "width",
GST_PROPS_INT_TYPE) &&
gst_caps_has_property_typed (caps, "depth",
GST_PROPS_INT_TYPE) &&
gst_caps_has_property_typed (caps, "signed",
GST_PROPS_BOOLEAN_TYPE) &&
gst_caps_has_property_typed (caps, "endianness",
GST_PROPS_INT_TYPE)) {
gint depth = 0, width = 0, endianness = 0;
gboolean signedness = FALSE;
gst_caps_get (caps,
"width", &width,
"depth", &depth,
"endianness", &endianness,
"signed", &signedness,
NULL);
GstStructure *structure;
gint depth = 0, width = 0, endianness = 0;
gboolean signedness = FALSE;
g_return_if_fail (gst_caps_get_size (caps) == 1);
structure = gst_caps_get_structure (caps, 0);
if (gst_structure_get_int (structure, "width", &width) &&
gst_structure_get_int (structure, "depth", &depth) &&
gst_structure_get_int (structure, "signed", &signedness) &&
gst_structure_get_int (structure, "endianness", &endianness)) {
if (width == 16 && depth == 16 &&
endianness == G_BYTE_ORDER && signedness == TRUE) {
context->sample_fmt = SAMPLE_FMT_S16;
}
}
if (gst_caps_has_property_typed (caps, "channels",
GST_PROPS_INT_TYPE)) {
gst_caps_get_int (caps, "channels", &context->channels);
}
if (gst_caps_has_property_typed (caps, "rate",
GST_PROPS_INT_TYPE)) {
gst_caps_get_int (caps, "rate", &context->sample_rate);
}
if (gst_caps_has_property_typed (caps, "block_align",
GST_PROPS_INT_TYPE)) {
gst_caps_get_int (caps, "block_align", &context->block_align);
}
if (gst_caps_has_property_typed (caps, "bitrate",
GST_PROPS_INT_TYPE)) {
gst_caps_get_int (caps, "bitrate", &context->bit_rate);
}
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", &context->bit_rate);
gst_ffmpeg_caps_to_extradata (caps, context);
}
......@@ -814,33 +706,27 @@ gst_ffmpeg_caps_to_smpfmt (GstCaps *caps,
*/
static void
gst_ffmpeg_caps_to_pixfmt (GstCaps *caps,
gst_ffmpeg_caps_to_pixfmt (const GstCaps *caps,
AVCodecContext *context)
{
if (gst_caps_has_property_typed (caps, "width",
GST_PROPS_INT_TYPE) &&
gst_caps_has_property_typed (caps, "height",
GST_PROPS_INT_TYPE)) {
gst_caps_get (caps,
"width", &context->width,
"height", &context->height,
NULL);
}
GstStructure *structure;
gdouble fps;
g_return_if_fail (gst_caps_get_size (caps) == 1);
structure = gst_caps_get_structure (caps, 0);
gst_structure_get_int (structure, "width", &context->width);
gst_structure_get_int (structure, "height", &context->height);
if (gst_caps_has_property_typed (caps, "framerate",
GST_PROPS_FLOAT_TYPE)) {
gfloat fps;
gst_caps_get_float (caps, "framerate", &fps);
if (gst_structure_get_double (structure, "framerate", &fps)) {
context->frame_rate = fps * DEFAULT_FRAME_RATE_BASE;
context->frame_rate_base = DEFAULT_FRAME_RATE_BASE;
}
if (strcmp (gst_caps_get_mime (caps), "video/x-raw-yuv") == 0) {
if (gst_caps_has_property_typed (caps, "format",
GST_PROPS_FOURCC_TYPE)) {
guint32 fourcc;
gst_caps_get_fourcc_int (caps, "format", &fourcc);
if (strcmp (gst_structure_get_name (structure), "video/x-raw-yuv") == 0) {
guint32 fourcc;
if (gst_structure_get_fourcc (structure, "format", &fourcc)) {
switch (fourcc) {
case GST_MAKE_FOURCC ('Y','U','Y','2'):
context->pix_fmt = PIX_FMT_YUV422;
......@@ -864,21 +750,18 @@ gst_ffmpeg_caps_to_pixfmt (GstCaps *caps,
#endif
}
}
} else if (strcmp (gst_caps_get_mime (caps), "video/x-raw-rgb") == 0) {
if (gst_caps_has_property_typed (caps, "bpp", GST_PROPS_INT_TYPE) &&
gst_caps_has_property_typed (caps, "red_mask", GST_PROPS_INT_TYPE)) {
gint bpp = 0, rmask = 0, endianness = 0;
gst_caps_get (caps, "bpp", &bpp,
"red_mask", &rmask,
"endianness", &endianness, NULL);
} else if (strcmp (gst_structure_get_name (structure), "video/x-raw-rgb") == 0) {
gint bpp = 0, rmask = 0, endianness = 0;
if (gst_structure_get_int (structure, "bpp", &bpp) &&
gst_structure_get_int (structure, "endianness", &endianness) &&
gst_structure_get_int (structure, "red_mask", &rmask)) {
switch (bpp) {
case 32:
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
if (rmask == 0xff0000)
if (rmask == 0x00ff0000)
#else
if (rmask == 0x0000ff)
if (rmask == 0x0000ff00)
#endif
context->pix_fmt = PIX_FMT_RGBA32;
break;
......@@ -913,7 +796,7 @@ gst_ffmpeg_caps_to_pixfmt (GstCaps *caps,
void
gst_ffmpeg_caps_to_codectype (enum CodecType type,
GstCaps *caps,
const GstCaps *caps,
AVCodecContext *context)
{
if (context == NULL)
......@@ -950,60 +833,42 @@ gst_ffmpeg_formatid_to_caps (const gchar *format_name)
GstCaps *caps = NULL;
if (!strcmp (format_name, "mpeg")) {
caps = GST_CAPS_NEW ("ffmpeg_mpeg",
"video/mpeg",
"systemstream", GST_PROPS_BOOLEAN (TRUE)
);
caps = gst_caps_new_simple ("video/mpeg",
"systemstream", G_TYPE_BOOLEAN, TRUE,
NULL);
} else if (!strcmp (format_name, "mpegts")) {
caps = GST_CAPS_NEW ("ffmpeg_mpegts",
"video/mpegts",
"systemstream", GST_PROPS_BOOLEAN (TRUE)
);
caps = gst_caps_new_simple ("video/mpegts",
"systemstream", G_TYPE_BOOLEAN, TRUE,
NULL);
} else if (!strcmp (format_name, "rm")) {
caps = GST_CAPS_NEW ("ffmpeg_rm",
"audio/x-pn-realvideo",
"systemstream", GST_PROPS_BOOLEAN (TRUE)
);
caps = gst_caps_new_simple ("ffmpeg_rm", "audio/x-pn-realvideo",
"systemstream", G_TYPE_BOOLEAN, TRUE,
NULL);
} else if (!strcmp (format_name, "asf")) {
caps = GST_CAPS_NEW ("ffmpeg_asf",
"video/x-ms-asf",
NULL
);
caps = gst_caps_new_simple ("video/x-ms-asf",
NULL);
} else if (!strcmp (format_name, "avi")) {
caps = GST_CAPS_NEW ("ffmpeg_avi",
"video/x-msvideo",
NULL
);
caps = gst_caps_new_simple ("video/x-msvideo",
NULL);
} else if (!strcmp (format_name, "wav")) {
caps = GST_CAPS_NEW ("ffmpeg_wav",
"video/x-wav",
NULL
);
caps = gst_caps_new_simple ("video/x-wav",
NULL);
} else if (!strcmp (format_name, "swf")) {
caps = GST_CAPS_NEW ("ffmpeg_swf",
"application/x-shockwave-flash",
NULL
);
caps = gst_caps_new_simple ("application/x-shockwave-flash",
NULL);
} else if (!strcmp (format_name, "au")) {
caps = GST_CAPS_NEW ("ffmpeg_au",
"audio/x-au",
NULL
);
caps = gst_caps_new_simple ("audio/x-au",
NULL);
} else if (!strcmp (format_name, "mov")) {
caps = GST_CAPS_NEW ("ffmpeg_quicktime",
"video/quicktime",
NULL
);
caps = gst_caps_new_simple ("video/quicktime",
NULL);
} else if (!strcmp (format_name, "dv")) {
caps = GST_CAPS_NEW ("ffmpeg_dv",
"video/x-dv",
"systemstream", GST_PROPS_BOOLEAN (TRUE)
);
caps = gst_caps_new_simple ("video/x-dv",
"systemstream", G_TYPE_BOOLEAN, TRUE,
NULL);
} else if (!strcmp (format_name, "4xm")) {
caps = GST_CAPS_NEW ("ffmpeg_4xm",
"video/x-4xm",
NULL
);
caps = gst_caps_new_simple ("video/x-4xm",
NULL);
} else {
/* unknown! */
}
......@@ -1019,16 +884,19 @@ gst_ffmpeg_formatid_to_caps (const gchar *format_name)
*/
enum CodecID
gst_ffmpeg_caps_to_codecid (GstCaps *caps,
gst_ffmpeg_caps_to_codecid (const GstCaps *caps,
AVCodecContext *context)
{
enum CodecID id = CODEC_ID_NONE;
const gchar *mimetype;
const GstStructure *structure;
gboolean video = FALSE, audio = FALSE; /* we want to be sure! */
g_return_val_if_fail (caps != NULL, CODEC_ID_NONE);
mimetype = gst_caps_get_mime(caps);
g_return_val_if_fail (gst_caps_get_size (caps) == 1, CODEC_ID_NONE);
structure = gst_caps_get_structure (caps, 0);
mimetype = gst_structure_get_name (structure);
if (!strcmp (mimetype, "video/x-raw-rgb")) {
......@@ -1038,9 +906,9 @@ gst_ffmpeg_caps_to_codecid (GstCaps *caps,
gint bpp = 0, endianness = 0, rmask = 0;
enum PixelFormat pix_fmt = -1;
gst_caps_get (caps, "bpp", &bpp,
"endianness", &endianness,
"rmask", &rmask, NULL);
gst_structure_get_int (structure, "bpp", &bpp);
gst_structure_get_int (structure, "endianness", &endianness);
gst_structure_get_int (structure, "rmask", &rmask);
switch (bpp) {
case 15:
......@@ -1091,7 +959,7 @@ gst_ffmpeg_caps_to_codecid (GstCaps *caps,
guint32 fmt_fcc = 0;
enum PixelFormat pix_fmt = -1;
gst_caps_get_fourcc_int (caps, "format", &fmt_fcc);
gst_structure_get_fourcc (structure, "format", &fmt_fcc);
switch (fmt_fcc) {
case GST_MAKE_FOURCC ('Y','U','Y','2'):
......@@ -1128,51 +996,49 @@ gst_ffmpeg_caps_to_codecid (GstCaps *caps,
gint depth = 0, width = 0, endianness = 0;
gboolean signedness = FALSE; /* bla default value */
if (gst_caps_has_property(caps, "signed")) {
gst_caps_get_int(caps, "endianness", &endianness);
gst_caps_get_boolean(caps, "signed", &signedness);
gst_caps_get_int(caps, "width", &width);
gst_caps_get_int(caps, "depth", &depth);
gst_structure_get_int (structure, "endianness", &endianness);
gst_structure_get_boolean (structure, "signed", &signedness);
gst_structure_get_int (structure, "width", &width);
gst_structure_get_int (structure, "depth", &depth);
if (context) {
context->sample_rate = 0;
context->channels = 0;
gst_caps_get_int(caps, "channels", &context->channels);
gst_caps_get_int(caps, "rate", &context->sample_rate);
}
if (context) {
context->sample_rate = 0;
context->channels = 0;
gst_structure_get_int (structure, "channels", &context->channels);
gst_structure_get_int (structure, "rate", &context->sample_rate);
}
if (depth == width) {
switch (depth) {
case 8:
if (signedness) {
id = CODEC_ID_PCM_S8;
} else {
id = CODEC_ID_PCM_U8;
}
break;
case 16:
switch (endianness) {
case G_BIG_ENDIAN:
if (signedness) {
id = CODEC_ID_PCM_S16BE;
} else {
id = CODEC_ID_PCM_U16BE;
}
break;
case G_LITTLE_ENDIAN:
if (signedness) {
id = CODEC_ID_PCM_S16LE;
} else {
id = CODEC_ID_PCM_U16LE;
}
break;
}
break;
}
if (depth == width) {
switch (depth) {
case 8:
if (signedness) {
id = CODEC_ID_PCM_S8;
} else {
id = CODEC_ID_PCM_U8;
}
break;
case 16:
switch (endianness) {
case G_BIG_ENDIAN:
if (signedness) {
id = CODEC_ID_PCM_S16BE;
} else {
id = CODEC_ID_PCM_U16BE;
}
break;
case G_LITTLE_ENDIAN:
if (signedness) {
id = CODEC_ID_PCM_S16LE;
} else {
id = CODEC_ID_PCM_U16LE;
}
break;
}
break;
}
if (id != CODEC_ID_NONE) {
audio = TRUE;
}
if (id != CODEC_ID_NONE) {
audio = TRUE;
}
}
......@@ -1205,11 +1071,9 @@ gst_ffmpeg_caps_to_codecid (GstCaps *caps,
gboolean sys_strm = TRUE;
gint mpegversion = 0;
if (gst_caps_has_property(caps, "systemstream")) {
gst_caps_get_boolean(caps, "systemstream", &sys_strm);
}
if (!sys_strm && gst_caps_has_property(caps, "mpegversion")) {
gst_caps_get_int(caps, "mpegversion", &mpegversion);
gst_structure_get_boolean (structure, "systemstream", &sys_strm);
gst_structure_get_int (structure, "mpegversion", &mpegversion);
if (!sys_strm) {
switch (mpegversion) {
case 1:
id = CODEC_ID_MPEG1VIDEO;
......@@ -1233,26 +1097,24 @@ gst_ffmpeg_caps_to_codecid (GstCaps *caps,
video = TRUE;
} else if (!strcmp(mimetype, "video/x-wmv")) {
gint wmvversion = 0;
gst_structure_get_int (structure, "wmvversion", &wmvversion);
switch (wmvversion) {
case 1:
id = CODEC_ID_WMV1;
break;
case 2:
id = CODEC_ID_WMV2;
break;
default:
/* ... */
break;
}
if (gst_caps_has_property (caps, "wmvversion")) {
gint wmvversion = 0;
gst_caps_get_int (caps, "wmvversion", &wmvversion);
switch (wmvversion) {
case 1:
id = CODEC_ID_WMV1;
break;
case 2:
id = CODEC_ID_WMV2;
break;
default:
/* ... */
break;
}
if (id != CODEC_ID_NONE) {
video = TRUE;
}
if (id != CODEC_ID_NONE) {
video = TRUE;
}
} else if (!strcmp(mimetype, "application/ogg")) {
......@@ -1260,30 +1122,26 @@ gst_ffmpeg_caps_to_codecid (GstCaps *caps,
id = CODEC_ID_VORBIS;
} else if (!strcmp(mimetype, "audio/mpeg")) {
gint layer = 0;
gint mpegversion = 0;
if (gst_caps_has_property (caps, "layer")) {
gint layer = 0;
gst_caps_get_int (caps, "layer", &layer);
switch (layer) {
case 1:
case 2:
id = CODEC_ID_MP2;
break;
case 3:
id = CODEC_ID_MP3LAME;
break;
default:
/* ... */
break;
}
} else if (gst_caps_has_property (caps, "mpegversion")) {
gint mpegversion = 0;
gst_structure_get_int (structure, "layer", &layer);
switch (layer) {
case 1:
case 2:
id = CODEC_ID_MP2;
break;
case 3:
id = CODEC_ID_MP3LAME;
break;
default:
/* ... */
break;
}
gst_caps_get_int (caps, "mpegversion", &mpegversion);
if (mpegversion == 4) {
id = CODEC_ID_MPEG4AAC;
}
gst_structure_get_int (structure, "mpegversion", &mpegversion);
if (mpegversion == 4) {
id = CODEC_ID_MPEG4AAC;
}
if (id != CODEC_ID_NONE) {
......@@ -1291,22 +1149,20 @@ gst_ffmpeg_caps_to_codecid (GstCaps *caps,
}
} else if (!strcmp(mimetype, "audio/x-wma")) {
if (gst_caps_has_property (caps, "wmaversion")) {
gint wmaversion = 0;
gst_caps_get_int (caps, "wmaversion", &wmaversion);
switch (wmaversion) {
case 1:
id = CODEC_ID_WMAV1;
break;
case 2:
id = CODEC_ID_WMAV2;
break;
default:
/* ... */
break;
}
gint wmaversion = 0;
gst_structure_get_int (structure, "wmaversion", &wmaversion);
switch (wmaversion) {
case 1:
id = CODEC_ID_WMAV1;
break;
case 2:
id = CODEC_ID_WMAV2;
break;
default:
/* ... */
break;
}
if (id != CODEC_ID_NONE) {
......@@ -1318,25 +1174,23 @@ gst_ffmpeg_caps_to_codecid (GstCaps *caps,
id = CODEC_ID_AC3;
} else if (!strcmp(mimetype, "video/x-msmpeg")) {
if (gst_caps_has_property (caps, "msmpegversion")) {
gint msmpegversion = 0;
gst_caps_get_int (caps, "msmpegversion", &msmpegversion);
switch (msmpegversion) {
case 41:
id = CODEC_ID_MSMPEG4V1;
break;
case 42:
id = CODEC_ID_MSMPEG4V2;
break;
case 43:
id = CODEC_ID_MSMPEG4V3;
break;
default:
/* ... */
break;
}
gint msmpegversion = 0;
gst_structure_get_int (structure, "msmpegversion", &msmpegversion);
switch (msmpegversion) {
case 41:
id = CODEC_ID_MSMPEG4V1;
break;
case 42:
id = CODEC_ID_MSMPEG4V2;
break;
case 43:
id = CODEC_ID_MSMPEG4V3;
break;
default:
/* ... */
break;
}
if (id != CODEC_ID_NONE) {
......@@ -1344,22 +1198,20 @@ gst_ffmpeg_caps_to_codecid (GstCaps *caps,
}
} else if (!strcmp(mimetype, "video/x-svq")) {
if (gst_caps_has_property (caps, "svqversion")) {
gint svqversion = 0;
gst_caps_get_int (caps, "svqversion", &svqversion);
switch (svqversion) {
case 1:
id = CODEC_ID_SVQ1;
break;
case 3:
id = CODEC_ID_SVQ3;
break;
default:
/* ... */
break;
}
gint svqversion = 0;
gst_structure_get_int (structure, "svqversion", &svqversion);
switch (svqversion) {
case 1:
id = CODEC_ID_SVQ1;
break;
case 3:
id = CODEC_ID_SVQ3;
break;
default:
/* ... */
break;
}
if (id != CODEC_ID_NONE) {
......@@ -1372,22 +1224,19 @@ gst_ffmpeg_caps_to_codecid (GstCaps *caps,
video = TRUE;
} else if (!strcmp (mimetype, "audio/x-mace")) {
if (gst_caps_has_property (caps, "maceversion")) {
gint maceversion;
gst_caps_get_int (caps, "maceversion", &maceversion);
switch (maceversion) {
case 3:
id = CODEC_ID_MACE3;
break;
case 6:
id = CODEC_ID_MACE6;
break;
default:
/* ... */
break;
}
gint maceversion = 0;
gst_structure_get_int (structure, "maceversion", &maceversion);
switch (maceversion) {
case 3:
id = CODEC_ID_MACE3;
break;
case 6:
id = CODEC_ID_MACE6;
break;
default:
/* ... */
break;
}
if (id != CODEC_ID_NONE) {
......@@ -1401,19 +1250,16 @@ gst_ffmpeg_caps_to_codecid (GstCaps *caps,
video = TRUE;
} else if (!strcmp (mimetype, "video/x-indeo")) {
if (gst_caps_has_property (caps, "indeoversion")) {
gint indeoversion = 0;
gst_caps_get_int (caps, "indeoversion", &indeoversion);
switch (indeoversion) {
case 3:
id = CODEC_ID_INDEO3;
break;
default:
/* ... */
break;
}
gint indeoversion = 0;
gst_structure_get_int (structure, "indeoversion", &indeoversion);
switch (indeoversion) {
case 3:
id = CODEC_ID_INDEO3;
break;
default:
/* ... */
break;
}
if (id != CODEC_ID_NONE) {
......@@ -1421,23 +1267,20 @@ gst_ffmpeg_caps_to_codecid (GstCaps *caps,
}
} else if (!strcmp (mimetype, "video/x-divx")) {
if (gst_caps_has_property (caps, "divxversion")) {
gint divxversion = 0;
gst_caps_get_int (caps, "divxversion", &divxversion);
switch (divxversion) {
case 3:
id = CODEC_ID_MSMPEG4V3;
break;
case 4:
case 5:
id = CODEC_ID_MPEG4;
break;
default:
/* ... */
break;
}
gint divxversion = 0;
gst_structure_get_int (structure, "divxversion", &divxversion);
switch (divxversion) {
case 3:
id = CODEC_ID_MSMPEG4V3;
break;
case 4:
case 5:
id = CODEC_ID_MPEG4;
break;
default:
/* ... */
break;
}
if (id != CODEC_ID_NONE) {
......@@ -1451,19 +1294,16 @@ gst_ffmpeg_caps_to_codecid (GstCaps *caps,
video = TRUE;
} else if (!strcmp (mimetype, "video/x-ffv")) {
if (gst_caps_has_property (caps, "ffvversion")) {
gint ffvversion = 0;
gst_caps_get_int (caps, "ffvversion", &ffvversion);
switch (ffvversion) {
case 1:
id = CODEC_ID_FFV1;
break;
default:
/* ... */
break;
}
gint ffvversion = 0;
gst_structure_get_int (structure, "ffvversion", &ffvversion);
switch (ffvversion) {
case 1:
id = CODEC_ID_FFV1;
break;
default:
/* ... */
break;
}
if (id != CODEC_ID_NONE) {
......@@ -1471,20 +1311,19 @@ gst_ffmpeg_caps_to_codecid (GstCaps *caps,
}
} else if (!strcmp (mimetype, "x-adpcm")) {
if (gst_caps_has_property (caps, "layout")) {
const gchar *layout = "";
gst_caps_get_string (caps, "layout", &layout);
if (!strcmp (layout, "quicktime")) {
id = CODEC_ID_ADPCM_IMA_QT;
} else if (!strcmp (layout, "microsoft")) {
id = CODEC_ID_ADPCM_MS;
} else if (!strcmp (layout, "wav")) {
id = CODEC_ID_ADPCM_IMA_WAV;
} else if (!strcmp (layout, "4xm")) {
id = CODEC_ID_ADPCM_4XM;
}
const gchar *layout;
layout = gst_structure_get_string (structure, "layout");
if (layout == NULL) {
/* break */
} else if (!strcmp (layout, "quicktime")) {
id = CODEC_ID_ADPCM_IMA_QT;
} else if (!strcmp (layout, "microsoft")) {
id = CODEC_ID_ADPCM_MS;
} else if (!strcmp (layout, "wav")) {
id = CODEC_ID_ADPCM_IMA_WAV;
} else if (!strcmp (layout, "4xm")) {
id = CODEC_ID_ADPCM_4XM;
}
if (id != CODEC_ID_NONE) {
......@@ -1513,8 +1352,8 @@ gst_ffmpeg_caps_to_codecid (GstCaps *caps,
}
if (id != CODEC_ID_NONE) {
char *str = g_strdup_printf("The id=%d belongs to this caps", id);
gst_caps_debug(caps, str);
char *str = gst_caps_to_string (caps);
GST_DEBUG ("The id=%d belongs to the caps %s", id, str);
g_free(str);
}
......
......@@ -49,7 +49,7 @@ gst_ffmpeg_codectype_to_caps (enum CodecType codec_type,
*/
enum CodecID
gst_ffmpeg_caps_to_codecid (GstCaps *caps,
gst_ffmpeg_caps_to_codecid (const GstCaps *caps,
AVCodecContext *context);
/* caps_to_codectype () transforms a GstCaps that belongs to
......@@ -58,7 +58,7 @@ gst_ffmpeg_caps_to_codecid (GstCaps *caps,
void
gst_ffmpeg_caps_to_codectype (enum CodecType type,
GstCaps *caps,
const GstCaps *caps,
AVCodecContext *context);
/* _formatid_to_caps () is meant for muxers/demuxers, it
......
......@@ -32,35 +32,38 @@
#include "gstffmpegcodecmap.h"
#define GST_TYPE_FFMPEGCSP \
GST_DEBUG_CATEGORY_STATIC (debug_ffmpeg_csp);
#define GST_CAT_DEFAULT debug_ffmpeg_csp
#define GST_TYPE_FFMPEG_CSP \
(gst_ffmpegcsp_get_type())
#define GST_FFMPEGCSP(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEGCSP,GstFFMpegCsp))
#define GST_FFMPEGCSP_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEGCSP,GstFFMpegCsp))
#define GST_IS_FFMPEGCSP(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEGCSP))
#define GST_IS_FFMPEGCSP_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGCSP))
#define GST_FFMPEG_CSP(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FFMPEG_CSP,GstFFMpegCsp))
#define GST_FFMPEG_CSP_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FFMPEG_CSP,GstFFMpegCsp))
#define GST_IS_FFMPEG_CSP(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FFMPEG_CSP))
#define GST_IS_FFMPEG_CSP_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEG_CSP))
typedef struct _GstFFMpegCsp GstFFMpegCsp;