• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer
2  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
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 #ifndef __GST_FFMPEGVIDDEC_H__
20 #define __GST_FFMPEGVIDDEC_H__
21 
22 #include <gst/gst.h>
23 #include <gst/video/video.h>
24 #include <libavcodec/avcodec.h>
25 
26 G_BEGIN_DECLS
27 
28 typedef struct _GstFFMpegVidDec GstFFMpegVidDec;
29 struct _GstFFMpegVidDec
30 {
31   GstVideoDecoder parent;
32 
33   GstVideoCodecState *input_state;
34   GstVideoCodecState *output_state;
35 
36   /* decoding */
37   AVCodecContext *context;
38   AVFrame *picture;
39   GstVideoMultiviewMode picture_multiview_mode;
40   GstVideoMultiviewFlags picture_multiview_flags;
41   gint stride[AV_NUM_DATA_POINTERS];
42   gboolean opened;
43 
44   /* current output pictures */
45   enum AVPixelFormat pic_pix_fmt;
46   gint pic_width;
47   gint pic_height;
48   gint pic_par_n;
49   gint pic_par_d;
50   gint pic_interlaced;
51   /* GST_VIDEO_BUFFER_FLAG_RFF | GST_VIDEO_BUFFER_FLAG_TFF */
52   gint pic_field_order;
53   gboolean pic_field_order_changed;
54   GstVideoMultiviewMode cur_multiview_mode;
55   GstVideoMultiviewFlags cur_multiview_flags;
56   /* current context */
57   gint ctx_ticks;
58   gint ctx_time_d;
59   gint ctx_time_n;
60   GstBuffer *palette;
61 
62   guint8 *padded;
63   gint padded_size;
64 
65   /* some properties */
66   enum AVDiscard skip_frame;
67   gint lowres;
68   gboolean direct_rendering;
69   int max_threads;
70   gboolean output_corrupt;
71   guint thread_type;
72 
73   GstCaps *last_caps;
74 
75   /* Internally used for direct rendering */
76   GstBufferPool *internal_pool;
77   gint pool_width;
78   gint pool_height;
79   enum AVPixelFormat pool_format;
80   GstVideoInfo pool_info;
81 #ifdef OHOS_OPT_PERFORMANCE // ohos.opt.performance.0001: first key frame decoded cost time
82   gboolean has_send_first_key_frame;
83   gint64 send_first_key_frame_time;
84   gboolean has_recv_first_key_frame;
85 #endif
86 #ifdef OHOS_OPT_COMPAT
87   // ohos.opt.compat.0012
88   gboolean is_first_key_frame_after_seek;
89 #endif
90 };
91 
92 typedef struct _GstFFMpegVidDecClass GstFFMpegVidDecClass;
93 
94 struct _GstFFMpegVidDecClass
95 {
96   GstVideoDecoderClass parent_class;
97 
98   AVCodec *in_plugin;
99 };
100 
101 G_END_DECLS
102 
103 #endif
104