Revert "flacparse: fix header rewriting being ignored"

This caused broken metadata and also looks a bit dodgy.
Revert until we can figure out a solution that works for
all cases and doesn't break anything.

This reverts commit adeee44b07.

https://bugzilla.gnome.org/show_bug.cgi?id=727802
https://bugzilla.gnome.org/show_bug.cgi?id=785558
This commit is contained in:
Tim-Philipp Müller 2017-12-07 11:15:19 +00:00
parent 5e05cadb17
commit d4c04cb079
2 changed files with 1 additions and 52 deletions

View file

@ -208,8 +208,6 @@ static GstFlowReturn gst_flac_parse_pre_push_frame (GstBaseParse * parse,
static gboolean gst_flac_parse_convert (GstBaseParse * parse,
GstFormat src_format, gint64 src_value, GstFormat dest_format,
gint64 * dest_value);
static gboolean gst_flac_parse_sink_event (GstBaseParse * parse,
GstEvent * event);
static gboolean gst_flac_parse_src_event (GstBaseParse * parse,
GstEvent * event);
static GstCaps *gst_flac_parse_get_sink_caps (GstBaseParse * parse,
@ -245,7 +243,6 @@ gst_flac_parse_class_init (GstFlacParseClass * klass)
baseparse_class->pre_push_frame =
GST_DEBUG_FUNCPTR (gst_flac_parse_pre_push_frame);
baseparse_class->convert = GST_DEBUG_FUNCPTR (gst_flac_parse_convert);
baseparse_class->sink_event = GST_DEBUG_FUNCPTR (gst_flac_parse_sink_event);
baseparse_class->src_event = GST_DEBUG_FUNCPTR (gst_flac_parse_src_event);
baseparse_class->get_sink_caps =
GST_DEBUG_FUNCPTR (gst_flac_parse_get_sink_caps);
@ -318,8 +315,6 @@ gst_flac_parse_reset (GstFlacParse * parser)
g_list_foreach (parser->headers, (GFunc) gst_mini_object_unref, NULL);
g_list_free (parser->headers);
parser->headers = NULL;
parser->header_size = 0;
parser->byte_mode = FALSE;
}
static void
@ -797,11 +792,7 @@ gst_flac_parse_handle_frame (GstBaseParse * parse,
goto cleanup;
}
if (flacparse->byte_mode && flacparse->byte_offset < flacparse->header_size) {
*skipsize = 0;
framesize = map.size;
goto cleanup;
} else if ((GST_READ_UINT16_BE (map.data) & 0xfffe) == 0xfff8) {
if ((GST_READ_UINT16_BE (map.data) & 0xfffe) == 0xfff8) {
gboolean ret, is_first = !flacparse->strategy_checked;
guint next;
@ -1348,7 +1339,6 @@ push_headers:
/* push header buffers; update caps, so when we push the first buffer the
* negotiated caps will change to caps that include the streamheader field */
flacparse->header_size = 0;
while (flacparse->headers) {
GstBuffer *buf = GST_BUFFER (flacparse->headers->data);
GstBaseParseFrame frame;
@ -1361,7 +1351,6 @@ push_headers:
gst_base_parse_frame_init (&frame);
frame.buffer = buf;
frame.overhead = -1;
flacparse->header_size += gst_buffer_get_size (frame.buffer);
res = gst_base_parse_push_frame (GST_BASE_PARSE (flacparse), &frame);
gst_base_parse_frame_free (&frame);
if (res != GST_FLOW_OK)
@ -1370,7 +1359,6 @@ push_headers:
g_list_foreach (flacparse->headers, (GFunc) gst_mini_object_unref, NULL);
g_list_free (flacparse->headers);
flacparse->headers = NULL;
flacparse->byte_offset = flacparse->header_size;
return res;
}
@ -1614,11 +1602,6 @@ gst_flac_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame,
/* DROPPED because we pushed already or will push all headers manually */
res = GST_BASE_PARSE_FLOW_DROPPED;
} else {
if (flacparse->byte_mode && flacparse->byte_offset < flacparse->header_size) {
res = GST_FLOW_OK;
goto cleanup;
}
if (flacparse->offset != GST_BUFFER_OFFSET (buffer)) {
FrameHeaderCheckReturn ret;
@ -1750,8 +1733,6 @@ gst_flac_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
frame->flags |= GST_BASE_PARSE_FRAME_FLAG_CLIP;
flacparse->byte_offset += gst_buffer_get_size (frame->buffer);
return GST_FLOW_OK;
}
@ -1787,34 +1768,6 @@ gst_flac_parse_convert (GstBaseParse * parse,
src_value, dest_format, dest_value);
}
static gboolean
gst_flac_parse_sink_event (GstBaseParse * parse, GstEvent * event)
{
GstFlacParse *flacparse = GST_FLAC_PARSE (parse);
const GstSegment *segment;
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEGMENT:
{
gst_event_parse_segment (event, &segment);
flacparse->byte_mode = (segment->format == GST_FORMAT_BYTES)
&& flacparse->header_size > 0;
if (flacparse->byte_mode) {
/* we must pass every header update now */
gst_base_parse_set_min_frame_size (GST_BASE_PARSE (flacparse), 0);
/* we must drain any pending data before the seek */
gst_base_parse_drain (parse);
flacparse->byte_offset = segment->start;
return gst_pad_push_event (GST_BASE_PARSE_SRC_PAD (parse), event);
}
break;
}
default:
break;
}
return GST_BASE_PARSE_CLASS (parent_class)->sink_event (parse, event);
}
static gboolean
gst_flac_parse_src_event (GstBaseParse * parse, GstEvent * event)
{

View file

@ -86,10 +86,6 @@ struct _GstFlacParse {
GstBuffer *seektable;
gboolean force_variable_block_size;
gsize header_size;
gsize byte_offset;
gboolean byte_mode;
};
struct _GstFlacParseClass {