Commit 1f775591 authored by Jan Schmidt's avatar Jan Schmidt

Port mpeg1videoparse to 0.10 and give it rank SECONDARY-1, so that it's below existing decoders.

Original commit message from CVS:
* configure.ac:
* gst/mpeg1videoparse/Makefile.am:
* gst/mpeg1videoparse/gstmp1videoparse.c:
* gst/mpeg1videoparse/gstmp1videoparse.h:
* gst/mpeg1videoparse/mp1videoparse.vcproj:
* gst/mpegvideoparse/Makefile.am:
* gst/mpegvideoparse/mpegpacketiser.c: (mpeg_packetiser_init),
(mpeg_packetiser_free), (mpeg_packetiser_add_buf),
(mpeg_packetiser_flush), (mpeg_find_start_code),
(get_next_free_block), (complete_current_block),
(append_to_current_block), (start_new_block), (handle_packet),
(collect_packets), (mpeg_packetiser_handle_eos),
(mpeg_packetiser_get_block), (mpeg_packetiser_next_block):
* gst/mpegvideoparse/mpegpacketiser.h:
* gst/mpegvideoparse/mpegvideoparse.c: (mpegvideoparse_get_type),
(gst_mpegvideoparse_base_init), (gst_mpegvideoparse_class_init),
(mpv_parse_reset), (gst_mpegvideoparse_init),
(gst_mpegvideoparse_dispose), (set_par_from_dar),
(set_fps_from_code), (mpegvideoparse_parse_seq),
(gst_mpegvideoparse_time_code), (gst_mpegvideoparse_flush),
(mpegvideoparse_drain_avail), (gst_mpegvideoparse_chain),
(mpv_parse_sink_event), (gst_mpegvideoparse_change_state),
(plugin_init):
* gst/mpegvideoparse/mpegvideoparse.h:
* gst/mpegvideoparse/mpegvideoparse.vcproj:
Port mpeg1videoparse to 0.10 and give it rank SECONDARY-1, so
that it's below existing decoders.
Rename it to mpegvideoparse to reflect that it handles MPEG-1 and
MPEG-2 now.
Re-write the parsing code so that it collects packets differently
and timestamps Picture packets correctly.
Add a list of FIXME's at the top.
parent 03ab5302
2007-03-15 Jan Schmidt <thaytan@mad.scientist.com>
* configure.ac:
* gst/mpeg1videoparse/Makefile.am:
* gst/mpeg1videoparse/gstmp1videoparse.c:
* gst/mpeg1videoparse/gstmp1videoparse.h:
* gst/mpeg1videoparse/mp1videoparse.vcproj:
* gst/mpegvideoparse/Makefile.am:
* gst/mpegvideoparse/mpegpacketiser.c: (mpeg_packetiser_init),
(mpeg_packetiser_free), (mpeg_packetiser_add_buf),
(mpeg_packetiser_flush), (mpeg_find_start_code),
(get_next_free_block), (complete_current_block),
(append_to_current_block), (start_new_block), (handle_packet),
(collect_packets), (mpeg_packetiser_handle_eos),
(mpeg_packetiser_get_block), (mpeg_packetiser_next_block):
* gst/mpegvideoparse/mpegpacketiser.h:
* gst/mpegvideoparse/mpegvideoparse.c: (mpegvideoparse_get_type),
(gst_mpegvideoparse_base_init), (gst_mpegvideoparse_class_init),
(mpv_parse_reset), (gst_mpegvideoparse_init),
(gst_mpegvideoparse_dispose), (set_par_from_dar),
(set_fps_from_code), (mpegvideoparse_parse_seq),
(gst_mpegvideoparse_time_code), (gst_mpegvideoparse_flush),
(mpegvideoparse_drain_avail), (gst_mpegvideoparse_chain),
(mpv_parse_sink_event), (gst_mpegvideoparse_change_state),
(plugin_init):
* gst/mpegvideoparse/mpegvideoparse.h:
* gst/mpegvideoparse/mpegvideoparse.vcproj:
Port mpeg1videoparse to 0.10 and give it rank SECONDARY-1, so
that it's below existing decoders.
Rename it to mpegvideoparse to reflect that it handles MPEG-1 and
MPEG-2 now.
Re-write the parsing code so that it collects packets differently
and timestamps Picture packets correctly.
Add a list of FIXME's at the top.
2007-03-14 Stefan Kost <ensonic@users.sf.net>
* tests/icles/equalizer-test.c: (equalizer_set_band_value),
......
......@@ -88,6 +88,7 @@ GST_PLUGINS_ALL="\
interleave \
librfb \
modplug \
mpegvideoparse \
multifile \
mve \
nsf \
......@@ -1061,6 +1062,7 @@ gst/interleave/Makefile
gst/librfb/Makefile
gst/modplug/Makefile
gst/modplug/libmodplug/Makefile
gst/mpegvideoparse/Makefile
gst/multifile/Makefile
gst/mve/Makefile
gst/nsf/Makefile
......
plugin_LTLIBRARIES = libgstmp1videoparse.la
libgstmp1videoparse_la_SOURCES = gstmp1videoparse.c
libgstmp1videoparse_la_CFLAGS = $(GST_CFLAGS)
libgstmp1videoparse_la_LIBADD =
libgstmp1videoparse_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
noinst_HEADERS = gstmp1videoparse.h
This diff is collapsed.
plugin_LTLIBRARIES = libgstmpegvideoparse.la
libgstmpegvideoparse_la_SOURCES = mpegvideoparse.c mpegpacketiser.c
libgstmpegvideoparse_la_CFLAGS = $(GST_CFLAGS)
libgstmpegvideoparse_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS)
libgstmpegvideoparse_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
noinst_HEADERS = mpegvideoparse.h mpegpacketiser.h
This diff is collapsed.
/* GStreamer
* Copyright (C) <2007> Jan Schmidt <thaytan@mad.scientist.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __MPEGPACKETISER_H__
#define __MPEGPACKETISER_H__
#include <gst/gst.h>
#include <gst/base/gstadapter.h>
typedef struct MPEGPacketiser MPEGPacketiser;
typedef struct MPEGBlockInfo MPEGBlockInfo;
/* Packet ID codes for different packet types we
* care about */
#define MPEG_PACKET_PICTURE 0x00
#define MPEG_PACKET_SLICE_MIN 0x01
#define MPEG_PACKET_SLICE_MAX 0xaf
#define MPEG_PACKET_SEQUENCE 0xb3
#define MPEG_PACKET_EXTENSION 0xb5
#define MPEG_PACKET_SEQUENCE_END 0xb7
#define MPEG_PACKET_GOP 0xb8
#define MPEG_PACKET_NONE 0xff
/* Extension codes we care about */
#define MPEG_PACKET_EXT_SEQUENCE 0x01
#define MPEG_PACKET_EXT_SEQUENCE_DISPLAY 0x02
#define MPEG_PACKET_EXT_QUANT_MATRIX 0x03
/* Flags indicating what type of packets are in this block, some are mutually
* exclusive though - ie, sequence packs are accumulated separately. GOP &
* Picture may occur together or separately */
#define MPEG_BLOCK_FLAG_SEQUENCE 0x01
#define MPEG_BLOCK_FLAG_PICTURE 0x02
#define MPEG_BLOCK_FLAG_GOP 0x04
struct MPEGBlockInfo {
guint8 first_pack_type;
guint8 flags;
guint64 offset;
guint32 length;
GstClockTime ts;
};
struct MPEGPacketiser {
GstAdapter *adapter;
/* position in the adapter */
guint64 adapter_offset;
/* Sync word accumulator */
guint32 sync_word;
/* Offset since the last flush (unrelated to incoming buffer offsets) */
guint64 tracked_offset;
/* Number of picture packets currently collected */
guint n_pictures;
/* 2 sets of timestamps + offsets used to mark picture blocks
* The first is used when a sync word overlaps packet boundaries
* and comes from some buffer in the past. The next one comes from current
* buffer. These are only ever valid when handling streams from a demuxer,
* of course. */
GstClockTime prev_buf_ts;
GstClockTime cur_buf_ts;
/* MPEG id of the previous SEQUENCE, PICTURE or GOP packet.
MPEG_PACKET_NONE after a flush */
guint8 prev_sync_packet;
/* Indices into the blocks array. cur_block_idx is where we're writing and
indicates the end of the populated block entries.
first_block_idx is the read ptr. It may be -1 to indicate there are no
complete blocks available */
gint cur_block_idx;
gint first_block_idx;
/* An array of MPEGBlockInfo entries, used as a growable circular buffer
* indexed by cur_block_idx and bounded by last_block_idx */
gint n_blocks;
MPEGBlockInfo *blocks;
};
guint8 *mpeg_find_start_code (guint32 *sync_word, guint8 *cur, guint8 *end);
void mpeg_packetiser_init (MPEGPacketiser *p);
void mpeg_packetiser_free (MPEGPacketiser *p);
void mpeg_packetiser_add_buf (MPEGPacketiser *p, GstBuffer *buf);
void mpeg_packetiser_handle_eos (MPEGPacketiser *p);
void mpeg_packetiser_flush (MPEGPacketiser *p);
/* Get the blockinfo and buffer for the block at the head of the queue */
MPEGBlockInfo *mpeg_packetiser_get_block (MPEGPacketiser *p, GstBuffer **buf);
/* Advance to the next data block */
void mpeg_packetiser_next_block (MPEGPacketiser *p);
#endif
This diff is collapsed.
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) <2007> Jan Schmidt <thaytan@mad.scientist.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -16,61 +17,63 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __MP1VIDEOPARSE_H__
#define __MP1VIDEOPARSE_H__
#ifndef __MPEGVIDEOPARSE_H__
#define __MPEGVIDEOPARSE_H__
#include <gst/gst.h>
#include "mpegpacketiser.h"
G_BEGIN_DECLS
#define GST_TYPE_MPEGVIDEOPARSE \
(mpegvideoparse_get_type())
#define GST_MPEGVIDEOPARSE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MPEGVIDEOPARSE,MpegVideoParse))
#define GST_MPEGVIDEOPARSE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MPEGVIDEOPARSE,MpegVideoParseClass))
#define GST_IS_MPEGVIDEOPARSE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MPEGVIDEOPARSE))
#define GST_IS_MPEGVIDEOPARSE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MPEGVIDEOPARSE))
typedef struct _MpegVideoParse MpegVideoParse;
typedef struct _MpegVideoParseClass MpegVideoParseClass;
typedef struct MPEGSeqHdr
{
/* 0 for unknown, else 1 or 2 */
guint8 mpeg_version;
/* Pixel-Aspect Ratio from DAR code via set_par_from_dar */
gint par_w, par_h;
/* Width and Height of the video */
gint width, height;
/* Framerate */
gint fps_n, fps_d;
} MPEGSeqHdr;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define GST_TYPE_MP1VIDEOPARSE \
(mp1videoparse_get_type())
#define GST_MP1VIDEOPARSE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MP1VIDEOPARSE,Mp1VideoParse))
#define GST_MP1VIDEOPARSE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MP1VIDEOPARSE,Mp1VideoParseClass))
#define GST_IS_MP1VIDEOPARSE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MP1VIDEOPARSE))
#define GST_IS_MP1VIDEOPARSE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MP1VIDEOPARSE))
typedef struct _Mp1VideoParse Mp1VideoParse;
typedef struct _Mp1VideoParseClass Mp1VideoParseClass;
struct _Mp1VideoParse {
struct _MpegVideoParse {
GstElement element;
GstPad *sinkpad,*srcpad;
GstPad *sinkpad, *srcpad;
GstBuffer *partialbuf; /* previous buffer (if carryover) */
gulong next_buffer_offset;
gboolean need_resync;
gboolean in_flush;
gint64 next_offset;
gboolean need_discont;
guint64 last_pts;
gint picture_in_buffer;
gint width, height;
gfloat fps, asr;
/* Info from the Sequence Header */
MPEGSeqHdr seq_hdr;
GstBuffer *seq_hdr_buf;
/* Packetise helper */
MPEGPacketiser packer;
};
struct _Mp1VideoParseClass {
struct _MpegVideoParseClass {
GstElementClass parent_class;
};
GType gst_mp1videoparse_get_type(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
GType gst_mpegvideoparse_get_type(void);
G_END_DECLS
#endif /* __MP1VIDEOPARSE_H__ */
#endif /* __MPEGVIDEOPARSE_H__ */
......@@ -2,7 +2,7 @@
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="mp1videoparse"
Name="mpegvideoparse"
ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D678E6}"
Keyword="Win32Proj">
<Platforms>
......@@ -20,7 +20,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;mp1videoparse_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;mpegvideoparse_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
......@@ -33,15 +33,15 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstmp1videoparse.dll"
OutputFile="$(OutDir)/mpegvideoparse.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="../../../gstreamer/win32/Debug;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
ModuleDefinitionFile=""
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/mp1videoparse.pdb"
ProgramDatabaseFile="$(OutDir)/mpegvideoparse.pdb"
SubSystem="2"
OptimizeReferences="2"
ImportLibrary="$(OutDir)/gstmp1videoparse.lib"
ImportLibrary="$(OutDir)/mpegvideoparse.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
......@@ -74,7 +74,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../gstreamer/win32;../../../gstreamer;../../../gstreamer/libs;../../../glib;../../../glib/glib;../../../glib/gmodule;&quot;../../gst-libs&quot;;../../../popt/include;../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;mp1videoparse_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;mpegvideoparse_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
......@@ -85,7 +85,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstmp1videoparse.dll"
OutputFile="$(OutDir)/mpegvideoparse.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../gstreamer/win32/Release;../../../glib/glib;../../../glib/gmodule;../../../glib/gthread;../../../glib/gobject;../../../gettext/lib;../../../libiconv/lib"
ModuleDefinitionFile=""
......@@ -93,7 +93,7 @@
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/gstmp1videoparse.lib"
ImportLibrary="$(OutDir)/mpegvideoparse.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
......@@ -126,7 +126,7 @@
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\gstmp1videoparse.c">
RelativePath=".\mpegvideoparse.c">
</File>
</Filter>
<Filter
......@@ -134,7 +134,7 @@
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\gstmp1videoparse.h">
RelativePath=".\mpegvideoparse.h">
</File>
</Filter>
<Filter
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment