webOS Userland
Native system APIs for webOS
media-common.h
1 /*
2  * Copyright (c) 2008-2018 LG Electronics, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9 
10 
11 
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17 
18  * SPDX-License-Identifier: Apache-2.0
19  */
20 
21 #ifndef NDL_DIRECTMEDIA2_MEDIA_COMMON_H_
22 #define NDL_DIRECTMEDIA2_MEDIA_COMMON_H_
23 
24 #include "media-types.h"
25 
29 typedef enum {
30  NDL_ESP_PTS_TICKS,
31  NDL_ESP_PTS_MICROSECS,
32 } NDL_ESP_PTS_UNITS;
33 
37 typedef struct {
38  uint8_t* data;
39  uint32_t data_len; // total data length
40  uint32_t offset; // current offset
41  NDL_ESP_STREAM_T stream_type;
42  int64_t timestamp; // PTS in stream
43  uint32_t flags; // OMX buffer flag to set END_OF_STREAM. 0x0001 => EOS.
45 
49 // TODO : will use more specific name..later.
50 typedef struct {
55  NDL_ESP_VIDEO_CODEC video_codec;
56 
61  NDL_ESP_AUDIO_CODEC audio_codec;
62 
63  //TODO : Need to be added...
64  // !Consider OMX IL Component Configuration for MSTAR & SIC.
65 
66  // Only use for RPI
67  /* config for video */
68  uint32_t framerate;
69  uint32_t width;
70  uint32_t video_encoding;
71  uint32_t height;
72  void* extradata;
73  uint32_t extrasize;
74 
75  /* config for audio */
76  uint32_t channels;
77  uint32_t samplerate;
78  uint32_t blockalign;
79  uint32_t bitrate;
80  uint32_t bitspersample;
82 
95 typedef enum {
96  NDL_ESP_FIRST_FRAME_PRESENTED,
97  NDL_ESP_LOW_THRESHOLD_CROSSED_VIDEO,
98  NDL_ESP_HIGH_THRESHOLD_CROSSED_VIDEO,
99  NDL_ESP_STREAM_DRAINED_VIDEO,
100  NDL_ESP_LOW_THRESHOLD_CROSSED_AUDIO,
101  NDL_ESP_HIGH_THRESHOLD_CROSSED_AUDIO,
102  NDL_ESP_STREAM_DRAINED_AUDIO,
103  NDL_ESP_END_OF_STREAM,
104  NDL_ESP_VIDEO_INFO, // corresponding data type : NDL_ESP_VIDEO_INFO_T
105  NDL_ESP_RESOURCE_RELEASED_BY_POLICY,
106  NDL_ESP_VIDEOCONFIG_DECODED,
107  NDL_ESP_AUDIOCONFIG_DECODED,
108  NDL_ESP_VIDEO_PORT_CHANGED,
109  NDL_ESP_AUDIO_PORT_CHANGED,
110 } NDL_ESP_EVENT;
111 
112 #define NDL_ESP_FLAG_END_OF_STREAM 1
113 
114 // TODO : Need to be added more error type.
115 #define NDL_ESP_RESULT_SUCCESS 0
116 #define NDL_ESP_RESULT_FAIL (-1)
117 
121 #define NDL_ESP_RESULT_FEED_FULL (-1)
122 #define NDL_ESP_RESULT_FEED_CODEC_ERROR (-1001)
123 #define NDL_ESP_RESULT_FEED_INVALID_INPUT (-1002)
124 #define NDL_ESP_RESULT_FEED_INVALID_STATE (-1003)
125 
129 #define NDL_ESP_RESULT_VIDEO_UNSUPPORTED (-2000)
130 #define NDL_ESP_RESULT_VIDEO_CODEC_ERROR (-2001)
131 #define NDL_ESP_RESULT_VIDEO_RENDER_ERROR (-2002)
132 #define NDL_ESP_RESULT_VIDEO_TUNNEL_ERROR (-2003)
133 #define NDL_ESP_RESULT_VIDEO_BUFFER_ERROR (-2004)
134 #define NDL_ESP_RESULT_VIDEO_STATE_ERROR (-2005)
135 #define NDL_ESP_RESULT_AUDIO_UNSUPPORTED (-2100)
136 #define NDL_ESP_RESULT_AUDIO_CODEC_ERROR (-2101)
137 #define NDL_ESP_RESULT_AUDIO_RENDER_ERROR (-2102)
138 #define NDL_ESP_RESULT_AUDIO_TUNNEL_ERROR (-2103)
139 #define NDL_ESP_RESULT_AUDIO_BUFFER_ERROR (-2104)
140 #define NDL_ESP_RESULT_AUDIO_STATE_ERROR (-2105)
141 #define NDL_ESP_RESULT_CLOCK_ERROR (-2200)
142 #define NDL_ESP_RESULT_CLOCK_TUNNEL_ERROR (-2203)
143 #define NDL_ESP_RESULT_CLOCK_BUFFER_ERROR (-2204)
144 #define NDL_ESP_RESULT_CLOCK_STATE_ERROR (-2205)
145 #define NDL_ESP_RESULT_SET_STATE_ERROR (-2300)
146 
147 // connectionId(mediaId) buffer size
148 #define CONNECTION_ID_BUFFER_SIZE 17
149 
150 #endif // NDL_DIRECTMEDIA2_MEDIA_COMMON_H_
Definition: media-common.h:50
NDL_ESP_VIDEO_CODEC video_codec
Definition: media-common.h:55
NDL_ESP_AUDIO_CODEC audio_codec
Definition: media-common.h:61
Definition: media-common.h:37