[libdvdnav-devel] [Git][videolan/libdvdread][master] 8 commits: DVD-Audio: add ifoOpen public api for ASVS and SAMG
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sun Dec 14 23:06:23 UTC 2025
Jean-Baptiste Kempf pushed to branch master at VideoLAN / libdvdread
Commits:
ddbd83ea by Saifelden Mohamed Ismail at 2025-12-12T11:26:24+02:00
DVD-Audio: add ifoOpen public api for ASVS and SAMG
- - - - -
132a738a by Saifelden Mohamed Ismail at 2025-12-12T11:45:29+02:00
DVD-Audio: add ifoOpen Implementation for ASVS and SAMG
- - - - -
07cf2b78 by Saifelden Mohamed Ismail at 2025-12-12T11:45:33+02:00
DVD-Audio: free asvs_mat on ifoClose
- - - - -
c53e78a5 by Saifelden Mohamed Ismail at 2025-12-12T11:45:33+02:00
DVD-Audio: Simplify set stream logic
- - - - -
3deafea4 by Saifelden Mohamed Ismail at 2025-12-12T11:45:33+02:00
make dvdcss title hack in DVDOpenVOBPath use stream_type
- - - - -
a3f183ee by Saifelden Mohamed Ismail at 2025-12-12T11:45:33+02:00
DVD-Audio: initialize cpxm decryption context in DVDOpenVOBPath
- - - - -
8884baba by Saifelden Mohamed Ismail at 2025-12-12T12:53:06+02:00
DVD-Audio: remove unnecessary imports
- - - - -
3e6ee2e7 by Saifelden Mohamed at 2025-12-12T13:55:42+00:00
DVD-Audio: give default value for dvdinput_init
- - - - -
4 changed files:
- src/dvd_input.c
- src/dvd_reader.c
- src/dvdread/ifo_read.h
- src/ifo_read.c
Changes:
=====================================
src/dvd_input.c
=====================================
@@ -58,7 +58,7 @@ int (*dvdinput_close) (dvd_input_t);
int (*dvdinput_seek) (dvd_input_t, int);
int (*dvdinput_title) (dvd_input_t, int);
int (*dvdinput_read) (dvd_input_t, void *, int, int);
-int (*dvdinput_init) (dvd_input_t, uint8_t* mkb);
+int (*dvdinput_init) (dvd_input_t, uint8_t* mkb) = NULL;
#ifdef HAVE_DVDCSS_DVDCSS_H
/* linking to libdvdcss */
@@ -72,9 +72,6 @@ int (*dvdinput_init) (dvd_input_t, uint8_t* mkb);
/* linking cpxm functions*/
#ifdef HAVE_DVDCSS_DVDCPXM_H
# include <dvdcss/dvdcpxm.h>
-# define DVDcpxm_open_stream(a, b) \
- dvdcpxm_open_stream((void*)(a), (dvdcss_stream_cb*)(b))
-# define DVDcpxm_open(a) dvdcss_open((char*)(a))
# define DVDcpxm_read dvdcpxm_read
# define DVDcpxm_init dvdcpxm_init
#endif
=====================================
src/dvd_reader.c
=====================================
@@ -1014,17 +1014,14 @@ static dvd_file_t *DVDOpenVOBUDF( dvd_reader_t *ctx, int title, int menu )
/* stream type must be set to determine decryption method*/
/* DVD-Audio discs contain both AOBs and VOBs */
/* DVD_V = VOB, DVD_A = AOB */
- dvd_type_t stream_type;
+ dvd_type_t stream_type = ( menu ) ? DVD_V : ctx->dvd_type;
if( title == 0 ) {
- stream_type = DVD_V;
sprintf( filename, "/%s_TS/%s_TS.VOB", DVD_TYPE_STRING( ctx->dvd_type ), DVD_TYPE_STRING( ctx->dvd_type ) );
} else if(!menu) {
/* DVD Content - Tracks/Chapters */
- stream_type = ctx->dvd_type;
sprintf( filename, "/%s_TS/%cTS_%02d_1.%cOB", DVD_TYPE_STRING( ctx->dvd_type ),
STREAM_TYPE_STRING( ctx->dvd_type ), title, STREAM_TYPE_STRING( ctx->dvd_type ) );
} else {
- stream_type = DVD_V;
if ( ctx->dvd_type == DVD_V )
/* DVD_Video title menu */
sprintf( filename, "/VIDEO_TS/VTS_%02d_0.VOB", title );
@@ -1078,13 +1075,17 @@ static dvd_file_t *DVDOpenVOBPath( dvd_reader_t *ctx, int title, int menu )
char full_path[ PATH_MAX + 1 ];
dvdstat_t fileinfo;
dvd_file_t *dvd_file;
+ /* menus are always VOB streams, title type depends on disc disc */
+ /* for now will set as the dvd_type,
+ * when hybrid discs are implemented set as title type */
+ dvd_type_t stream_type = ( menu ) ? DVD_V : ctx->dvd_type;
dvd_file = calloc( 1, sizeof( dvd_file_t ) );
if( !dvd_file ) return NULL;
dvd_file->ctx = ctx;
/* css vars aren't used in CPXM */
- if ( ctx->dvd_type == DVD_V )
+ if ( stream_type == DVD_V )
/*Hack*/ dvd_file->css_title = title << 1 | menu;
if( menu ) {
@@ -1122,8 +1123,7 @@ static dvd_file_t *DVDOpenVOBPath( dvd_reader_t *ctx, int title, int menu )
dvd_file->title_devs[ 0 ] = dev;
dvdinput_title( dvd_file->title_devs[0], 0);
dvd_file->filesize = dvd_file->title_sizes[ 0 ];
- /* menus are always VOB streams */
- dvdinput_set_stream(dev, DVD_V);
+ dvdinput_set_stream( dev, stream_type );
} else {
int i;
@@ -1143,7 +1143,14 @@ static dvd_file_t *DVDOpenVOBPath( dvd_reader_t *ctx, int title, int menu )
dvd_file->title_sizes[ i ] = fileinfo.st_size / DVD_VIDEO_LB_LEN;
dvd_file->title_devs[ i ] = dvdinput_open( ctx->priv, &ctx->logcb, full_path, NULL );
/* setting type of stream will determine what decryption to use */
- dvdinput_set_stream( dvd_file->title_devs[ i ], ctx->dvd_type );
+ dvdinput_set_stream( dvd_file->title_devs[ i ], stream_type );
+
+ /* if function is defined, cpxm was imported so call init */
+ /* should have already been initialized in dvdinput_setup, will copy over
+ * decryption context to each dev dvdcss instance */
+ if( dvdinput_init && stream_type == DVD_A )
+ dvdinput_init( dvd_file->title_devs[ i ], NULL );
+
dvdinput_title( dvd_file->title_devs[ i ], 0 );
dvd_file->filesize += dvd_file->title_sizes[ i ];
}
=====================================
src/dvdread/ifo_read.h
=====================================
@@ -223,6 +223,27 @@ DVDREAD_API int ifoRead_TT(ifo_handle_t *);
*/
DVDREAD_API int ifoRead_TIF(ifo_handle_t *, int);
+/**
+ * handle = ifoRead_SAMG(ifofile);
+ *
+ * the SAMG menu contains all the information for all the ATS and AMG
+ * But only for audio titles, and without any menu information
+ * is loaded in ifoOpen as a part of the audio manager
+ * Can be for simple audio playback
+ *
+ */
+DVDREAD_API ifo_handle_t *ifoOpenSAMG(dvd_reader_t *ctx);
+
+/**
+ * handle = ifoOpenASVS(ifofile);
+ *
+ * the ASVS ifo contains the sector addresses of each still frame
+ * in Audio_sv.vob, to access audio_sv.vob load menu > 0 in dvdopenvob
+ * is loaded in ifoOpen as a part of the audio manager
+ *
+ */
+DVDREAD_API ifo_handle_t *ifoOpenASVS(dvd_reader_t *ctx);
+
/**
* The following functions are used for freeing parsed sections of the
* ifo_handle_t structure and the allocated substructures. The free calls
=====================================
src/ifo_read.c
=====================================
@@ -611,6 +611,81 @@ ifo_handle_t *ifoOpenVTSI(dvd_reader_t *ctx, int title) {
return NULL;
}
+ifo_handle_t *ifoOpenASVS(dvd_reader_t *ctx) {
+
+ if ( ctx->dvd_type != DVD_A )
+ {
+ Log1(ctx, "the ASVS IFO is exclusive to DVD-Audio Discs");
+ return NULL;
+ }
+
+ struct ifo_handle_private_s *ifop;
+
+ for(int backup = ifoGetBupFlag(ctx, 0); backup <= 1; backup++)
+ {
+ ifop = calloc(1, sizeof(*ifop));
+ if(!ifop)
+ return NULL;
+
+ const dvd_read_domain_t domain = backup ? DVD_READ_ASVS_INFO
+ : DVD_READ_ASVS_INFO_BACKUP;
+ const char *ext = backup ? "BUP" : "IFO";
+
+ ifop->ctx = ctx;
+ ifop->file = DVDOpenFile(ctx, 0, domain);
+ if(!ifop->file) { /* Should really catch any error */
+ Log1(ctx, "Can't open file AUDIO_SV.%s.", ext);
+ free(ifop);
+ return NULL;
+ }
+
+
+ if (ifoRead_ASVS(&ifop->handle))
+ return &ifop->handle;
+
+ Log1(ctx, "ifoOpenASVS(): Invalid ASVS IFO (AUDIO_SV.%s).", ext);
+ ifoClose(&ifop->handle);
+ }
+ return NULL;
+
+
+}
+
+
+ifo_handle_t * ifoOpenSAMG(dvd_reader_t *ctx) {
+
+ if ( ctx->dvd_type != DVD_A )
+ {
+ Log1(ctx, "the SAMG IFO is exclusive to DVD-Audio Discs");
+ return NULL;
+ }
+
+ struct ifo_handle_private_s *ifop;
+
+ for(int backup = ifoGetBupFlag(ctx, 0); backup <= 1; backup++)
+ {
+ ifop = calloc(1, sizeof(*ifop));
+ if(!ifop)
+ return NULL;
+
+ ifop->ctx = ctx;
+ ifop->file = DVDOpenFile(ctx, 0, DVD_READ_SAMG_INFO);
+ if(!ifop->file) { /* Should really catch any error */
+ Log1(ctx, "Can't open file AUDIO_PP.IFO.");
+ free(ifop);
+ return NULL;
+ }
+
+
+ if (ifoRead_SAMG(&ifop->handle))
+ return &ifop->handle;
+
+ Log1(ctx, "ifoOpenSAMG(): Invalid SAMG IFO (AUDIO_PP.IFO).");
+ ifoClose(&ifop->handle);
+ }
+ return NULL;
+}
+
void ifoFree_TT(ifo_handle_t *ifofile){
if(!ifofile)
return;
@@ -665,6 +740,11 @@ void ifoClose(ifo_handle_t *ifofile) {
free(ifofile->samg_mat);
}
+ if(ifofile->asvs_mat){
+ free(ifofile->asvs_mat->frame_offsets_sectors);
+ free(ifofile->asvs_mat);
+ }
+
if(ifofile->info_table_first_sector){
free(ifofile->info_table_first_sector->tracks_info);
free(ifofile->info_table_first_sector);
View it on GitLab: https://code.videolan.org/videolan/libdvdread/-/compare/482f0ab6de0e3771ed3f573e7107585ba105a6ae...3e6ee2e796c1d0b1ab8cd8fc27238c954fdd2669
--
View it on GitLab: https://code.videolan.org/videolan/libdvdread/-/compare/482f0ab6de0e3771ed3f573e7107585ba105a6ae...3e6ee2e796c1d0b1ab8cd8fc27238c954fdd2669
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the libdvdnav-devel
mailing list