Commit 2eecb04c authored by Shaun Ren's avatar Shaun Ren Committed by Alexandre Julliard

winegstreamer: Map MF_SD_LANGUAGE to ISO 639-1 for QuickTime media.

For QuickTime media, MF_SD_LANGUAGE contains the ISO 639-1-mapped language code. Some games such as Borderlands 3 expect this behaviour. In order to determine the type of the media, we store the demuxer caps in the wg_parser structure.
parent 4a9c72b8
...@@ -2563,10 +2563,10 @@ Some influential environment variables: ...@@ -2563,10 +2563,10 @@ Some influential environment variables:
PULSE_LIBS Linker flags for libpulse, overriding pkg-config PULSE_LIBS Linker flags for libpulse, overriding pkg-config
GSTREAMER_CFLAGS GSTREAMER_CFLAGS
C compiler flags for gstreamer-1.0 gstreamer-video-1.0 C compiler flags for gstreamer-1.0 gstreamer-video-1.0
gstreamer-audio-1.0, overriding pkg-config gstreamer-audio-1.0 gstreamer-tag-1.0, overriding pkg-config
GSTREAMER_LIBS GSTREAMER_LIBS
Linker flags for gstreamer-1.0 gstreamer-video-1.0 Linker flags for gstreamer-1.0 gstreamer-video-1.0
gstreamer-audio-1.0, overriding pkg-config gstreamer-audio-1.0 gstreamer-tag-1.0, overriding pkg-config
UDEV_CFLAGS C compiler flags for libudev, overriding pkg-config UDEV_CFLAGS C compiler flags for libudev, overriding pkg-config
UDEV_LIBS Linker flags for libudev, overriding pkg-config UDEV_LIBS Linker flags for libudev, overriding pkg-config
UNWIND_CFLAGS UNWIND_CFLAGS
...@@ -16919,7 +16919,7 @@ if ${GSTREAMER_CFLAGS:+false} : ...@@ -16919,7 +16919,7 @@ if ${GSTREAMER_CFLAGS:+false} :
then : then :
if test ${PKG_CONFIG+y} if test ${PKG_CONFIG+y}
then : then :
GSTREAMER_CFLAGS=`$PKG_CONFIG --cflags gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 2>conftest.err` GSTREAMER_CFLAGS=`$PKG_CONFIG --cflags gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 gstreamer-tag-1.0 2>conftest.err`
fi fi
fi fi
...@@ -16927,15 +16927,15 @@ if ${GSTREAMER_LIBS:+false} : ...@@ -16927,15 +16927,15 @@ if ${GSTREAMER_LIBS:+false} :
then : then :
if test ${PKG_CONFIG+y} if test ${PKG_CONFIG+y}
then : then :
GSTREAMER_LIBS=`$PKG_CONFIG --libs gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 2>/dev/null` GSTREAMER_LIBS=`$PKG_CONFIG --libs gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 gstreamer-tag-1.0 2>/dev/null`
fi fi
fi fi
printf "%s\n" "$as_me:${as_lineno-$LINENO}: gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 cflags: $GSTREAMER_CFLAGS" >&5 printf "%s\n" "$as_me:${as_lineno-$LINENO}: gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 gstreamer-tag-1.0 cflags: $GSTREAMER_CFLAGS" >&5
printf "%s\n" "$as_me:${as_lineno-$LINENO}: gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 libs: $GSTREAMER_LIBS" >&5 printf "%s\n" "$as_me:${as_lineno-$LINENO}: gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 gstreamer-tag-1.0 libs: $GSTREAMER_LIBS" >&5
if test -s conftest.err; then if test -s conftest.err; then
printf %s "$as_me:${as_lineno-$LINENO}: gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 errors: " >&5 printf %s "$as_me:${as_lineno-$LINENO}: gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 gstreamer-tag-1.0 errors: " >&5
cat conftest.err >&5 cat conftest.err >&5
fi fi
rm -f conftest.err rm -f conftest.err
......
...@@ -1570,7 +1570,7 @@ WINE_NOTICE_WITH(pulse, [test -z "$PULSE_LIBS"], ...@@ -1570,7 +1570,7 @@ WINE_NOTICE_WITH(pulse, [test -z "$PULSE_LIBS"],
dnl **** Check for gstreamer **** dnl **** Check for gstreamer ****
if test "x$with_gstreamer" != "xno" if test "x$with_gstreamer" != "xno"
then then
WINE_PACKAGE_FLAGS(GSTREAMER,[gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0],,,, WINE_PACKAGE_FLAGS(GSTREAMER,[gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 gstreamer-tag-1.0],,,,
[AC_CHECK_HEADER([gst/gst.h], [AC_CHECK_HEADER([gst/gst.h],
[AC_MSG_CHECKING([whether gint64 defined by gst/gst.h is indeed 64-bit]) [AC_MSG_CHECKING([whether gint64 defined by gst/gst.h is indeed 64-bit])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <gst/gst.h>]], AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <gst/gst.h>]],
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/video/video.h> #include <gst/video/video.h>
#include <gst/audio/audio.h> #include <gst/audio/audio.h>
#include <gst/tag/tag.h>
#include "ntstatus.h" #include "ntstatus.h"
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
...@@ -93,6 +94,8 @@ struct wg_parser ...@@ -93,6 +94,8 @@ struct wg_parser
bool sink_connected; bool sink_connected;
bool unlimited_buffering; bool unlimited_buffering;
gchar *sink_caps;
}; };
struct wg_parser_stream struct wg_parser_stream
...@@ -476,7 +479,9 @@ static NTSTATUS wg_parser_stream_notify_qos(void *args) ...@@ -476,7 +479,9 @@ static NTSTATUS wg_parser_stream_notify_qos(void *args)
static GstAutoplugSelectResult autoplug_select_cb(GstElement *bin, GstPad *pad, static GstAutoplugSelectResult autoplug_select_cb(GstElement *bin, GstPad *pad,
GstCaps *caps, GstElementFactory *fact, gpointer user) GstCaps *caps, GstElementFactory *fact, gpointer user)
{ {
struct wg_parser *parser = user;
const char *name = gst_element_factory_get_longname(fact); const char *name = gst_element_factory_get_longname(fact);
const char *klass = gst_element_factory_get_klass(fact);
GST_INFO("Using \"%s\".", name); GST_INFO("Using \"%s\".", name);
...@@ -490,6 +495,10 @@ static GstAutoplugSelectResult autoplug_select_cb(GstElement *bin, GstPad *pad, ...@@ -490,6 +495,10 @@ static GstAutoplugSelectResult autoplug_select_cb(GstElement *bin, GstPad *pad,
GST_WARNING("Disabled video acceleration since it breaks in wine."); GST_WARNING("Disabled video acceleration since it breaks in wine.");
return GST_AUTOPLUG_SELECT_SKIP; return GST_AUTOPLUG_SELECT_SKIP;
} }
if (!parser->sink_caps && strstr(klass, GST_ELEMENT_FACTORY_KLASS_DEMUXER))
parser->sink_caps = g_strdup(gst_structure_get_name(gst_caps_get_structure(caps, 0)));
return GST_AUTOPLUG_SELECT_TRY; return GST_AUTOPLUG_SELECT_TRY;
} }
...@@ -1326,7 +1335,18 @@ static void query_tags(struct wg_parser_stream *stream) ...@@ -1326,7 +1335,18 @@ static void query_tags(struct wg_parser_stream *stream)
if (!stream->tags[WG_PARSER_TAG_LANGUAGE]) if (!stream->tags[WG_PARSER_TAG_LANGUAGE])
{ {
gst_tag_list_get_string(tag_list, GST_TAG_LANGUAGE_CODE, &stream->tags[WG_PARSER_TAG_LANGUAGE]); gchar *lang_code = NULL;
gst_tag_list_get_string(tag_list, GST_TAG_LANGUAGE_CODE, &lang_code);
if (stream->parser->sink_caps && !strcmp(stream->parser->sink_caps, "video/quicktime"))
{
/* For QuickTime media, we convert the language tags to ISO 639-1. */
const gchar *lang_code_iso_639_1 = lang_code ? gst_tag_get_language_code_iso_639_1(lang_code) : NULL;
stream->tags[WG_PARSER_TAG_LANGUAGE] = lang_code_iso_639_1 ? g_strdup(lang_code_iso_639_1) : NULL;
g_free(lang_code);
}
else
stream->tags[WG_PARSER_TAG_LANGUAGE] = lang_code;
} }
gst_event_unref(tag_event); gst_event_unref(tag_event);
...@@ -1493,6 +1513,9 @@ out: ...@@ -1493,6 +1513,9 @@ out:
parser->container = NULL; parser->container = NULL;
} }
g_free(parser->sink_caps);
parser->sink_caps = NULL;
pthread_mutex_lock(&parser->mutex); pthread_mutex_lock(&parser->mutex);
parser->sink_connected = false; parser->sink_connected = false;
pthread_mutex_unlock(&parser->mutex); pthread_mutex_unlock(&parser->mutex);
...@@ -1536,6 +1559,9 @@ static NTSTATUS wg_parser_disconnect(void *args) ...@@ -1536,6 +1559,9 @@ static NTSTATUS wg_parser_disconnect(void *args)
gst_object_unref(parser->container); gst_object_unref(parser->container);
parser->container = NULL; parser->container = NULL;
g_free(parser->sink_caps);
parser->sink_caps = NULL;
return S_OK; return S_OK;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment