avdeinterlace: fix element leak
[platform/upstream/gstreamer.git] / subprojects / gst-libav / ext / libav / gstavprotocol.h
1 /* GStreamer
2  * Copyright (C) <2006> Mark Nauwelaerts <manauw@skynet.be>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20
21 #ifndef __GST_FFMPEGPROTOCOL_H__
22 #define __GST_FFMPEGPROTOCOL_H__
23
24 #include <gst/base/gstadapter.h>
25 #include "gstav.h"
26
27 G_BEGIN_DECLS
28
29 /* pipe protocol helpers */
30 #define GST_FFMPEG_PIPE_MUTEX_LOCK(m) G_STMT_START {                    \
31   GST_LOG ("locking tlock from thread %p", g_thread_self ()); \
32   g_mutex_lock (&m->tlock);                                              \
33   GST_LOG ("locked tlock from thread %p", g_thread_self ());  \
34 } G_STMT_END
35
36 #define GST_FFMPEG_PIPE_MUTEX_UNLOCK(m) G_STMT_START {                    \
37   GST_LOG ("unlocking tlock from thread %p", g_thread_self ()); \
38   g_mutex_unlock (&m->tlock);                                              \
39 } G_STMT_END
40
41 #define GST_FFMPEG_PIPE_WAIT(m) G_STMT_START {                          \
42   GST_LOG ("thread %p waiting", g_thread_self ());            \
43   g_cond_wait (&m->cond, &m->tlock);                                      \
44 } G_STMT_END
45
46 #define GST_FFMPEG_PIPE_SIGNAL(m) G_STMT_START {                        \
47   GST_LOG ("signalling from thread %p", g_thread_self ());    \
48   g_cond_signal (&m->cond);                                              \
49 } G_STMT_END
50
51 typedef struct _GstFFMpegPipe GstFFMpegPipe;
52
53 struct _GstFFMpegPipe
54 {
55   /* lock for syncing */
56   GMutex tlock;
57   /* with TLOCK */
58   /* signals counterpart thread to have a look */
59   GCond cond;
60   /* seen eos */
61   gboolean eos;
62   /* flowreturn obtained by src task */
63   GstFlowReturn srcresult;
64   /* adpater collecting data */
65   GstAdapter *adapter;
66   /* amount needed in adapter by src task */
67   guint needed;
68 };
69
70 int gst_ffmpeg_pipe_open (GstFFMpegPipe *ffpipe, int flags, AVIOContext ** context);
71 int gst_ffmpeg_pipe_close (AVIOContext * h);
72
73 int gst_ffmpegdata_open (GstPad * pad, int flags, AVIOContext ** context);
74 int gst_ffmpegdata_close (AVIOContext * h);
75
76 G_END_DECLS
77
78 #endif /* __GST_FFMPEGPROTOCOL_H__ */