Skip to content

Commit b388f05

Browse files
committed
Added sample to decode raw .H264 bitstream
...without using input context.
1 parent 82facd4 commit b388f05

File tree

3 files changed

+450
-11
lines changed

3 files changed

+450
-11
lines changed

.clang-format

Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
#
2+
# Reference
3+
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
4+
#
5+
# Editor:
6+
# https://clang-format-configurator.site/
7+
#
8+
---
9+
BasedOnStyle: ""
10+
Language: Cpp
11+
AccessModifierOffset: -4
12+
AlignAfterOpenBracket: BlockIndent
13+
AlignArrayOfStructures: Left
14+
AlignConsecutiveAssignments:
15+
Enabled: false
16+
AcrossEmptyLines: false
17+
AcrossComments: false
18+
AlignCompound: false
19+
PadOperators: false
20+
AlignConsecutiveBitFields:
21+
Enabled: false
22+
AcrossEmptyLines: false
23+
AcrossComments: false
24+
AlignCompound: false
25+
PadOperators: false
26+
AlignConsecutiveDeclarations:
27+
Enabled: false
28+
AcrossEmptyLines: false
29+
AcrossComments: false
30+
AlignCompound: false
31+
PadOperators: false
32+
AlignConsecutiveMacros:
33+
Enabled: false
34+
AcrossEmptyLines: false
35+
AcrossComments: false
36+
AlignCompound: false
37+
PadOperators: false
38+
AlignEscapedNewlines: Right
39+
AlignOperands: Align
40+
AlignTrailingComments:
41+
Kind: Always
42+
OverEmptyLines: 2
43+
#AllowAllArgumentsOnNextLine: true
44+
AllowAllArgumentsOnNextLine: false
45+
AllowAllParametersOfDeclarationOnNextLine: true
46+
AllowShortEnumsOnASingleLine: true
47+
AllowShortBlocksOnASingleLine: Never
48+
AllowShortCaseLabelsOnASingleLine: false
49+
AllowShortFunctionsOnASingleLine: None
50+
AllowShortLambdasOnASingleLine: Empty
51+
AllowShortIfStatementsOnASingleLine: Never
52+
AllowShortLoopsOnASingleLine: false
53+
AlwaysBreakAfterDefinitionReturnType: None
54+
AlwaysBreakAfterReturnType: None
55+
AlwaysBreakBeforeMultilineStrings: false
56+
AlwaysBreakTemplateDeclarations: MultiLine
57+
AttributeMacros:
58+
- __capability
59+
BinPackArguments: true
60+
BinPackParameters: false
61+
BraceWrapping:
62+
AfterCaseLabel: false
63+
AfterClass: true
64+
AfterControlStatement: Never
65+
AfterEnum: true
66+
AfterFunction: true
67+
AfterNamespace: false
68+
AfterObjCDeclaration: false
69+
AfterStruct: true
70+
AfterUnion: true
71+
AfterExternBlock: false
72+
BeforeCatch: false
73+
BeforeElse: false
74+
BeforeLambdaBody: false
75+
BeforeWhile: false
76+
IndentBraces: false
77+
SplitEmptyFunction: true
78+
SplitEmptyRecord: true
79+
SplitEmptyNamespace: true
80+
BreakBeforeBinaryOperators: NonAssignment
81+
BreakBeforeConceptDeclarations: Always
82+
BreakBeforeBraces: Custom
83+
BreakInheritanceList: BeforeColon
84+
BreakBeforeTernaryOperators: true
85+
BreakConstructorInitializers: BeforeColon
86+
BreakStringLiterals: false
87+
ColumnLimit: 0
88+
CommentPragmas: "^ IWYU pragma:"
89+
QualifierAlignment: Leave
90+
CompactNamespaces: false
91+
ConstructorInitializerIndentWidth: 4
92+
ContinuationIndentWidth: 4
93+
Cpp11BracedListStyle: true
94+
DeriveLineEnding: true
95+
DerivePointerAlignment: true
96+
DisableFormat: false
97+
EmptyLineAfterAccessModifier: Never
98+
EmptyLineBeforeAccessModifier: LogicalBlock
99+
ExperimentalAutoDetectBinPacking: false
100+
PackConstructorInitializers: Never
101+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
102+
AllowAllConstructorInitializersOnNextLine: true
103+
FixNamespaceComments: true
104+
ForEachMacros:
105+
- foreach
106+
- Q_FOREACH
107+
- BOOST_FOREACH
108+
IfMacros:
109+
- KJ_IF_MAYBE
110+
IncludeBlocks: Preserve
111+
IncludeCategories:
112+
- Regex: ^"(llvm|llvm-c|clang|clang-c)/
113+
Priority: 2
114+
SortPriority: 0
115+
CaseSensitive: false
116+
- Regex: ^(<|"(gtest|gmock|isl|json)/)
117+
Priority: 3
118+
SortPriority: 0
119+
CaseSensitive: false
120+
- Regex: .*
121+
Priority: 1
122+
SortPriority: 0
123+
CaseSensitive: false
124+
IncludeIsMainRegex: (Test)?$
125+
IncludeIsMainSourceRegex: ""
126+
IndentAccessModifiers: false
127+
IndentCaseLabels: true
128+
IndentCaseBlocks: false
129+
IndentGotoLabels: true
130+
IndentPPDirectives: AfterHash
131+
IndentExternBlock: AfterExternBlock
132+
IndentRequiresClause: true
133+
IndentWidth: 4
134+
IndentWrappedFunctionNames: true
135+
InsertBraces: false
136+
InsertTrailingCommas: None
137+
JavaScriptQuotes: Leave
138+
JavaScriptWrapImports: true
139+
LambdaBodyIndentation: Signature
140+
MacroBlockBegin: ""
141+
MacroBlockEnd: ""
142+
MaxEmptyLinesToKeep: 1
143+
NamespaceIndentation: None
144+
ObjCBinPackProtocolList: Auto
145+
ObjCBlockIndentWidth: 2
146+
ObjCBreakBeforeNestedBlockParam: true
147+
ObjCSpaceAfterProperty: false
148+
ObjCSpaceBeforeProtocolList: true
149+
PenaltyBreakAssignment: 2
150+
PenaltyBreakBeforeFirstCallParameter: 19
151+
PenaltyBreakComment: 300
152+
PenaltyBreakFirstLessLess: 120
153+
PenaltyBreakOpenParenthesis: 0
154+
PenaltyBreakString: 1000
155+
PenaltyBreakTemplateDeclaration: 10
156+
PenaltyExcessCharacter: 1000000
157+
PenaltyReturnTypeOnItsOwnLine: 60
158+
PenaltyIndentedWhitespace: 0
159+
PointerAlignment: Right
160+
PPIndentWidth: -1
161+
ReferenceAlignment: Pointer
162+
ReflowComments: false
163+
RemoveBracesLLVM: false
164+
RequiresClausePosition: OwnLine
165+
SeparateDefinitionBlocks: Leave
166+
ShortNamespaceLines: 1
167+
SortIncludes: CaseSensitive
168+
SortJavaStaticImport: Before
169+
SortUsingDeclarations: true
170+
SpaceAfterCStyleCast: false
171+
SpaceAfterLogicalNot: false
172+
SpaceAfterTemplateKeyword: true
173+
SpaceBeforeAssignmentOperators: true
174+
SpaceBeforeCaseColon: false
175+
SpaceBeforeCpp11BracedList: true
176+
SpaceBeforeCtorInitializerColon: true
177+
SpaceBeforeInheritanceColon: true
178+
SpaceBeforeParens: ControlStatements
179+
SpaceBeforeParensOptions:
180+
AfterControlStatements: true
181+
AfterForeachMacros: true
182+
AfterFunctionDefinitionName: false
183+
AfterFunctionDeclarationName: false
184+
AfterIfMacros: true
185+
AfterOverloadedOperator: false
186+
AfterRequiresInClause: false
187+
AfterRequiresInExpression: false
188+
BeforeNonEmptyParentheses: false
189+
SpaceAroundPointerQualifiers: Default
190+
SpaceBeforeRangeBasedForLoopColon: true
191+
SpaceInEmptyBlock: false
192+
SpaceInEmptyParentheses: false
193+
SpacesBeforeTrailingComments: 1
194+
SpacesInAngles: Never
195+
SpacesInConditionalStatement: false
196+
SpacesInContainerLiterals: true
197+
SpacesInCStyleCastParentheses: false
198+
SpacesInLineCommentPrefix:
199+
Minimum: 1
200+
Maximum: -1
201+
SpacesInParentheses: false
202+
SpacesInSquareBrackets: false
203+
SpaceBeforeSquareBrackets: false
204+
BitFieldColonSpacing: Both
205+
Standard: Latest
206+
StatementAttributeLikeMacros:
207+
- Q_EMIT
208+
StatementMacros:
209+
- Q_UNUSED
210+
- QT_REQUIRE_VERSION
211+
TabWidth: 8
212+
UseCRLF: false
213+
UseTab: Never
214+
WhitespaceSensitiveMacros:
215+
- STRINGIZE
216+
- PP_STRINGIZE
217+
- BOOST_PP_STRINGIZE
218+
- NS_SWIFT_NAME
219+
- CF_SWIFT_NAME
220+
#BreakTemplateDeclarations: Yes
221+
#BreakFunctionDefinitionParameters: true
222+
BreakArrays: true
223+
#KeepEmptyLines:
224+
# AtStartOfBlock: true
225+
KeepEmptyLinesAtTheStartOfBlocks: true
226+
RequiresExpressionIndentation: OuterScope
227+
#AlignConsecutiveTableGenBreakingDAGArgColons: {}
228+
AllowShortCompoundRequirementOnASingleLine: true

example/api2-samples/CMakeLists.txt

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,31 @@ set(TARGETS
2626
api2-hw-encode
2727
)
2828

29-
foreach(target ${TARGETS})
30-
add_executable(${target} ${target}.cpp)
29+
# helper for the sample target
30+
function(api2_sample_target target)
31+
add_executable(${target} ${target}.cpp)
3132

32-
target_link_libraries(${target}
33-
avcpp::avcpp
34-
)
33+
target_link_libraries(${target}
34+
avcpp::avcpp
35+
)
3536

36-
if (AVCPP_WARNING_OPTIONS)
37-
target_compile_options(${target} PRIVATE ${AVCPP_WARNING_OPTIONS})
38-
endif()
37+
if (AVCPP_WARNING_OPTIONS)
38+
target_compile_options(${target} PRIVATE ${AVCPP_WARNING_OPTIONS})
39+
endif()
3940

40-
if(WIN32)
41-
target_link_libraries(${target} ws2_32)
42-
endif()
41+
if(WIN32)
42+
target_link_libraries(${target} ws2_32)
43+
endif()
44+
endfunction()
4345

46+
# Common targets
47+
foreach(target ${TARGETS})
48+
api2_sample_target(${target})
4449
endforeach()
50+
51+
# Custom targets
52+
if ("cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
53+
api2_sample_target(api2-decode-raw-h264)
54+
set_property(TARGET api2-decode-raw-h264 PROPERTY CXX_STANDARD 20)
55+
endif()
56+

0 commit comments

Comments
 (0)