mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
ext/dvdread/stream_labels.c: new file
Original commit message from CVS: * ext/dvdread/stream_labels.c: new file * ext/dvdread/stream_labels.h: new file * ext/dvdread/Makefile.am: * ext/dvdread/dvdreadsrc.c: (_seek_title): Extract audio stream label from DVD IFO files. It only dump them on the console for now, still have to make playbin aware of them.
This commit is contained in:
parent
83dfa105bb
commit
ac51b9c42e
5 changed files with 287 additions and 3 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2005-01-09 Stephane LOEUILLET <stephane.loeuillet@tiscali.fr>
|
||||
|
||||
* ext/dvdread/stream_labels.c: new file
|
||||
* ext/dvdread/stream_labels.h: new file
|
||||
* ext/dvdread/Makefile.am:
|
||||
* ext/dvdread/dvdreadsrc.c: (_seek_title):
|
||||
Extract audio stream label from DVD IFO files.
|
||||
It only dump them on the console for now, still have to
|
||||
make playbin aware of them.
|
||||
|
||||
2005-01-09 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||
|
||||
* gst/playback/gstplaybasebin.c: (setup_source):
|
||||
|
|
|
@ -4,12 +4,12 @@ plugin_LTLIBRARIES = libgstdvdreadsrc.la
|
|||
## FIXME: the extra option, what do we do with it ?
|
||||
## AM_CFLAGS = -D_LARGEFILE64_SOURCE $(LIBDVDREADCFLAGS)
|
||||
|
||||
libgstdvdreadsrc_la_SOURCES = dvdreadsrc.c
|
||||
libgstdvdreadsrc_la_SOURCES = dvdreadsrc.c stream_labels.c
|
||||
libgstdvdreadsrc_la_CFLAGS = $(GST_CFLAGS)
|
||||
libgstdvdreadsrc_la_LIBADD = $(DVDREAD_LIBS)
|
||||
libgstdvdreadsrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||
|
||||
noinst_HEADERS = dvdreadsrc.h
|
||||
noinst_HEADERS = dvdreadsrc.h stream_labels.h
|
||||
|
||||
EXTRA_DIST = \
|
||||
README \
|
||||
|
|
|
@ -37,7 +37,8 @@
|
|||
//#include <linux/cdrom.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <dvdreadsrc.h>
|
||||
#include "dvdreadsrc.h"
|
||||
#include "stream_labels.h"
|
||||
|
||||
#include <dvdread/dvd_reader.h>
|
||||
#include <dvdread/ifo_types.h>
|
||||
|
@ -592,6 +593,8 @@ _close (DVDReadSrcPrivate * priv)
|
|||
static int
|
||||
_seek_title (DVDReadSrcPrivate * priv, int title, int angle)
|
||||
{
|
||||
GHashTable *languagelist = NULL;
|
||||
|
||||
/**
|
||||
* Make sure our title number is valid.
|
||||
*/
|
||||
|
@ -653,6 +656,14 @@ _seek_title (DVDReadSrcPrivate * priv, int title, int angle)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* Get stream labels for all audio and subtitle streams */
|
||||
languagelist = dvdreadsrc_init_languagelist ();
|
||||
|
||||
dvdreadsrc_get_audio_stream_labels (priv->vts_file, languagelist);
|
||||
dvdreadsrc_get_subtitle_stream_labels (priv->vts_file, languagelist);
|
||||
|
||||
g_hash_table_destroy (languagelist);
|
||||
|
||||
GST_LOG ("Opened title %d, angle %d", title, angle);
|
||||
|
||||
return 0;
|
||||
|
|
237
ext/dvdread/stream_labels.c
Normal file
237
ext/dvdread/stream_labels.c
Normal file
|
@ -0,0 +1,237 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <2005> Stephane Loeuillet <stephane.loeuillet@tiscali.fr>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "dvdreadsrc.h"
|
||||
#include "stream_labels.h"
|
||||
#include "gst/gst-i18n-plugin.h"
|
||||
|
||||
GHashTable *
|
||||
dvdreadsrc_init_languagelist (void)
|
||||
{
|
||||
GHashTable *languagelist = NULL;
|
||||
|
||||
languagelist = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
g_hash_table_insert (languagelist, "aa", _("Afar"));
|
||||
g_hash_table_insert (languagelist, "ab", _("Abkhazian"));
|
||||
g_hash_table_insert (languagelist, "af", _("Afrikaans"));
|
||||
g_hash_table_insert (languagelist, "am", _("Amharic"));
|
||||
g_hash_table_insert (languagelist, "ar", _("Arabic"));
|
||||
g_hash_table_insert (languagelist, "as", _("Assamese"));
|
||||
g_hash_table_insert (languagelist, "ax", _("Aymara"));
|
||||
g_hash_table_insert (languagelist, "az", _("Azerbaijani"));
|
||||
g_hash_table_insert (languagelist, "ba", _("Bashkir"));
|
||||
g_hash_table_insert (languagelist, "be", _("Byelorussian"));
|
||||
g_hash_table_insert (languagelist, "bg", _("Bulgarian"));
|
||||
g_hash_table_insert (languagelist, "bh", _("Bislama"));
|
||||
g_hash_table_insert (languagelist, "bn", _("Bengali"));
|
||||
g_hash_table_insert (languagelist, "bo", _("Tibetan"));
|
||||
g_hash_table_insert (languagelist, "br", _("Breton"));
|
||||
g_hash_table_insert (languagelist, "ca", _("Catalan"));
|
||||
g_hash_table_insert (languagelist, "co", _("Corsican"));
|
||||
g_hash_table_insert (languagelist, "cs", _("Czech"));
|
||||
g_hash_table_insert (languagelist, "cy", _("Welsh"));
|
||||
g_hash_table_insert (languagelist, "da", _("Danish"));
|
||||
g_hash_table_insert (languagelist, "de", _("German"));
|
||||
g_hash_table_insert (languagelist, "dz", _("Bhutani"));
|
||||
g_hash_table_insert (languagelist, "el", _("Greek"));
|
||||
g_hash_table_insert (languagelist, "en", _("English"));
|
||||
g_hash_table_insert (languagelist, "eo", _("Esperanto"));
|
||||
g_hash_table_insert (languagelist, "es", _("Spanish"));
|
||||
g_hash_table_insert (languagelist, "et", _("Estonian"));
|
||||
g_hash_table_insert (languagelist, "eu", _("Basque"));
|
||||
g_hash_table_insert (languagelist, "fa", _("Persian"));
|
||||
g_hash_table_insert (languagelist, "fi", _("Finnish"));
|
||||
g_hash_table_insert (languagelist, "fj", _("Fiji"));
|
||||
g_hash_table_insert (languagelist, "fo", _("Faeroese"));
|
||||
g_hash_table_insert (languagelist, "fr", _("French"));
|
||||
g_hash_table_insert (languagelist, "fy", _("Frisian"));
|
||||
g_hash_table_insert (languagelist, "ga", _("Irish"));
|
||||
g_hash_table_insert (languagelist, "gd", _("Scots/Gaelic"));
|
||||
g_hash_table_insert (languagelist, "gl", _("Galician"));
|
||||
g_hash_table_insert (languagelist, "gn", _("Guarani"));
|
||||
g_hash_table_insert (languagelist, "gu", _("Gujarati"));
|
||||
g_hash_table_insert (languagelist, "ha", _("Hausa"));
|
||||
g_hash_table_insert (languagelist, "hi", _("Hindi"));
|
||||
g_hash_table_insert (languagelist, "hr", _("Croatian"));
|
||||
g_hash_table_insert (languagelist, "hu", _("Hungarian"));
|
||||
g_hash_table_insert (languagelist, "hy", _("Armenian"));
|
||||
g_hash_table_insert (languagelist, "ia", _("Interlingua"));
|
||||
g_hash_table_insert (languagelist, "in", _("Indonesian"));
|
||||
g_hash_table_insert (languagelist, "is", _("Icelandic"));
|
||||
g_hash_table_insert (languagelist, "it", _("Italian"));
|
||||
g_hash_table_insert (languagelist, "iw", _("Hebrew"));
|
||||
g_hash_table_insert (languagelist, "ja", _("Japanese"));
|
||||
g_hash_table_insert (languagelist, "ji", _("Yiddish"));
|
||||
g_hash_table_insert (languagelist, "jw", _("Javanese"));
|
||||
g_hash_table_insert (languagelist, "ka", _("Georgian"));
|
||||
g_hash_table_insert (languagelist, "kk", _("Kazakh"));
|
||||
g_hash_table_insert (languagelist, "kl", _("Greenlandic"));
|
||||
g_hash_table_insert (languagelist, "km", _("Cambodian"));
|
||||
g_hash_table_insert (languagelist, "kn", _("Kannada"));
|
||||
g_hash_table_insert (languagelist, "ko", _("Korean"));
|
||||
g_hash_table_insert (languagelist, "ks", _("Kashmiri"));
|
||||
g_hash_table_insert (languagelist, "ku", _("Kurdish"));
|
||||
g_hash_table_insert (languagelist, "ky", _("Kirghiz"));
|
||||
g_hash_table_insert (languagelist, "la", _("Latin"));
|
||||
g_hash_table_insert (languagelist, "ln", _("Lingala"));
|
||||
g_hash_table_insert (languagelist, "lo", _("Laothian"));
|
||||
g_hash_table_insert (languagelist, "lt", _("Lithuanian"));
|
||||
g_hash_table_insert (languagelist, "lv", _("Latvian/Lettish"));
|
||||
g_hash_table_insert (languagelist, "mg", _("Malagasy"));
|
||||
g_hash_table_insert (languagelist, "mi", _("Maori"));
|
||||
g_hash_table_insert (languagelist, "mk", _("Macedonian"));
|
||||
g_hash_table_insert (languagelist, "ml", _("Malayalam"));
|
||||
g_hash_table_insert (languagelist, "mn", _("Mongolian"));
|
||||
g_hash_table_insert (languagelist, "mo", _("Moldavian"));
|
||||
g_hash_table_insert (languagelist, "mr", _("Marathi"));
|
||||
g_hash_table_insert (languagelist, "ms", _("Malay"));
|
||||
g_hash_table_insert (languagelist, "mt", _("Maltese"));
|
||||
g_hash_table_insert (languagelist, "my", _("Burmese"));
|
||||
g_hash_table_insert (languagelist, "na", _("Nauru"));
|
||||
g_hash_table_insert (languagelist, "ne", _("Nepali"));
|
||||
g_hash_table_insert (languagelist, "nl", _("Dutch"));
|
||||
g_hash_table_insert (languagelist, "no", _("Norwegian"));
|
||||
g_hash_table_insert (languagelist, "or", _("Oriya"));
|
||||
g_hash_table_insert (languagelist, "pa", _("Punjabi"));
|
||||
g_hash_table_insert (languagelist, "pl", _("Polish"));
|
||||
g_hash_table_insert (languagelist, "ps", _("Pashto/Pushto"));
|
||||
g_hash_table_insert (languagelist, "pt", _("Portuguese"));
|
||||
g_hash_table_insert (languagelist, "qu", _("Quechua"));
|
||||
g_hash_table_insert (languagelist, "rm", _("Rhaeto-Romance"));
|
||||
g_hash_table_insert (languagelist, "ro", _("Romanian"));
|
||||
g_hash_table_insert (languagelist, "ru", _("Russian"));
|
||||
g_hash_table_insert (languagelist, "sa", _("Kinyarwanda"));
|
||||
g_hash_table_insert (languagelist, "sd", _("Sanskrit"));
|
||||
g_hash_table_insert (languagelist, "sh", _("Serbo-Croatian"));
|
||||
g_hash_table_insert (languagelist, "si", _("Singhalese"));
|
||||
g_hash_table_insert (languagelist, "sk", _("Slovak"));
|
||||
g_hash_table_insert (languagelist, "sl", _("Slovenian"));
|
||||
g_hash_table_insert (languagelist, "sm", _("Samoan"));
|
||||
g_hash_table_insert (languagelist, "sn", _("Shona"));
|
||||
g_hash_table_insert (languagelist, "so", _("Somali"));
|
||||
g_hash_table_insert (languagelist, "sq", _("Albanian"));
|
||||
g_hash_table_insert (languagelist, "sr", _("Serbian"));
|
||||
g_hash_table_insert (languagelist, "su", _("Sundanese"));
|
||||
g_hash_table_insert (languagelist, "sv", _("Swedish"));
|
||||
g_hash_table_insert (languagelist, "sw", _("Swahili"));
|
||||
g_hash_table_insert (languagelist, "ta", _("Tamil"));
|
||||
g_hash_table_insert (languagelist, "te", _("Tegulu"));
|
||||
g_hash_table_insert (languagelist, "tg", _("Tajik"));
|
||||
g_hash_table_insert (languagelist, "th", _("Thai"));
|
||||
g_hash_table_insert (languagelist, "ti", _("Tigrinya"));
|
||||
g_hash_table_insert (languagelist, "tk", _("Turkmen"));
|
||||
g_hash_table_insert (languagelist, "tl", _("Tagalog"));
|
||||
g_hash_table_insert (languagelist, "to", _("Tonga"));
|
||||
g_hash_table_insert (languagelist, "tr", _("Turkish"));
|
||||
g_hash_table_insert (languagelist, "tt", _("Tatar"));
|
||||
g_hash_table_insert (languagelist, "tw", _("Twi"));
|
||||
g_hash_table_insert (languagelist, "uk", _("Ukrainian"));
|
||||
g_hash_table_insert (languagelist, "ur", _("Urdu"));
|
||||
g_hash_table_insert (languagelist, "uz", _("Uzbek"));
|
||||
g_hash_table_insert (languagelist, "vi", _("Vietnamese"));
|
||||
g_hash_table_insert (languagelist, "vo", _("Volapuk"));
|
||||
g_hash_table_insert (languagelist, "wo", _("Wolof"));
|
||||
g_hash_table_insert (languagelist, "xh", _("Xhosa"));
|
||||
g_hash_table_insert (languagelist, "yo", _("Yoruba"));
|
||||
g_hash_table_insert (languagelist, "zh", _("Chinese"));
|
||||
g_hash_table_insert (languagelist, "zu", _("Zulu"));
|
||||
|
||||
return languagelist;
|
||||
}
|
||||
|
||||
void
|
||||
dvdreadsrc_get_audio_stream_labels (ifo_handle_t * vts_file,
|
||||
GHashTable * languagelist)
|
||||
{
|
||||
GList *audio_stream_label = g_list_alloc ();
|
||||
|
||||
if (vts_file->vts_pgcit) {
|
||||
int i;
|
||||
|
||||
/* 8 audio streams maximum */
|
||||
for (i = 0; i < 8; i++) {
|
||||
GString *streamlabel;
|
||||
guchar *language, *format, *channel_nb;
|
||||
guchar language_code[3] = "??";
|
||||
|
||||
if (vts_file->vts_pgcit->pgci_srp[0].pgc->audio_control[i] & 0x8000) {
|
||||
audio_attr_t *audio = &vts_file->vtsi_mat->vts_audio_attr[i];
|
||||
guint16 language_id = 0;
|
||||
|
||||
if (audio->lang_type == 1) {
|
||||
language_id = audio->lang_code;
|
||||
snprintf (language_code, 3, "%c%c", (language_id >> 8),
|
||||
(language_id & 0xFF));
|
||||
}
|
||||
|
||||
language = g_hash_table_lookup (languagelist, language_code);
|
||||
if (!language) {
|
||||
language = g_strdup ("?");
|
||||
}
|
||||
|
||||
switch (audio->audio_format) {
|
||||
case 0:
|
||||
format = g_strdup (_("Dolby AC-3"));
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
format = g_strdup (_("MPEG layer I, II or III"));
|
||||
break;
|
||||
case 4:
|
||||
format = g_strdup (_("LCPM"));
|
||||
break;
|
||||
case 6:
|
||||
format = g_strdup (_("Digital Theatre System"));
|
||||
break;
|
||||
default:
|
||||
format = g_strdup ("?");
|
||||
}
|
||||
|
||||
switch (audio->channels) {
|
||||
case 1:
|
||||
channel_nb = g_strdup (_("Stereo"));
|
||||
break;
|
||||
case 5:
|
||||
channel_nb = g_strdup (_("5.1"));
|
||||
break;
|
||||
default:
|
||||
format = g_strdup ("?");
|
||||
}
|
||||
streamlabel = g_string_new ("");
|
||||
g_string_printf (streamlabel, "%u : %s, %s %s", i + 1, language, format,
|
||||
channel_nb);
|
||||
audio_stream_label = g_list_append (audio_stream_label, streamlabel); /* "French, Dolby AC-3 Stereo" */
|
||||
|
||||
printf ("%u : %s, %s %s\n", i + 1, language, format, channel_nb);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
dvdreadsrc_get_subtitle_stream_labels (ifo_handle_t * vts_file,
|
||||
GHashTable * languagelist)
|
||||
{
|
||||
|
||||
}
|
26
ext/dvdread/stream_labels.h
Normal file
26
ext/dvdread/stream_labels.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <2005> Stephane Loeuillet <stephane.loeuillet@tiscali.fr>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <dvdread/ifo_types.h>
|
||||
|
||||
#include "dvdreadsrc.h"
|
||||
|
||||
GHashTable * dvdreadsrc_init_languagelist (void);
|
||||
void dvdreadsrc_get_audio_stream_labels (ifo_handle_t *vts_file, GHashTable * languagelist);
|
||||
void dvdreadsrc_get_subtitle_stream_labels (ifo_handle_t *vts_file, GHashTable * languagelist);
|
Loading…
Reference in a new issue