@@ -12,7 +12,7 @@ static int videoIndexCmp(const int *a, const int *b) {
12
12
}
13
13
}
14
14
/*parsing the video file, done by parse thread*/
15
- void get_video_info (char * * p_videoFilenameList , int p_debug ) {
15
+ void get_video_info (int p_debug ) {
16
16
AVCodec * lVideoCodec ;
17
17
int lError ;
18
18
int l_dumpDep ;
@@ -61,7 +61,7 @@ void get_video_info(char **p_videoFilenameList, int p_debug) {
61
61
The following section are initialization for dumping dependencies
62
62
**/
63
63
/*open the video file*/
64
- if ((lError = av_open_input_file (& gFormatCtxDepList [l_i ], p_videoFilenameList [l_i ], NULL , 0 , NULL )) != 0 ) {
64
+ if ((lError = av_open_input_file (& gFormatCtxDepList [l_i ], gVideoFileNameList [l_i ], NULL , 0 , NULL )) != 0 ) {
65
65
LOGE (1 , "Error open video file: %d" , lError );
66
66
return ; //open file failed
67
67
}
@@ -93,7 +93,7 @@ void get_video_info(char **p_videoFilenameList, int p_debug) {
93
93
/***
94
94
The following section are initialization for decoding
95
95
**/
96
- if ((lError = av_open_input_file (& gFormatCtxList [l_i ], p_videoFilenameList [l_i ], NULL , 0 , NULL )) != 0 ) {
96
+ if ((lError = av_open_input_file (& gFormatCtxList [l_i ], gVideoFileNameList [l_i ], NULL , 0 , NULL )) != 0 ) {
97
97
LOGE (1 , "Error open video file: %d" , lError );
98
98
return ; //open file failed
99
99
}
@@ -134,7 +134,11 @@ void get_video_info(char **p_videoFilenameList, int p_debug) {
134
134
gVideoCodecCtxList [l_i ]-> debug_selective = p_debug ;
135
135
if (gVideoCodecCtxList [l_i ]-> debug_selective == 1 ) {
136
136
//clear the old dump file
137
+ #ifdef ANDROID_BUILD
138
+ FILE * dctF = fopen ("/sdcard/r10videocam/debug_dct.txt" , "w" );
139
+ #else
137
140
FILE * dctF = fopen ("./debug_dct.txt" , "w" );
141
+ #endif
138
142
fclose (dctF );
139
143
}
140
144
}
@@ -583,11 +587,19 @@ int if_dependency_complete(int p_videoFileIndex, int p_gopNum) {
583
587
FILE * lGopF ;
584
588
int ret , ti , tj ;
585
589
/*check if the dependency files exist, if not, we'll need to dump the dependencies*/
590
+ #ifdef ANDROID_BUILD
591
+ sprintf (l_depGopRecFileName , "%s_goprec_gop%d.txt" , gVideoFileNameList [p_videoFileIndex ], p_gopNum );
592
+ sprintf (l_depIntraFileName , "%s_intra_gop%d.txt" , gVideoFileNameList [p_videoFileIndex ], p_gopNum );
593
+ sprintf (l_depInterFileName , "%s_inter_gop%d.txt" , gVideoFileNameList [p_videoFileIndex ], p_gopNum );
594
+ sprintf (l_depMbPosFileName , "%s_mbpos_gop%d.txt" , gVideoFileNameList [p_videoFileIndex ], p_gopNum );
595
+ sprintf (l_depDcpFileName , "%s_dcp_gop%d.txt" , gVideoFileNameList [p_videoFileIndex ], p_gopNum );
596
+ #else
586
597
sprintf (l_depGopRecFileName , "./%s_goprec_gop%d.txt" , gVideoFileNameList [p_videoFileIndex ], p_gopNum );
587
598
sprintf (l_depIntraFileName , "./%s_intra_gop%d.txt" , gVideoFileNameList [p_videoFileIndex ], p_gopNum );
588
599
sprintf (l_depInterFileName , "./%s_inter_gop%d.txt" , gVideoFileNameList [p_videoFileIndex ], p_gopNum );
589
600
sprintf (l_depMbPosFileName , "./%s_mbpos_gop%d.txt" , gVideoFileNameList [p_videoFileIndex ], p_gopNum );
590
601
sprintf (l_depDcpFileName , "./%s_dcp_gop%d.txt" , gVideoFileNameList [p_videoFileIndex ], p_gopNum );
602
+ #endif
591
603
if ((!if_file_exists (l_depGopRecFileName )) || (!if_file_exists (l_depIntraFileName )) || (!if_file_exists (l_depInterFileName )) || (!if_file_exists (l_depMbPosFileName )) || (!if_file_exists (l_depDcpFileName ))) {
592
604
return 0 ;
593
605
} else {
@@ -643,13 +655,22 @@ void dep_decode_a_video_packet(int p_videoFileIndex) {
643
655
++ gVideoPacketQueueList [p_videoFileIndex ].dep_gop_num ;
644
656
}
645
657
/*check if the dependency files exist, if not, we'll need to dump the dependencies*/
646
- LOGI (10 , "dependency files for video %d gop %d" , p_videoFileIndex , gVideoPacketQueueList [p_videoFileIndex ].dep_gop_num );
658
+ LOGI (10 , "dependency files for video %d gop %d" , p_videoFileIndex , gVideoPacketQueueList [p_videoFileIndex ].dep_gop_num );
659
+ #ifdef ANDROID_BUILD
660
+ sprintf (l_depGopRecFileName , "%s_goprec_gop%d.txt" , gVideoFileNameList [p_videoFileIndex ], gVideoPacketQueueList [p_videoFileIndex ].dep_gop_num );
661
+ sprintf (l_depIntraFileName , "%s_intra_gop%d.txt" , gVideoFileNameList [p_videoFileIndex ], gVideoPacketQueueList [p_videoFileIndex ].dep_gop_num );
662
+ sprintf (l_depInterFileName , "%s_inter_gop%d.txt" , gVideoFileNameList [p_videoFileIndex ], gVideoPacketQueueList [p_videoFileIndex ].dep_gop_num );
663
+ sprintf (l_depMbPosFileName , "%s_mbpos_gop%d.txt" , gVideoFileNameList [p_videoFileIndex ], gVideoPacketQueueList [p_videoFileIndex ].dep_gop_num );
664
+ sprintf (l_depDcpFileName , "%s_dcp_gop%d.txt" , gVideoFileNameList [p_videoFileIndex ], gVideoPacketQueueList [p_videoFileIndex ].dep_gop_num );
665
+
666
+ #else
647
667
sprintf (l_depGopRecFileName , "./%s_goprec_gop%d.txt" , gVideoFileNameList [p_videoFileIndex ], gVideoPacketQueueList [p_videoFileIndex ].dep_gop_num );
648
668
sprintf (l_depIntraFileName , "./%s_intra_gop%d.txt" , gVideoFileNameList [p_videoFileIndex ], gVideoPacketQueueList [p_videoFileIndex ].dep_gop_num );
649
669
sprintf (l_depInterFileName , "./%s_inter_gop%d.txt" , gVideoFileNameList [p_videoFileIndex ], gVideoPacketQueueList [p_videoFileIndex ].dep_gop_num );
650
670
sprintf (l_depMbPosFileName , "./%s_mbpos_gop%d.txt" , gVideoFileNameList [p_videoFileIndex ], gVideoPacketQueueList [p_videoFileIndex ].dep_gop_num );
651
671
sprintf (l_depDcpFileName , "./%s_dcp_gop%d.txt" , gVideoFileNameList [p_videoFileIndex ], gVideoPacketQueueList [p_videoFileIndex ].dep_gop_num );
652
- LOGI (10 , "dependency files for video %d gop %d" , p_videoFileIndex , gVideoPacketQueueList [p_videoFileIndex ].dep_gop_num );
672
+ #endif
673
+ LOGI (10 , "dependency files %s, %s, %s, %s, %s for video %d gop %d" , l_depGopRecFileName , l_depIntraFileName , l_depInterFileName , l_depMbPosFileName , l_depDcpFileName , p_videoFileIndex , gVideoPacketQueueList [p_videoFileIndex ].dep_gop_num );
653
674
#ifdef CLEAR_DEP_BEFORE_START
654
675
remove (l_depGopRecFileName );
655
676
remove (l_depIntraFileName );
@@ -671,10 +692,25 @@ void dep_decode_a_video_packet(int p_videoFileIndex) {
671
692
if (gVideoCodecCtxDepList [p_videoFileIndex ]-> dump_dependency ) {
672
693
LOGI (10 , "dumping dependency starts from video %d, gop %d" , p_videoFileIndex , gVideoPacketQueueList [p_videoFileIndex ].dep_gop_num );
673
694
gVideoCodecCtxDepList [p_videoFileIndex ]-> g_gopF = fopen (l_depGopRecFileName , "w" );
695
+ if (gVideoCodecCtxDepList [p_videoFileIndex ]-> g_gopF == NULL ) {
696
+ LOGI (10 , "cannot open gop file to write" );
697
+ }
674
698
gVideoCodecCtxDepList [p_videoFileIndex ]-> g_mbPosF = fopen (l_depMbPosFileName , "w" );
699
+ if (gVideoCodecCtxDepList [p_videoFileIndex ]-> g_mbPosF == NULL ) {
700
+ LOGI (10 , "cannot open mb pos file to write" );
701
+ }
675
702
gVideoCodecCtxDepList [p_videoFileIndex ]-> g_dcPredF = fopen (l_depDcpFileName , "w" );
703
+ if (gVideoCodecCtxDepList [p_videoFileIndex ]-> g_dcPredF == NULL ) {
704
+ LOGI (10 , "cannot open dc prediction file to write" );
705
+ }
676
706
gVideoCodecCtxDepList [p_videoFileIndex ]-> g_intraDepF = fopen (l_depIntraFileName , "w" );
707
+ if (gVideoCodecCtxDepList [p_videoFileIndex ]-> g_intraDepF == NULL ) {
708
+ LOGI (10 , "cannot open intra frame dependency file to write" );
709
+ }
677
710
gVideoCodecCtxDepList [p_videoFileIndex ]-> g_interDepF = fopen (l_depInterFileName , "w" );
711
+ if (gVideoCodecCtxDepList [p_videoFileIndex ]-> g_interDepF == NULL ) {
712
+ LOGI (10 , "cannot open inter frame dependency file to write" );
713
+ }
678
714
//dump the start frame number for the new gop
679
715
fprintf (gVideoCodecCtxDepList [p_videoFileIndex ]-> g_gopF , "%d:" , gVideoCodecCtxDepList [p_videoFileIndex ]-> dep_video_packet_num );
680
716
}
@@ -712,7 +748,11 @@ void decode_a_video_packet(int p_videoFileIndex, int _roiStH, int _roiStW, int _
712
748
/*read the next video packet*/
713
749
LOGI (10 , "decode_a_video_packet %d: (%d, %d) (%d, %d)" , gVideoPacketNum , _roiStH , _roiStW , _roiEdH , _roiEdW );
714
750
if (gVideoCodecCtxList [p_videoFileIndex ]-> debug_selective == 1 ) {
751
+ #ifdef ANDROID_BUILD
752
+ FILE * dctF = fopen ("/sdcard/r10videocam/debug_dct.txt" , "a+" );
753
+ #else
715
754
FILE * dctF = fopen ("./debug_dct.txt" , "a+" );
755
+ #endif
716
756
fprintf (dctF , "#####%d#####\n" , gVideoPacketNum );
717
757
fclose (dctF );
718
758
}
@@ -764,7 +804,11 @@ void decode_a_video_packet(int p_videoFileIndex, int _roiStH, int _roiStW, int _
764
804
#ifdef DUMP_SELECTIVE_DEP
765
805
FILE * l_interF ;
766
806
char l_interFName [50 ];
807
+ #ifdef ANDROID_BUILD
808
+ sprintf (l_interFName , "/sdcard/r10videocam/%d/inter.txt" , gVideoPacketNum );
809
+ #else
767
810
sprintf (l_interFName , "./%d/inter.txt" , gVideoPacketNum );
811
+ #endif
768
812
LOGI (10 , "filename: %s" , l_interFName );
769
813
l_interF = fopen (l_interFName , "w" );
770
814
if (l_interF != NULL ) {
@@ -792,7 +836,11 @@ void decode_a_video_packet(int p_videoFileIndex, int _roiStH, int _roiStW, int _
792
836
#ifdef DUMP_SELECTIVE_DEP
793
837
FILE * l_dcpF ;
794
838
char l_dcpFName [50 ];
839
+ #ifdef ANDROID_BUILD
840
+ sprintf (l_dcpFName , "/sdcard/r10videocam/%d/dcp.txt" , gVideoPacketNum );
841
+ #else
795
842
sprintf (l_dcpFName , "./%d/dcp.txt" , gVideoPacketNum );
843
+ #endif
796
844
l_dcpF = fopen (l_dcpFName , "w" );
797
845
for (l_i = 0 ; l_i < l_mbHeight ; ++ l_i ) {
798
846
for (l_j = 0 ; l_j < l_mbWidth ; ++ l_j ) {
@@ -815,7 +863,11 @@ void decode_a_video_packet(int p_videoFileIndex, int _roiStH, int _roiStW, int _
815
863
#ifdef DUMP_SELECTIVE_DEP
816
864
FILE * l_intraF ;
817
865
char l_intraFName [50 ];
866
+ #ifdef ANDROID_BUILD
867
+ sprintf (l_intraFName , "/sdcard/r10videocam/%d/intra.txt" , gVideoPacketNum );
868
+ #else
818
869
sprintf (l_intraFName , "./%d/intra.txt" , gVideoPacketNum );
870
+ #endif
819
871
l_intraF = fopen (l_intraFName , "w" );
820
872
for (l_i = 0 ; l_i < l_mbHeight ; ++ l_i ) {
821
873
for (l_j = 0 ; l_j < l_mbWidth ; ++ l_j ) {
@@ -827,9 +879,17 @@ void decode_a_video_packet(int p_videoFileIndex, int _roiStH, int _roiStW, int _
827
879
#endif
828
880
#ifdef DUMP_SELECTED_MB_MASK
829
881
if (gVideoPacketNum == 1 ) {
830
- l_maskF = fopen ("./debug_mask.txt" , "w" );
882
+ #ifdef ANDROID_BUILD
883
+ l_maskF = fopen ("/sdcard/r10videocam/debug_mask.txt" , "w" );
884
+ #else
885
+ l_maskF = fopen ("./debug_mask.txt" , "w" );
886
+ #endif
831
887
} else {
832
- l_maskF = fopen ("./debug_mask.txt" , "a+" );
888
+ #ifdef ANDROID_BUILD
889
+ l_maskF = fopen ("/sdcard/r10videocam/debug_mask.txt" , "a+" );
890
+ #else
891
+ l_maskF = fopen ("./debug_mask.txt" , "a+" );
892
+ #endif
833
893
}
834
894
fprintf (l_maskF , "-----%d-----\n" , gVideoPacketNum );
835
895
for (l_i = 0 ; l_i < l_mbHeight ; ++ l_i ) {
0 commit comments