mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 03:31:05 +00:00
sbcparse: Post AUDIO_CODEC tag
This commit is contained in:
parent
05e196cbb6
commit
753d3c23a2
2 changed files with 36 additions and 4 deletions
|
@ -40,9 +40,8 @@
|
|||
#include <string.h>
|
||||
#include <gst/tag/tag.h>
|
||||
#include <gst/audio/audio.h>
|
||||
|
||||
#include <gst/base/gstbitreader.h>
|
||||
#include <gst/base/gstbytereader.h>
|
||||
#include <gst/base/base.h>
|
||||
#include <gst/pbutils/pbutils.h>
|
||||
|
||||
#define SBC_SYNCBYTE 0x9C
|
||||
|
||||
|
@ -67,6 +66,8 @@ static gboolean gst_sbc_parse_start (GstBaseParse * parse);
|
|||
static gboolean gst_sbc_parse_stop (GstBaseParse * parse);
|
||||
static GstFlowReturn gst_sbc_parse_handle_frame (GstBaseParse * parse,
|
||||
GstBaseParseFrame * frame, gint * skipsize);
|
||||
static GstFlowReturn gst_sbc_parse_pre_push_frame (GstBaseParse * parse,
|
||||
GstBaseParseFrame * frame);
|
||||
static GstCaps *gst_sbc_parse_get_sink_caps (GstBaseParse * parse,
|
||||
GstCaps * filter);
|
||||
|
||||
|
@ -90,7 +91,8 @@ gst_sbc_parse_class_init (GstSbcParseClass * klass)
|
|||
|
||||
baseparse_class->start = GST_DEBUG_FUNCPTR (gst_sbc_parse_start);
|
||||
baseparse_class->stop = GST_DEBUG_FUNCPTR (gst_sbc_parse_stop);
|
||||
|
||||
baseparse_class->pre_push_frame =
|
||||
GST_DEBUG_FUNCPTR (gst_sbc_parse_pre_push_frame);
|
||||
baseparse_class->handle_frame =
|
||||
GST_DEBUG_FUNCPTR (gst_sbc_parse_handle_frame);
|
||||
baseparse_class->get_sink_caps =
|
||||
|
@ -115,6 +117,7 @@ gst_sbc_parse_reset (GstSbcParse * sbcparse)
|
|||
sbcparse->n_blocks = -1;
|
||||
sbcparse->n_subbands = -1;
|
||||
sbcparse->bitpool = -1;
|
||||
sbcparse->sent_codec_tag = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -493,3 +496,30 @@ gst_sbc_parse_header (const guint8 * data, guint * rate, guint * n_blocks,
|
|||
|
||||
return gst_sbc_calc_framelen (*n_subbands, *ch_mode, *n_blocks, *bitpool);
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_sbc_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
|
||||
{
|
||||
GstSbcParse *sbcparse = GST_SBC_PARSE (parse);
|
||||
|
||||
if (!sbcparse->sent_codec_tag) {
|
||||
GstTagList *taglist;
|
||||
GstCaps *caps;
|
||||
|
||||
taglist = gst_tag_list_new_empty ();
|
||||
|
||||
/* codec tag */
|
||||
caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (parse));
|
||||
gst_pb_utils_add_codec_description_to_tag_list (taglist,
|
||||
GST_TAG_AUDIO_CODEC, caps);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
gst_pad_push_event (GST_BASE_PARSE_SRC_PAD (sbcparse),
|
||||
gst_event_new_tag (taglist));
|
||||
|
||||
/* also signals the end of first-frame processing */
|
||||
sbcparse->sent_codec_tag = TRUE;
|
||||
}
|
||||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
|
|
@ -61,6 +61,8 @@ struct _GstSbcParse {
|
|||
gint n_blocks;
|
||||
gint n_subbands;
|
||||
gint bitpool;
|
||||
|
||||
gboolean sent_codec_tag;
|
||||
};
|
||||
|
||||
struct _GstSbcParseClass {
|
||||
|
|
Loading…
Reference in a new issue