Changeset 6133470 in mainline


Ignore:
Timestamp:
2013-04-04T10:39:16Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b266f9e
Parents:
be7eccf
Message:

libhound: fix pcm format transfer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/hound/src/protocol.c

    rbe7eccf r6133470  
    5858};
    5959
     60typedef union {
     61        struct {
     62                uint16_t rate;
     63                uint8_t channels;
     64                uint8_t format;
     65        } f __attribute__((packed));
     66        sysarg_t arg;
     67} format_convert_t;
     68
     69
    6070/****
    6171 * CLIENT
     
    224234    int flags, pcm_format_t format, size_t bsize)
    225235{
    226         union {
    227                 sysarg_t arg;
    228                 pcm_format_t format;
    229         } convert = { .format = format };
     236        const format_convert_t c = { .f = {
     237                .channels = format.channels,
     238                .rate = format.sampling_rate / 100,
     239                .format = format.sample_format,
     240        }};
    230241        return async_req_4_0(exch, IPC_M_HOUND_STREAM_ENTER, id, flags,
    231             convert.arg, bsize);
     242            c.arg, bsize);
    232243}
    233244
     
    420431
    421432                        hound_context_id_t id = IPC_GET_ARG1(call);
    422                         int flags = IPC_GET_ARG2(call);
    423                         union {
    424                                 sysarg_t arg;
    425                                 pcm_format_t format;
    426                         } convert = { .arg = IPC_GET_ARG3(call) };
     433                        const int flags = IPC_GET_ARG2(call);
     434                        const format_convert_t c = {.arg = IPC_GET_ARG3(call)};
     435                        const pcm_format_t f = {
     436                            .sampling_rate = c.f.rate * 100,
     437                            .channels = c.f.channels,
     438                            .sample_format = c.f.format,
     439                        };
    427440                        size_t bsize = IPC_GET_ARG4(call);
    428441                        void *stream;
    429442                        int ret = server_iface->add_stream(server_iface->server,
    430                             id, flags, convert.format, bsize, &stream);
     443                            id, flags, f, bsize, &stream);
    431444                        if (ret != EOK) {
    432445                                async_answer_0(callid, ret);
Note: See TracChangeset for help on using the changeset viewer.