Ignore:
Timestamp:
Mar 18, 2015 8:25:24 AM (9 years ago)
Author:
ming
Message:

Re #1823 (PJSUA2 Video API): Add Pjsua2 Video Window API and Pjsua API to set output window

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsua2/media.hpp

    r4845 r4996  
    13261326}; 
    13271327 
     1328 
     1329/************************************************************************* 
     1330* Video media 
     1331*/ 
     1332 
     1333/** 
     1334 * Representation of media coordinate. 
     1335 */ 
     1336struct MediaCoordinate 
     1337{ 
     1338    int         x;          /**< X position of the coordinate */ 
     1339    int         y;          /**< Y position of the coordinate */ 
     1340}; 
     1341 
     1342/** 
     1343 * Representation of media size. 
     1344 */ 
     1345struct MediaSize 
     1346{ 
     1347    unsigned    w;          /**< The width.             */ 
     1348    unsigned    h;          /**< The height.    */ 
     1349}; 
     1350 
     1351/** 
     1352 * Window handle. 
     1353 */ 
     1354typedef struct WindowHandle { 
     1355    void        *window;    /**< Window         */ 
     1356    void        *display;   /**< Display        */ 
     1357} WindowHandle; 
     1358 
     1359/** 
     1360 * Video window handle. 
     1361 */ 
     1362struct VideoWindowHandle 
     1363{ 
     1364    /** 
     1365     * The window handle type. 
     1366     */ 
     1367    pjmedia_vid_dev_hwnd_type   type; 
     1368 
     1369    /** 
     1370     * The window handle. 
     1371     */ 
     1372    WindowHandle                handle; 
     1373}; 
     1374 
     1375/** 
     1376 * This structure describes video window info. 
     1377 */ 
     1378typedef struct VideoWindowInfo 
     1379{ 
     1380    /** 
     1381     * Flag to indicate whether this window is a native window, 
     1382     * such as created by built-in preview device. If this field is 
     1383     * true, only the video window handle field of this 
     1384     * structure is valid. 
     1385     */ 
     1386    bool                isNative; 
     1387 
     1388    /** 
     1389     * Video window handle. 
     1390     */ 
     1391    VideoWindowHandle   winHandle; 
     1392 
     1393    /** 
     1394     * Renderer device ID. 
     1395     */ 
     1396    int                 renderDeviceId; 
     1397 
     1398    /** 
     1399     * Window show status. The window is hidden if false. 
     1400     */ 
     1401    bool                show; 
     1402 
     1403    /** 
     1404     * Window position. 
     1405     */ 
     1406    MediaCoordinate     pos; 
     1407 
     1408    /** 
     1409     * Window size. 
     1410     */ 
     1411    MediaSize           size; 
     1412 
     1413} VideoWindowInfo; 
     1414 
     1415/** 
     1416 * Video window. 
     1417 */ 
     1418class VideoWindow 
     1419{ 
     1420public: 
     1421    /** 
     1422     * Constructor 
     1423     */ 
     1424    VideoWindow(int win_id); 
     1425 
     1426    /** 
     1427     * Get window info. 
     1428     * 
     1429     * @return                  video window info. 
     1430     */ 
     1431    VideoWindowInfo getInfo() const throw(Error); 
     1432     
     1433    /** 
     1434     * Show or hide window. This operation is not valid for native windows 
     1435     * (VideoWindowInfo.isNative=true), on which native windowing API 
     1436     * must be used instead. 
     1437     * 
     1438     * @param show              Set to true to show the window, false to 
     1439     *                          hide the window. 
     1440     * 
     1441     */ 
     1442    void Show(bool show) throw(Error); 
     1443     
     1444    /** 
     1445     * Set video window position. This operation is not valid for native windows 
     1446     * (VideoWindowInfo.isNative=true), on which native windowing API 
     1447     * must be used instead. 
     1448     * 
     1449     * @param pos               The window position. 
     1450     * 
     1451     */ 
     1452    void setPos(const MediaCoordinate &pos) throw(Error); 
     1453     
     1454    /** 
     1455     * Resize window. This operation is not valid for native windows 
     1456     * (VideoWindowInfo.isNative=true), on which native windowing API 
     1457     * must be used instead. 
     1458     * 
     1459     * @param size              The new window size. 
     1460     * 
     1461     */ 
     1462    void setSize(const MediaSize &size) throw(Error); 
     1463     
     1464    /** 
     1465     * Rotate the video window. This function will change the video orientation 
     1466     * and also possibly the video window size (width and height get swapped). 
     1467     * This operation is not valid for native windows (VideoWindowInfo.isNative 
     1468     * =true), on which native windowing API must be used instead. 
     1469     * 
     1470     * @param angle             The rotation angle in degrees, must be 
     1471     *                          multiple of 90. 
     1472     *                          Specify positive value for clockwise rotation or 
     1473     *                          negative value for counter-clockwise rotation. 
     1474     */ 
     1475    void rotate(int angle) throw(Error); 
     1476 
     1477    /** 
     1478     * Set output window. This operation is valid only when the underlying 
     1479     * video device supports PJMEDIA_VIDEO_DEV_CAP_OUTPUT_WINDOW capability AND 
     1480     * allows the output window to be changed on-the-fly, otherwise Error will 
     1481     * be thrown. Currently it is only supported on Android. 
     1482     * 
     1483     * @param win               The new output window. 
     1484     */ 
     1485    void setWindow(const VideoWindowHandle &win) throw(Error); 
     1486     
     1487private: 
     1488    pjsua_vid_win_id            winId; 
     1489}; 
     1490 
    13281491/************************************************************************* 
    13291492* Codec management 
Note: See TracChangeset for help on using the changeset viewer.