summaryrefslogtreecommitdiffstats
path: root/gst-libs/gst/riff/riff-media.c
diff options
context:
space:
mode:
Diffstat (limited to 'gst-libs/gst/riff/riff-media.c')
-rw-r--r--gst-libs/gst/riff/riff-media.c294
1 files changed, 104 insertions, 190 deletions
diff --git a/gst-libs/gst/riff/riff-media.c b/gst-libs/gst/riff/riff-media.c
index eeb6fd63..cbeb3492 100644
--- a/gst-libs/gst/riff/riff-media.c
+++ b/gst-libs/gst/riff/riff-media.c
@@ -36,40 +36,28 @@ gst_riff_create_video_caps (guint32 codec_fcc,
switch (codec_fcc) {
case GST_MAKE_FOURCC('I','4','2','0'):
case GST_MAKE_FOURCC('Y','U','Y','2'):
- caps = GST_CAPS_NEW (
- "riff_video_raw",
- "video/x-raw-yuv",
- "format", GST_PROPS_FOURCC (codec_fcc)
- );
+ caps = gst_caps_new_simple ("video/x-raw-yuv",
+ "format", GST_TYPE_FOURCC, codec_fcc,
+ NULL);
break;
case GST_MAKE_FOURCC('M','J','P','G'): /* YUY2 MJPEG */
case GST_MAKE_FOURCC('J','P','E','G'): /* generic (mostly RGB) MJPEG */
case GST_MAKE_FOURCC('P','I','X','L'): /* Miro/Pinnacle fourccs */
case GST_MAKE_FOURCC('V','I','X','L'): /* Miro/Pinnacle fourccs */
- caps = GST_CAPS_NEW (
- "riff_video_jpeg",
- "video/x-jpeg",
- NULL
- );
+ caps = gst_caps_new_simple ("video/x-jpeg", NULL);
break;
case GST_MAKE_FOURCC('H','F','Y','U'):
- caps = GST_CAPS_NEW (
- "riff_video_hfyu",
- "video/x-huffyuv",
- NULL
- );
+ caps = gst_caps_new_simple ( "video/x-huffyuv", NULL);
break;
case GST_MAKE_FOURCC('M','P','E','G'):
case GST_MAKE_FOURCC('M','P','G','I'):
- caps = GST_CAPS_NEW (
- "riff_video_mpeg1",
- "video/mpeg",
- "systemstream", GST_PROPS_BOOLEAN (FALSE),
- "mpegversion", GST_PROPS_BOOLEAN (1)
- );
+ caps = gst_caps_new_simple ("video/mpeg",
+ "systemstream", G_TYPE_BOOLEAN, FALSE,
+ "mpegversion", G_TYPE_BOOLEAN, 1,
+ NULL);
break;
case GST_MAKE_FOURCC('H','2','6','3'):
@@ -79,138 +67,98 @@ gst_riff_create_video_caps (guint32 codec_fcc,
case GST_MAKE_FOURCC('V','D','O','W'):
case GST_MAKE_FOURCC('V','I','V','O'):
case GST_MAKE_FOURCC('x','2','6','3'):
- caps = GST_CAPS_NEW (
- "riff_video_h263",
- "video/x-h263",
- NULL
- );
+ caps = gst_caps_new_simple ("video/x-h263", NULL);
break;
case GST_MAKE_FOURCC('D','I','V','3'):
case GST_MAKE_FOURCC('D','I','V','4'):
case GST_MAKE_FOURCC('D','I','V','5'):
- caps = GST_CAPS_NEW (
- "riff_video_divx3",
- "video/x-divx",
- "divxversion", GST_PROPS_INT(3)
- );
+ caps = gst_caps_new_simple ("video/x-divx",
+ "divxversion", G_TYPE_INT, 3,
+ NULL);
break;
case GST_MAKE_FOURCC('d','i','v','x'):
case GST_MAKE_FOURCC('D','I','V','X'):
case GST_MAKE_FOURCC('D','X','5','0'):
- caps = GST_CAPS_NEW (
- "riff_video_divx45",
- "video/x-divx",
- "divxversion", GST_PROPS_INT(5)
- );
+ caps = gst_caps_new_simple ("video/x-divx",
+ "divxversion", G_TYPE_INT, 5,
+ NULL);
break;
case GST_MAKE_FOURCC('X','V','I','D'):
case GST_MAKE_FOURCC('x','v','i','d'):
- caps = GST_CAPS_NEW (
- "riff_video_xvid",
- "video/x-xvid",
- NULL
- );
+ caps = gst_caps_new_simple ("video/x-xvid", NULL);
break;
case GST_MAKE_FOURCC('M','P','G','4'):
- caps = GST_CAPS_NEW (
- "riff_video_msmpeg41",
- "video/x-msmpeg",
- "msmpegversion", GST_PROPS_INT (41)
- );
+ caps = gst_caps_new_simple ("video/x-msmpeg",
+ "msmpegversion", G_TYPE_INT, 41,
+ NULL);
break;
case GST_MAKE_FOURCC('M','P','4','2'):
- caps = GST_CAPS_NEW (
- "riff_video_msmpeg42",
- "video/x-msmpeg",
- "msmpegversion", GST_PROPS_INT (42)
- );
+ caps = gst_caps_new_simple ("video/x-msmpeg",
+ "msmpegversion", G_TYPE_INT, 42,
+ NULL);
break;
case GST_MAKE_FOURCC('M','P','4','3'):
- caps = GST_CAPS_NEW (
- "riff_video_msmpeg43",
- "video/x-msmpeg",
- "msmpegversion", GST_PROPS_INT (43)
- );
+ caps = gst_caps_new_simple ("video/x-msmpeg",
+ "msmpegversion", G_TYPE_INT, 43,
+ NULL);
break;
case GST_MAKE_FOURCC('3','I','V','1'):
case GST_MAKE_FOURCC('3','I','V','2'):
- caps = GST_CAPS_NEW (
- "riff_video_3ivx",
- "video/x-3ivx",
- NULL
- );
+ caps = gst_caps_new_simple ( "video/x-3ivx", NULL);
break;
case GST_MAKE_FOURCC('D','V','S','D'):
case GST_MAKE_FOURCC('d','v','s','d'):
- caps = GST_CAPS_NEW (
- "riff_video_dv",
- "video/x-dv",
- "systemstream", GST_PROPS_BOOLEAN (FALSE)
- );
+ caps = gst_caps_new_simple ("video/x-dv",
+ "systemstream", G_TYPE_BOOLEAN, FALSE,
+ NULL);
break;
case GST_MAKE_FOURCC('W','M','V','1'):
- caps = GST_CAPS_NEW (
- "riff_video_wmv1",
- "video/x-wmv",
- "wmvversion", GST_PROPS_INT (1)
- );
+ caps = gst_caps_new_simple ("video/x-wmv",
+ "wmvversion", G_TYPE_INT, 1,
+ NULL);
break;
case GST_MAKE_FOURCC('W','M','V','2'):
- caps = GST_CAPS_NEW (
- "riff_video_wmv2",
- "video/x-wmv",
- "wmvversion", GST_PROPS_INT (2)
- );
+ caps = gst_caps_new_simple ("video/x-wmv",
+ "wmvversion", G_TYPE_INT, 2,
+ NULL);
break;
default:
GST_WARNING ("Unkown video fourcc " GST_FOURCC_FORMAT,
GST_FOURCC_ARGS (codec_fcc));
- break;
+ return NULL;
}
- /* add general properties */
- if (caps != NULL) {
- GstPropsEntry *framerate, *width, *height;
-
- if (strh != NULL) {
- gfloat fps = 1. * strh->rate / strh->scale;
-
- framerate = gst_props_entry_new ("framerate",
- GST_PROPS_FLOAT (fps));
- } else {
- framerate = gst_props_entry_new ("framerate",
- GST_PROPS_FLOAT_RANGE (0., G_MAXFLOAT));
- }
-
- if (strf != NULL) {
- width = gst_props_entry_new ("width",
- GST_PROPS_INT (strf->width));
- height = gst_props_entry_new ("height",
- GST_PROPS_INT (strf->height));
- } else {
- width = gst_props_entry_new ("width",
- GST_PROPS_INT_RANGE (16, 4096));
- height = gst_props_entry_new ("height",
- GST_PROPS_INT_RANGE (16, 4096));
- }
-
- if (!caps->properties)
- caps->properties = gst_props_empty_new ();
-
- gst_props_add_entry (caps->properties, width);
- gst_props_add_entry (caps->properties, height);
- gst_props_add_entry (caps->properties, framerate);
+ if (strh != NULL) {
+ gfloat fps = 1. * strh->rate / strh->scale;
+
+ gst_caps_set_simple (caps, "framerate", G_TYPE_DOUBLE, fps, NULL);
+ } else {
+ gst_caps_set_simple (caps,
+ "framerate", GST_TYPE_DOUBLE_RANGE, 0., G_MAXDOUBLE,
+ NULL);
+ }
+
+ if (strf != NULL) {
+ gst_caps_set_simple (caps,
+ "width", G_TYPE_INT, strf->width,
+ "height", G_TYPE_INT, strf->height,
+ NULL);
+ } else {
+ gst_caps_set_simple (caps,
+ "width", GST_TYPE_INT_RANGE, 16, 4096,
+ "height", GST_TYPE_INT_RANGE, 16, 4096,
+ NULL);
}
return caps;
@@ -225,57 +173,38 @@ gst_riff_create_audio_caps (guint16 codec_id,
switch (codec_id) {
case GST_RIFF_WAVE_FORMAT_MPEGL3: /* mp3 */
- caps = GST_CAPS_NEW ("riff_audio_mp1l3",
- "audio/mpeg",
- "mpegversion", GST_PROPS_INT (1),
- "layer", GST_PROPS_INT (3));
+ caps = gst_caps_new_simple ("audio/mpeg",
+ "mpegversion", G_TYPE_INT, 1,
+ "layer", G_TYPE_INT, 3,
+ NULL);
break;
case GST_RIFF_WAVE_FORMAT_MPEGL12: /* mp1 or mp2 */
- caps = GST_CAPS_NEW ("riff_audio_mp1l12",
- "audio/mpeg",
- "mpegversion", GST_PROPS_INT (1),
- "layer", GST_PROPS_INT (2));
+ caps = gst_caps_new_simple ("audio/mpeg",
+ "mpegversion", G_TYPE_INT, 1,
+ "layer", G_TYPE_INT, 2,
+ NULL);
break;
- case GST_RIFF_WAVE_FORMAT_PCM: /* PCM/wav */ {
- GstPropsEntry *width = NULL, *depth = NULL, *signedness = NULL;
-
+ case GST_RIFF_WAVE_FORMAT_PCM: /* PCM/wav */
if (strf != NULL) {
gint ba = GUINT16_FROM_LE (strf->blockalign);
gint ch = GUINT16_FROM_LE (strf->channels);
gint ws = GUINT16_FROM_LE (strf->size);
- width = gst_props_entry_new ("width",
- GST_PROPS_INT (ba * 8 / ch));
- depth = gst_props_entry_new ("depth",
- GST_PROPS_INT (ws));
- signedness = gst_props_entry_new ("signed",
- GST_PROPS_BOOLEAN (ws != 8));
+ caps = gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
+ "width", G_TYPE_INT, (int)(ba * 8 / ch),
+ "depth", G_TYPE_INT, ws,
+ "signed", G_TYPE_BOOLEAN, ws != 8,
+ NULL);
} else {
- signedness = gst_props_entry_new ("signed",
- GST_PROPS_LIST (
- GST_PROPS_BOOLEAN (TRUE),
- GST_PROPS_BOOLEAN (FALSE)));
- width = gst_props_entry_new ("width",
- GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)));
- depth = gst_props_entry_new ("depth",
- GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)));
+ caps = gst_caps_from_string ("audio/x-raw-int, "
+ "endianness = (int) LITTLE_ENDIAN, "
+ "signed = (boolean) { true, false }, "
+ "width = (int) { 8, 16 }, "
+ "height = (int) { 8, 16 }");
}
-
- caps = GST_CAPS_NEW ("riff_audio_pcm",
- "audio/x-raw-int",
- "endianness",
- GST_PROPS_INT (G_LITTLE_ENDIAN));
- gst_props_add_entry (caps->properties, width);
- gst_props_add_entry (caps->properties, depth);
- gst_props_add_entry (caps->properties, signedness);
-
- }
break;
case GST_RIFF_WAVE_FORMAT_MULAW:
@@ -283,9 +212,7 @@ gst_riff_create_audio_caps (guint16 codec_id,
GST_WARNING ("invalid depth (%d) of mulaw audio, overwriting.",
strf->size);
}
- caps = GST_CAPS_NEW ("riff_audio_mulaw",
- "audio/x-mulaw",
- NULL);
+ caps = gst_caps_new_simple ("audio/x-mulaw", NULL);
break;
case GST_RIFF_WAVE_FORMAT_ALAW:
@@ -293,9 +220,7 @@ gst_riff_create_audio_caps (guint16 codec_id,
GST_WARNING ("invalid depth (%d) of alaw audio, overwriting.",
strf->size);
}
- caps = GST_CAPS_NEW ("riff_audio_alaw",
- "audio/x-alaw",
- NULL);
+ caps = gst_caps_new_simple ("audio/x-alaw", NULL);
break;
case GST_RIFF_WAVE_FORMAT_VORBIS1: /* ogg/vorbis mode 1 */
@@ -304,15 +229,11 @@ gst_riff_create_audio_caps (guint16 codec_id,
case GST_RIFF_WAVE_FORMAT_VORBIS1PLUS: /* ogg/vorbis mode 1+ */
case GST_RIFF_WAVE_FORMAT_VORBIS2PLUS: /* ogg/vorbis mode 2+ */
case GST_RIFF_WAVE_FORMAT_VORBIS3PLUS: /* ogg/vorbis mode 3+ */
- caps = GST_CAPS_NEW ("riff_audio_vorbis",
- "audio/x-vorbis",
- NULL);
+ caps = gst_caps_new_simple ("audio/x-vorbis", NULL);
break;
case GST_RIFF_WAVE_FORMAT_A52:
- caps = GST_CAPS_NEW ("riff_audio_ac3",
- "audio/x-ac3",
- NULL);
+ caps = gst_caps_new_simple ("audio/x-ac3", NULL);
break;
default:
@@ -321,26 +242,16 @@ gst_riff_create_audio_caps (guint16 codec_id,
break;
}
- if (caps != NULL) {
- GstPropsEntry *samplerate, *channels;
-
- if (strf != NULL) {
- samplerate = gst_props_entry_new ("rate",
- GST_PROPS_INT (strf->rate));
- channels = gst_props_entry_new ("channels",
- GST_PROPS_INT (strf->channels));
- } else {
- samplerate = gst_props_entry_new ("rate",
- GST_PROPS_INT_RANGE (8000, 96000));
- channels = gst_props_entry_new ("channels",
- GST_PROPS_INT_RANGE (1, 2));
- }
-
- if (!caps->properties)
- caps->properties = gst_props_empty_new ();
-
- gst_props_add_entry (caps->properties, samplerate);
- gst_props_add_entry (caps->properties, channels);
+ if (strf != NULL) {
+ gst_caps_set_simple (caps,
+ "rate", G_TYPE_INT, strf->rate,
+ "channels", G_TYPE_INT, strf->channels,
+ NULL);
+ } else {
+ gst_caps_set_simple (caps,
+ "rate", GST_TYPE_INT_RANGE, 8000, 96000,
+ "channels", GST_TYPE_INT_RANGE, 1, 2,
+ NULL);
}
return caps;
@@ -357,14 +268,13 @@ gst_riff_create_iavs_caps (guint32 codec_fcc,
/* is this correct? */
case GST_MAKE_FOURCC ('D','V','S','D'):
case GST_MAKE_FOURCC ('d','v','s','d'):
- caps = GST_CAPS_NEW ("riff_iavs_dv",
- "video/x-dv",
- "systemstream", GST_PROPS_BOOLEAN (TRUE));
+ caps = gst_caps_new_simple ("video/x-dv",
+ "systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
default:
GST_WARNING ("Unkown IAVS fourcc " GST_FOURCC_FORMAT,
GST_FOURCC_ARGS (codec_fcc));
- break;
+ return NULL;
}
return caps;
@@ -398,12 +308,13 @@ gst_riff_create_video_template_caps (void)
0
};
guint i;
- GstCaps *caps = NULL, *one;
+ GstCaps *caps, *one;
+ caps = gst_caps_new_empty ();
for (i = 0; tags[i] != 0; i++) {
one = gst_riff_create_video_caps (tags[i], NULL, NULL);
if (one)
- caps = gst_caps_append (caps, one);
+ gst_caps_append (caps, one);
}
return caps;
@@ -424,12 +335,13 @@ gst_riff_create_audio_template_caps (void)
0
};
guint i;
- GstCaps *caps = NULL, *one;
+ GstCaps *caps, *one;
+ caps = gst_caps_new_empty ();
for (i = 0; tags[i] != 0; i++) {
one = gst_riff_create_audio_caps (tags[i], NULL, NULL);
if (one)
- caps = gst_caps_append (caps, one);
+ gst_caps_append (caps, one);
}
return caps;
@@ -444,13 +356,15 @@ gst_riff_create_iavs_template_caps (void)
0
};
guint i;
- GstCaps *caps = NULL, *one;
+ GstCaps *caps, *one;
+ caps = gst_caps_new_empty ();
for (i = 0; tags[i] != 0; i++) {
one = gst_riff_create_iavs_caps (tags[i], NULL, NULL);
if (one)
- caps = gst_caps_append (caps, one);
+ gst_caps_append (caps, one);
}
return caps;
}
+