~ubuntu-branches/ubuntu/oneiric/gmerlin/oneiric

« back to all changes in this revision

Viewing changes to plugins/wavwrite/e_wav.c

  • Committer: Bazaar Package Importer
  • Author(s): Romain Beauxis
  • Date: 2010-03-20 10:53:50 UTC
  • mfrom: (1.1.3 upstream) (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100320105350-ny481yhh3v12bnuo
* New upstream release. 
Closes: #573833
* Bumped standards-version.
* Bumped build-dep on libgavl.
* Refreshed patches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************
2
2
 * gmerlin - a general purpose multimedia framework and applications
3
3
 *
4
 
 * Copyright (c) 2001 - 2008 Members of the Gmerlin project
 
4
 * Copyright (c) 2001 - 2010 Members of the Gmerlin project
5
5
 * gmerlin-general@lists.sourceforge.net
6
6
 * http://gmerlin.sourceforge.net
7
7
 *
33
33
 
34
34
 
35
35
#include <gmerlin/plugin.h>
 
36
#include <gmerlin/pluginfuncs.h>
36
37
#include <gmerlin/utils.h>
37
38
#include <gmerlin/log.h>
38
39
#define LOG_DOMAIN "e_wav"
76
77
  uint8_t * buffer;
77
78
  int buffer_alloc;
78
79
  void (*convert_func)(struct wav_s*, uint8_t * samples, int num_samples);
 
80
  bg_encoder_callbacks_t * cb;
79
81
  } wav_t;
80
82
 
81
83
static int write_8(FILE * output, uint32_t val)
287
289
  return ret;
288
290
  }
289
291
 
 
292
static void set_callbacks_wav(void * data, bg_encoder_callbacks_t * cb)
 
293
  {
 
294
  wav_t * e = data;
 
295
  e->cb = cb;
 
296
  }
 
297
 
290
298
static void destroy_wav(void * priv)
291
299
  {
292
300
  wav_t * wav;
450
458
  wav_t * wav;
451
459
  wav = (wav_t*)data;
452
460
  
453
 
  wav->filename = bg_strdup(wav->filename, filename);
 
461
  wav->filename = bg_filename_ensure_extension(filename, "wav");
 
462
 
 
463
  if(!bg_encoder_cb_create_output_file(wav->cb, wav->filename))
 
464
    return 0;
 
465
  
454
466
  wav->output = fopen(wav->filename, "wb");
455
467
 
456
468
  if(!wav->output)
468
480
  return result;
469
481
  }
470
482
 
471
 
static char const * const wav_extension = ".wav";
472
 
 
473
 
static const char * get_extension_wav(void * data)
474
 
  {
475
 
  return wav_extension;
476
 
  }
477
 
 
478
 
static int add_audio_stream_wav(void * data, const char * language, gavl_audio_format_t * format)
 
483
 
 
484
static int add_audio_stream_wav(void * data, const char * language,
 
485
                                const gavl_audio_format_t * format)
479
486
  {
480
487
  wav_t * wav;
481
488
  
643
650
    .max_audio_streams =   1,
644
651
    .max_video_streams =   0,
645
652
    
646
 
    .get_extension =       get_extension_wav,
 
653
    .set_callbacks =       set_callbacks_wav,
647
654
    
648
655
    .open =                open_wav,
649
656