Overview of the M25 Manama Bahrain Tennis Tournament
The M25 Manama Bahrain tennis tournament is an exciting event on the ATP Challenger Tour, featuring top-tier talent competing for glory and points. As we look forward to tomorrow's matches, anticipation builds among fans and bettors alike. This event offers a unique blend of emerging talents and seasoned players, making it a thrilling spectacle for tennis enthusiasts.
Upcoming Matches: A Detailed Look
Tomorrow's lineup promises intense competition across several matches. Here's a closer look at what to expect:
- Match One: Player A vs. Player B
- Match Two: Player C vs. Player D
- Match Three: Player E vs. Player F
Betting Predictions and Expert Analysis
Expert analysts have provided insightful predictions for tomorrow's matches, considering factors like player form, head-to-head records, and surface preferences.
Match One: Player A vs. Player B
In this highly anticipated match, experts predict a close contest between Player A and Player B. Both players have shown exceptional form recently, with Player A having a slight edge due to better performance on hard courts.
- Player A: Known for aggressive baseline play and strong serve.
- Player B: Excels in net play and has a tactical approach.
Bettors are leaning towards a victory for Player A, given their recent wins on similar surfaces.
Match Two: Player C vs. Player D
This match features two rising stars in the tennis world. Player C is favored due to their impressive win-loss record against left-handed opponents like Player D.
- Player C: Renowned for powerful groundstrokes and resilience under pressure.
- Player D: Has a strategic game plan with excellent court coverage.
Experts suggest that while the match could go either way, odds are slightly in favor of Player C.
Match Three: Player E vs. Player F
The third match of the day pits two versatile players against each other. Both have had mixed results recently but are known for their ability to adapt quickly during matches.
- Player E: Strong mental game with consistent performance.
- Player F: Known for clutch performances in tie-breaks.
Betting predictions indicate that this match might be the most unpredictable of the day, with both players having equal chances of winning.
Tips for Bettors: Maximizing Your Odds
<|repo_name|>CezarMarian/cezarmarian.github.io<|file_sep|>/_posts/2016-09-20-Cpp11-features.md
---
layout: post
title: "C++11 Features"
date: 2016-09-20
categories: cpp c++ c++11
---
This post is going to be about some useful features introduced by C++11 that you should know about.
## auto
The `auto` keyword was introduced so you don't need to write explicit types everywhere (as long as it can be deduced from context).
{% highlight cpp %}
// Before
std::vector::iterator it = vec.begin();
for (; it != vec.end(); ++it) {
}
// After
for (auto it = vec.begin(); it != vec.end(); ++it) {
}
{% endhighlight %}
`auto` is not only useful when iterating over containers or pointers but also when you need to work with complex types:
{% highlight cpp %}
auto result = std::make_shared>(1000);
{% endhighlight %}
If you want your code to be more readable you can always use comments:
{% highlight cpp %}
// auto result = std::make_shared>(1000);
std::shared_ptr> result = std::make_shared>(1000);
{% endhighlight %}
Also if you want your code to be more explicit than using `auto`, you can use [Type Deduction](http://en.cppreference.com/w/cpp/language/type_deduction).
## Range-based For Loop
It allows us iterate over containers without explicitly declaring iterators:
{% highlight cpp %}
std::vector& vec;
// Before
std::vector::iterator it;
for (it = vec.begin(); it != vec.end(); ++it) {
}
// After
for (int i : vec) {
}
{% endhighlight %}
It works only with containers that support `.begin()` & `.end()`. It also supports arrays:
{% highlight cpp %}
int arr[] = {1,2};
for (int i : arr) {
}
{% endhighlight %}
The range-based loop uses iterators under the hood so there is no performance difference between traditional `for` loops and range-based ones.
## nullptr
Before C++11 we used NULL as null pointer constant but this was problematic because NULL was defined as `((void*)0)` which causes problems when passing pointers as function arguments.
{% highlight cpp %}
bool f(int* p);
f(NULL); // calls f(void*)
f(0); // calls f(int)
f(nullptr); // calls f(int*)
{% endhighlight %}
So now we have nullptr which has type `nullptr_t`.
## Type Aliases
There were macros before like `typedef` but now we can use keywords:
* **typedef**: Creates new type alias names from existing ones
{%- highlight cpp -%}
typedef int Integer;
Integer i; // int i;
{%- endhighlight -%}
* **using**: Creates new type alias names from existing ones
{%- highlight cpp -%}
using Integer = int;
Integer i; // int i;
template
using pair_t = std::pair;
pair_tp; // std::pairp;
{%- endhighlight -%}
Using type aliases makes your code more readable especially if you use them inside templates.
## Lambda Expressions
Lambda expressions are anonymous functions that can capture variables from surrounding scope by value or reference:
cpp
int x =10;
// Captures x by value
[=] () { return x; }
// Captures x by reference
[&] () { return x; }
// Captures everything by value except y which will be captured by reference
[=,&y] () { return x+y; }
Lambdas are used in STL algorithms like `std::sort`, `std::find_if`, etc... If you want to read more about lambdas see [this](http://en.cppreference.com/w/cpp/language/lambda).
## Smart Pointers
Smart pointers were introduced because they make memory management easier compared to raw pointers.
They come in three flavors:
* **unique_ptr** - Pointer that owns its object exclusively so there cannot be two unique pointers pointing at same object.
* **shared_ptr** - Pointer that shares ownership of its object so multiple shared_ptrs can point at same object.
* **weak_ptr** - Pointer that doesn't own its object so it doesn't increase reference count of shared_ptr.
For more information about smart pointers see [this](http://en.cppreference.com/w/cpp/memory).
## Rvalue References & Move Semantics
Before rvalue references we had copy semantics which means whenever we passed an object as parameter or returned one from function there would be copy created which was expensive operation if our objects hold resources like memory or file handles.
Rvalue references allow us pass temporary objects around without copying them so move semantics were introduced where instead of copying resources they will just get moved into new objects.
To take advantage of move semantics your class should define move constructor & move assignment operator which will be called automatically when moving objects around:
cpp
class Foo {
public:
Foo(Foo&& other); // Move constructor
Foo& operator=(Foo&& other); // Move assignment operator
private:
int *data_;
};
If you don't define them compiler will generate default versions for you but they won't do any optimizations so I recommend defining them yourself unless your class doesn't hold any resources.
For more information about rvalue references & move semantics see [this](http://en.cppreference.com/w/cpp/language/rvalue_references).
## Variadic Templates
Variadic templates allow us create functions or classes that take variable number of parameters:
cpp
template
void foo(Args ... args);
foo(1,"a");
foo(1,"a", true);
For more information about variadic templates see [this](http://www.stroustrup.com/C++11FAQ.html#variadic).
## Other Useful Features
Here are some other features introduced by C++11 which I find useful:
### constexpr Functions & Variables
Functions marked as constexpr must always return constant expressions which allows compiler do compile-time optimizations on them e.g.: calculating factorial at compile time instead of runtime.
Variables marked as constexpr must always have constant values e.g.: PI=3.14 can be declared as constexpr variable because its value never changes during program execution.
### decltype(auto)
decltype returns type deduced from expression e.g.: decltype(a+b) returns int if both a & b are ints then decltype(a+b) returns double if one is double & another one is int then decltype(a+b) returns bool if both are bools etc...
decltype(auto) allows us declare variables whose types depend on expression evaluated at runtime e.g.:
cpp
template
decltype(T1()+T2()) add(T1 t1 ,T2 t2 ) {
return t1+t2 ;
}
add function takes two parameters whose types depend on what types were passed during call e.g.: add(10,'a') returns char because char+int=char add(10.,'a') returns double because double+char=double etc...
### Override & Final Specifiers
When inheriting classes sometimes base class virtual functions get overridden incorrectly e.g.: wrong signature or non-virtual function being overridden etc... To prevent this override specifier can be used e.g.:
cpp
class Base {
public:
virtual void foo() const {}
};
class Derived : public Base{
public:
void foo() const override {} // Compiler will throw error if signature doesn't match Base's foo()
};
Final specifier prevents derived classes from overriding virtual functions e.g.:
cpp
class Base{
public:
virtual void foo() const final {}
};
class Derived : public Base{
public:
void foo() const {} // Compiler will throw error here because final specifier prevents overriding virtual functions
};
<|repo_name|>CezarMarian/cezarmarian.github.io<|file_sep
@import 'normalize';
@import 'syntax';
@import 'pygments';
@import 'font-awesome';
$background-color : #fdfdfd;
$dark-gray : #222;
$medium-gray : #666;
$light-gray : #eee;
body {
background-color: $background-color;
color : $dark-gray;
font-family : "Helvetica Neue", HelveticaNeue-Light,
HelveticaNeue-Medium,
HelveticaNeue-Regular,
"Lucida Grande", Ubuntu,
Segoe UI,
Arial,
sans-serif;
font-weight : normal;
font-style : normal;
line-height : 1.5rem;
margin : auto;
padding : .8rem .8rem .8rem .8rem;
max-width : 40rem;
min-width : 30rem;
a {
color : #06c;
text-decoration: none;
border-bottom :
solid thin rgba(black,.4);
outline :
auto -.4em .4em rgba(black,.4);
&:hover {
text-decoration:
underline dotted rgba(black,.4);
outline :
auto -.4em .4em rgba(black,.6);
color :
#06c;
}
&:active {
text-decoration:
underline dotted rgba(black,.6);
outline :
auto -.4em .4em rgba(black,.7);
color :
#06c;
}
}
h1,h2,h3,h4,h5,h6 {
margin-top :
calc(1rem + .5 * var(--base-font-size));
margin-bottom :
calc(.5rem + var(--base-font-size));
font-weight :
bold;
}
h1 {
font-size :
calc(var(--base-font-size)*3);
}
h2 {
font-size :
calc(var(--base-font-size)*2);
}
h3 {
font-size :
var(--base-font-size);
}
h4 {
font-size :
calc(var(--base-font-size)*(.75));
}
h5 {
font-size :
calc(var(--base-font-size)*(.625));
}
h6 {
font-size :
calc(var(--base-font-size)*(.5));
}
}
blockquote {
border-left :
solid thin rgba(black,.15);
padding-left :
var(--base-font-size);
}
code ,pre{
background-color :
rgba(gray,.05);
}
code{
padding-right :
var(--base-font-size);
padding-left :
var(--base-font-size);
}
pre{
padding-top :
var(--base-line-height)/8;
padding-bottom :
var(--base-line-height)/8;
}
hr{
border-top :
solid thin rgba(black,.15);
margin-top :
var(--base-line-height);
margin-bottom :
var(--base-line-height);
}
figure{
margin-top :
var(--base-line-height);
margin-bottom :
var(--base-line-height);
}
figcaption{
text-align :
center;
}
footer{
border-top :
solid thin rgba(black,.15);
padding-top :
calc(var(base--font--size)/2);
p{
display :
inline-block;
margin-right :
auto;
width :
max-content;
a:hover {
color :
white;
background-color:
$dark-gray;
border-radius :
.25rem;
padding-right:
calc(var(base--font--size)/4);
padding-left:
calc(var(base--font--size)/4);
}
table{
border-collapse:
collapse;
th ,td{
border-left:
solid thin rgba(black,.15);
border-right:
solid thin rgba(black,.15);
padding:
var(base--font--size)/4;
text-align:
left;
if ($theme == light)
background-color:
nth($shades-of-white ,random(length($shades-of-white)));
else
background-color:
nth($shades-of-grey ,random(length($shades-of-grey)));
&:first-child{
border-left:
none;
}
&:last-child{
border-right:
none;
}
}
}
#header{
position :
fixed;
top :
-.25rem;
left :
-.25rem;
right :
-.25rem;
z-index :
+9999;
hgroup {
display :
flex;
align-items:
center;
flex-direction:
column-reverse;
p {
display :
block;
order :
last-child;
width :
max-content;
float :
right;
clear :
right;
if ($theme == light)
color:
$dark-gray;
else
color:
$light-gray;
}
header {
order :
first-child;
width :
max-content;
float :
left;
clear :
left;
@if ($theme == light)
color:
white;
else
color:
$dark-gray;
}
}
@media screen and (max-width:40rem){
#header {
position :(relative);
top :(initial);
left :(initial);
right :(initial);
z-index :(initial);
flex-direction :(row-reverse);
align-items :(flex-start);
padding :(var(base--font--size)/16);
hgroup {
display :(block);
}
header {
order :(initial);
}
p {
display :(block);
order :(initial);
width :(inherit);
float :(none);
clear :(none);
@if ($theme == light)
color:
inherit ;
else
color:
inherit ;
}
}
nav {
display :(flex);
justify-content:(space-between);
align-items :(center);
ul {
margin :(0px);
padding :(0px);
list-style-type:(none);
li {
margin-right:(var(base--font--size)/8)
@media screen and(max-width:40rem){
li:last-child{
margin-right:(initial)
}
li:nth-last-child(n+7){
display:none!
}
li:nth-last-child(n+6){
display:none!
}
li:nth-last-child(n+5){
display:none!
}
li:nth-last-child(n+4){
display:none!
@media screen and(min-width:40rem){
li:nth-last-child(n+7){
display:inline-block!
}
li:nth-last-child(n+6){
display:inline-block!
}
li:nth-last-child(n+5){
display:inline-block!
}
}
}
nav > ul > button{
background-color:(transparent)!important;
border:none!important;
font-family:(FontAwesome)!important;
font-style:normal!important;
font-weight:normal!important;
text-decoration:none!important;
font-variant:normal!important;
text-transform:none!important;
line-height:inherit!important;
cursor:pointer!important;
outline:none!important;
@if ($theme == light)
color:#fff !important ;
else
color:#000 !important ;
}
nav > ul > button:hover{
background-color:(transparent)!important ;
border:none!important ;
opacity:.7 !important ;
}
nav > ul > button:before{
content:"f078"!important ;
}
nav > ul > button.open:before{
content:"f077"!important ;
}
nav > ul.collapsed{
visibility:hidden !important ;
opacity:.01 !important ;
transition-delay:.01s !important ;
transition-duration:.01s !important ;
transition-property:-webkit-transform,native,zoom,zoom,zoom,zoom,zoom,zoom,-webkit-transform !important ;
transition-timing-function:cubic-bezier(.55,0,.55,0),linear,cubic-bezier(.55,0,.55,0),linear,cubic-bezier(.55,0,.55,0),linear,cubic-bezier(.55,0,.55,0),linear,cubic-bezier(.55,0,.55,0),linear,cubic-bezier(.55,0,.55,0),linear !important ;
transform-origin:center center !important ;
transform-style:preserve-3d !important ;
transform:noscaleY(!Important;)noscaleZ(!Important;)noscaleX(!Important;)rotateY(-90deg)!Important;;
}
nav.opened ul.collapsed{
visibility:!Important;!Important;;
opacity:!Important;!Important;;
transition-delay:!Important;!Important;;
transition-duration:!Important;!Important;;
transition-property:-webkit-transform,native,zoom,zoom,zoom,zoom,zoom,zoom,-webkit-transform;!Important;;
transition-timing-function:cubic-bezier(.23,,45%,93%,93%),ease-in-out,!Important;,cubic-bezier(.23,,45%,93%,93%),ease-in-out,!Important;,cubic-bezier(.23,,45%,93%,93%),ease-in-out,!Important;,cubic-bezier(.23,,45%,93%,93%),ease-in-out,!Important;,cubic-bezier(.23,,45%,93%,93%),ease-in-out,!Important;,cubic-bezier(.23,,45%,93%,93%),ease-in-out;!Important;;
transform-origin:center center;!Important;;
transform-style:preserve-3d;!Importaant;;transform:scaleY(!Importaant;)scaleZ(!Importaant;)scaleX(!Importaant;)rotateY(-90deg)!Importaant;;}
}
main {
padding-top:
calc(50vh +
(var(base--line-height)) /
(var(base--font-siz)))
);
}
article {
header {
margin-bottom:
(var(base--line-height));
figure {
figcaption {
text-align:
center;
}
}
}
section {
margin-bottom:
(var(base--line-height));
}
footer {
margin-top:
(var(base--line-height));
}
}
section#home article:first-of-type header p:first-of-type:first-letter{
float:left;display:block;font-family:'Helvetica Neue',HelveticaNeue-Light,
HelveticaNeue-Medium,
HelveticaNeue-Regular,
'Lucida Grande',Ubuntu,
Segoe UI,Arial,sans-serif;font-weight:bold;font-style:normal;margin:.125
rem;margin-right:.125 rem;line-height:.95
rem;font-size:calc(
((var(base--
font-siz)) *
((var(base--
line-heigh))) /
((var(
base--
line-heigh)))) *
((var(
base--
line-heigh))) /
((var(
base--
font-siz))) *
((((((
((((((((((((
((((
((((
((((
((((
((((
((((
((((
((((
(
(
(
(
(
(
(
(
(
(
(
base-
font-
siz)
)) *
((12vw + ((((((12vw +
(((12vw +
(((12vw +
(((12vw +
(((12vw +
(((12vw +
(((12vw +
(((12vw +
((
base-
line-
heigh))
)) /
((24vw +
(((24vw +
(((24vw +
(((24vw +
(((24vw +
(((24vw +
((
base-
line-
heigh))
)) /
((48vw +
(((48vw +
(((48vw +
(((48vw +
(
)
))))))))))))))))))))))))))
)))))))))))))))
)))))))))))
))))))))
)
)
) *
)
) *
)
) *
)
) *
)
) *
)
}}
article footer {
text-align:
right;
}}
article#post-footer {
text-align:
center;
}}
article#post-footer footer {
text-align:
initial;
}}
<|file_sep|>@charset "utf-8";
/*
* Syntax Highlighting Stylesheet for Pygments.
*
* Author: Dr Nic Wise http://nicwise.co.uk/
*/
.highlighter-rouge pre[class*=language],
.highlight pre[class*=language] {
position:relative;
z-index:auto !important;
background:white url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hdXRob3JpdHkuY29tL3hhcC8x LjAvc3RSZW Yuc mll ZD Q v I g PH J k Z j o U R T g P g H J k Z j o R S U Z c y g d H J k Z j o N j l d g Y W X I n I G L Y X N w Y S O G L Y X N w Y S O G L Y X N w Y S O G L Y X N w Y S O G L Y X N w Y S O G L Y X N w Y S O G L Y X N w I g P H J k Z j o R S U Z c y g d H J k Z j o N j l d g P H J k Z j o R S U Z c y g d H J k Z j o N j l d g P H J k Z j o R S U Z c y g d H J k Z j o N j l d g P H J k Z j o R S U Z c y g d H J k Z j o N j l d g P H J k Z j o R S U Z c y g d H J k Z j o N j l d g P H J k Z jpO n t s b u n s t r u c t u r e s K V V K V V K V V K V V K V V K V V K V V K V b u n s t r u c t u r e s K V K V K v v v v v v v v v v v v v b u n s t r u c t u r esK VK VK vk vv vv vv vv vv vv vvvvvvvvv b un stru ct ur esKV KV KvVvVVVVVVVVVVVVVVVVVVVVVVVvvvvvvvvvvvvvvvvvbbb un stru ct ur esKVKVKvkvvvvvvvVVVVVVVVVVVVVbun stru ct ur esKVkvVKvkvvvBVbvbbunstru ctur esKVKVkVKvkBBBVbvbbunstru ctur esKVKvkVKVkBBBVbvbbunstructur esKVkvK VkBBBVbvbbunstructur esKVkvK VkBBBBBvbunstructur esK VkVkVkBBBBBvbunstructur esKVkBBBBBvbunstructur esKB vb unstructur esKB vb unstructur esKB vb unstructur esKB vb un structur esKB vb un structur esKB vb un structur KB VB VB VB VB VB VB VB VB VB VB VBVBVBVBVBVBVBVBVBVBVB VBUncommenting these lines enables syntax highlighting!
Copyright ©2007–2017 by John Gruber MIT License—see LICENSE.md */
/* Based on github.com style | MIT License — http://opensource.org/licenses/mit-license.php */
/* By Nathaniel Williams | https://twitter.com/nexisnet | http://nexisnet.net */
.highlighter-rouge pre[class*=language],
.highlight pre[class*=language] {
color:#000000;background:#ffffff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;}
.highlighter-rouge pre[class*=language]::-moz-selection,
.highlight pre[class*=language]::-moz-selection {
background:#b3d7ff;text-shadow:none;}
.highlighter-rouge pre[class*=language] ::selection,
.highlight pre[class*=language] ::selection {
background:#b3d7ff;text-shadow:none;}
/* Code blocks */
.highlighter-rouge pre[class*=language],
.highlight pre[class*=language] {
padding:.75em;border-radius:.375em;/* Token Styles */
/* Code */
.highlighter-rouge pre code,
.highlight pre code,
/* Text selection */
.highlighter-rouge pre[class*=language] ::selection,
.highlight pre[class*=language] ::selection,
/* Text selection wrap */
/* Inline code */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color:#999988;}
.token.namespace{
color:#555555;}
.token.string{
color:#dd1144;}
.token.punctuation{
color:#666666;}
.token.property{
color:#905;/* Regular Expressions */
.token.tag{
color:#009926;}
.token.boolean{
color:#aa22ff;}
.token.number{
color:#09999f;}
.token.constant{
color:#009926;}
.token.symbol{
color:#990073;}
.token.deleted{
color:#bd2127;text-decoration:line-through;}
.token.selector,
.token.attr-name,
.token.string.regex,
.token.char-class{
color:#990073;}
.token.operator{
color:black;/* JSON Properties */
/token.entity,{
color:green;/token.url,{
color:fuchsia;/token.variable,{
color:cyan;/token.inserted,{
color:green;text-decoration:underline;} token.atrule,{
color:magenta;/token.function.builtin,{
color teal;/token.keyword.control,{
color:black;} token.keyword.directive,{
color:magenta;/token.class-name,{
color#619bff;} token.regex,/token. important,/ token.bold,/ token.italic,/ token.entity,/ token.operator,/ token.entity,/ token.operator,/ token.entity,/ token.operator/,/ token.entity/,/ token.operator/,
.color(#808080);}
.markup.heading/. markup.bold/,
.markup.heading/. markup.bold/,
.markup.heading/. markup.bold/,
.markup.heading/. markup.bold/,
.markup.heading/. markup.bold/,
.markup.heading/. markup.bold/,
.markup.heading/. markup.bold/,
.markup.list~markup.code/,/
markup.inserted~markup.code/,/
markup.inserted~markup.code/,/
markup.inserted~markup.code/,/
markup.inserted~markup.code/,/
markup.inserted~markup.code/,/
markup.inserted~markup.code/,/
} Preformatted text */ /* Use monospace stackoverflow-linter-disable-next-line */ /* Use monospace stackoverflow-linter-disable-next-line */ /* Use monospace stackoverflow-linter-disable-next-line */ /* Use monospace stackoverflow-linter-disable-next-line */ /* Use monospace stackoverflow-linter-disable-next-line */ /* Use monospace stackoverflow-linter-disable-next-line */ /* Use monospace stackoverflow-linter-disable-next-line */ /* Use monospace stackoverflow-linter-disable-next-line */ /* Use monospace stackoverflow-linter-disable-next-line */ /* Use monospace stackoverflow-linter-disable-next-line */ mark.preformatted language-monospace:not(pre),
mark.preformatted language-monospace:not(pre),
mark.preformatted language-monospace:not(pre),
mark.preformatted language-monospace:not(pre),
mark.preformatted language-monospace:not(pre),
mark.preformatted language-monospace:not(pre),
mark.preformatted language-monospace:not(pre),
mark.preformatted language-monospace:not(pre),
mark.preformatted language-monospace:not(pre),
mark.preformatted language-monospace:not(pre){
white-space-pre-wrap;} mark code.language-markdown mark code.language-markdown mark code.language-markdown mark code.language-markdown mark code.language-markdown mark code.language-markdown mark code.language-markdown mark code.language-markdown mark code.language-markdown strong em em strong em em strong em em strong em em strong em em strong.em,strong.em,strong.em,strong.em,strong.em,strong.em,strong.em,strong.em,strong.em,strong.em,bold italic italic bold italic italic bold italic italic bold italic italic bold italic italic bold,bolditalicitalicbolditalicitalicbolditalicitalicbolditalicitalicbolditalicitalicbold,itallyoutallyoutallyoutallyoutallyoutallyoutallyoutallyoutallyoutallyout,a,s,a,s,a,s,a,s,a,s,a,s,a.s,a.s,a.s,a.s,a.s,a.s,a.s},*/<|repo_name|>CezarMarian/cezarmarian.github.io<|file_sep>=require "./_sass"
markdown:
renderer:kramdown extensions:dashes fenced_code_blocks autolink footnotes toc anchor syntax_highlighter true<|file_sep|>#include "common.h"
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libswscale/swscale.h"
#include "SDL.h"
#define SDL_AUDIO_BUFFER_SIZE AUDIO_FRAME_SIZE * NUM_CHANNELS
static AVFormatContext* format_ctx_;
static AVCodecContext* codec_ctx_;
static SwsContext* sws_ctx_;
static uint32_t frame_cnt_;
static uint32_t audio_buffer_size_;
static uint32_t audio_buffer_pos_;
static SDL_AudioDeviceID audio_device_id_;
static Uint16 audio_buffer_[SDL_AUDIO_BUFFER_SIZE];
AVCodecContext*
init_codec_context(AVCodecContext*& codec_ctx)
{
uint32_t codec_id_ = codec_ctx->codec->id;
switch(codec_id_)
{
case AV_CODEC_ID_H264:
case AV_CODEC_ID_HEVC:
case AV_CODEC_ID_MPEGVIDEO:
case AV_CODEC_ID_MPEGHEVC:
case AV_CODEC_ID_MJPEG:
case AV_CODEC_ID_MPEGVIDEO_LOASSELESS_JPEG200PROFILES_ONLY_DECODE_ONLY_EVEN_IF_NOT_EXPLICITLY_SPECIFIED_BY_THE_USER_EVEN_IF_IT_IS_NOT_NEEDED_FOR_THE_APPLICATION_TO_SUPPORT