r913 - in trunk/libdvdnav2/src: dvdnav.c dvdnav.h
Author: nicodvb Date: Sun Apr 29 13:25:57 2007 New Revision: 913 Log: implemented dvdnav_audio_stream_format() to identify the codec used Modified: trunk/libdvdnav2/src/dvdnav.c trunk/libdvdnav2/src/dvdnav.h Modified: trunk/libdvdnav2/src/dvdnav.c ============================================================================== --- trunk/libdvdnav2/src/dvdnav.c (original) +++ trunk/libdvdnav2/src/dvdnav.c Sun Apr 29 13:25:57 2007 @@ -879,6 +879,48 @@ uint16_t dvdnav_audio_stream_to_lang(dvd return attr.lang_code; } +uint16_t dvdnav_audio_stream_format(dvdnav_t *this, uint8_t stream) { + audio_attr_t attr; + uint16_t format; + + if(!this) { + printerr("Passed a NULL pointer."); + return -1; /* 0xffff */ + } + if(!this->started) { + printerr("Virtual DVD machine not started."); + return -1; /* 0xffff */ + } + + pthread_mutex_lock(&this->vm_lock); + attr = vm_get_audio_attr(this->vm, stream); + pthread_mutex_unlock(&this->vm_lock); + + switch(attr.audio_format) { + case 0: + format = DVDNAV_FORMAT_AC3; + break; + case 2: /* MPEG-1 or MPEG-2 without extension bitstream. */ + case 3: /* MPEG-2 with extension bitstream. */ + format = DVDNAV_FORMAT_MPEGAUDIO; + break; + case 4: + format = DVDNAV_FORMAT_LPCM; + break; + case 6: + format = DVDNAV_FORMAT_DTS; + break; + case 7: + format = DVDNAV_FORMAT_SDDS; + break; + default: + format = 0xffff; + break; + } + + return format; +} + uint16_t dvdnav_spu_stream_to_lang(dvdnav_t *this, uint8_t stream) { subp_attr_t attr; Modified: trunk/libdvdnav2/src/dvdnav.h ============================================================================== --- trunk/libdvdnav2/src/dvdnav.h (original) +++ trunk/libdvdnav2/src/dvdnav.h Sun Apr 29 13:25:57 2007 @@ -70,6 +70,11 @@ typedef int32_t dvdnav_status_t; #define DVDNAV_STATUS_ERR 0 #define DVDNAV_STATUS_OK 1 +#define DVDNAV_FORMAT_AC3 0 +#define DVDNAV_FORMAT_MPEGAUDIO 3 +#define DVDNAV_FORMAT_LPCM 4 +#define DVDNAV_FORMAT_DTS 5 +#define DVDNAV_FORMAT_SDDS 6 /********************************************************************* * initialisation & housekeeping functions * @@ -548,6 +553,12 @@ uint8_t dvdnav_get_video_scale_permissio uint16_t dvdnav_audio_stream_to_lang(dvdnav_t *self, uint8_t stream); /* + * Returns the format of *logical* audio stream 'stream' + * (returns 0xffff if no such stream). + */ +uint16_t dvdnav_audio_stream_format(dvdnav_t *self, uint8_t stream); + +/* * Converts a *logical* subpicture stream id into country code * (returns 0xffff if no such stream). */
participants (1)
-
nicodvb