Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
gst-libav
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
60
Issues
60
List
Boards
Labels
Service Desk
Milestones
Merge Requests
11
Merge Requests
11
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GStreamer
gst-libav
Commits
7383aa1b
Commit
7383aa1b
authored
Mar 29, 2004
by
Thomas Vander Stichele
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
indent
Original commit message from CVS: indent
parent
d5cfdabb
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
894 additions
and
987 deletions
+894
-987
ChangeLog
ChangeLog
+4
-0
ext/ffmpeg/gstffmpeg.c
ext/ffmpeg/gstffmpeg.c
+14
-19
ext/ffmpeg/gstffmpegcodecmap.c
ext/ffmpeg/gstffmpegcodecmap.c
+306
-327
ext/ffmpeg/gstffmpegcolorspace.c
ext/ffmpeg/gstffmpegcolorspace.c
+75
-94
ext/ffmpeg/gstffmpegdec.c
ext/ffmpeg/gstffmpegdec.c
+111
-119
ext/ffmpeg/gstffmpegdemux.c
ext/ffmpeg/gstffmpegdemux.c
+116
-126
ext/ffmpeg/gstffmpegenc.c
ext/ffmpeg/gstffmpegenc.c
+140
-152
ext/ffmpeg/gstffmpegmux.c
ext/ffmpeg/gstffmpegmux.c
+108
-122
ext/ffmpeg/gstffmpegprotocol.c
ext/ffmpeg/gstffmpegprotocol.c
+20
-28
No files found.
ChangeLog
View file @
7383aa1b
2004-03-29 Thomas Vander Stichele <thomas at apestaart dot org>
* ext/ffmpeg/*.c: indent
2004-03-25 Ronald Bultje <rbultje@ronald.bitfreak.net>
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_base_init):
...
...
ext/ffmpeg/gstffmpeg.c
View file @
7383aa1b
...
...
@@ -33,16 +33,16 @@
#include <ffmpeg/avformat.h>
#endif
extern
gboolean
gst_ffmpegdemux_register
(
GstPlugin
*
plugin
);
extern
gboolean
gst_ffmpegdec_register
(
GstPlugin
*
plugin
);
extern
gboolean
gst_ffmpegenc_register
(
GstPlugin
*
plugin
);
extern
gboolean
gst_ffmpegmux_register
(
GstPlugin
*
plugin
);
extern
gboolean
gst_ffmpegcsp_register
(
GstPlugin
*
plugin
);
extern
gboolean
gst_ffmpegdemux_register
(
GstPlugin
*
plugin
);
extern
gboolean
gst_ffmpegdec_register
(
GstPlugin
*
plugin
);
extern
gboolean
gst_ffmpegenc_register
(
GstPlugin
*
plugin
);
extern
gboolean
gst_ffmpegmux_register
(
GstPlugin
*
plugin
);
extern
gboolean
gst_ffmpegcsp_register
(
GstPlugin
*
plugin
);
extern
URLProtocol
gstreamer_protocol
;
static
gboolean
plugin_init
(
GstPlugin
*
plugin
)
plugin_init
(
GstPlugin
*
plugin
)
{
if
(
!
gst_library_load
(
"gstbytestream"
))
return
FALSE
;
...
...
@@ -54,7 +54,7 @@ plugin_init (GstPlugin *plugin)
gst_ffmpegenc_register
(
plugin
);
gst_ffmpegdec_register
(
plugin
);
gst_ffmpegdemux_register
(
plugin
);
/*gst_ffmpegmux_register (plugin);*/
/*gst_ffmpegmux_register (plugin);
*/
gst_ffmpegcsp_register
(
plugin
);
register_protocol
(
&
gstreamer_protocol
);
...
...
@@ -63,14 +63,9 @@ plugin_init (GstPlugin *plugin)
return
TRUE
;
}
GST_PLUGIN_DEFINE
(
GST_VERSION_MAJOR
,
GST_VERSION_MINOR
,
"ffmpeg"
,
"All FFMPEG codecs"
,
plugin_init
,
FFMPEG_VERSION
,
"LGPL"
,
"FFMpeg"
,
"http://ffmpeg.sourceforge.net/"
)
GST_PLUGIN_DEFINE
(
GST_VERSION_MAJOR
,
GST_VERSION_MINOR
,
"ffmpeg"
,
"All FFMPEG codecs"
,
plugin_init
,
FFMPEG_VERSION
,
"LGPL"
,
"FFMpeg"
,
"http://ffmpeg.sourceforge.net/"
)
ext/ffmpeg/gstffmpegcodecmap.c
View file @
7383aa1b
This diff is collapsed.
Click to expand it.
ext/ffmpeg/gstffmpegcolorspace.c
View file @
7383aa1b
...
...
@@ -46,22 +46,21 @@
typedef
struct
_GstFFMpegCsp
GstFFMpegCsp
;
typedef
struct
_GstFFMpegCspClass
GstFFMpegCspClass
;
struct
_GstFFMpegCsp
{
GstElement
element
;
GstPad
*
sinkpad
,
*
srcpad
;
gint
width
,
height
;
gfloat
fps
;
enum
PixelFormat
from_pixfmt
,
to_pixfmt
;
AVFrame
*
from_frame
,
*
to_frame
;
GstCaps
*
sinkcaps
;
struct
_GstFFMpegCsp
{
GstElement
element
;
GstPad
*
sinkpad
,
*
srcpad
;
gint
width
,
height
;
gfloat
fps
;
enum
PixelFormat
from_pixfmt
,
to_pixfmt
;
AVFrame
*
from_frame
,
*
to_frame
;
GstCaps
*
sinkcaps
;
};
struct
_GstFFMpegCspClass
{
struct
_GstFFMpegCspClass
{
GstElementClass
parent_class
;
};
...
...
@@ -75,72 +74,68 @@ static GstElementDetails ffmpegcsp_details = {
/* Stereo signals and args */
enum
{
enum
{
/* FILL ME */
LAST_SIGNAL
};
enum
{
enum
{
ARG_0
,
};
static
GType
gst_ffmpegcsp_get_type
(
void
);
static
GType
gst_ffmpegcsp_get_type
(
void
);
static
void
gst_ffmpegcsp_base_init
(
GstFFMpegCspClass
*
klass
);
static
void
gst_ffmpegcsp_class_init
(
GstFFMpegCspClass
*
klass
);
static
void
gst_ffmpegcsp_init
(
GstFFMpegCsp
*
space
);
static
void
gst_ffmpegcsp_base_init
(
GstFFMpegCspClass
*
klass
);
static
void
gst_ffmpegcsp_class_init
(
GstFFMpegCspClass
*
klass
);
static
void
gst_ffmpegcsp_init
(
GstFFMpegCsp
*
space
);
static
void
gst_ffmpegcsp_set_property
(
GObject
*
object
,
guint
prop_id
,
const
GValue
*
value
,
GParamSpec
*
pspec
);
static
void
gst_ffmpegcsp_get_property
(
GObject
*
object
,
guint
prop_id
,
GValue
*
value
,
GParamSpec
*
pspec
);
static
void
gst_ffmpegcsp_set_property
(
GObject
*
object
,
guint
prop_id
,
const
GValue
*
value
,
GParamSpec
*
pspec
);
static
void
gst_ffmpegcsp_get_property
(
GObject
*
object
,
guint
prop_id
,
GValue
*
value
,
GParamSpec
*
pspec
);
static
GstPadLinkReturn
gst_ffmpegcsp_pad_link
(
GstPad
*
pad
,
const
GstCaps
*
caps
);
gst_ffmpegcsp_pad_link
(
GstPad
*
pad
,
const
GstCaps
*
caps
);
static
void
gst_ffmpegcsp_chain
(
GstPad
*
pad
,
GstData
*
data
);
static
GstElementStateReturn
gst_ffmpegcsp_change_state
(
GstElement
*
element
);
static
void
gst_ffmpegcsp_chain
(
GstPad
*
pad
,
GstData
*
data
);
static
GstElementStateReturn
gst_ffmpegcsp_change_state
(
GstElement
*
element
);
static
GstPadTemplate
*
srctempl
,
*
sinktempl
;
static
GstElementClass
*
parent_class
=
NULL
;
/*static guint gst_ffmpegcsp_signals[LAST_SIGNAL] = { 0 }; */
static
GstCaps
*
gst_ffmpegcsp_caps_remove_format_info
(
GstCaps
*
caps
)
gst_ffmpegcsp_caps_remove_format_info
(
GstCaps
*
caps
)
{
int
i
;
GstStructure
*
structure
;
GstCaps
*
rgbcaps
;
for
(
i
=
0
;
i
<
gst_caps_get_size
(
caps
);
i
++
)
{
for
(
i
=
0
;
i
<
gst_caps_get_size
(
caps
);
i
++
)
{
structure
=
gst_caps_get_structure
(
caps
,
i
);
gst_structure_set_name
(
structure
,
"video/x-raw-yuv"
);
gst_structure_remove_field
(
structure
,
"format"
);
gst_structure_remove_field
(
structure
,
"endianness"
);
gst_structure_remove_field
(
structure
,
"depth"
);
gst_structure_remove_field
(
structure
,
"bpp"
);
gst_structure_remove_field
(
structure
,
"red_mask"
);
gst_structure_remove_field
(
structure
,
"green_mask"
);
gst_structure_remove_field
(
structure
,
"blue_mask"
);
gst_structure_set_name
(
structure
,
"video/x-raw-yuv"
);
gst_structure_remove_field
(
structure
,
"format"
);
gst_structure_remove_field
(
structure
,
"endianness"
);
gst_structure_remove_field
(
structure
,
"depth"
);
gst_structure_remove_field
(
structure
,
"bpp"
);
gst_structure_remove_field
(
structure
,
"red_mask"
);
gst_structure_remove_field
(
structure
,
"green_mask"
);
gst_structure_remove_field
(
structure
,
"blue_mask"
);
}
rgbcaps
=
gst_caps_simplify
(
caps
);
gst_caps_free
(
caps
);
caps
=
gst_caps_copy
(
rgbcaps
);
for
(
i
=
0
;
i
<
gst_caps_get_size
(
rgbcaps
);
i
++
)
{
for
(
i
=
0
;
i
<
gst_caps_get_size
(
rgbcaps
);
i
++
)
{
structure
=
gst_caps_get_structure
(
rgbcaps
,
i
);
gst_structure_set_name
(
structure
,
"video/x-raw-rgb"
);
gst_structure_set_name
(
structure
,
"video/x-raw-rgb"
);
}
gst_caps_append
(
caps
,
rgbcaps
);
...
...
@@ -149,13 +144,13 @@ gst_ffmpegcsp_caps_remove_format_info (GstCaps *caps)
}
static
GstCaps
*
gst_ffmpegcsp_getcaps
(
GstPad
*
pad
)
gst_ffmpegcsp_getcaps
(
GstPad
*
pad
)
{
GstFFMpegCsp
*
space
;
GstCaps
*
othercaps
;
GstCaps
*
caps
;
GstPad
*
otherpad
;
space
=
GST_FFMPEGCSP
(
gst_pad_get_parent
(
pad
));
otherpad
=
(
pad
==
space
->
srcpad
)
?
space
->
sinkpad
:
space
->
srcpad
;
...
...
@@ -171,8 +166,7 @@ gst_ffmpegcsp_getcaps (GstPad *pad)
}
static
GstPadLinkReturn
gst_ffmpegcsp_pad_link
(
GstPad
*
pad
,
const
GstCaps
*
caps
)
gst_ffmpegcsp_pad_link
(
GstPad
*
pad
,
const
GstCaps
*
caps
)
{
GstStructure
*
structure
;
AVCodecContext
*
ctx
;
...
...
@@ -223,8 +217,7 @@ gst_ffmpegcsp_pad_link (GstPad *pad,
gst_caps_set_simple
(
caps
,
"width"
,
G_TYPE_INT
,
width
,
"height"
,
G_TYPE_INT
,
height
,
"framerate"
,
G_TYPE_DOUBLE
,
framerate
,
NULL
);
"framerate"
,
G_TYPE_DOUBLE
,
framerate
,
NULL
);
ret
=
gst_pad_try_set_caps
(
otherpad
,
caps
);
if
(
GST_PAD_LINK_FAILED
(
ret
))
{
return
ret
;
...
...
@@ -270,15 +263,14 @@ gst_ffmpegcsp_get_type (void)
};
ffmpegcsp_type
=
g_type_register_static
(
GST_TYPE_ELEMENT
,
"GstFFMpegCsp"
,
&
ffmpegcsp_info
,
0
);
"GstFFMpegCsp"
,
&
ffmpegcsp_info
,
0
);
}
return
ffmpegcsp_type
;
}
static
void
gst_ffmpegcsp_base_init
(
GstFFMpegCspClass
*
klass
)
gst_ffmpegcsp_base_init
(
GstFFMpegCspClass
*
klass
)
{
GstElementClass
*
element_class
=
GST_ELEMENT_CLASS
(
klass
);
...
...
@@ -288,13 +280,13 @@ gst_ffmpegcsp_base_init (GstFFMpegCspClass *klass)
}
static
void
gst_ffmpegcsp_class_init
(
GstFFMpegCspClass
*
klass
)
gst_ffmpegcsp_class_init
(
GstFFMpegCspClass
*
klass
)
{
GObjectClass
*
gobject_class
;
GstElementClass
*
gstelement_class
;
gobject_class
=
(
GObjectClass
*
)
klass
;
gstelement_class
=
(
GstElementClass
*
)
klass
;
gobject_class
=
(
GObjectClass
*
)
klass
;
gstelement_class
=
(
GstElementClass
*
)
klass
;
parent_class
=
g_type_class_ref
(
GST_TYPE_ELEMENT
);
...
...
@@ -305,13 +297,13 @@ gst_ffmpegcsp_class_init (GstFFMpegCspClass *klass)
}
static
void
gst_ffmpegcsp_init
(
GstFFMpegCsp
*
space
)
gst_ffmpegcsp_init
(
GstFFMpegCsp
*
space
)
{
space
->
sinkpad
=
gst_pad_new_from_template
(
sinktempl
,
"sink"
);
gst_pad_set_link_function
(
space
->
sinkpad
,
gst_ffmpegcsp_pad_link
);
gst_pad_set_getcaps_function
(
space
->
sinkpad
,
gst_ffmpegcsp_getcaps
);
gst_pad_set_chain_function
(
space
->
sinkpad
,
gst_ffmpegcsp_chain
);
gst_element_add_pad
(
GST_ELEMENT
(
space
),
space
->
sinkpad
);
gst_pad_set_chain_function
(
space
->
sinkpad
,
gst_ffmpegcsp_chain
);
gst_element_add_pad
(
GST_ELEMENT
(
space
),
space
->
sinkpad
);
space
->
srcpad
=
gst_pad_new_from_template
(
srctempl
,
"src"
);
gst_element_add_pad
(
GST_ELEMENT
(
space
),
space
->
srcpad
);
...
...
@@ -323,8 +315,7 @@ gst_ffmpegcsp_init (GstFFMpegCsp *space)
}
static
void
gst_ffmpegcsp_chain
(
GstPad
*
pad
,
GstData
*
data
)
gst_ffmpegcsp_chain
(
GstPad
*
pad
,
GstData
*
data
)
{
GstBuffer
*
inbuf
=
GST_BUFFER
(
data
);
GstFFMpegCsp
*
space
;
...
...
@@ -335,14 +326,13 @@ gst_ffmpegcsp_chain (GstPad *pad,
g_return_if_fail
(
inbuf
!=
NULL
);
space
=
GST_FFMPEGCSP
(
gst_pad_get_parent
(
pad
));
g_return_if_fail
(
space
!=
NULL
);
g_return_if_fail
(
GST_IS_FFMPEGCSP
(
space
));
if
(
space
->
from_pixfmt
==
PIX_FMT_NB
||
space
->
to_pixfmt
==
PIX_FMT_NB
)
{
if
(
space
->
from_pixfmt
==
PIX_FMT_NB
||
space
->
to_pixfmt
==
PIX_FMT_NB
)
{
GST_ELEMENT_ERROR
(
space
,
CORE
,
NOT_IMPLEMENTED
,
NULL
,
(
"attempting to convert colorspaces between unknown formats"
));
(
"attempting to convert colorspaces between unknown formats"
));
gst_buffer_unref
(
inbuf
);
return
;
}
...
...
@@ -352,19 +342,19 @@ gst_ffmpegcsp_chain (GstPad *pad,
}
else
{
/* use bufferpool here */
guint
size
=
avpicture_get_size
(
space
->
to_pixfmt
,
space
->
width
,
space
->
height
);
outbuf
=
gst_pad_alloc_buffer
(
space
->
srcpad
,
GST_BUFFER_OFFSET_NONE
,
size
);
space
->
width
,
space
->
height
);
outbuf
=
gst_pad_alloc_buffer
(
space
->
srcpad
,
GST_BUFFER_OFFSET_NONE
,
size
);
/* convert */
avpicture_fill
((
AVPicture
*
)
space
->
from_frame
,
GST_BUFFER_DATA
(
inbuf
),
space
->
from_pixfmt
,
space
->
width
,
space
->
height
);
space
->
from_pixfmt
,
space
->
width
,
space
->
height
);
avpicture_fill
((
AVPicture
*
)
space
->
to_frame
,
GST_BUFFER_DATA
(
outbuf
),
space
->
to_pixfmt
,
space
->
width
,
space
->
height
);
space
->
to_pixfmt
,
space
->
width
,
space
->
height
);
img_convert
((
AVPicture
*
)
space
->
to_frame
,
space
->
to_pixfmt
,
(
AVPicture
*
)
space
->
from_frame
,
space
->
from_pixfmt
,
space
->
width
,
space
->
height
);
(
AVPicture
*
)
space
->
from_frame
,
space
->
from_pixfmt
,
space
->
width
,
space
->
height
);
GST_BUFFER_TIMESTAMP
(
outbuf
)
=
GST_BUFFER_TIMESTAMP
(
inbuf
);
GST_BUFFER_DURATION
(
outbuf
)
=
GST_BUFFER_DURATION
(
inbuf
);
...
...
@@ -376,7 +366,7 @@ gst_ffmpegcsp_chain (GstPad *pad,
}
static
GstElementStateReturn
gst_ffmpegcsp_change_state
(
GstElement
*
element
)
gst_ffmpegcsp_change_state
(
GstElement
*
element
)
{
GstFFMpegCsp
*
space
;
...
...
@@ -400,10 +390,8 @@ gst_ffmpegcsp_change_state (GstElement *element)
}
static
void
gst_ffmpegcsp_set_property
(
GObject
*
object
,
guint
prop_id
,
const
GValue
*
value
,
GParamSpec
*
pspec
)
gst_ffmpegcsp_set_property
(
GObject
*
object
,
guint
prop_id
,
const
GValue
*
value
,
GParamSpec
*
pspec
)
{
GstFFMpegCsp
*
space
;
...
...
@@ -418,10 +406,8 @@ gst_ffmpegcsp_set_property (GObject *object,
}
static
void
gst_ffmpegcsp_get_property
(
GObject
*
object
,
guint
prop_id
,
GValue
*
value
,
GParamSpec
*
pspec
)
gst_ffmpegcsp_get_property
(
GObject
*
object
,
guint
prop_id
,
GValue
*
value
,
GParamSpec
*
pspec
)
{
GstFFMpegCsp
*
space
;
...
...
@@ -437,7 +423,7 @@ gst_ffmpegcsp_get_property (GObject *object,
}
gboolean
gst_ffmpegcsp_register
(
GstPlugin
*
plugin
)
gst_ffmpegcsp_register
(
GstPlugin
*
plugin
)
{
GstCaps
*
caps
;
...
...
@@ -445,15 +431,10 @@ gst_ffmpegcsp_register (GstPlugin *plugin)
caps
=
gst_ffmpeg_codectype_to_caps
(
CODEC_TYPE_VIDEO
,
NULL
);
/* build templates */
srctempl
=
gst_pad_template_new
(
"src"
,
GST_PAD_SRC
,
GST_PAD_ALWAYS
,
gst_caps_copy
(
caps
));
sinktempl
=
gst_pad_template_new
(
"sink"
,
GST_PAD_SINK
,
GST_PAD_ALWAYS
,
caps
);
srctempl
=
gst_pad_template_new
(
"src"
,
GST_PAD_SRC
,
GST_PAD_ALWAYS
,
gst_caps_copy
(
caps
));
sinktempl
=
gst_pad_template_new
(
"sink"
,
GST_PAD_SINK
,
GST_PAD_ALWAYS
,
caps
);
return
gst_element_register
(
plugin
,
"ffcolorspace"
,
GST_RANK_NONE
,
GST_TYPE_FFMPEGCSP
);
GST_RANK_NONE
,
GST_TYPE_FFMPEGCSP
);
}
ext/ffmpeg/gstffmpegdec.c
View file @
7383aa1b
...
...
@@ -36,7 +36,8 @@
typedef
struct
_GstFFMpegDec
GstFFMpegDec
;
struct
_GstFFMpegDec
{
struct
_GstFFMpegDec
{
GstElement
element
;
/* We need to keep track of our pads, so we do so here. */
...
...
@@ -50,7 +51,8 @@ struct _GstFFMpegDec {
typedef
struct
_GstFFMpegDecClass
GstFFMpegDecClass
;
struct
_GstFFMpegDecClass
{
struct
_GstFFMpegDecClass
{
GstElementClass
parent_class
;
AVCodec
*
in_plugin
;
...
...
@@ -59,7 +61,8 @@ struct _GstFFMpegDecClass {
typedef
struct
_GstFFMpegDecClassParams
GstFFMpegDecClassParams
;
struct
_GstFFMpegDecClassParams
{
struct
_GstFFMpegDecClassParams
{
AVCodec
*
in_plugin
;
GstCaps
*
srccaps
,
*
sinkcaps
;
};
...
...
@@ -75,12 +78,14 @@ struct _GstFFMpegDecClassParams {
#define GST_IS_FFMPEGDEC_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FFMPEGDEC))
enum
{
enum
{
/* FILL ME */
LAST_SIGNAL
};
enum
{
enum
{
ARG_0
,
/* FILL ME */
};
...
...
@@ -88,25 +93,23 @@ enum {
static
GHashTable
*
global_plugins
;
/* A number of functon prototypes are given so we can refer to them later. */
static
void
gst_ffmpegdec_base_init
(
GstFFMpegDecClass
*
klass
);
static
void
gst_ffmpegdec_class_init
(
GstFFMpegDecClass
*
klass
);
static
void
gst_ffmpegdec_init
(
GstFFMpegDec
*
ffmpegdec
);
static
void
gst_ffmpegdec_dispose
(
GObject
*
object
);
static
void
gst_ffmpegdec_base_init
(
GstFFMpegDecClass
*
klass
);
static
void
gst_ffmpegdec_class_init
(
GstFFMpegDecClass
*
klass
);
static
void
gst_ffmpegdec_init
(
GstFFMpegDec
*
ffmpegdec
);
static
void
gst_ffmpegdec_dispose
(
GObject
*
object
);
static
GstPadLinkReturn
gst_ffmpegdec_connect
(
GstPad
*
pad
,
const
GstCaps
*
caps
);
static
void
gst_ffmpegdec_chain
(
GstPad
*
pad
,
GstData
*
data
);
static
GstPadLinkReturn
gst_ffmpegdec_connect
(
GstPad
*
pad
,
const
GstCaps
*
caps
);
static
void
gst_ffmpegdec_chain
(
GstPad
*
pad
,
GstData
*
data
);
static
GstElementStateReturn
gst_ffmpegdec_change_state
(
GstElement
*
element
);
static
GstElementStateReturn
gst_ffmpegdec_change_state
(
GstElement
*
element
);
#if 0
/* some sort of bufferpool handling, but different */
static int
gst_ffmpegdec_get_buffer (AVCodecContext *
context,
AVFrame *
picture);
static void
gst_ffmpegdec_release_buffer (AVCodecContext *
context,
AVFrame *
picture);
static int
gst_ffmpegdec_get_buffer (AVCodecContext *
context,
AVFrame *
picture);
static void
gst_ffmpegdec_release_buffer (AVCodecContext *
context,
AVFrame *
picture);
#endif
static
GstElementClass
*
parent_class
=
NULL
;
...
...
@@ -114,7 +117,7 @@ static GstElementClass *parent_class = NULL;
/*static guint gst_ffmpegdec_signals[LAST_SIGNAL] = { 0 }; */
static
void
gst_ffmpegdec_base_init
(
GstFFMpegDecClass
*
klass
)
gst_ffmpegdec_base_init
(
GstFFMpegDecClass
*
klass
)
{
GObjectClass
*
gobject_class
=
G_OBJECT_CLASS
(
klass
);
GstElementClass
*
element_class
=
GST_ELEMENT_CLASS
(
klass
);
...
...
@@ -123,22 +126,20 @@ gst_ffmpegdec_base_init (GstFFMpegDecClass *klass)
GstPadTemplate
*
sinktempl
,
*
srctempl
;
params
=
g_hash_table_lookup
(
global_plugins
,
GINT_TO_POINTER
(
G_OBJECT_CLASS_TYPE
(
gobject_class
)));
GINT_TO_POINTER
(
G_OBJECT_CLASS_TYPE
(
gobject_class
)));
if
(
!
params
)
params
=
g_hash_table_lookup
(
global_plugins
,
GINT_TO_POINTER
(
0
));
params
=
g_hash_table_lookup
(
global_plugins
,
GINT_TO_POINTER
(
0
));
g_assert
(
params
);
/* construct the element details struct */
details
.
longname
=
g_strdup_printf
(
"FFMPEG %s decoder"
,
params
->
in_plugin
->
name
);
details
.
klass
=
g_strdup_printf
(
"Codec/%s/Decoder"
,
(
params
->
in_plugin
->
type
==
CODEC_TYPE_VIDEO
)
?
"Video"
:
"Audio"
);
details
.
description
=
g_strdup_printf
(
"FFMPEG %s decoder"
,
params
->
in_plugin
->
name
);
details
.
longname
=
g_strdup_printf
(
"FFMPEG %s decoder"
,
params
->
in_plugin
->
name
);
details
.
klass
=
g_strdup_printf
(
"Codec/%s/Decoder"
,
(
params
->
in_plugin
->
type
==
CODEC_TYPE_VIDEO
)
?
"Video"
:
"Audio"
);
details
.
description
=
g_strdup_printf
(
"FFMPEG %s decoder"
,
params
->
in_plugin
->
name
);
details
.
author
=
"Wim Taymans <wim.taymans@chello.be>, "
"Ronald Bultje <rbultje@ronald.bitfreak.net>"
;
"Ronald Bultje <rbultje@ronald.bitfreak.net>"
;
gst_element_class_set_details
(
element_class
,
&
details
);
g_free
(
details
.
longname
);
g_free
(
details
.
klass
);
...
...
@@ -146,9 +147,9 @@ gst_ffmpegdec_base_init (GstFFMpegDecClass *klass)
/* pad templates */
sinktempl
=
gst_pad_template_new
(
"sink"
,
GST_PAD_SINK
,
GST_PAD_ALWAYS
,
params
->
sinkcaps
);
GST_PAD_ALWAYS
,
params
->
sinkcaps
);
srctempl
=
gst_pad_template_new
(
"src"
,
GST_PAD_SRC
,
GST_PAD_ALWAYS
,
params
->
srccaps
);
GST_PAD_ALWAYS
,
params
->
srccaps
);
gst_element_class_add_pad_template
(
element_class
,
srctempl
);
gst_element_class_add_pad_template
(
element_class
,
sinktempl
);
...
...
@@ -159,13 +160,13 @@ gst_ffmpegdec_base_init (GstFFMpegDecClass *klass)
}
static
void
gst_ffmpegdec_class_init
(
GstFFMpegDecClass
*
klass
)
gst_ffmpegdec_class_init
(
GstFFMpegDecClass
*
klass
)
{
GObjectClass
*
gobject_class
;
GstElementClass
*
gstelement_class
;
gobject_class
=
(
GObjectClass
*
)
klass
;
gstelement_class
=
(
GstElementClass
*
)
klass
;
gobject_class
=
(
GObjectClass
*
)
klass
;
gstelement_class
=
(
GstElementClass
*
)
klass
;
parent_class
=
g_type_class_peek_parent
(
klass
);
...
...
@@ -174,9 +175,10 @@ gst_ffmpegdec_class_init (GstFFMpegDecClass *klass)
}
static
void
gst_ffmpegdec_init
(
GstFFMpegDec
*
ffmpegdec
)
gst_ffmpegdec_init
(
GstFFMpegDec
*
ffmpegdec
)
{
GstFFMpegDecClass
*
oclass
=
(
GstFFMpegDecClass
*
)(
G_OBJECT_GET_CLASS
(
ffmpegdec
));
GstFFMpegDecClass
*
oclass
=
(
GstFFMpegDecClass
*
)
(
G_OBJECT_GET_CLASS
(
ffmpegdec
));
/* setup pads */
ffmpegdec
->
sinkpad
=
gst_pad_new_from_template
(
oclass
->
sinktempl
,
"sink"
);
...
...
@@ -189,14 +191,14 @@ gst_ffmpegdec_init (GstFFMpegDec *ffmpegdec)
gst_element_add_pad
(
GST_ELEMENT
(
ffmpegdec
),
ffmpegdec
->
srcpad
);
/* some ffmpeg data */
ffmpegdec
->
context
=
avcodec_alloc_context
();
ffmpegdec
->
picture
=
avcodec_alloc_frame
();
ffmpegdec
->
context
=
avcodec_alloc_context
();
ffmpegdec
->
picture
=
avcodec_alloc_frame
();
ffmpegdec
->
opened
=
FALSE
;
}
static
void
gst_ffmpegdec_dispose
(
GObject
*
object
)
gst_ffmpegdec_dispose
(
GObject
*
object
)
{
GstFFMpegDec
*
ffmpegdec
=
(
GstFFMpegDec
*
)
object
;
...
...
@@ -210,11 +212,11 @@ gst_ffmpegdec_dispose (GObject *object)
}
static
GstPadLinkReturn
gst_ffmpegdec_connect
(
GstPad
*
pad
,
const
GstCaps
*
caps
)
gst_ffmpegdec_connect
(
GstPad
*
pad
,
const
GstCaps
*
caps
)
{
GstFFMpegDec
*
ffmpegdec
=
(
GstFFMpegDec
*
)(
gst_pad_get_parent
(
pad
));
GstFFMpegDecClass
*
oclass
=
(
GstFFMpegDecClass
*
)(
G_OBJECT_GET_CLASS
(
ffmpegdec
));
GstFFMpegDec
*
ffmpegdec
=
(
GstFFMpegDec
*
)
(
gst_pad_get_parent
(
pad
));
GstFFMpegDecClass
*
oclass
=
(
GstFFMpegDecClass
*
)
(
G_OBJECT_GET_CLASS
(
ffmpegdec
));
/* close old session */
if
(
ffmpegdec
->
opened
)
{
...
...
@@ -233,13 +235,13 @@ gst_ffmpegdec_connect (GstPad *pad,
/* get size and so */
gst_ffmpeg_caps_to_codectype
(
oclass
->
in_plugin
->
type
,
caps
,
ffmpegdec
->
context
);
caps
,
ffmpegdec
->
context
);
/* we dont send complete frames - FIXME: we need a 'framed' property
* in caps */
if
(
oclass
->
in_plugin
->
capabilities
&
CODEC_CAP_TRUNCATED
&&
(
ffmpegdec
->
context
->
codec_id
==
CODEC_ID_MPEG1VIDEO
||
ffmpegdec
->
context
->
codec_id
==
CODEC_ID_MPEG2VIDEO
))
ffmpegdec
->
context
->
codec_id
==
CODEC_ID_MPEG2VIDEO
))
ffmpegdec
->
context
->
flags
|=
CODEC_FLAG_TRUNCATED
;
/* do *not* draw edges */
...
...
@@ -251,7 +253,7 @@ gst_ffmpegdec_connect (GstPad *pad,
if
(
avcodec_open
(
ffmpegdec
->
context
,
oclass
->
in_plugin
)
<
0
)
{
avcodec_close
(
ffmpegdec
->
context
);
GST_DEBUG
(
"ffdec_%s: Failed to open FFMPEG codec"
,
oclass
->
in_plugin
->
name
);
oclass
->
in_plugin
->
name
);
return
GST_PAD_LINK_REFUSED
;
}
...
...
@@ -263,8 +265,7 @@ gst_ffmpegdec_connect (GstPad *pad,
#if 0