\begin{DoxyDate}{Date}
2003 (created)
\end{DoxyDate}
\hypertarget{eina_cxx_main_toc}{}\section{Table of Contents}\label{eina_cxx_main_toc}
\begin{DoxyItemize}
\item \hyperlink{emotion_main_emotion_main_intro}{Introduction} \item \hyperlink{emotion_main_emotion_main_work}{How does Emotion work?} \item \hyperlink{emotion_main_emotion_main_compiling}{How to compile} \item \hyperlink{emotion_main_emotion_main_next_steps}{Next Steps} \item \hyperlink{emotion_main_emotion_main_intro_example}{Introductory Example}\end{DoxyItemize}
\hypertarget{emotion_main_emotion_main_intro}{}\section{Introduction}\label{emotion_main_emotion_main_intro}
A media object library for Evas and Ecore.

Emotion is a library that allows playing audio and video files, using one of its backends (gstreamer, xine or generic shm player).

It is integrated into Ecore through its mainloop, and is transparent to the user of the library how the decoding of audio and video is being done. Once the objects are created, the user can set callbacks to the specific events and set options to this object, all in the main loop (no threads are needed).

Emotion is also integrated with Evas. The emotion object returned by \hyperlink{group__Emotion__Init_ga9b89c712866a0ae77d4cdc6c676e6c01}{emotion\+\_\+object\+\_\+add()} is an Evas smart object, so it can be manipulated with default Evas object functions. Callbacks can be added to the signals emitted by this object with \hyperlink{group__Evas__Smart__Object__Group_ga18a8b179f94d21b2b09e19db11741061}{evas\+\_\+object\+\_\+smart\+\_\+callback\+\_\+add()}.\hypertarget{emotion_main_emotion_main_work}{}\section{How does Emotion work?}\label{emotion_main_emotion_main_work}
The Emotion library uses Evas smart objects to allow you to manipulate the created object as any other Evas object, and to connect to its signals, handling them when needed. It\textquotesingle{}s also possible to swallow Emotion objects inside Edje themes, and expect it to behave as a normal image or rectangle when regarding to its dimensions.\hypertarget{emotion_main_emotion_main_compiling}{}\section{How to compile}\label{emotion_main_emotion_main_compiling}
Emotion is a library your application links to. The procedure for this is very simple. You simply have to compile your application with the appropriate compiler flags that the {\ttfamily pkg-\/config} script outputs. For example\+:

Compiling C or C++ files into object files\+:

\begin{DoxyVerb}gcc -c -o main.o main.c `pkg-config --cflags emotion`
\end{DoxyVerb}


Linking object files into a binary executable\+:

\begin{DoxyVerb}gcc -o my_application main.o `pkg-config --libs emotion`
\end{DoxyVerb}


See \hyperlink{pkgconfig}{pkgconfig}\hypertarget{emotion_main_emotion_main_next_steps}{}\section{Next Steps}\label{emotion_main_emotion_main_next_steps}
After you understood what Emotion is and installed it in your system you should proceed understanding the programming interface. We\textquotesingle{}d recommend you to take a while to learn \hyperlink{group__Ecore}{Ecore} and \hyperlink{group__Evas}{Evas} to get started.

Recommended reading\+:

\begin{DoxyItemize}
\item \hyperlink{group__Emotion__Init}{Creation and initialization functions} to initialize the library. \item \hyperlink{group__Emotion__Video}{Video control functions} to control video parameters. \item \hyperlink{group__Emotion__Audio}{Audio control functions} to control audio parameters. \item \hyperlink{group__Emotion__Play}{Play control functions} to control playback. \item \hyperlink{group__Emotion__Webcam}{A\+P\+I available for accessing webcam} to show cameras. \item \hyperlink{group__Emotion__API}{A\+P\+I available for manipulating Emotion object.} for general programming interface.\end{DoxyItemize}
\hypertarget{emotion_main_emotion_main_intro_example}{}\section{Introductory Example}\label{emotion_main_emotion_main_intro_example}

\begin{DoxyCodeInclude}
\textcolor{comment}{//Compile with:}
\textcolor{comment}{// gcc -o emotion\_basic\_example emotion\_basic\_example.c `pkg-config --libs --cflags emotion evas ecore
       ecore-evas`}

\textcolor{preprocessor}{#include <Ecore.h>}
\textcolor{preprocessor}{#include <\hyperlink{Ecore__Evas_8h}{Ecore\_Evas.h}>}
\textcolor{preprocessor}{#include <Evas.h>}
\textcolor{preprocessor}{#include <\hyperlink{Emotion_8h}{Emotion.h}>}
\textcolor{preprocessor}{#include <stdio.h>}

\textcolor{preprocessor}{#define WIDTH  (320)}
\textcolor{preprocessor}{#define HEIGHT (240)}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_playback\_started\_cb(\textcolor{keywordtype}{void} *data EINA\_UNUSED, \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *o EINA\_UNUSED, \textcolor{keywordtype}{void} *event\_info 
      EINA\_UNUSED)
\{
    printf(\textcolor{stringliteral}{"Emotion object started playback.\(\backslash\)n"});
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{int} argc, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *argv[])
\{
   Ecore\_Evas *ee;
   \hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas} *e;
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *bg, *em;
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *filename = NULL;

   \textcolor{keywordflow}{if} (argc < 2)
     \{
        printf(\textcolor{stringliteral}{"One argument is necessary. Usage:\(\backslash\)n"});
        printf(\textcolor{stringliteral}{"\(\backslash\)t%s <filename>\(\backslash\)n"}, argv[0]);
     \}

   filename = argv[1];

   \textcolor{keywordflow}{if} (!\hyperlink{group__Ecore__Evas__Group_ga32ddbb6457033ad435a177eb0c4fe235}{ecore\_evas\_init}())
     \textcolor{keywordflow}{return} EXIT\_FAILURE;

   \textcolor{comment}{/* this will give you a window with an Evas canvas under the first}
\textcolor{comment}{    * engine available */}
   ee = \hyperlink{group__Ecore__Evas__Group_gac7f2cdbcb79635c34317c1183dd04cb0}{ecore\_evas\_new}(NULL, 10, 10, WIDTH, HEIGHT, NULL);
   \textcolor{keywordflow}{if} (!ee)
     \textcolor{keywordflow}{goto} error;

   \hyperlink{group__Ecore__Evas__Group_ga4953047ff97d4f1b0d75a7d513d4f317}{ecore\_evas\_show}(ee);

   \textcolor{comment}{/* the canvas pointer, de facto */}
   e = \hyperlink{group__Ecore__Evas__Group_ga75a7cc694b6069e78df47dab0b0f2d20}{ecore\_evas\_get}(ee);

   \textcolor{comment}{/* adding a background to this example */}
   bg = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(e);
   evas\_object\_name\_set(bg, \textcolor{stringliteral}{"our dear rectangle"});
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(bg, 255, 255, 255, 255); \textcolor{comment}{/* white bg */}
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(bg, 0, 0); \textcolor{comment}{/* at canvas' origin */}
   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(bg, WIDTH, HEIGHT); \textcolor{comment}{/* covers full canvas */}
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(bg);

   \textcolor{comment}{/* Creating the emotion object */}
   em = \hyperlink{group__Emotion__Init_ga9b89c712866a0ae77d4cdc6c676e6c01}{emotion\_object\_add}(e);
   emotion\_object\_init(em, NULL);

   \hyperlink{group__Evas__Smart__Object__Group_ga18a8b179f94d21b2b09e19db11741061}{evas\_object\_smart\_callback\_add}(
       em, \textcolor{stringliteral}{"playback\_started"}, \_playback\_started\_cb, NULL);

   \hyperlink{group__Emotion__Init_ga1b288409a547989d867fd735f7eec556}{emotion\_object\_file\_set}(em, filename);

   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(em, 0, 0);
   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(em, WIDTH, HEIGHT);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(em);

   \hyperlink{group__Emotion__Play_ga9be5c239d2100e2c16e18c171e1c1790}{emotion\_object\_play\_set}(em, \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});

   \hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}();

   \hyperlink{group__Ecore__Evas__Group_gad3ec61f2aa03df4d3dbfd0d311e0c8dc}{ecore\_evas\_free}(ee);
   \hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}();
   \textcolor{keywordflow}{return} 0;

error:
   fprintf(stderr, \textcolor{stringliteral}{"you got to have at least one evas engine built and linked"}
                   \textcolor{stringliteral}{" up to ecore-evas for this example to run properly.\(\backslash\)n"});

   \hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}();
   \textcolor{keywordflow}{return} -1;
\}
\end{DoxyCodeInclude}


More examples can be found at \hyperlink{emotion_examples}{Emotion Examples}. 