gst/: First batch implementing audio and video codec tags in demuxers.

Original commit message from CVS:
2004-02-23  Julien MOUTTE  <julien@moutte.net>

* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps),
(gst_riff_create_audio_caps), (gst_riff_create_iavs_caps),
(gst_riff_create_video_template_caps),
(gst_riff_create_audio_template_caps),
(gst_riff_create_iavs_template_caps):
* gst-libs/gst/riff/riff-media.h:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_base_init),
(gst_asf_demux_audio_caps), (gst_asf_demux_add_audio_stream),
(gst_asf_demux_video_caps), (gst_asf_demux_add_video_stream):
* gst/avi/gstavidemux.c: (gst_avi_demux_add_stream):
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps),
(gst_matroska_demux_plugin_init): First batch implementing audio and
video codec tags in demuxers.
This commit is contained in:
Julien Moutte 2004-02-23 22:16:21 +00:00
parent b5ae6d8d8c
commit c74043423e
3 changed files with 85 additions and 13 deletions

View file

@ -1,3 +1,20 @@
2004-02-23 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps),
(gst_riff_create_audio_caps), (gst_riff_create_iavs_caps),
(gst_riff_create_video_template_caps),
(gst_riff_create_audio_template_caps),
(gst_riff_create_iavs_template_caps):
* gst-libs/gst/riff/riff-media.h:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_base_init),
(gst_asf_demux_audio_caps), (gst_asf_demux_add_audio_stream),
(gst_asf_demux_video_caps), (gst_asf_demux_add_video_stream):
* gst/avi/gstavidemux.c: (gst_avi_demux_add_stream):
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps),
(gst_matroska_demux_plugin_init): First batch implementing audio and
video codec tags in demuxers.
2004-02-22 Benjamin Otte <otte@gnome.org> 2004-02-22 Benjamin Otte <otte@gnome.org>
* ext/xine/Makefile.am: * ext/xine/Makefile.am:

View file

@ -863,26 +863,56 @@ gst_avi_demux_add_stream (GstAviDemux *avi)
/* create stream name + pad */ /* create stream name + pad */
switch (strh->type) { switch (strh->type) {
case GST_RIFF_FCC_vids: case GST_RIFF_FCC_vids:
{
char *codec_name = NULL;
GstTagList *list = gst_tag_list_new ();
padname = g_strdup_printf ("video_%02d", avi->num_v_streams); padname = g_strdup_printf ("video_%02d", avi->num_v_streams);
templ = gst_element_class_get_pad_template (klass, "video_%02d"); templ = gst_element_class_get_pad_template (klass, "video_%02d");
caps = gst_riff_create_video_caps (strf.vids->compression, strh, strf.vids); caps = gst_riff_create_video_caps (strf.vids->compression, strh,
strf.vids, &codec_name);
gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC,
codec_name, NULL);
gst_element_found_tags (GST_ELEMENT (avi), list);
gst_tag_list_free (list);
if (codec_name) g_free (codec_name);
g_free (strf.vids); g_free (strf.vids);
avi->num_v_streams++; avi->num_v_streams++;
break; break;
}
case GST_RIFF_FCC_auds: case GST_RIFF_FCC_auds:
{
char *codec_name = NULL;
GstTagList *list = gst_tag_list_new ();
padname = g_strdup_printf ("audio_%02d", avi->num_a_streams); padname = g_strdup_printf ("audio_%02d", avi->num_a_streams);
templ = gst_element_class_get_pad_template (klass, "audio_%02d"); templ = gst_element_class_get_pad_template (klass, "audio_%02d");
caps = gst_riff_create_audio_caps (strf.auds->format, strh, strf.auds); caps = gst_riff_create_audio_caps (strf.auds->format, strh, strf.auds,
&codec_name);
gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_AUDIO_CODEC,
codec_name, NULL);
gst_element_found_tags (GST_ELEMENT (avi), list);
gst_tag_list_free (list);
if (codec_name) g_free (codec_name);
g_free (strf.auds); g_free (strf.auds);
avi->num_a_streams++; avi->num_a_streams++;
break; break;
}
case GST_RIFF_FCC_iavs: case GST_RIFF_FCC_iavs:
{
char *codec_name = NULL;
GstTagList *list = gst_tag_list_new ();
padname = g_strdup_printf ("video_%02d", avi->num_v_streams); padname = g_strdup_printf ("video_%02d", avi->num_v_streams);
templ = gst_element_class_get_pad_template (klass, "video_%02d"); templ = gst_element_class_get_pad_template (klass, "video_%02d");
caps = gst_riff_create_iavs_caps (strh->fcc_handler, strh, strf.iavs); caps = gst_riff_create_iavs_caps (strh->fcc_handler, strh, strf.iavs,
&codec_name);
gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC,
codec_name, NULL);
gst_element_found_tags (GST_ELEMENT (avi), list);
gst_tag_list_free (list);
if (codec_name) g_free (codec_name);
g_free (strf.iavs); g_free (strf.iavs);
avi->num_v_streams++; avi->num_v_streams++;
break; break;
}
default: default:
g_assert (0); g_assert (0);
} }

View file

@ -94,12 +94,14 @@ static GstCaps *gst_matroska_demux_video_caps (GstMatroskaTrackVideoCont
*videocontext, *videocontext,
const gchar *codec_id, const gchar *codec_id,
gpointer data, gpointer data,
guint size); guint size,
GstMatroskaDemux *demux);
static GstCaps *gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext static GstCaps *gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext
*audiocontext, *audiocontext,
const gchar *codec_id, const gchar *codec_id,
gpointer data, gpointer data,
guint size); guint size,
GstMatroskaDemux *demux);
static GstCaps *gst_matroska_demux_complex_caps (GstMatroskaTrackComplexContext static GstCaps *gst_matroska_demux_complex_caps (GstMatroskaTrackComplexContext
*complexcontext, *complexcontext,
const gchar *codec_id, const gchar *codec_id,
@ -836,7 +838,8 @@ gst_matroska_demux_add_stream (GstMatroskaDemux *demux)
caps = gst_matroska_demux_video_caps (videocontext, caps = gst_matroska_demux_video_caps (videocontext,
context->codec_id, context->codec_id,
context->codec_priv, context->codec_priv,
context->codec_priv_size); context->codec_priv_size,
demux);
break; break;
} }
@ -848,7 +851,8 @@ gst_matroska_demux_add_stream (GstMatroskaDemux *demux)
caps = gst_matroska_demux_audio_caps (audiocontext, caps = gst_matroska_demux_audio_caps (audiocontext,
context->codec_id, context->codec_id,
context->codec_priv, context->codec_priv,
context->codec_priv_size); context->codec_priv_size,
demux);
break; break;
} }
@ -2164,7 +2168,8 @@ static GstCaps *
gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *videocontext, gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *videocontext,
const gchar *codec_id, const gchar *codec_id,
gpointer data, gpointer data,
guint size) guint size,
GstMatroskaDemux *demux)
{ {
GstMatroskaTrackContext *context = GstMatroskaTrackContext *context =
(GstMatroskaTrackContext *) videocontext; (GstMatroskaTrackContext *) videocontext;
@ -2174,6 +2179,9 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *videocontext,
gst_riff_strf_vids *vids = NULL; gst_riff_strf_vids *vids = NULL;
if (data) { if (data) {
char *codec_name = NULL;
GstTagList *list = gst_tag_list_new ();
vids = (gst_riff_strf_vids *) data; vids = (gst_riff_strf_vids *) data;
/* assure size is big enough */ /* assure size is big enough */
@ -2198,7 +2206,14 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *videocontext,
vids->num_colors = GUINT32_FROM_LE (vids->num_colors); vids->num_colors = GUINT32_FROM_LE (vids->num_colors);
vids->imp_colors = GUINT32_FROM_LE (vids->imp_colors); vids->imp_colors = GUINT32_FROM_LE (vids->imp_colors);
caps = gst_riff_create_video_caps (vids->compression, NULL, vids); caps = gst_riff_create_video_caps (vids->compression, NULL, vids,
&codec_name);
gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC,
codec_name, NULL);
if (GST_IS_ELEMENT (demux))
gst_element_found_tags (GST_ELEMENT (demux), list);
gst_tag_list_free (list);
if (codec_name) g_free (codec_name);
} else { } else {
caps = gst_riff_create_video_template_caps (); caps = gst_riff_create_video_template_caps ();
} }
@ -2330,7 +2345,8 @@ static GstCaps *
gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *audiocontext, gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *audiocontext,
const gchar *codec_id, const gchar *codec_id,
gpointer data, gpointer data,
guint size) guint size,
GstMatroskaDemux *demux)
{ {
GstMatroskaTrackContext *context = GstMatroskaTrackContext *context =
(GstMatroskaTrackContext *) audiocontext; (GstMatroskaTrackContext *) audiocontext;
@ -2396,6 +2412,9 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *audiocontext,
gst_riff_strf_auds *auds = NULL; gst_riff_strf_auds *auds = NULL;
if (data) { if (data) {
char *codec_name = NULL;
GstTagList *list = gst_tag_list_new ();
auds = (gst_riff_strf_auds *) data; auds = (gst_riff_strf_auds *) data;
/* little-endian -> byte-order */ /* little-endian -> byte-order */
@ -2406,7 +2425,13 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *audiocontext,
auds->blockalign = GUINT16_FROM_LE (auds->blockalign); auds->blockalign = GUINT16_FROM_LE (auds->blockalign);
auds->size = GUINT16_FROM_LE (auds->size); auds->size = GUINT16_FROM_LE (auds->size);
caps = gst_riff_create_audio_caps (auds->format, NULL, auds); caps = gst_riff_create_audio_caps (auds->format, NULL, auds, &codec_name);
gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_AUDIO_CODEC,
codec_name, NULL);
if (GST_IS_ELEMENT (demux))
gst_element_found_tags (GST_ELEMENT (demux), list);
gst_tag_list_free (list);
if (codec_name) g_free (codec_name);
} else { } else {
caps = gst_riff_create_audio_template_caps (); caps = gst_riff_create_audio_template_caps ();
} }
@ -2576,7 +2601,7 @@ gst_matroska_demux_plugin_init (GstPlugin *plugin)
/* video src template */ /* video src template */
videosrccaps = gst_caps_new_empty (); videosrccaps = gst_caps_new_empty ();
for (i = 0; video_id[i] != NULL; i++) { for (i = 0; video_id[i] != NULL; i++) {
temp = gst_matroska_demux_video_caps (NULL, video_id[i], NULL, 0); temp = gst_matroska_demux_video_caps (NULL, video_id[i], NULL, 0, NULL);
gst_caps_append (videosrccaps, temp); gst_caps_append (videosrccaps, temp);
} }
for (i = 0; complex_id[i] != NULL; i++) { for (i = 0; complex_id[i] != NULL; i++) {
@ -2591,7 +2616,7 @@ gst_matroska_demux_plugin_init (GstPlugin *plugin)
audiosrccaps = gst_caps_new_empty (); audiosrccaps = gst_caps_new_empty ();
/* audio src template */ /* audio src template */
for (i = 0; audio_id[i] != NULL; i++) { for (i = 0; audio_id[i] != NULL; i++) {
temp = gst_matroska_demux_audio_caps (NULL, audio_id[i], NULL, 0); temp = gst_matroska_demux_audio_caps (NULL, audio_id[i], NULL, 0, NULL);
gst_caps_append (audiosrccaps, temp); gst_caps_append (audiosrccaps, temp);
} }
audiosrctempl = gst_pad_template_new ("audio_%02d", audiosrctempl = gst_pad_template_new ("audio_%02d",