mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 05:31:15 +00:00
videoparsers: port to baseparse, which is now in libgstbase in core
This commit is contained in:
parent
38c6f6366c
commit
5365dbfdce
8 changed files with 18 additions and 20 deletions
|
@ -5,9 +5,8 @@ libgstvideoparsersbad_la_SOURCES = plugin.c \
|
||||||
gsth264parse.c h264parse.c \
|
gsth264parse.c h264parse.c \
|
||||||
gstdiracparse.c dirac_parse.c
|
gstdiracparse.c dirac_parse.c
|
||||||
libgstvideoparsersbad_la_CFLAGS = \
|
libgstvideoparsersbad_la_CFLAGS = \
|
||||||
$(GST_PLUGINS_BAD_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
|
$(GST_BASE_CFLAGS) $(GST_CFLAGS)
|
||||||
libgstvideoparsersbad_la_LIBADD = \
|
libgstvideoparsersbad_la_LIBADD = \
|
||||||
$(top_builddir)/gst-libs/gst/baseparse/libgstbaseparse-$(GST_MAJORMINOR).la \
|
|
||||||
$(GST_BASE_LIBS) $(GST_LIBS)
|
$(GST_BASE_LIBS) $(GST_LIBS)
|
||||||
libgstvideoparsersbad_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
libgstvideoparsersbad_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||||
libgstvideoparsersbad_la_LIBTOOLFLAGS = --tag=disable-static
|
libgstvideoparsersbad_la_LIBTOOLFLAGS = --tag=disable-static
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/base/gstbytereader.h>
|
#include <gst/base/gstbytereader.h>
|
||||||
#include <gst/baseparse/gstbaseparse.h>
|
|
||||||
#include "gstdiracparse.h"
|
#include "gstdiracparse.h"
|
||||||
|
|
||||||
/* prototypes */
|
/* prototypes */
|
||||||
|
@ -239,8 +238,8 @@ gst_dirac_parse_check_valid_frame (GstBaseParse * parse,
|
||||||
GstDiracParse *diracparse = GST_DIRAC_PARSE (parse);
|
GstDiracParse *diracparse = GST_DIRAC_PARSE (parse);
|
||||||
int off;
|
int off;
|
||||||
guint32 next_header;
|
guint32 next_header;
|
||||||
gboolean sync;
|
gboolean lost_sync;
|
||||||
gboolean drain;
|
gboolean draining;
|
||||||
|
|
||||||
if (G_UNLIKELY (GST_BUFFER_SIZE (frame->buffer) < 13))
|
if (G_UNLIKELY (GST_BUFFER_SIZE (frame->buffer) < 13))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -269,10 +268,10 @@ gst_dirac_parse_check_valid_frame (GstBaseParse * parse,
|
||||||
|
|
||||||
GST_LOG ("framesize %d", *framesize);
|
GST_LOG ("framesize %d", *framesize);
|
||||||
|
|
||||||
sync = GST_BASE_PARSE_FRAME_SYNC (frame);
|
lost_sync = GST_BASE_PARSE_LOST_SYNC (frame);
|
||||||
drain = GST_BASE_PARSE_FRAME_DRAIN (frame);
|
draining = GST_BASE_PARSE_DRAINING (frame);
|
||||||
|
|
||||||
if (!sync && !drain) {
|
if (lost_sync && !draining) {
|
||||||
guint32 next_sync_word = 0;
|
guint32 next_sync_word = 0;
|
||||||
|
|
||||||
next_header = GST_READ_UINT32_BE (GST_BUFFER_DATA (frame->buffer) + 5);
|
next_header = GST_READ_UINT32_BE (GST_BUFFER_DATA (frame->buffer) + 5);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#define _GST_DIRAC_PARSE_H_
|
#define _GST_DIRAC_PARSE_H_
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/baseparse/gstbaseparse.h>
|
#include <gst/base/gstbaseparse.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
|
|
@ -273,7 +273,7 @@ gst_h263_parse_check_valid_frame (GstBaseParse * parse,
|
||||||
next_psc_pos = find_psc (buffer, next_psc_pos);
|
next_psc_pos = find_psc (buffer, next_psc_pos);
|
||||||
|
|
||||||
if (next_psc_pos == -1) {
|
if (next_psc_pos == -1) {
|
||||||
if (GST_BASE_PARSE_FRAME_DRAIN (frame))
|
if (GST_BASE_PARSE_DRAINING (parse))
|
||||||
/* FLUSH/EOS, it's okay if we can't find the next frame */
|
/* FLUSH/EOS, it's okay if we can't find the next frame */
|
||||||
next_psc_pos = GST_BUFFER_SIZE (buffer);
|
next_psc_pos = GST_BUFFER_SIZE (buffer);
|
||||||
else
|
else
|
||||||
|
@ -290,11 +290,11 @@ gst_h263_parse_check_valid_frame (GstBaseParse * parse,
|
||||||
res = gst_h263_parse_get_params (¶ms, buffer, FALSE, &h263parse->state);
|
res = gst_h263_parse_get_params (¶ms, buffer, FALSE, &h263parse->state);
|
||||||
if (res != GST_FLOW_OK || h263parse->state != GOT_HEADER) {
|
if (res != GST_FLOW_OK || h263parse->state != GOT_HEADER) {
|
||||||
GST_WARNING ("Couldn't parse header - setting passthrough mode");
|
GST_WARNING ("Couldn't parse header - setting passthrough mode");
|
||||||
gst_base_parse_set_format (parse,
|
gst_base_parse_set_passthrough (parse, TRUE);
|
||||||
GST_BASE_PARSE_FORMAT_PASSTHROUGH, TRUE);
|
|
||||||
} else {
|
} else {
|
||||||
/* Set srcpad caps since we now have sufficient information to do so */
|
/* Set srcpad caps since we now have sufficient information to do so */
|
||||||
gst_h263_parse_set_src_caps (h263parse, ¶ms);
|
gst_h263_parse_set_src_caps (h263parse, ¶ms);
|
||||||
|
gst_base_parse_set_passthrough (parse, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,7 +337,7 @@ gst_h263_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
|
||||||
* parse the header, which should not be possible. Either way, go into
|
* parse the header, which should not be possible. Either way, go into
|
||||||
* passthrough mode and let downstream handle it if it can. */
|
* passthrough mode and let downstream handle it if it can. */
|
||||||
GST_WARNING ("Couldn't parse header - setting passthrough mode");
|
GST_WARNING ("Couldn't parse header - setting passthrough mode");
|
||||||
gst_base_parse_set_format (parse, GST_BASE_PARSE_FORMAT_PASSTHROUGH, TRUE);
|
gst_base_parse_set_passthrough (parse, TRUE);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/base/gstadapter.h>
|
#include <gst/base/gstadapter.h>
|
||||||
#include <gst/baseparse/gstbaseparse.h>
|
#include <gst/base/gstbaseparse.h>
|
||||||
|
|
||||||
#include "h263parse.h"
|
#include "h263parse.h"
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include <gst/base/gstbytereader.h>
|
#include <gst/base/gstbytereader.h>
|
||||||
#include <gst/base/gstbytewriter.h>
|
#include <gst/base/gstbytewriter.h>
|
||||||
|
#include <gst/base/gstadapter.h>
|
||||||
#include "gsth264parse.h"
|
#include "gsth264parse.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -495,7 +496,7 @@ gst_h264_parse_check_valid_frame (GstBaseParse * parse,
|
||||||
sc_pos = 0;
|
sc_pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
drain = GST_BASE_PARSE_FRAME_DRAIN (frame);
|
drain = GST_BASE_PARSE_DRAINING (parse);
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
gint prev_sc_pos;
|
gint prev_sc_pos;
|
||||||
|
|
||||||
|
@ -684,7 +685,7 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse)
|
||||||
GST_TYPE_FRACTION, sps->fps_num, sps->fps_den, NULL);
|
GST_TYPE_FRACTION, sps->fps_num, sps->fps_den, NULL);
|
||||||
h264parse->fps_num = sps->fps_num;
|
h264parse->fps_num = sps->fps_num;
|
||||||
h264parse->fps_den = sps->fps_den;
|
h264parse->fps_den = sps->fps_den;
|
||||||
gst_base_parse_set_frame_props (GST_BASE_PARSE (h264parse),
|
gst_base_parse_set_frame_rate (GST_BASE_PARSE (h264parse),
|
||||||
h264parse->fps_num, h264parse->fps_den, 0, 0);
|
h264parse->fps_num, h264parse->fps_den, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -978,6 +979,7 @@ gst_h264_parse_set_caps (GstBaseParse * parse, GstCaps * caps)
|
||||||
/* arrange to insert codec-data in-stream if needed */
|
/* arrange to insert codec-data in-stream if needed */
|
||||||
h264parse->push_codec = h264parse->packetized;
|
h264parse->push_codec = h264parse->packetized;
|
||||||
}
|
}
|
||||||
|
gst_base_parse_set_passthrough (parse, FALSE);
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (h264parse, "passing on packetized AVC");
|
GST_DEBUG_OBJECT (h264parse, "passing on packetized AVC");
|
||||||
/* no choice to negotiate */
|
/* no choice to negotiate */
|
||||||
|
@ -986,8 +988,7 @@ gst_h264_parse_set_caps (GstBaseParse * parse, GstCaps * caps)
|
||||||
/* fallback codec-data */
|
/* fallback codec-data */
|
||||||
h264parse->codec_data = gst_buffer_ref (buffer);
|
h264parse->codec_data = gst_buffer_ref (buffer);
|
||||||
/* pass through unharmed, though _chain will parse a bit */
|
/* pass through unharmed, though _chain will parse a bit */
|
||||||
gst_base_parse_set_format (parse,
|
gst_base_parse_set_passthrough (parse, TRUE);
|
||||||
GST_BASE_PARSE_FORMAT_PASSTHROUGH, TRUE);
|
|
||||||
/* we did parse codec-data and might supplement src caps */
|
/* we did parse codec-data and might supplement src caps */
|
||||||
gst_h264_parse_update_src_caps (h264parse);
|
gst_h264_parse_update_src_caps (h264parse);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#define __GST_H264_PARSE_H__
|
#define __GST_H264_PARSE_H__
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/baseparse/gstbaseparse.h>
|
#include <gst/base/gstbaseparse.h>
|
||||||
|
|
||||||
#include "h264parse.h"
|
#include "h264parse.h"
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/base/gstadapter.h>
|
#include <gst/base/gstadapter.h>
|
||||||
#include <gst/baseparse/gstbaseparse.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue