dvd: check for empty DVD volume ID

The only DVD sample I have just returns an empty string for this. Let
command.c use the filename if the ID is empty.
This commit is contained in:
wm4 2014-02-23 18:07:13 +01:00
parent 5cbef87c17
commit 42e70868ab
2 changed files with 7 additions and 3 deletions

View File

@ -730,8 +730,10 @@ static int control(stream_t *stream,int cmd,void* arg)
case STREAM_CTRL_GET_DVD_VOLUME_ID: case STREAM_CTRL_GET_DVD_VOLUME_ID:
{ {
char buffer[128]; char buffer[128];
if (DVDUDFVolumeInfo(d->dvd, buffer, sizeof(buffer), NULL, 0) < 0 if (DVDUDFVolumeInfo(d->dvd, buffer, sizeof(buffer), NULL, 0) < 0 &&
&& DVDISOVolumeInfo(d->dvd, buffer, sizeof(buffer), NULL, 0) < 0) DVDISOVolumeInfo(d->dvd, buffer, sizeof(buffer), NULL, 0) < 0)
return STREAM_ERROR;
if (!buffer[0])
return STREAM_ERROR; return STREAM_ERROR;
*(char**)arg = talloc_strdup(NULL, buffer); *(char**)arg = talloc_strdup(NULL, buffer);
return STREAM_OK; return STREAM_OK;

View File

@ -604,7 +604,9 @@ static int control(stream_t *stream, int cmd, void *arg)
} }
case STREAM_CTRL_GET_DVD_VOLUME_ID: { case STREAM_CTRL_GET_DVD_VOLUME_ID: {
const char *volume = NULL; const char *volume = NULL;
if (dvdnav_get_title_string(dvdnav, &volume) != DVDNAV_STATUS_OK || !volume) if (dvdnav_get_title_string(dvdnav, &volume) != DVDNAV_STATUS_OK)
return STREAM_ERROR;
if (!volume || !volume[0])
return STREAM_ERROR; return STREAM_ERROR;
*(char**)arg = talloc_strdup(NULL, volume); *(char**)arg = talloc_strdup(NULL, volume);
return STREAM_OK; return STREAM_OK;