~ubuntu-branches/ubuntu/trusty/sflphone/trusty

« back to all changes in this revision

Viewing changes to daemon/src/video/video_v4l2.cpp

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (4.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20140128182336-jrsv0k9u6cawc068
Tags: 1.3.0-1
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 *  Copyright (C) 2011-2012 Savoir-Faire Linux Inc.
 
2
 *  Copyright (C) 2011-2013 Savoir-Faire Linux Inc.
3
3
 *  Author: Rafaël Carré <rafael.carre@savoirfairelinux.com>
4
4
 *
5
5
 *  This program is free software; you can redistribute it and/or modify
121
121
namespace {
122
122
unsigned int pixelformat_score(unsigned pixelformat)
123
123
{
124
 
    size_t n = sizeof pixelformats_supported / sizeof *pixelformats_supported;
125
 
    for (unsigned int i = 0; i < n ; ++i)
126
 
        if (pixelformats_supported[i] == pixelformat)
127
 
            return i;
 
124
    for (const auto &item : pixelformats_supported)
 
125
        if (item == pixelformat)
 
126
            return item;
128
127
 
129
128
    return UINT_MAX - 1;
130
129
}
137
136
{
138
137
    vector<string> v;
139
138
 
140
 
    for (vector<float>::const_iterator i = rates_.begin() ; i != rates_.end(); ++i) {
 
139
    for (const auto &item : rates_) {
141
140
        std::stringstream ss;
142
 
        ss << *i;
 
141
        ss << item;
143
142
        v.push_back(ss.str());
144
143
    }
145
144
 
201
200
{
202
201
    vector<string> v;
203
202
 
204
 
    for (vector<VideoV4l2Size>::const_iterator itr = sizes_.begin(); itr != sizes_.end(); ++itr) {
 
203
    for (const auto &item : sizes_) {
205
204
        std::stringstream ss;
206
 
        ss << itr->width << "x" << itr->height;
 
205
        ss << item.width << "x" << item.height;
207
206
        v.push_back(ss.str());
208
207
    }
209
208
 
309
308
 
310
309
VideoV4l2Size VideoV4l2Channel::getSize(const string &name) const
311
310
{
312
 
    for (vector<VideoV4l2Size>::const_iterator i = sizes_.begin(); i != sizes_.end(); ++i) {
 
311
    for (const auto &item : sizes_) {
313
312
        std::stringstream ss;
314
 
        ss << i->width << "x" << i->height;
 
313
        ss << item.width << "x" << item.height;
315
314
        if (ss.str() == name)
316
 
            return *i;
 
315
            return item;
317
316
    }
318
317
 
319
318
    // fallback to last size
354
353
{
355
354
    vector<string> v;
356
355
 
357
 
    for (vector<VideoV4l2Channel>::const_iterator itr = channels_.begin(); itr != channels_.end(); ++itr)
358
 
        v.push_back(itr->name);
 
356
    for (const auto &itr : channels_)
 
357
        v.push_back(itr.name);
359
358
 
360
359
    return v;
361
360
}
363
362
const VideoV4l2Channel &
364
363
VideoV4l2Device::getChannel(const string &name) const
365
364
{
366
 
    for (vector<VideoV4l2Channel>::const_iterator itr = channels_.begin(); itr != channels_.end(); ++itr)
367
 
        if (itr->name == name)
368
 
            return *itr;
 
365
    for (const auto &item : channels_)
 
366
        if (item.name == name)
 
367
            return item;
369
368
 
370
369
    return channels_.back();
371
370
}