mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2026-01-12 07:35:55 +01:00
2018-02-06 Fred Gleason <fredg@paravelsystems.com>
* Refactored the RDAudioInfo class to use RDApplication.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Get information about a cut in the audio store.
|
||||
//
|
||||
// (C) Copyright 2011,2016-2017 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2011,2016-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@@ -30,10 +30,11 @@
|
||||
|
||||
#include <qstringlist.h>
|
||||
|
||||
#include <rd.h>
|
||||
#include <rdxport_interface.h>
|
||||
#include <rdformpost.h>
|
||||
#include <rdaudioinfo.h>
|
||||
#include "rd.h"
|
||||
#include "rdapplication.h"
|
||||
#include "rdxport_interface.h"
|
||||
#include "rdformpost.h"
|
||||
#include "rdaudioinfo.h"
|
||||
|
||||
size_t RDAudioInfoCallback(void *ptr,size_t size,size_t nmemb,void *userdata)
|
||||
{
|
||||
@@ -45,11 +46,9 @@ size_t RDAudioInfoCallback(void *ptr,size_t size,size_t nmemb,void *userdata)
|
||||
}
|
||||
|
||||
|
||||
RDAudioInfo::RDAudioInfo(RDStation *station,RDConfig *config,QObject *parent)
|
||||
RDAudioInfo::RDAudioInfo(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
conv_station=station;
|
||||
conv_config=config;
|
||||
conv_cart_number=0;
|
||||
conv_cut_number=0;
|
||||
conv_format=RDWaveFile::Pcm16;
|
||||
@@ -135,14 +134,14 @@ RDAudioInfo::ErrorCode RDAudioInfo::runInfo(const QString &username,
|
||||
// otherwise some versions of LibCurl will throw a 'bad/illegal format'
|
||||
// error.
|
||||
//
|
||||
strncpy(url,conv_station->webServiceUrl(conv_config),1024);
|
||||
strncpy(url,rda->station()->webServiceUrl(rda->config()),1024);
|
||||
curl_easy_setopt(curl,CURLOPT_URL,url);
|
||||
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,RDAudioInfoCallback);
|
||||
curl_easy_setopt(curl,CURLOPT_WRITEDATA,&conv_xml);
|
||||
curl_easy_setopt(curl,CURLOPT_POST,1);
|
||||
curl_easy_setopt(curl,CURLOPT_POSTFIELDS,(const char *)post);
|
||||
curl_easy_setopt(curl,CURLOPT_USERAGENT,
|
||||
(const char *)conv_config->userAgent());
|
||||
(const char *)rda->config()->userAgent());
|
||||
curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT);
|
||||
|
||||
switch(curl_err=curl_easy_perform(curl)) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Get information about a cut in the audio store.
|
||||
//
|
||||
// (C) Copyright 2011,2016 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2011,2016-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@@ -23,9 +23,7 @@
|
||||
|
||||
#include <qobject.h>
|
||||
|
||||
#include <rdconfig.h>
|
||||
#include <rdwavefile.h>
|
||||
#include <rdstation.h>
|
||||
|
||||
class RDAudioInfo : public QObject
|
||||
{
|
||||
@@ -33,7 +31,7 @@ class RDAudioInfo : public QObject
|
||||
public:
|
||||
enum ErrorCode {ErrorOk=0,ErrorInternal=5,ErrorUrlInvalid=7,
|
||||
ErrorService=8,ErrorInvalidUser=9,ErrorNoAudio=10};
|
||||
RDAudioInfo(RDStation *station,RDConfig *config,QObject *parent=0);
|
||||
RDAudioInfo(QObject *parent=0);
|
||||
RDWaveFile::Format format() const;
|
||||
unsigned channels() const;
|
||||
unsigned sampleRate() const;
|
||||
@@ -48,8 +46,6 @@ class RDAudioInfo : public QObject
|
||||
|
||||
private:
|
||||
int ParseInt(const QString &tag,const QString &xml);
|
||||
RDStation *conv_station;
|
||||
RDConfig *conv_config;
|
||||
unsigned conv_cart_number;
|
||||
unsigned conv_cut_number;
|
||||
RDWaveFile::Format conv_format;
|
||||
|
||||
@@ -109,7 +109,7 @@ RDEditAudio::RDEditAudio(RDCart *cart,QString cut_name,RDCae *cae,RDUser *user,
|
||||
this,SLOT(positionData(int,unsigned)));
|
||||
edit_cae->loadPlay(edit_card,edit_cut->cutName(),&edit_stream,&edit_handle);
|
||||
RDSetMixerOutputPort(edit_cae,edit_card,edit_stream,edit_port);
|
||||
RDAudioInfo *info=new RDAudioInfo(station,edit_config,this);
|
||||
RDAudioInfo *info=new RDAudioInfo(this);
|
||||
RDAudioInfo::ErrorCode audio_err;
|
||||
info->setCartNumber(RDCut::cartNumber(cut_name));
|
||||
info->setCutNumber(RDCut::cutNumber(cut_name));
|
||||
|
||||
Reference in New Issue
Block a user