I have been working on a code that accesses different attributes of DVDs. I am using the libdvdnav library to access them. I try to open a DVD ISO file using it but the height of the video frame that I get is 0. I also get 0 audio stream channels and ffff as the return value for the rest (i.e Stream format,Audio to Lang etc.). I'm not sure what the problem is. It would be great if someone could help me out with this. Thanks Here is the code:
#include <stdio.h>
#include <dvdnav/dvdnav.h>
#include <dvdnav/dvdnav_events.h>
#include <sys/types.h>
#include <stdlib.h>
int main(int argc, char **argv) {
dvdnav_t *dvdnav;
int finished, len, event;
int audio_stream,spu_stream,display;
int audio_streamL,spu_streamL;
int audio_lang,spu_lang;
uint8_t buf[2050],stream,stream_format;
uint32_t width,height;
/* Open the DVD */
dvdnav_open(&dvdnav, "LOTR3.ISO");
fprintf(stderr, "Reading...\n");
finished = 0;
audio_stream=dvdnav_get_active_audio_stream(dvdnav);
audio_streamL=dvdnav_get_audio_logical_stream(dvdnav, audio_stream);
spu_stream=dvdnav_get_active_spu_stream(dvdnav);
spu_streamL=dvdnav_get_spu_logical_stream(dvdnav, spu_stream);
dvdnav_get_video_resolution(dvdnav , &width, &height);
dvdnav_audio_stream_channels(dvdnav, stream);
stream_format = dvdnav_audio_stream_format(dvdnav, dvdnav_get_audio_logical_stream(dvdnav, audio_stream));
audio_lang=dvdnav_audio_stream_to_lang(dvdnav, audio_streamL);
spu_lang=dvdnav_spu_stream_to_lang(dvdnav, spu_streamL);
printf("Audio Stream value is %d ,Audio to Lang is %x, SPU Stream value is %d,SPU to Lang is %x\n",audio_streamL,audio_lang,spu_streamL,spu_lang);
printf("Video Resolution width %d and height %d Audio Stream Channels %d and Stream Format %d \n",width,height,stream,stream_format);
while(!finished) {
int result = dvdnav_get_next_block(dvdnav, buf,
&event, &len);
if(result == DVDNAV_STATUS_ERR) {
fprintf(stderr, "Error getting next block (%s)\n",
dvdnav_err_to_string(dvdnav));
exit(1);
}
switch(event) {
case DVDNAV_BLOCK_OK:
/* Write output to stdout */
fwrite(buf, len, 1, stdout);
break;
case DVDNAV_STILL_FRAME:
{
fprintf(stderr, "Skipping still frame\n");
dvdnav_still_skip(dvdnav);
}
break;
case DVDNAV_STOP:
{
finished = 1;
}
default:
fprintf(stderr, "Unhandled event (%i)\n", event);
finished = 1;
break;
}
}
dvdnav_close(dvdnav);
return 0;
}
Aucun commentaire:
Enregistrer un commentaire