mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
Merge branch 'master' into 0.11
This commit is contained in:
commit
c16cc4698a
4 changed files with 45 additions and 58 deletions
|
@ -339,8 +339,7 @@ gst_h264_parse_wrap_nal (GstH264Parse * h264parse, guint format, guint8 * data,
|
|||
GstBuffer *buf;
|
||||
const guint nl = h264parse->nal_length_size;
|
||||
|
||||
GST_DEBUG_OBJECT (h264parse, "nal length %d %d", size,
|
||||
h264parse->nal_length_size);
|
||||
GST_DEBUG_OBJECT (h264parse, "nal length %d", size);
|
||||
|
||||
buf = gst_buffer_new_and_alloc (size + nl + 4);
|
||||
if (format == GST_H264_PARSE_FORMAT_AVC) {
|
||||
|
@ -1243,7 +1242,8 @@ gst_h264_parse_set_caps (GstBaseParse * parse, GstCaps * caps)
|
|||
/* this is the number of bytes in front of the NAL units to mark their
|
||||
* length */
|
||||
h264parse->nal_length_size = (data[4] & 0x03) + 1;
|
||||
GST_DEBUG_OBJECT (h264parse, "nal length %u", h264parse->nal_length_size);
|
||||
GST_DEBUG_OBJECT (h264parse, "nal length size %u",
|
||||
h264parse->nal_length_size);
|
||||
|
||||
num_sps = data[5] & 0x1f;
|
||||
off = 6;
|
||||
|
@ -1340,50 +1340,36 @@ gst_h264_parse_chain (GstPad * pad, GstBuffer * buffer)
|
|||
GstH264Parse *h264parse = GST_H264_PARSE (GST_PAD_PARENT (pad));
|
||||
|
||||
if (h264parse->packetized && buffer) {
|
||||
GstByteReader br;
|
||||
GstBuffer *sub;
|
||||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
guint32 len;
|
||||
GstH264ParserResult parse_res;
|
||||
GstH264NalUnit nalu;
|
||||
const guint nl = h264parse->nal_length_size;
|
||||
|
||||
if (nl < 1 || nl > 4) {
|
||||
GST_DEBUG_OBJECT (h264parse, "insufficient data to split input");
|
||||
gst_buffer_unref (buffer);
|
||||
|
||||
return GST_FLOW_NOT_NEGOTIATED;
|
||||
}
|
||||
|
||||
GST_LOG_OBJECT (h264parse, "processing packet buffer of size %d",
|
||||
GST_BUFFER_SIZE (buffer));
|
||||
|
||||
gst_byte_reader_init_from_buffer (&br, buffer);
|
||||
while (ret == GST_FLOW_OK && gst_byte_reader_get_remaining (&br)) {
|
||||
parse_res = gst_h264_parser_identify_nalu_avc (h264parse->nalparser,
|
||||
GST_BUFFER_DATA (buffer), 0, GST_BUFFER_SIZE (buffer), nl, &nalu);
|
||||
|
||||
while (parse_res == GST_H264_PARSER_OK) {
|
||||
GST_DEBUG_OBJECT (h264parse, "AVC nal offset %d",
|
||||
gst_byte_reader_get_pos (&br));
|
||||
if (gst_byte_reader_get_remaining (&br) < nl)
|
||||
goto parse_failed;
|
||||
switch (nl) {
|
||||
case 4:
|
||||
len = gst_byte_reader_get_uint32_be_unchecked (&br);
|
||||
break;
|
||||
case 3:
|
||||
len = gst_byte_reader_get_uint24_be_unchecked (&br);
|
||||
break;
|
||||
case 2:
|
||||
len = gst_byte_reader_get_uint16_be_unchecked (&br);
|
||||
break;
|
||||
case 1:
|
||||
len = gst_byte_reader_get_uint8_unchecked (&br);
|
||||
break;
|
||||
default:
|
||||
goto not_negotiated;
|
||||
}
|
||||
nalu.offset + nalu.size);
|
||||
|
||||
GST_DEBUG_OBJECT (h264parse, "AVC nal size %d", len);
|
||||
|
||||
if (gst_byte_reader_get_remaining (&br) < len)
|
||||
goto parse_failed;
|
||||
if (h264parse->split_packetized) {
|
||||
/* convert to NAL aligned byte stream input */
|
||||
sub = gst_h264_parse_wrap_nal (h264parse, GST_H264_PARSE_FORMAT_BYTE,
|
||||
(guint8 *) gst_byte_reader_get_data_unchecked (&br, len), len);
|
||||
nalu.data + nalu.offset, nalu.size);
|
||||
/* at least this should make sense */
|
||||
GST_BUFFER_TIMESTAMP (sub) = GST_BUFFER_TIMESTAMP (buffer);
|
||||
GST_LOG_OBJECT (h264parse, "pushing NAL of size %d", len);
|
||||
GST_LOG_OBJECT (h264parse, "pushing NAL of size %d", nalu.size);
|
||||
ret = h264parse->parse_chain (pad, sub);
|
||||
} else {
|
||||
/* pass-through: no looking for frames (and nal processing),
|
||||
|
@ -1391,13 +1377,15 @@ gst_h264_parse_chain (GstPad * pad, GstBuffer * buffer)
|
|||
/* NOTE: so if it is really configured to do so,
|
||||
* pre_push can/will still insert codec-data at intervals,
|
||||
* which is not really pure pass-through, but anyway ... */
|
||||
gst_h264_parser_identify_nalu (h264parse->nalparser,
|
||||
GST_BUFFER_DATA (buffer), gst_byte_reader_get_pos (&br) - nl,
|
||||
GST_BUFFER_SIZE (buffer), &nalu);
|
||||
gst_h264_parse_process_nal (h264parse, &nalu);
|
||||
gst_byte_reader_skip_unchecked (&br, len);
|
||||
|
||||
}
|
||||
|
||||
parse_res = gst_h264_parser_identify_nalu_avc (h264parse->nalparser,
|
||||
GST_BUFFER_DATA (buffer), nalu.offset + nalu.size,
|
||||
GST_BUFFER_SIZE (buffer), nl, &nalu);
|
||||
}
|
||||
|
||||
if (h264parse->split_packetized) {
|
||||
gst_buffer_unref (buffer);
|
||||
return ret;
|
||||
|
@ -1406,31 +1394,24 @@ gst_h264_parse_chain (GstPad * pad, GstBuffer * buffer)
|
|||
* ensure nothing happens with this later on */
|
||||
gst_adapter_clear (h264parse->frame_out);
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
return h264parse->parse_chain (pad, buffer);
|
||||
if (parse_res == GST_H264_PARSER_NO_NAL_END ||
|
||||
parse_res == GST_H264_PARSER_BROKEN_DATA) {
|
||||
|
||||
/* ERRORS */
|
||||
not_negotiated:
|
||||
{
|
||||
GST_DEBUG_OBJECT (h264parse, "insufficient data to split input");
|
||||
gst_buffer_unref (buffer);
|
||||
return GST_FLOW_NOT_NEGOTIATED;
|
||||
}
|
||||
parse_failed:
|
||||
{
|
||||
if (h264parse->split_packetized) {
|
||||
GST_ELEMENT_ERROR (h264parse, STREAM, FAILED, (NULL),
|
||||
("invalid AVC input data"));
|
||||
gst_buffer_unref (buffer);
|
||||
return GST_FLOW_ERROR;
|
||||
} else {
|
||||
/* do not meddle to much in this case */
|
||||
GST_DEBUG_OBJECT (h264parse, "parsing packet failed");
|
||||
goto exit;
|
||||
if (h264parse->split_packetized) {
|
||||
GST_ELEMENT_ERROR (h264parse, STREAM, FAILED, (NULL),
|
||||
("invalid AVC input data"));
|
||||
gst_buffer_unref (buffer);
|
||||
|
||||
return GST_FLOW_ERROR;
|
||||
} else {
|
||||
/* do not meddle to much in this case */
|
||||
GST_DEBUG_OBJECT (h264parse, "parsing packet failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return h264parse->parse_chain (pad, buffer);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -276,7 +276,7 @@ my_bus_sync_callback (GstBus * bus, GstMessage * message, gpointer data)
|
|||
/* FIXME: make sure to get XID in main thread */
|
||||
gst_x_overlay_set_window_handle (GST_X_OVERLAY (message->src),
|
||||
#if GTK_CHECK_VERSION (2, 91, 6)
|
||||
GDK_WINDOW_XID (gtk_widget_get_window (ui_drawing));
|
||||
GDK_WINDOW_XID (gtk_widget_get_window (ui_drawing)));
|
||||
#else
|
||||
GDK_WINDOW_XWINDOW (gtk_widget_get_window (ui_drawing)));
|
||||
#endif
|
||||
|
|
|
@ -98,7 +98,11 @@ bus_sync_callback (GstBus * bus, GstMessage * message, gpointer data)
|
|||
/* FIXME: make sure to get XID in main thread */
|
||||
ui_drawing = GTK_WIDGET (gtk_builder_get_object (builder, "viewfinderArea"));
|
||||
gst_x_overlay_set_window_handle (GST_X_OVERLAY (message->src),
|
||||
#if GTK_CHECK_VERSION (2, 91, 6)
|
||||
GDK_WINDOW_XID (gtk_widget_get_window (ui_drawing)));
|
||||
#else
|
||||
GDK_WINDOW_XWINDOW (gtk_widget_get_window (ui_drawing)));
|
||||
#endif
|
||||
|
||||
gst_message_unref (message);
|
||||
return GST_BUS_DROP;
|
||||
|
|
|
@ -1035,8 +1035,10 @@ demo_gui_show_func (DemoGui * gui)
|
|||
seek_range =
|
||||
gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 5.0,
|
||||
30.0, 0.00)));
|
||||
#if !GTK_CHECK_VERSION (3, 0, 0)
|
||||
gtk_range_set_update_policy (GTK_RANGE (seek_range),
|
||||
GTK_UPDATE_DISCONTINUOUS);
|
||||
#endif
|
||||
seek_bar = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (seek_bar), amount_played, FALSE, FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (seek_bar), seek_range, TRUE, TRUE, 2);
|
||||
|
|
Loading…
Reference in a new issue