theora: Port to base video classes

FIXME : Don't forget to backport changes that happened to theoraenc
since April 2011

theoraenc: Don't create keyframe on time gap

There is no rational to do so, and also gst_video_encoder_set_discont() is
gone from base class.
This commit is contained in:
Mark Nauwelaerts 2012-03-07 12:22:14 +01:00 committed by Edward Hervey
parent f6cfd763e4
commit 7bfd1bc3d7
4 changed files with 525 additions and 1964 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,8 @@
/* GStreamer
* Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de>
* Copyright (c) 2012 Collabora Ltd.
* Author : Edward Hervey <edward@collabora.com>
* Author : Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -25,6 +28,7 @@
#endif
#include <gst/gst.h>
#include <gst/video/gstvideodecoder.h>
#include <theora/theoradec.h>
#include <string.h>
@ -51,11 +55,7 @@ typedef struct _GstTheoraDecClass GstTheoraDecClass;
*/
struct _GstTheoraDec
{
GstElement element;
/* Pads */
GstPad *sinkpad;
GstPad *srcpad;
GstVideoDecoder element;
/* theora decoder state */
th_dec_ctx *decoder;
@ -66,14 +66,12 @@ struct _GstTheoraDec
gboolean have_header;
GstClockTime last_timestamp;
guint64 frame_nr;
gboolean need_keyframe;
gint width, height;
GstVideoCodecState *input_state;
GstVideoCodecState *output_state;
gint offset_x, offset_y;
gint output_bpp;
/* telemetry debugging options */
/* telemetry debuging options */
gint telemetry_mv;
gint telemetry_mbmode;
gint telemetry_qi;
@ -81,39 +79,17 @@ struct _GstTheoraDec
gboolean crop;
/* list of buffers that need timestamps */
GList *queued;
/* list of raw output buffers */
GList *output;
/* gather/decode queues for reverse playback */
GList *gather;
GList *decode;
GList *pendingevents;
GstTagList *tags;
/* segment info */ /* with STREAM_LOCK */
GstSegment segment;
gboolean discont;
guint32 seqnum;
/* QoS stuff */ /* with LOCK*/
gdouble proportion;
GstClockTime earliest_time;
guint64 processed;
guint64 dropped;
gboolean have_par;
gint par_num;
gint par_den;
};
struct _GstTheoraDecClass
{
GstElementClass parent_class;
GstVideoDecoderClass parent_class;
};
GType gst_theora_dec_get_type (void);
gboolean gst_theora_dec_register (GstPlugin * plugin);
G_END_DECLS

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,8 @@
/* GStreamer
* Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
* Copyright (c) 2012 Collabora Ltd.
* Author : Edward Hervey <edward@collabora.com>
* Author : Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -22,6 +25,7 @@
#include <gst/gst.h>
#include <gst/base/gstadapter.h>
#include <gst/video/gstvideoencoder.h>
#include <theora/theoraenc.h>
G_BEGIN_DECLS
@ -77,12 +81,7 @@ typedef enum
*/
struct _GstTheoraEnc
{
GstElement element;
GstPad *sinkpad;
GstPad *srcpad;
GstSegment segment;
GstVideoEncoder element;
ogg_stream_state to;
@ -99,21 +98,16 @@ struct _GstTheoraEnc
gint keyframe_freq;
gint keyframe_force;
gint info_width, info_height;
GstVideoCodecState *input_state;
gint width, height;
gint fps_n, fps_d;
gint par_n, par_d;
GstClockTime next_ts;
GstClockTime expected_ts;
gboolean next_discont;
gboolean force_keyframe;
guint packetno;
guint64 bytes_out;
guint64 granulepos_offset;
guint64 timestamp_offset;
guint64 pfn_offset;
gint speed_level;
gboolean vp3_compatible;
@ -122,13 +116,6 @@ struct _GstTheoraEnc
gboolean cap_underflow;
int rate_buffer;
/* variables for dup-on-gap */
gboolean dup_on_gap;
gboolean current_discont;
GstBuffer *prevbuf;
GQueue *t_queue;
/* end dup-on-gap */
GstTheoraEncMultipassMode multipass_mode;
GIOChannel *multipass_cache_fd;
GstAdapter *multipass_cache_adapter;
@ -137,10 +124,11 @@ struct _GstTheoraEnc
struct _GstTheoraEncClass
{
GstElementClass parent_class;
GstVideoEncoderClass parent_class;
};
GType gst_theora_enc_get_type (void);
gboolean gst_theora_enc_register (GstPlugin * plugin);
G_END_DECLS