mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 20:42:30 +00:00
flv: fix caps
This commit is contained in:
parent
dd26b14930
commit
6674b029e4
3 changed files with 29 additions and 28 deletions
|
@ -1,7 +1,7 @@
|
||||||
plugin_LTLIBRARIES = libgstflv.la
|
plugin_LTLIBRARIES = libgstflv.la
|
||||||
|
|
||||||
libgstflv_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
|
libgstflv_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
|
||||||
libgstflv_la_LIBADD = -lgstpbutils-@GST_MAJORMINOR@ \
|
libgstflv_la_LIBADD = -lgstpbutils-@GST_MAJORMINOR@ -lgstaudio-@GST_MAJORMINOR@\
|
||||||
$(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS)
|
$(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS)
|
||||||
libgstflv_la_LDFLAGS = ${GST_PLUGIN_LDFLAGS}
|
libgstflv_la_LDFLAGS = ${GST_PLUGIN_LDFLAGS}
|
||||||
libgstflv_la_SOURCES = gstflvdemux.c gstflvmux.c
|
libgstflv_la_SOURCES = gstflvdemux.c gstflvmux.c
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include <gst/base/gstbytereader.h>
|
#include <gst/base/gstbytereader.h>
|
||||||
#include <gst/pbutils/descriptions.h>
|
#include <gst/pbutils/descriptions.h>
|
||||||
#include <gst/pbutils/pbutils.h>
|
#include <gst/pbutils/pbutils.h>
|
||||||
|
#include <gst/audio/audio.h>
|
||||||
|
|
||||||
/* FIXME: don't rely on own GstIndex */
|
/* FIXME: don't rely on own GstIndex */
|
||||||
#include "gstindex.c"
|
#include "gstindex.c"
|
||||||
|
@ -64,8 +65,7 @@ static GstStaticPadTemplate audio_src_template =
|
||||||
"audio/mpeg, mpegversion = (int) 1, layer = (int) 3, channels = (int) { 1, 2 }, rate = (int) { 5512, 8000, 11025, 22050, 44100 }, parsed = (boolean) TRUE; "
|
"audio/mpeg, mpegversion = (int) 1, layer = (int) 3, channels = (int) { 1, 2 }, rate = (int) { 5512, 8000, 11025, 22050, 44100 }, parsed = (boolean) TRUE; "
|
||||||
"audio/mpeg, mpegversion = (int) 4, framed = (boolean) TRUE; "
|
"audio/mpeg, mpegversion = (int) 4, framed = (boolean) TRUE; "
|
||||||
"audio/x-nellymoser, channels = (int) { 1, 2 }, rate = (int) { 5512, 8000, 11025, 16000, 22050, 44100 }; "
|
"audio/x-nellymoser, channels = (int) { 1, 2 }, rate = (int) { 5512, 8000, 11025, 16000, 22050, 44100 }; "
|
||||||
"audio/x-raw-int, endianness = (int) LITTLE_ENDIAN, channels = (int) { 1, 2 }, width = (int) 8, depth = (int) 8, rate = (int) { 5512, 11025, 22050, 44100 }, signed = (boolean) FALSE; "
|
"audio/x-raw, format = (string) { U8, S16LE }, layout = (string) interleaved, channels = (int) { 1, 2 }, rate = (int) { 5512, 11025, 22050, 44100 }; "
|
||||||
"audio/x-raw-int, endianness = (int) LITTLE_ENDIAN, channels = (int) { 1, 2 }, width = (int) 16, depth = (int) 16, rate = (int) { 5512, 11025, 22050, 44100 }, signed = (boolean) TRUE; "
|
|
||||||
"audio/x-alaw, channels = (int) { 1, 2 }, rate = (int) { 5512, 11025, 22050, 44100 }; "
|
"audio/x-alaw, channels = (int) { 1, 2 }, rate = (int) { 5512, 11025, 22050, 44100 }; "
|
||||||
"audio/x-mulaw, channels = (int) { 1, 2 }, rate = (int) { 5512, 11025, 22050, 44100 }; "
|
"audio/x-mulaw, channels = (int) { 1, 2 }, rate = (int) { 5512, 11025, 22050, 44100 }; "
|
||||||
"audio/x-speex, channels = (int) { 1, 2 }, rate = (int) { 5512, 11025, 22050, 44100 };")
|
"audio/x-speex, channels = (int) { 1, 2 }, rate = (int) { 5512, 11025, 22050, 44100 };")
|
||||||
|
@ -646,14 +646,20 @@ gst_flv_demux_audio_negotiate (GstFlvDemux * demux, guint32 codec_tag,
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
case 3:
|
case 3:
|
||||||
|
{
|
||||||
|
GstAudioFormat format;
|
||||||
|
|
||||||
/* Assuming little endian for 0 (aka endianness of the
|
/* Assuming little endian for 0 (aka endianness of the
|
||||||
* system on which the file was created) as most people
|
* system on which the file was created) as most people
|
||||||
* are probably using little endian machines */
|
* are probably using little endian machines */
|
||||||
caps = gst_caps_new_simple ("audio/x-raw-int",
|
format = gst_audio_format_build_integer ((width == 8) ? FALSE : TRUE,
|
||||||
"endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
|
G_LITTLE_ENDIAN, width, width);
|
||||||
"signed", G_TYPE_BOOLEAN, (width == 8) ? FALSE : TRUE,
|
|
||||||
"width", G_TYPE_INT, width, "depth", G_TYPE_INT, width, NULL);
|
caps = gst_caps_new_simple ("audio/x-raw",
|
||||||
|
"format", G_TYPE_STRING, gst_audio_format_to_string (format),
|
||||||
|
"layout", G_TYPE_STRING, "interleaved", NULL);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 4:
|
case 4:
|
||||||
case 5:
|
case 5:
|
||||||
case 6:
|
case 6:
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <gst/audio/audio.h>
|
||||||
|
|
||||||
#include "gstflvmux.h"
|
#include "gstflvmux.h"
|
||||||
#include "amfdefs.h"
|
#include "amfdefs.h"
|
||||||
|
|
||||||
|
@ -76,8 +78,7 @@ static GstStaticPadTemplate audiosink_templ = GST_STATIC_PAD_TEMPLATE ("audio",
|
||||||
"audio/mpeg, mpegversion = (int) 1, layer = (int) 3, channels = (int) { 1, 2 }, rate = (int) { 5512, 8000, 11025, 22050, 44100 }, parsed = (boolean) TRUE; "
|
"audio/mpeg, mpegversion = (int) 1, layer = (int) 3, channels = (int) { 1, 2 }, rate = (int) { 5512, 8000, 11025, 22050, 44100 }, parsed = (boolean) TRUE; "
|
||||||
"audio/mpeg, mpegversion = (int) { 2, 4 }, framed = (boolean) TRUE; "
|
"audio/mpeg, mpegversion = (int) { 2, 4 }, framed = (boolean) TRUE; "
|
||||||
"audio/x-nellymoser, channels = (int) { 1, 2 }, rate = (int) { 5512, 8000, 11025, 16000, 22050, 44100 }; "
|
"audio/x-nellymoser, channels = (int) { 1, 2 }, rate = (int) { 5512, 8000, 11025, 16000, 22050, 44100 }; "
|
||||||
"audio/x-raw-int, endianness = (int) LITTLE_ENDIAN, channels = (int) { 1, 2 }, width = (int) 8, depth = (int) 8, rate = (int) { 5512, 11025, 22050, 44100 }, signed = (boolean) FALSE; "
|
"audio/x-raw, format = (string) { U8, S16LE}, layout = (string) interleaved, channels = (int) { 1, 2 }, rate = (int) { 5512, 11025, 22050, 44100 }; "
|
||||||
"audio/x-raw-int, endianness = (int) LITTLE_ENDIAN, channels = (int) { 1, 2 }, width = (int) 16, depth = (int) 16, rate = (int) { 5512, 11025, 22050, 44100 }, signed = (boolean) TRUE; "
|
|
||||||
"audio/x-alaw, channels = (int) { 1, 2 }, rate = (int) { 5512, 11025, 22050, 44100 }; "
|
"audio/x-alaw, channels = (int) { 1, 2 }, rate = (int) { 5512, 11025, 22050, 44100 }; "
|
||||||
"audio/x-mulaw, channels = (int) { 1, 2 }, rate = (int) { 5512, 11025, 22050, 44100 }; "
|
"audio/x-mulaw, channels = (int) { 1, 2 }, rate = (int) { 5512, 11025, 22050, 44100 }; "
|
||||||
"audio/x-speex, channels = (int) { 1, 2 }, rate = (int) { 5512, 11025, 22050, 44100 };")
|
"audio/x-speex, channels = (int) { 1, 2 }, rate = (int) { 5512, 11025, 22050, 44100 };")
|
||||||
|
@ -425,13 +426,19 @@ gst_flv_mux_audio_pad_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
} else {
|
} else {
|
||||||
cpad->audio_codec = 6;
|
cpad->audio_codec = 6;
|
||||||
}
|
}
|
||||||
} else if (strcmp (gst_structure_get_name (s), "audio/x-raw-int") == 0) {
|
} else if (strcmp (gst_structure_get_name (s), "audio/x-raw") == 0) {
|
||||||
gint endianness;
|
GstAudioInfo info;
|
||||||
|
|
||||||
if (gst_structure_get_int (s, "endianness", &endianness)
|
if (gst_audio_info_from_caps (&info, caps)) {
|
||||||
&& endianness == G_LITTLE_ENDIAN)
|
|
||||||
cpad->audio_codec = 3;
|
cpad->audio_codec = 3;
|
||||||
else
|
|
||||||
|
if (GST_AUDIO_INFO_WIDTH (&info) == 8)
|
||||||
|
cpad->width = 0;
|
||||||
|
else if (GST_AUDIO_INFO_WIDTH (&info) == 16)
|
||||||
|
cpad->width = 1;
|
||||||
|
else
|
||||||
|
ret = FALSE;
|
||||||
|
} else
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
} else if (strcmp (gst_structure_get_name (s), "audio/x-alaw") == 0) {
|
} else if (strcmp (gst_structure_get_name (s), "audio/x-alaw") == 0) {
|
||||||
cpad->audio_codec = 7;
|
cpad->audio_codec = 7;
|
||||||
|
@ -444,7 +451,7 @@ gst_flv_mux_audio_pad_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
gint rate, channels, width;
|
gint rate, channels;
|
||||||
|
|
||||||
if (gst_structure_get_int (s, "rate", &rate)) {
|
if (gst_structure_get_int (s, "rate", &rate)) {
|
||||||
if (cpad->audio_codec == 10)
|
if (cpad->audio_codec == 10)
|
||||||
|
@ -491,20 +498,8 @@ gst_flv_mux_audio_pad_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gst_structure_get_int (s, "width", &width)) {
|
if (cpad->audio_codec != 3)
|
||||||
if (cpad->audio_codec != 3)
|
|
||||||
cpad->width = 1;
|
|
||||||
else if (width == 8)
|
|
||||||
cpad->width = 0;
|
|
||||||
else if (width == 16)
|
|
||||||
cpad->width = 1;
|
|
||||||
else
|
|
||||||
ret = FALSE;
|
|
||||||
} else if (cpad->audio_codec != 3) {
|
|
||||||
cpad->width = 1;
|
cpad->width = 1;
|
||||||
} else {
|
|
||||||
ret = FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret && gst_structure_has_field (s, "codec_data")) {
|
if (ret && gst_structure_has_field (s, "codec_data")) {
|
||||||
|
|
Loading…
Reference in a new issue